00001 /* 00002 * File Name: notepad_display_sched.cpp 00003 */ 00004 00005 /* 00006 * This file is part of notepad. 00007 * 00008 * notepad 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 * notepad 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) 2010 IREX Technologies B.V. 00024 * All rights reserved. 00025 */ 00026 00027 //---------------------------------------------------------------------------- 00028 // Include Files 00029 //---------------------------------------------------------------------------- 00030 00031 #include <gtk/gtk.h> 00032 00033 #include "notepad_display_sched.h" 00034 00035 00036 //---------------------------------------------------------------------------- 00037 // Type Declarations 00038 //---------------------------------------------------------------------------- 00039 00040 00041 //---------------------------------------------------------------------------- 00042 // Constants 00043 //---------------------------------------------------------------------------- 00044 00045 00046 //---------------------------------------------------------------------------- 00047 // Static Variables 00048 //---------------------------------------------------------------------------- 00049 00050 static gboolean g_have_control = FALSE; 00051 00052 //============================================================================ 00053 // Local Function Definitions 00054 //============================================================================ 00055 00056 00057 //============================================================================ 00058 // Functions Implementation 00059 //============================================================================ 00060 00061 void notepad_stop_display_update(void) 00062 { 00063 if (! g_have_control ) 00064 { 00065 g_have_control = TRUE; 00066 display_gain_control(); 00067 } 00068 } 00069 00070 void notepad_start_display_update(void) 00071 { 00072 if (g_have_control ) 00073 { 00074 g_have_control = FALSE; 00075 display_return_control(); 00076 } 00077 } 00078 00079 gboolean notepad_display_yield(gpointer data) 00080 { 00081 if ( g_have_control ) 00082 { 00083 display_update_return_control((gint) data); 00084 g_have_control = FALSE; 00085 } 00086 return FALSE; 00087 } 00088 00089 gboolean notepad_display_update(gpointer data) 00090 { 00091 if ( g_have_control ) 00092 { 00093 display_update_keep_control((gint) data); 00094 } 00095 return FALSE; 00096 } 00097 00098 void notepad_on_idle_display_yield(gint type) 00099 { 00100 if ( g_have_control ) 00101 { 00102 g_idle_add(notepad_display_yield, (gpointer) type ); 00103 } 00104 } 00105 00106 void notepad_on_idle_display_update(gint type) 00107 { 00108 if ( g_have_control ) 00109 { 00110 g_idle_add(notepad_display_update, (gpointer) type ); 00111 } 00112 } 00113 00114 void notepad_on_timeout_display_yield(gint timeout, gint type) 00115 { 00116 if ( g_have_control ) 00117 { 00118 g_timeout_add(timeout, notepad_display_yield, (gpointer) type ); 00119 } 00120 } 00121 00122 void notepad_on_timeout_display_update(gint timeout, gint type) 00123 { 00124 if ( g_have_control ) 00125 { 00126 g_timeout_add(timeout, notepad_display_update, (gpointer) type ); 00127 } 00128 }