00001 /* 00002 * This file is part of pageBar. 00003 * 00004 * pageBar 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 * pageBar 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 00032 #include <gdk/gdk.h> 00033 #include <gdk/gdkx.h> 00034 #include <gtk/gtk.h> 00035 #include <liberdm/erdm.h> 00036 #include "displayUpdate.h" 00037 #include "erbusy.h" 00038 00039 00040 static int g_currentLevel = LOWEST_LEVEL; 00041 00042 // internally used routines 00043 int display_update_get_level(void); 00044 int display_update_reset_level(void); 00045 00053 gboolean display_update_during_idle_handling(gpointer data) 00054 { 00055 int q = (int) data; 00056 eDmQuality quality = dmQFull; 00057 00058 if (q == DM_QUALITY_TYPING) 00059 { 00060 quality = dmQTyping; 00061 } 00062 00063 // full screen update, 00064 gdk_threads_enter(); 00065 gdk_flush(); 00066 gdk_threads_leave(); 00067 00068 //not busy any more 00069 erbusy_off(); 00070 00071 // full screen update, 00072 dmDisplay(dmCmdPriorUrgent, quality); 00073 00074 // return FALSE to remove handler 00075 return FALSE; 00076 } 00077 00078 gboolean display_update_request_screen_refresh(int level, gpointer data) 00079 { 00080 int theCurrentLevel = display_update_get_level(); 00081 int quality; 00082 00083 if (data == NULL) 00084 { 00085 quality = DM_QUALITY_FULL; 00086 } 00087 else 00088 { 00089 quality = (int) data; 00090 } 00091 00092 if (level >= theCurrentLevel) 00093 { 00094 00095 gtk_idle_add(display_update_during_idle_handling, (gpointer) quality); 00096 00097 //reset the current level 00098 display_update_reset_level(); 00099 00100 } 00101 return TRUE; 00102 } 00103 00104 int display_update_get_level(void) 00105 { 00106 return g_currentLevel; 00107 } 00108 00109 int display_update_reset_level(void) 00110 { 00111 g_currentLevel = LOWEST_LEVEL; 00112 return g_currentLevel; 00113 } 00114 00115 void display_update_increase_level(int level) 00116 { 00117 if (level > g_currentLevel) 00118 { 00119 g_currentLevel = level; 00120 } 00121 }