core: Shuffle wayland checks on passive button grabs

We used to bail out at the very bottom of it, but it seems better to
do that at a higher level so that we don't have to pass "invalid"
X11 data as arguments (e.g. None for windows, etc)
This commit is contained in:
Carlos Garnacho 2019-05-24 19:30:34 +02:00
parent b1ea768949
commit 9367cd2d66
2 changed files with 9 additions and 13 deletions

View File

@ -1171,9 +1171,6 @@ meta_change_button_grab (MetaKeyBindingManager *keys,
int button, int button,
int modmask) int modmask)
{ {
if (meta_is_wayland_compositor ())
return;
MetaBackendX11 *backend = META_BACKEND_X11 (keys->backend); MetaBackendX11 *backend = META_BACKEND_X11 (keys->backend);
Display *xdisplay = meta_backend_x11_get_xdisplay (backend); Display *xdisplay = meta_backend_x11_get_xdisplay (backend);
@ -1300,11 +1297,7 @@ meta_display_grab_focus_window_button (MetaDisplay *display,
return; return;
} }
/* FIXME If we ignored errors here instead of spewing, we could if (window->xwindow && !meta_is_wayland_compositor ())
* put one big error trap around the loop and avoid a bunch of
* XSync()
*/
meta_change_buttons_grab (keys, window->xwindow, TRUE, TRUE, XIAnyModifier); meta_change_buttons_grab (keys, window->xwindow, TRUE, TRUE, XIAnyModifier);
window->have_focus_click_grab = TRUE; window->have_focus_click_grab = TRUE;
} }
@ -1320,6 +1313,7 @@ meta_display_ungrab_focus_window_button (MetaDisplay *display,
if (!window->have_focus_click_grab) if (!window->have_focus_click_grab)
return; return;
if (window->xwindow && !meta_is_wayland_compositor ())
meta_change_buttons_grab (keys, window->xwindow, FALSE, FALSE, XIAnyModifier); meta_change_buttons_grab (keys, window->xwindow, FALSE, FALSE, XIAnyModifier);
window->have_focus_click_grab = FALSE; window->have_focus_click_grab = FALSE;
} }
@ -1348,6 +1342,7 @@ prefs_changed_callback (MetaPreference pref,
for (l = windows; l; l = l->next) for (l = windows; l; l = l->next)
{ {
MetaWindow *w = l->data; MetaWindow *w = l->data;
if (!meta_is_wayland_compositor ())
meta_display_ungrab_window_buttons (display, w->xwindow); meta_display_ungrab_window_buttons (display, w->xwindow);
} }
@ -1356,7 +1351,7 @@ prefs_changed_callback (MetaPreference pref,
for (l = windows; l; l = l->next) for (l = windows; l; l = l->next)
{ {
MetaWindow *w = l->data; MetaWindow *w = l->data;
if (w->type != META_WINDOW_DOCK) if (!meta_is_wayland_compositor () && w->type != META_WINDOW_DOCK)
meta_display_grab_window_buttons (display, w->xwindow); meta_display_grab_window_buttons (display, w->xwindow);
} }

View File

@ -5283,6 +5283,7 @@ meta_window_set_focused_internal (MetaWindow *window,
meta_display_ungrab_focus_window_button (window->display, window); meta_display_ungrab_focus_window_button (window->display, window);
/* Since we ungrab with XIAnyModifier above, all button /* Since we ungrab with XIAnyModifier above, all button
grabs go way so we need to re-grab the window buttons. */ grabs go way so we need to re-grab the window buttons. */
if (!meta_is_wayland_compositor ())
meta_display_grab_window_buttons (window->display, window->xwindow); meta_display_grab_window_buttons (window->display, window->xwindow);
} }