diff --git a/src/core/bell.c b/src/core/bell.c index 1b6022c84..108df98e6 100644 --- a/src/core/bell.c +++ b/src/core/bell.c @@ -210,7 +210,12 @@ bell_flash_window_frame (MetaWindow *window) g_assert (window->frame != NULL); window->frame->is_flashing = 1; meta_frame_queue_draw (window->frame); - g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 100, + /* Since this idle is added after the Clutter clock source, with + * the same priority, it will be executed after it as well, so + * we are guaranteed to get at least one frame drawn in the + * flashed state, no matter how loaded we are. + */ + g_timeout_add_full (META_PRIORITY_REDRAW, 100, bell_unflash_frame, window->frame, NULL); } diff --git a/src/core/delete.c b/src/core/delete.c index 629442325..5533e4d9f 100644 --- a/src/core/delete.c +++ b/src/core/delete.c @@ -71,7 +71,8 @@ sigchld_handler (MetaNexus *nexus, guint arg1, gpointer arg2, gpointer user_data if (GPOINTER_TO_INT (arg2) == ours->dialog_pid) { if (arg1 == 1 /* pressed "force quit" */) - g_idle_add (delete_window_callback, user_data); + g_idle_add_full (G_PRIORITY_DEFAULT, + delete_window_callback, user_data, NULL); ours->dialog_pid = -1; /* forget it anyway */ } diff --git a/src/core/screen.c b/src/core/screen.c index 777bd73b5..4e234071b 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -2115,7 +2115,7 @@ meta_screen_queue_workarea_recalc (MetaScreen *screen) meta_topic (META_DEBUG_WORKAREA, "Adding work area hint idle function\n"); screen->work_area_idle = - g_idle_add_full (META_PRIORITY_WORK_AREA_HINT, + g_idle_add_full (META_PRIORITY_BEFORE_REDRAW, (GSourceFunc) set_work_area_idle_func, screen, NULL); diff --git a/src/core/window.c b/src/core/window.c index 74f8e9539..400403a59 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -1987,9 +1987,9 @@ meta_window_queue (MetaWindow *window, guint queuebits) const gint window_queue_idle_priority[NUMBER_OF_QUEUES] = { - G_PRIORITY_DEFAULT_IDLE, /* CALC_SHOWING */ - META_PRIORITY_RESIZE, /* MOVE_RESIZE */ - G_PRIORITY_DEFAULT_IDLE /* UPDATE_ICON */ + META_PRIORITY_BEFORE_REDRAW, /* CALC_SHOWING */ + META_PRIORITY_RESIZE, /* MOVE_RESIZE */ + META_PRIORITY_BEFORE_REDRAW /* UPDATE_ICON */ }; const GSourceFunc window_queue_idle_handler[NUMBER_OF_QUEUES] = diff --git a/src/include/common.h b/src/include/common.h index 77fc9c54b..24d67317f 100644 --- a/src/include/common.h +++ b/src/include/common.h @@ -287,8 +287,57 @@ struct _MetaButtonLayout #define META_DEFAULT_ICON_NAME "window" +/* Main loop priorities determine when activity in the GLib + * will take precendence over the others. Priorities are sometimes + * used to enforce ordering: give A a higher priority than B if + * A must occur before B. But that poses a problem since then + * if A occurs frequently enough, B will never occur. + * + * Anything we want to occur more or less immediately should + * have a priority of G_PRIORITY_DEFAULT. When we want to + * coelesce multiple things together, the appropriate place to + * do it is usually META_PRIORITY_BEFORE_REDRAW. + * + * (FIXME: Use a Clutter paint() function instead, to prevent + * starving the repaints) + * + * If something has a priority lower than the redraw priority + * (such as a default priority idle), then it may be arbitrarily + * delayed. This happens if the screen is updating rapidly: we + * are spending all our time either redrawing or waiting for a + * vblank-synced buffer swap. (When X is improved to allow + * clutter to do the buffer-swap asychronously, this will get + * better.) + */ + +/* G_PRIORITY_DEFAULT: + * events + * many timeouts + */ + +/* GTK_PRIORITY_RESIZE: (G_PRIORITY_HIGH_IDLE + 10) */ +#define META_PRIORITY_RESIZE (G_PRIORITY_HIGH_IDLE + 15) +/* GTK_PRIORITY_REDRAW: (G_PRIORITY_HIGH_IDLE + 20) */ + +#define META_PRIORITY_BEFORE_REDRAW (G_PRIORITY_HIGH_IDLE + 40) +/* calc-showing idle + * update-icon idle + */ + +/* CLUTTER_PRIORITY_REDRAW: (G_PRIORITY_HIGH_IDLE + 50) */ +#define META_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 50) + +/* ==== Anything below here can be starved arbitrarily ==== */ + +/* G_PRIORITY_DEFAULT_IDLE: + * Mutter plugin unloading + * GConf notify idle + */ + +/* Chosen to be below the GConf notify idle */ #define META_PRIORITY_PREFS_NOTIFY (G_PRIORITY_DEFAULT_IDLE + 10) -#define META_PRIORITY_WORK_AREA_HINT (G_PRIORITY_DEFAULT_IDLE + 15) + +/************************************************************/ #define POINT_IN_RECT(xcoord, ycoord, rect) \ ((xcoord) >= (rect).x && \ diff --git a/src/include/ui.h b/src/include/ui.h index a4d7fea7d..f47f95bc7 100644 --- a/src/include/ui.h +++ b/src/include/ui.h @@ -31,9 +31,6 @@ #include #include -/* This is between GTK_PRIORITY_RESIZE (+10) and GTK_PRIORITY_REDRAW (+20) */ -#define META_PRIORITY_RESIZE (G_PRIORITY_HIGH_IDLE + 15) - typedef struct _MetaUI MetaUI; typedef struct _MetaImageWindow MetaImageWindow;