[gtk+/wip/paint-clock: 3/4] GdkWindow: Use GPeriodic to repaint windows
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/paint-clock: 3/4] GdkWindow: Use GPeriodic to repaint windows
- Date: Wed, 20 Oct 2010 11:52:47 +0000 (UTC)
commit 55b2f3ab4ed2bd9682629606e0ed1c1fe2c49a42
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Oct 20 13:47:22 2010 +0200
GdkWindow: Use GPeriodic to repaint windows
Replace the invalidation idle function with a damage registration inside
GPeriodic, using the GDK thread functions.
gdk/gdkwindow.c | 35 ++++++++++++++++-------------------
1 files changed, 16 insertions(+), 19 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 9ff1934..9177727 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -3760,7 +3760,7 @@ gdk_window_set_cairo_clip (GdkDrawable *drawable,
/* Code for dirty-region queueing
*/
static GSList *update_windows = NULL;
-static guint update_idle = 0;
+static gboolean damage_reported;
static gboolean debug_updates = FALSE;
static inline gboolean
@@ -3859,12 +3859,12 @@ gdk_window_remove_update_window (GdkWindow *window)
update_windows = g_slist_remove (update_windows, window);
}
-static gboolean
-gdk_window_update_idle (gpointer data)
+static void
+gdk_window_repair (GPeriodic *periodic,
+ gpointer user_data)
{
gdk_window_process_all_updates ();
-
- return FALSE;
+ damage_reported = FALSE;
}
static gboolean
@@ -3885,11 +3885,11 @@ gdk_window_schedule_update (GdkWindow *window)
gdk_window_is_toplevel_frozen (window)))
return;
- if (!update_idle)
- update_idle =
- gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
- gdk_window_update_idle,
- NULL, NULL);
+ if (!damage_reported)
+ {
+ gdk_threads_periodic_damaged (gdk_window_repair, NULL, NULL);
+ damage_reported = TRUE;
+ }
}
void
@@ -4212,18 +4212,15 @@ gdk_window_process_all_updates (void)
/* We can't do this now since that would recurse, so
delay it until after the recursion is done. */
got_recursive_update = TRUE;
- update_idle = 0;
return;
}
in_process_all_updates = TRUE;
got_recursive_update = FALSE;
- if (update_idle)
- g_source_remove (update_idle);
+ /* We can't unreport damage, so let it run anyway. */
update_windows = NULL;
- update_idle = 0;
_gdk_windowing_before_process_all_updates ();
@@ -4258,11 +4255,11 @@ gdk_window_process_all_updates (void)
redraw now so that it eventually happens,
otherwise we could miss an update if nothing
else schedules an update. */
- if (got_recursive_update && !update_idle)
- update_idle =
- gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
- gdk_window_update_idle,
- NULL, NULL);
+ if (got_recursive_update && !damage_reported)
+ {
+ gdk_threads_periodic_damaged (gdk_window_repair, NULL, NULL);
+ damage_reported = TRUE;
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]