[mutter] display: Simplify the regrab on focus mode
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] display: Simplify the regrab on focus mode
- Date: Thu, 14 Aug 2014 22:21:09 +0000 (UTC)
commit ef363e9d2e3be20b92ee5dbf1f9adfae5aa09761
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Aug 14 14:48:21 2014 -0400
display: Simplify the regrab on focus mode
src/core/display.c | 51 +++++++++++++++++++++++----------------------------
1 files changed, 23 insertions(+), 28 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index acb5c03..13c2bb8 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -2872,44 +2872,39 @@ prefs_changed_callback (MetaPreference pref,
{
MetaDisplay *display = data;
- /* It may not be obvious why we regrab on focus mode
- * 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)
+ if (pref == META_PREF_MOUSE_BUTTON_MODS)
{
- MetaDisplay *display = data;
- GSList *windows;
- GSList *tmp;
-
+ GSList *windows, *l;
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
- /* Ungrab all */
- tmp = windows;
- while (tmp != NULL)
+ for (l = windows; l; l = l->next)
{
- MetaWindow *w = tmp->data;
+ MetaWindow *w = l->data;
meta_display_ungrab_window_buttons (display, w->xwindow);
- meta_display_ungrab_focus_window_button (display, w);
- tmp = tmp->next;
}
- /* change our modifier */
- if (pref == META_PREF_MOUSE_BUTTON_MODS)
- update_window_grab_modifiers (display);
+ update_window_grab_modifiers (display);
- /* Grab all */
- tmp = windows;
- while (tmp != NULL)
+ for (l = windows; l; l = l->next)
{
- MetaWindow *w = tmp->data;
+ MetaWindow *w = l->data;
if (w->type != META_WINDOW_DOCK)
- {
- meta_display_grab_focus_window_button (display, w);
- meta_display_grab_window_buttons (display, w->xwindow);
- }
- tmp = tmp->next;
+ meta_display_grab_window_buttons (display, w->xwindow);
+ }
+
+ g_slist_free (windows);
+ }
+ 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]