mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 03:20:46 -05:00
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
This commit is contained in:
parent
2e0f979613
commit
592374bc62
@ -219,9 +219,6 @@ struct _MetaDisplay
|
|||||||
#ifdef HAVE_XKB
|
#ifdef HAVE_XKB
|
||||||
int xkb_base_event_type;
|
int xkb_base_event_type;
|
||||||
guint32 last_bell_time;
|
guint32 last_bell_time;
|
||||||
#endif
|
|
||||||
#ifdef HAVE_XSYNC
|
|
||||||
gint64 grab_sync_counter_wait_serial;
|
|
||||||
#endif
|
#endif
|
||||||
int grab_resize_timeout_id;
|
int grab_resize_timeout_id;
|
||||||
|
|
||||||
|
@ -343,9 +343,6 @@ struct _MetaWindow
|
|||||||
/* if TRUE, window is attached to its parent */
|
/* if TRUE, window is attached to its parent */
|
||||||
guint attached : 1;
|
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 */
|
/* whether or not the window is from a program running on another machine */
|
||||||
guint is_remote : 1;
|
guint is_remote : 1;
|
||||||
|
|
||||||
@ -366,6 +363,7 @@ struct _MetaWindow
|
|||||||
/* XSync update counter */
|
/* XSync update counter */
|
||||||
XSyncCounter sync_request_counter;
|
XSyncCounter sync_request_counter;
|
||||||
gint64 sync_request_serial;
|
gint64 sync_request_serial;
|
||||||
|
gint64 sync_request_wait_serial;
|
||||||
GTimeVal sync_request_time;
|
GTimeVal sync_request_time;
|
||||||
/* alarm monitoring client's _NET_WM_SYNC_REQUEST_COUNTER */
|
/* alarm monitoring client's _NET_WM_SYNC_REQUEST_COUNTER */
|
||||||
XSyncAlarm sync_request_alarm;
|
XSyncAlarm sync_request_alarm;
|
||||||
|
@ -4631,7 +4631,7 @@ send_sync_request (MetaWindow *window)
|
|||||||
*/
|
*/
|
||||||
wait_serial = window->sync_request_serial + 240;
|
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.type = ClientMessage;
|
||||||
ev.window = window->xwindow;
|
ev.window = window->xwindow;
|
||||||
@ -4655,6 +4655,9 @@ send_sync_request (MetaWindow *window)
|
|||||||
window->xwindow, False, 0, (XEvent*) &ev);
|
window->xwindow, False, 0, (XEvent*) &ev);
|
||||||
|
|
||||||
g_get_current_time (&window->sync_request_time);
|
g_get_current_time (&window->sync_request_time);
|
||||||
|
|
||||||
|
meta_compositor_set_updates_frozen (window->display->compositor, window,
|
||||||
|
meta_window_updates_are_frozen (window));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -4677,22 +4680,12 @@ meta_window_updates_are_frozen (MetaWindow *window)
|
|||||||
if (window->extended_sync_request_counter &&
|
if (window->extended_sync_request_counter &&
|
||||||
window->sync_request_serial % 2 == 1)
|
window->sync_request_serial % 2 == 1)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
if (window->sync_request_serial < window->sync_request_wait_serial)
|
||||||
|
return TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return window->updates_frozen_for_resize;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -5210,14 +5203,12 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
#ifdef HAVE_XSYNC
|
#ifdef HAVE_XSYNC
|
||||||
if (window == window->display->grab_window &&
|
if (window == window->display->grab_window &&
|
||||||
meta_grab_op_is_resizing (window->display->grab_op) &&
|
meta_grab_op_is_resizing (window->display->grab_op) &&
|
||||||
|
!window->disable_sync &&
|
||||||
window->sync_request_counter != None &&
|
window->sync_request_counter != None &&
|
||||||
window->sync_request_alarm != None &&
|
window->sync_request_alarm != None &&
|
||||||
window->sync_request_time.tv_usec == 0 &&
|
window->sync_request_time.tv_usec == 0 &&
|
||||||
window->sync_request_time.tv_sec == 0)
|
window->sync_request_time.tv_sec == 0)
|
||||||
{
|
{
|
||||||
/* turn off updating */
|
|
||||||
meta_window_set_updates_frozen_for_resize (window, TRUE);
|
|
||||||
|
|
||||||
send_sync_request (window);
|
send_sync_request (window);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -8860,6 +8851,14 @@ check_moveresize_frequency (MetaWindow *window,
|
|||||||
* application to respond to the sync request
|
* application to respond to the sync request
|
||||||
*/
|
*/
|
||||||
window->disable_sync = TRUE;
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9405,9 +9404,6 @@ update_resize (MetaWindow *window,
|
|||||||
return;
|
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 */
|
/* Remove any scheduled compensation events */
|
||||||
if (window->display->grab_resize_timeout_id)
|
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 &&
|
if (window == window->display->grab_window &&
|
||||||
meta_grab_op_is_resizing (window->display->grab_op) &&
|
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))
|
(!window->extended_sync_request_counter || new_counter_value % 2 == 0))
|
||||||
{
|
{
|
||||||
meta_topic (META_DEBUG_RESIZING,
|
meta_topic (META_DEBUG_RESIZING,
|
||||||
@ -9682,7 +9678,6 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
|||||||
xev->root_x,
|
xev->root_x,
|
||||||
xev->root_y,
|
xev->root_y,
|
||||||
TRUE);
|
TRUE);
|
||||||
meta_window_set_updates_frozen_for_resize (window, FALSE);
|
|
||||||
|
|
||||||
/* If a tiled window has been dragged free with a
|
/* If a tiled window has been dragged free with a
|
||||||
* mouse resize without snapping back to the tiled
|
* mouse resize without snapping back to the tiled
|
||||||
|
Loading…
Reference in New Issue
Block a user