00001 /* 00002 * This file is part of pcshareMgr. 00003 * 00004 * pcshareMgr is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * pcshareMgr is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00031 // config.h is generated based on the directives placed in the configure.ac 00032 // file and user input supplied to the configure script 00033 #include <config.h> 00034 #include <stdio.h> 00035 #include <gtk/gtk.h> 00036 #include "liberdm/erdm.h" 00037 #include "logging.h" 00038 #include "displayUpdate.h" 00039 00040 static int g_currentLevel = LOWEST_LEVEL; 00041 00042 // internally used routines 00043 int display_update_get_level(void); 00044 void display_update_reset_level(void); 00045 00053 gboolean display_update_during_idle_handling(gpointer data) 00054 { 00055 int level = (int) data; 00056 int nQuality; 00057 eDmQuality quality; 00058 00059 //XImage *xi; 00060 00061 // Extract 00062 // level from data 00063 // waveform from data 00064 00065 level = (int) data & 0x0000FFFF; 00066 nQuality = (int) data >> 16; 00067 switch (nQuality) 00068 { 00069 case WAVEFORM_BW: 00070 DL_DMPRINTF("Request for BW waveform"); 00071 quality = dmQBW; 00072 break; 00073 case WAVEFORM_TYPING: 00074 DL_DMPRINTF("Request for Typing waveform"); 00075 quality = dmQTyping; 00076 break; 00077 default: 00078 quality = dmQFull; 00079 } 00080 00081 DL_DMPRINTF("\n________________request screen update (%d - %d)_____________", level, quality); 00082 00083 // full screen update, 00084 00085 gdk_threads_enter(); 00086 gdk_flush(); 00087 gdk_threads_leave(); 00088 00089 // full screen update, 00090 dmDisplay(dmCmdPriorNormal, quality); 00091 00092 // return FALSE to remove handler 00093 return FALSE; 00094 } 00095 00096 gboolean display_update_request_screen_refresh(int level, gpointer data) 00097 { 00098 int theCurrentLevel = display_update_get_level(); 00099 int waveform; 00100 00101 waveform = (int) data; 00102 00103 DL_DMPRINTF("entry level %d currentlevel %d", level, theCurrentLevel); 00104 00105 if (level >= theCurrentLevel) 00106 { 00107 if (waveform != 0) 00108 { 00109 DL_DMPRINTF("Special waveform request"); 00110 level += waveform << 16; 00111 } 00112 00113 00114 gtk_idle_add(display_update_during_idle_handling, (gpointer) level); 00115 00116 //reset the current level 00117 display_update_reset_level(); 00118 00119 } 00120 return TRUE; 00121 } 00122 00123 int display_update_get_level(void) 00124 { 00125 return g_currentLevel; 00126 } 00127 00128 void display_update_reset_level(void) 00129 { 00130 g_currentLevel = LOWEST_LEVEL; 00131 } 00132 00133 void display_update_increase_level(int level) 00134 { 00135 if (level > g_currentLevel) 00136 { 00137 g_currentLevel = level; 00138 } 00139 }
1.5.6