keybindings: Grab buttons with any modifier combo on unfocused windows

We currently only focus unfocused windows on button press if no
modifiers (or just ignored modifiers) are in effect. This behavior
seems surprising and counter-intuitive so let's do it for any modifier
combination instead.

https://bugzilla.gnome.org/show_bug.cgi?id=746642
This commit is contained in:
Rui Matos 2016-02-10 20:17:49 +01:00
parent 0249993377
commit 2b59b4c793
2 changed files with 18 additions and 3 deletions

View File

@ -902,6 +902,16 @@ calc_grab_modifiers (MetaKeyBindingManager *keys,
XIGrabModifiers mods;
GArray *mods_array = g_array_new (FALSE, TRUE, sizeof (XIGrabModifiers));
/* The X server crashes if XIAnyModifier gets passed in with any
other bits. It doesn't make sense to ask for a grab of
XIAnyModifier plus other bits anyway so we avoid that. */
if (modmask & XIAnyModifier)
{
mods = (XIGrabModifiers) { XIAnyModifier, 0 };
g_array_append_val (mods_array, mods);
return mods_array;
}
mods = (XIGrabModifiers) { modmask, 0 };
g_array_append_val (mods_array, mods);
@ -1061,7 +1071,7 @@ meta_display_grab_focus_window_button (MetaDisplay *display,
* XSync()
*/
meta_change_buttons_grab (keys, window->xwindow, TRUE, TRUE, 0);
meta_change_buttons_grab (keys, window->xwindow, TRUE, TRUE, XIAnyModifier);
window->have_focus_click_grab = TRUE;
}
@ -1076,7 +1086,7 @@ meta_display_ungrab_focus_window_button (MetaDisplay *display,
if (!window->have_focus_click_grab)
return;
meta_change_buttons_grab (keys, window->xwindow, FALSE, FALSE, 0);
meta_change_buttons_grab (keys, window->xwindow, FALSE, FALSE, XIAnyModifier);
window->have_focus_click_grab = FALSE;
}

View File

@ -4816,7 +4816,12 @@ meta_window_set_focused_internal (MetaWindow *window,
*/
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK ||
!meta_prefs_get_raise_on_click())
{
meta_display_ungrab_focus_window_button (window->display, window);
/* Since we ungrab with XIAnyModifier above, all button
grabs go way so we need to re-grab the window buttons. */
meta_display_grab_window_buttons (window->display, window->xwindow);
}
g_signal_emit (window, window_signals[FOCUS], 0);