00001 /* 00002 * This file is part of browser. 00003 * 00004 * browser 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 * browser 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 00026 /* browser - A mozilla based browser application on the eReader platform 00027 * Copyright (C) 2005-2008 iRex Technologies B.V. 00028 * 00029 */ 00030 00031 #include <gdk/gdkx.h> 00032 #include "liberdm/erdm.h" 00033 #include "browserTypes.h" 00034 #include "timingInfo.h" 00035 #include "displayUpdate.h" 00036 #include "browserLog.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 BR_DISPLAYPRINTF("request screen update (%d)", quality); 00064 00065 #ifdef TIMING_INFORMATION_ENABLED 00066 timing_display_time_elapsed(); 00067 #endif //TIMING_INFORMATION_ENABLED 00068 00069 // full screen update, 00070 gdk_threads_enter(); 00071 gdk_flush(); 00072 gdk_flush(); 00073 gdk_threads_leave(); 00074 00075 //not busy any more 00076 erbusy_off(); 00077 00078 #ifdef TIMING_INFORMATION_ENABLED 00079 timing_display_time_elapsed(); 00080 #endif //TIMING_INFORMATION_ENABLED 00081 00082 // full screen update, 00083 dmDisplay(dmCmdPriorUrgent, quality); 00084 00085 // return FALSE to remove handler 00086 return FALSE; 00087 } 00088 00089 gboolean display_update_request_screen_refresh(int level, gpointer data) 00090 { 00091 int theCurrentLevel = display_update_get_level(); 00092 int quality = (int) data; 00093 00094 if (quality == 0) 00095 { 00096 quality = DM_QUALITY_FULL; 00097 } 00098 00099 BR_DISPLAYPRINTF("entry level %d currentlevel %d", level, theCurrentLevel); 00100 00101 if (level >= theCurrentLevel) 00102 { 00103 00104 gtk_idle_add(display_update_during_idle_handling, (gpointer) quality); 00105 00106 //reset the current level 00107 display_update_reset_level(); 00108 00109 } 00110 return TRUE; 00111 } 00112 00113 int display_update_get_level(void) 00114 { 00115 return g_currentLevel; 00116 } 00117 00118 int display_update_reset_level(void) 00119 { 00120 g_currentLevel = LOWEST_LEVEL; 00121 } 00122 00123 void display_update_increase_level(int level) 00124 { 00125 if (level > g_currentLevel) 00126 { 00127 g_currentLevel = level; 00128 } 00129 }
1.5.6