summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2013-03-13 13:09:33 -0400
committerOwen W. Taylor <otaylor@fishsoup.net>2013-03-14 07:59:57 -0400
commit592374bc6236c13497527733c970e575e4e0339f (patch)
tree052def31bda16dc1ca0c32a3be4d096129b90668 /src
parent2e0f979613c4f1eeae8d5dafc649bb6a035c8b73 (diff)
downloadmutter-592374bc6236c13497527733c970e575e4e0339f.tar.gz
Fix freezing of windows with keyboard resizing
During resizing we froze window updates when configuring the window, and unfroze the window updates when processing the next resize. This wasn't absolutely reliable, because we might not have a next resize. Instead tie window freezing more directly to the current sync request value - a window is frozen until it catches up with the last value we sent it in _NET_WM_SYNC_REQUEST. Testing with unresponsive clients showed that there was a bug where window->disable_sync once set, would not actually disable sync, but it *would* disable noticing that the client was unresponsive for the next resize. Fix that by checking for ->disable_sync before sending _NET_WM_SYNC_REQUEST. https://bugzilla.gnome.org/show_bug.cgi?id=694046
Diffstat (limited to 'src')
-rw-r--r--src/core/display-private.h3
-rw-r--r--src/core/window-private.h4
-rw-r--r--src/core/window.c41
3 files changed, 19 insertions, 29 deletions
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 3d8a8482e..1f73fc3b2 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -220,9 +220,6 @@ struct _MetaDisplay
int xkb_base_event_type;
guint32 last_bell_time;
#endif
-#ifdef HAVE_XSYNC
- gint64 grab_sync_counter_wait_serial;
-#endif
int grab_resize_timeout_id;
/* Keybindings stuff */
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 311af1963..60e64bdd4 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -343,9 +343,6 @@ struct _MetaWindow
/* if TRUE, window is attached to its parent */
guint attached : 1;
- /* if TRUE, we are freezing updates during a resize */
- guint updates_frozen_for_resize : 1;
-
/* whether or not the window is from a program running on another machine */
guint is_remote : 1;
@@ -366,6 +363,7 @@ struct _MetaWindow
/* XSync update counter */
XSyncCounter sync_request_counter;
gint64 sync_request_serial;
+ gint64 sync_request_wait_serial;
GTimeVal sync_request_time;
/* alarm monitoring client's _NET_WM_SYNC_REQUEST_COUNTER */
XSyncAlarm sync_request_alarm;
diff --git a/src/core/window.c b/src/core/window.c
index caadfb715..1947d3541 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4631,7 +4631,7 @@ send_sync_request (MetaWindow *window)
*/
wait_serial = window->sync_request_serial + 240;
- window->display->grab_sync_counter_wait_serial = wait_serial;
+ window->sync_request_wait_serial = wait_serial;
ev.type = ClientMessage;
ev.window = window->xwindow;
@@ -4655,6 +4655,9 @@ send_sync_request (MetaWindow *window)
window->xwindow, False, 0, (XEvent*) &ev);
g_get_current_time (&window->sync_request_time);
+
+ meta_compositor_set_updates_frozen (window->display->compositor, window,
+ meta_window_updates_are_frozen (window));
}
#endif
@@ -4677,22 +4680,12 @@ meta_window_updates_are_frozen (MetaWindow *window)
if (window->extended_sync_request_counter &&
window->sync_request_serial % 2 == 1)
return TRUE;
-#endif
- return window->updates_frozen_for_resize;
-}
+ if (window->sync_request_serial < window->sync_request_wait_serial)
+ return TRUE;
+#endif
-static void
-meta_window_set_updates_frozen_for_resize (MetaWindow *window,
- gboolean updates_frozen)
-{
- if (updates_frozen != window->updates_frozen_for_resize)
- {
- window->updates_frozen_for_resize = updates_frozen;
- if (window->display->compositor)
- meta_compositor_set_updates_frozen (window->display->compositor, window,
- meta_window_updates_are_frozen (window));
- }
+ return FALSE;
}
static gboolean
@@ -5210,14 +5203,12 @@ meta_window_move_resize_internal (MetaWindow *window,
#ifdef HAVE_XSYNC
if (window == window->display->grab_window &&
meta_grab_op_is_resizing (window->display->grab_op) &&
+ !window->disable_sync &&
window->sync_request_counter != None &&
window->sync_request_alarm != None &&
window->sync_request_time.tv_usec == 0 &&
window->sync_request_time.tv_sec == 0)
{
- /* turn off updating */
- meta_window_set_updates_frozen_for_resize (window, TRUE);
-
send_sync_request (window);
}
#endif
@@ -8860,6 +8851,14 @@ check_moveresize_frequency (MetaWindow *window,
* application to respond to the sync request
*/
window->disable_sync = TRUE;
+
+ /* Reset the wait serial, so we don't continue freezing
+ * window updates
+ */
+ window->sync_request_wait_serial = 0;
+ meta_compositor_set_updates_frozen (window->display->compositor, window,
+ meta_window_updates_are_frozen (window));
+
return TRUE;
}
}
@@ -9405,9 +9404,6 @@ update_resize (MetaWindow *window,
return;
}
- /* If we get here, it means the client should have redrawn itself */
- meta_window_set_updates_frozen_for_resize (window, FALSE);
-
/* Remove any scheduled compensation events */
if (window->display->grab_resize_timeout_id)
{
@@ -9616,7 +9612,7 @@ meta_window_update_sync_request_counter (MetaWindow *window,
if (window == window->display->grab_window &&
meta_grab_op_is_resizing (window->display->grab_op) &&
- new_counter_value >= window->display->grab_sync_counter_wait_serial &&
+ new_counter_value >= window->sync_request_wait_serial &&
(!window->extended_sync_request_counter || new_counter_value % 2 == 0))
{
meta_topic (META_DEBUG_RESIZING,
@@ -9682,7 +9678,6 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
xev->root_x,
xev->root_y,
TRUE);
- meta_window_set_updates_frozen_for_resize (window, FALSE);
/* If a tiled window has been dragged free with a
* mouse resize without snapping back to the tiled