00001 /* 00002 * File Name: erkeyb-display-sched.c 00003 */ 00004 00005 /* 00006 * This file is part of erkeyb 00007 * 00008 * matchbox-keyboard is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation, either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * matchbox-keyboard is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 /** 00023 * Copyright (C) 2008 iRex Technologies B.V. 00024 * All rights reserved. 00025 */ 00026 00027 //---------------------------------------------------------------------------- 00028 // Include Files 00029 //---------------------------------------------------------------------------- 00030 00031 // system include files, between < > 00032 #include <stdio.h> 00033 #include <string.h> 00034 00035 #include <gtk/gtk.h> 00036 00037 // ereader include files, between < > 00038 00039 // local include files, between " " 00040 #include "erkeyb-display-sched.h" 00041 00042 00043 //---------------------------------------------------------------------------- 00044 // Type Declarations 00045 //---------------------------------------------------------------------------- 00046 00047 00048 //---------------------------------------------------------------------------- 00049 // Constants 00050 //---------------------------------------------------------------------------- 00051 00052 00053 //---------------------------------------------------------------------------- 00054 // Static Variables 00055 //---------------------------------------------------------------------------- 00056 00057 static gboolean g_have_control = FALSE; 00058 00059 //============================================================================ 00060 // Local Function Definitions 00061 //============================================================================ 00062 00063 00064 //============================================================================ 00065 // Functions Implementation 00066 //============================================================================ 00067 00068 void erkeyb_stop_display_update(void) 00069 { 00070 if (! g_have_control ) 00071 { 00072 g_have_control = TRUE; 00073 display_gain_control(); 00074 } 00075 } 00076 00077 gboolean erkeyb_display_yield(gpointer data) 00078 { 00079 if ( g_have_control ) 00080 { 00081 display_update_return_control((gint) data); 00082 g_have_control = FALSE; 00083 } 00084 return FALSE; 00085 } 00086 00087 gboolean erkeyb_display_update(gpointer data) 00088 { 00089 if ( g_have_control ) 00090 { 00091 display_update_keep_control((gint) data); 00092 } 00093 return FALSE; 00094 } 00095 00096 void erkeyb_on_idle_display_yield(gint type) 00097 { 00098 if ( g_have_control ) 00099 { 00100 g_idle_add(erkeyb_display_yield, (gpointer) type ); 00101 } 00102 } 00103 00104 void erkeyb_on_idle_display_update(gint type) 00105 { 00106 if ( g_have_control ) 00107 { 00108 g_idle_add(erkeyb_display_update, (gpointer) type ); 00109 } 00110 } 00111 00112 void erkeyb_on_timeout_display_yield(gint timeout, gint type) 00113 { 00114 if ( g_have_control ) 00115 { 00116 g_timeout_add(timeout, erkeyb_display_yield, (gpointer) type ); 00117 } 00118 } 00119 00120 void erkeyb_on_timeout_display_update(gint timeout, gint type) 00121 { 00122 if ( g_have_control ) 00123 { 00124 g_timeout_add(timeout, erkeyb_display_update, (gpointer) type ); 00125 } 00126 }