[mutter] Fix some broken indentation and simplify nested if()s
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Subject: [mutter] Fix some broken indentation and simplify nested if()s
- Date: Mon, 4 May 2009 10:26:33 -0400 (EDT)
commit f55509aadd8dc636fb49f11d260e27e468de5915
Author: Dan Winship <danw gnome org>
Date: Mon Apr 27 09:27:31 2009 -0400
Fix some broken indentation and simplify nested if()s
http://bugzilla.gnome.org/show_bug.cgi?id=580917
---
src/core/keybindings.c | 197 ++++++++++++++++++++++++------------------------
1 files changed, 99 insertions(+), 98 deletions(-)
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 0fe62e4..21c913c 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -3020,68 +3020,71 @@ do_choose_window (MetaDisplay *display,
"Initially selecting window %s\n",
initial_selection ? initial_selection->desc : "(none)");
- if (initial_selection != NULL)
+ if (initial_selection == NULL)
+ return;
+
+ if (binding->mask == 0)
{
- if (binding->mask == 0)
- {
- /* If no modifiers, we can't do the "hold down modifier to keep
- * moving" thing, so we just instaswitch by one window.
- */
- meta_topic (META_DEBUG_FOCUS,
- "Activating %s and turning off mouse_mode due to "
- "switch/cycle windows with no modifiers\n",
- initial_selection->desc);
- display->mouse_mode = FALSE;
- meta_window_activate (initial_selection, event->xkey.time);
- }
- else if (!meta_prefs_get_no_tab_popup ())
- {
- if (meta_display_begin_grab_op (display,
- screen,
- NULL,
- show_popup ?
- tab_op_from_tab_type (type) :
- cycle_op_from_tab_type (type),
- FALSE,
- FALSE,
- 0,
- binding->mask,
- event->xkey.time,
- 0, 0))
- {
- if (!primary_modifier_still_pressed (display,
- binding->mask))
- {
- /* This handles a race where modifier might be released
- * before we establish the grab. must end grab
- * prior to trying to focus a window.
- */
- meta_topic (META_DEBUG_FOCUS,
- "Ending grab, activating %s, and turning off "
- "mouse_mode due to switch/cycle windows where "
- "modifier was released prior to grab\n",
- initial_selection->desc);
- meta_display_end_grab_op (display, event->xkey.time);
- display->mouse_mode = FALSE;
- meta_window_activate (initial_selection, event->xkey.time);
- }
- else
- {
- meta_ui_tab_popup_select (screen->tab_popup,
- (MetaTabEntryKey) initial_selection->xwindow);
+ /* If no modifiers, we can't do the "hold down modifier to keep
+ * moving" thing, so we just instaswitch by one window.
+ */
+ meta_topic (META_DEBUG_FOCUS,
+ "Activating %s and turning off mouse_mode due to "
+ "switch/cycle windows with no modifiers\n",
+ initial_selection->desc);
+ display->mouse_mode = FALSE;
+ meta_window_activate (initial_selection, event->xkey.time);
+ return;
+ }
- if (show_popup)
- meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
- else
- {
- meta_window_raise (initial_selection);
- initial_selection->tab_unminimized =
- initial_selection->minimized;
- meta_window_unminimize (initial_selection);
- }
- }
- }
+ if (meta_prefs_get_no_tab_popup ())
+ {
+ /* FIXME? Shouldn't this be merged with the previous case? */
+ return;
+ }
+
+ if (!meta_display_begin_grab_op (display,
+ screen,
+ NULL,
+ show_popup ?
+ tab_op_from_tab_type (type) :
+ cycle_op_from_tab_type (type),
+ FALSE,
+ FALSE,
+ 0,
+ binding->mask,
+ event->xkey.time,
+ 0, 0))
+ return;
+
+ if (!primary_modifier_still_pressed (display, binding->mask))
+ {
+ /* This handles a race where modifier might be released before
+ * we establish the grab. must end grab prior to trying to focus
+ * a window.
+ */
+ meta_topic (META_DEBUG_FOCUS,
+ "Ending grab, activating %s, and turning off "
+ "mouse_mode due to switch/cycle windows where "
+ "modifier was released prior to grab\n",
+ initial_selection->desc);
+ meta_display_end_grab_op (display, event->xkey.time);
+ display->mouse_mode = FALSE;
+ meta_window_activate (initial_selection, event->xkey.time);
+ return;
}
+
+ meta_ui_tab_popup_select (screen->tab_popup,
+ (MetaTabEntryKey) initial_selection->xwindow);
+
+ if (show_popup)
+ meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
+ else
+ {
+ meta_window_raise (initial_selection);
+ initial_selection->tab_unminimized =
+ initial_selection->minimized;
+ meta_window_unminimize (initial_selection);
}
}
@@ -3408,7 +3411,9 @@ handle_workspace_switch (MetaDisplay *display,
{
gint motion = binding->handler->data;
unsigned int grab_mask;
-
+ MetaWorkspace *next;
+ gboolean grabbed_before_release;
+
g_assert (motion < 0);
meta_topic (META_DEBUG_KEYBINDINGS,
@@ -3417,47 +3422,43 @@ handle_workspace_switch (MetaDisplay *display,
/* FIXME should we use binding->mask ? */
grab_mask = event->xkey.state & ~(display->ignored_modifier_mask);
- if (meta_display_begin_grab_op (display,
- screen,
- NULL,
- META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
- FALSE,
- FALSE,
- 0,
- grab_mask,
- event->xkey.time,
- 0, 0))
- {
- MetaWorkspace *next;
- gboolean grabbed_before_release;
-
- next = meta_workspace_get_neighbor (screen->active_workspace, motion);
- g_assert (next);
+ if (!meta_display_begin_grab_op (display,
+ screen,
+ NULL,
+ META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
+ FALSE,
+ FALSE,
+ 0,
+ grab_mask,
+ event->xkey.time,
+ 0, 0))
+ return;
- grabbed_before_release = primary_modifier_still_pressed (display, grab_mask);
-
- meta_topic (META_DEBUG_KEYBINDINGS,
- "Activating target workspace\n");
+ next = meta_workspace_get_neighbor (screen->active_workspace, motion);
+ g_assert (next);
- if (!grabbed_before_release)
- {
- /* end the grab right away, modifier possibly released
- * before we could establish the grab and receive the
- * release event. Must end grab before we can switch
- * spaces.
- */
- meta_display_end_grab_op (display, event->xkey.time);
- }
-
- meta_workspace_activate (next, event->xkey.time);
+ grabbed_before_release = primary_modifier_still_pressed (display, grab_mask);
- if (grabbed_before_release && !meta_prefs_get_no_tab_popup ())
- {
- meta_ui_tab_popup_select (screen->tab_popup, (MetaTabEntryKey) next);
-
- /* only after selecting proper space */
- meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
- }
+ meta_topic (META_DEBUG_KEYBINDINGS, "Activating target workspace\n");
+
+ if (!grabbed_before_release)
+ {
+ /* end the grab right away, modifier possibly released
+ * before we could establish the grab and receive the
+ * release event. Must end grab before we can switch
+ * spaces.
+ */
+ meta_display_end_grab_op (display, event->xkey.time);
+ }
+
+ meta_workspace_activate (next, event->xkey.time);
+
+ if (grabbed_before_release && !meta_prefs_get_no_tab_popup ())
+ {
+ meta_ui_tab_popup_select (screen->tab_popup, (MetaTabEntryKey) next);
+
+ /* only after selecting proper space */
+ meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]