00001 /* 00002 * This file is part of scribble. 00003 * 00004 * scribble 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 * scribble 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 "displayUpdate.h" 00034 #include "erbusy.h" 00035 #include "ScribbleLog.h" 00036 00037 //for usleep(usecond) 00038 //#include <unistd.h> 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 00054 static gboolean display_update_during_idle_handling(gpointer data) 00055 { 00056 eDmQuality quality = (int) data; 00057 00058 SB_TIMEDISPLAY("start...,quality=%d",quality); 00059 erbusy_blink(); 00060 //usleep( 300 * 1000 ); 00061 // full screen update, 00062 gdk_threads_enter(); 00063 //gdk_flush(); 00064 gdk_flush(); 00065 gdk_threads_leave(); 00066 00067 SB_TIMEDISPLAY("dmDisplay..."); 00068 // full screen update, 00069 //dmDisplay(dmCmdPriorUrgent, quality);//no wait 00070 dmDisplay(dmCmdPriorNormal,quality);//work,500ms wait. 00071 //dmDisplay(dmCmdPriorHigh,quality);doens't work 00072 erbusy_off(); 00073 00074 SB_TIMEDISPLAY("done."); 00075 // return FALSE to remove handler 00076 return FALSE; 00077 } 00078 00079 //data -- quality, four types now 00080 gboolean display_update_request_screen_refresh(int level, gpointer data) 00081 { 00082 int theCurrentLevel = display_update_get_level(); 00083 int quality = (int) data; 00084 00085 SB_IPCPRINTF("quality:%d\n",quality); 00086 if (quality == 0) 00087 { 00088 quality = dmQFull; 00089 } 00090 00091 00092 if (level >= theCurrentLevel) 00093 { 00094 g_idle_add_full(G_PRIORITY_HIGH_IDLE, 00095 display_update_during_idle_handling, 00096 (gpointer) quality, 00097 NULL); 00098 //gtk_idle_add(display_update_during_idle_handling, (gpointer) quality); 00099 //reset the current level 00100 display_update_reset_level(); 00101 } 00102 return TRUE; 00103 } 00104 00105 int display_update_get_level(void) 00106 { 00107 return g_currentLevel; 00108 } 00109 00110 int display_update_reset_level(void) 00111 { 00112 g_currentLevel = LOWEST_LEVEL; 00113 return g_currentLevel; 00114 } 00115 00116 void display_update_increase_level(int level) 00117 { 00118 if (level > g_currentLevel) 00119 { 00120 g_currentLevel = level; 00121 } 00122 }
1.5.6