display: Simplify the regrab on focus mode

This commit is contained in:
Jasper St. Pierre 2014-08-14 14:48:21 -04:00
parent 9fa77acb8c
commit ef363e9d2e

View File

@ -2872,44 +2872,39 @@ prefs_changed_callback (MetaPreference pref,
{ {
MetaDisplay *display = data; MetaDisplay *display = data;
/* It may not be obvious why we regrab on focus mode if (pref == META_PREF_MOUSE_BUTTON_MODS)
* change; it's because we handle focus clicks a
* bit differently for the different focus modes.
*/
if (pref == META_PREF_MOUSE_BUTTON_MODS ||
pref == META_PREF_FOCUS_MODE)
{ {
MetaDisplay *display = data; GSList *windows, *l;
GSList *windows;
GSList *tmp;
windows = meta_display_list_windows (display, META_LIST_DEFAULT); windows = meta_display_list_windows (display, META_LIST_DEFAULT);
/* Ungrab all */ for (l = windows; l; l = l->next)
tmp = windows;
while (tmp != NULL)
{ {
MetaWindow *w = tmp->data; MetaWindow *w = l->data;
meta_display_ungrab_window_buttons (display, w->xwindow); meta_display_ungrab_window_buttons (display, w->xwindow);
meta_display_ungrab_focus_window_button (display, w);
tmp = tmp->next;
} }
/* change our modifier */ update_window_grab_modifiers (display);
if (pref == META_PREF_MOUSE_BUTTON_MODS)
update_window_grab_modifiers (display);
/* Grab all */ for (l = windows; l; l = l->next)
tmp = windows;
while (tmp != NULL)
{ {
MetaWindow *w = tmp->data; MetaWindow *w = l->data;
if (w->type != META_WINDOW_DOCK) if (w->type != META_WINDOW_DOCK)
{ meta_display_grab_window_buttons (display, w->xwindow);
meta_display_grab_focus_window_button (display, w); }
meta_display_grab_window_buttons (display, w->xwindow);
} g_slist_free (windows);
tmp = tmp->next; }
else if (pref == META_PREF_FOCUS_MODE)
{
GSList *windows, *l;
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
for (l = windows; l; l = l->next)
{
MetaWindow *w = l->data;
meta_display_ungrab_focus_window_button (display, w);
if (w->type != META_WINDOW_DOCK)
meta_display_grab_focus_window_button (display, w);
} }
g_slist_free (windows); g_slist_free (windows);