00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00028 #include <stdio.h>
00029 #include <time.h>
00030
00031 #include <gtk/gtk.h>
00032 #include <gdk/gdk.h>
00033 #include <gdk/gdkx.h>
00034 #include <glib.h>
00035
00036 #include <liberdm/erdm.h>
00037
00038 #include "connectionMgrLog.h"
00039 #include "displayStatus.h"
00040 #include "erbusy.h"
00041
00042
00043 static int g_currentLevel = LOWEST_LEVEL;
00044
00045 static guint g_idle_hander_id = 0;
00046
00047 #if CN_DISPLAY_ON
00048 static int counter = 0;
00049 #endif
00050
00051
00052 void display_update_remove_idle_handler_id(void)
00053 {
00054 if (g_idle_hander_id)
00055 {
00056 CN_DMPRINTF("\nRemoving the old idle handler.\n");
00057 g_source_remove(g_idle_hander_id);
00058 g_idle_hander_id = 0;
00059 }
00060 }
00061
00070 gboolean display_update_during_idle_handling(gpointer data)
00071 {
00072 int level = (int) data;
00073 int nQuality;
00074 eDmQuality quality;
00075
00076 CN_DMPRINTF(" **** (%d) ***** [%d]", level, counter++);
00077
00078
00079 gdk_threads_enter();
00080 gdk_flush();
00081 gdk_threads_leave();
00082
00083 erbusy_off();
00084
00085
00086
00087
00088 level = (int) data & 0x0000FFFF;
00089 nQuality = (int) data >> 16;
00090 switch (nQuality)
00091 {
00092 case WAVEFORM_BW:
00093 CN_DMPRINTF("Request for BW waveform");
00094 quality = dmQBW;
00095 break;
00096 case WAVEFORM_TYPING:
00097 CN_DMPRINTF("Request for Typing waveform");
00098 quality = dmQTyping;
00099 break;
00100 default:
00101 quality = dmQFull;
00102 }
00103
00104 if ((level == MAIN_WINDOW_EXPOSE_LEVEL) ||
00105 (level == SETUP_SCREEN_EXPOSE_LEVEL) ||
00106 (level == ONE_BUTTON_ITEM_CLICKED_LEVEL) ||
00107 (level == SETUP_PAGE_LAYOUT_CHANGE) ||
00108 (level == SETTING_ITEM_CHANGE) ||
00109 (level == STATUS_ITEM_CHANGE) )
00110 {
00111
00112 dmDisplay(dmCmdPriorUrgent, quality);
00113 }
00114 else if ((level == BUTTON_FOCUS_IN_LEVEL) ||
00115 (level == SELECTION_FOCUS_IN_LEVEL) ||
00116 (level == TEXT_ENTRY_FOCUS_IN_LEVEL) )
00117 {
00118
00119
00120 dmDisplay(dmCmdPriorUrgent, quality);
00121
00122 }
00123 else if (level == TEXT_ENTRY_CHANGED_LEVEL)
00124 {
00125
00126 dmDisplay(dmCmdPriorNormal, quality);
00127
00128 }
00129 else if (level == SELECTION_CLICKED_LEVEL)
00130 {
00131
00132
00133 dmDisplay(dmCmdPriorUrgent, quality);
00134 }
00135 else
00136 {
00137
00138 dmDisplay(dmCmdPriorUrgent, quality);
00139 }
00140
00141
00142 g_currentLevel = LOWEST_LEVEL;
00143
00144
00145 g_idle_hander_id = 0;
00146 return FALSE;
00147 }
00148
00149 #undef display_update_request_screen_refresh
00150 gboolean display_update_request_screen_refresh(int level, int waveform)
00151 {
00152 CN_DMPRINTF("[%d] entry level %d currentlevel %d",
00153 counter++, level, g_currentLevel);
00154
00155 if (level >= g_currentLevel)
00156 {
00157 g_currentLevel = level + 1;
00158
00159 if (waveform != 0)
00160 {
00161 CN_DMPRINTF("Special waveform request");
00162 level += waveform << 16;
00163 }
00164
00165 display_update_remove_idle_handler_id();
00166
00167 g_idle_hander_id = gtk_idle_add(display_update_during_idle_handling,
00168 (gpointer) level);
00169 }
00170 return TRUE;
00171 }
00172
00173 int display_update_get_level(void)
00174 {
00175 return g_currentLevel;
00176 }
00177
00178 #undef display_update_increase_level
00179 void display_update_increase_level(int level)
00180 {
00181 CN_DMPRINTF("increase from %d to %d", g_currentLevel, level);
00182
00183 if (level > g_currentLevel)
00184 {
00185 g_currentLevel = level;
00186 }
00187 }
00188
00189 #undef display_update_decrease_level
00190 void display_update_decrease_level(int level)
00191 {
00192 CN_DMPRINTF("decrease from %d to %d", g_currentLevel, level);
00193
00194 if (level < g_currentLevel)
00195 {
00196 g_currentLevel = level;
00197 }
00198 }
00199