From 4e478159b665c60dd33566661085af3c09a65419 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 17 Feb 2007 21:34:00 +0000 Subject: [PATCH] renamed from MetaActionDoubleClickTitleBar; added _LOWER and _MENU. 2007-02-17 Linus Torvalds * src/common.h (MetaActionTitleBar): renamed from MetaActionDoubleClickTitleBar; added _LOWER and _MENU. * src/frames.c (meta_frame_titlebar_event): renamed enums as above; added code to handle _LOWER and _MENU, which is moved in from meta_frame_{middle|right}_click_event. * src/frames.c (meta_frame_middle_click_event, meta_frame_right_click_event): rewrote in terms of meta_frame_titlebar_event. * src/prefs.c: removed "DoubleClick" from names as above. * src/prefs.c (action_titlebar_from_string): added cases for "lower" and "menu". Fixes #408902. svn path=/trunk/; revision=3062 --- ChangeLog | 15 +++++++++++++++ src/common.h | 14 ++++++++------ src/frames.c | 38 ++++++++++++++++++++++---------------- src/prefs.c | 29 ++++++++++++++++------------- src/prefs.h | 2 +- 5 files changed, 62 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98938cdda..ce6f849c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-02-17 Linus Torvalds + + * src/common.h (MetaActionTitleBar): renamed from + MetaActionDoubleClickTitleBar; added _LOWER and _MENU. + * src/frames.c (meta_frame_titlebar_event): renamed + enums as above; added code to handle _LOWER and _MENU, + which is moved in from meta_frame_{middle|right}_click_event. + * src/frames.c (meta_frame_middle_click_event, + meta_frame_right_click_event): rewrote in terms of + meta_frame_titlebar_event. + * src/prefs.c: removed "DoubleClick" from names as above. + * src/prefs.c (action_titlebar_from_string): added cases + for "lower" and "menu". + Fixes #408902. + 2007-02-17 Linus Torvalds * src/frames.c (meta_frames_button_press_event): Split out diff --git a/src/common.h b/src/common.h index b58179936..087798e00 100644 --- a/src/common.h +++ b/src/common.h @@ -171,12 +171,14 @@ typedef enum typedef enum { - META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE, - META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE, - META_ACTION_DOUBLE_CLICK_TITLEBAR_MINIMIZE, - META_ACTION_DOUBLE_CLICK_TITLEBAR_NONE, - META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST -} MetaActionDoubleClickTitlebar; + META_ACTION_TITLEBAR_TOGGLE_SHADE, + META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE, + META_ACTION_TITLEBAR_MINIMIZE, + META_ACTION_TITLEBAR_NONE, + META_ACTION_TITLEBAR_LOWER, + META_ACTION_TITLEBAR_MENU, + META_ACTION_TITLEBAR_LAST +} MetaActionTitlebar; typedef enum { diff --git a/src/frames.c b/src/frames.c index d6e953b8f..35d94caf3 100644 --- a/src/frames.c +++ b/src/frames.c @@ -1196,7 +1196,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, switch (action) { - case META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE: + case META_ACTION_TITLEBAR_TOGGLE_SHADE: { flags = meta_core_get_frame_flags (gdk_display, frame->xwindow); @@ -1214,7 +1214,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, } break; - case META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE: + case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE: { flags = meta_core_get_frame_flags (gdk_display, frame->xwindow); @@ -1225,7 +1225,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, } break; - case META_ACTION_DOUBLE_CLICK_TITLEBAR_MINIMIZE: + case META_ACTION_TITLEBAR_MINIMIZE: { flags = meta_core_get_frame_flags (gdk_display, frame->xwindow); @@ -1236,11 +1236,26 @@ meta_frame_titlebar_event (MetaUIFrame *frame, } break; - case META_ACTION_DOUBLE_CLICK_TITLEBAR_NONE: + case META_ACTION_TITLEBAR_NONE: /* Yaay, a sane user that doesn't use that other weird crap! */ break; + + case META_ACTION_TITLEBAR_LOWER: + meta_core_user_lower_and_unfocus (gdk_display, + frame->xwindow, + event->time); + break; - case META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST: + case META_ACTION_TITLEBAR_MENU: + meta_core_show_window_menu (gdk_display, + frame->xwindow, + event->x_root, + event->y_root, + event->button, + event->time); + break; + + case META_ACTION_TITLEBAR_LAST: break; } @@ -1260,23 +1275,14 @@ static gboolean meta_frame_middle_click_event (MetaUIFrame *frame, GdkEventButton *event) { - meta_core_user_lower_and_unfocus (gdk_display, - frame->xwindow, - event->time); - return TRUE; + return meta_frame_titlebar_event (frame, event, META_ACTION_TITLEBAR_LOWER); } static gboolean meta_frame_right_click_event(MetaUIFrame *frame, GdkEventButton *event) { - meta_core_show_window_menu (gdk_display, - frame->xwindow, - event->x_root, - event->y_root, - event->button, - event->time); - return TRUE; + return meta_frame_titlebar_event (frame, event, META_ACTION_TITLEBAR_MENU); } static gboolean diff --git a/src/prefs.c b/src/prefs.c index 3313bd384..008b111e7 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -91,8 +91,7 @@ static MetaFocusNewWindows focus_new_windows = META_FOCUS_NEW_WINDOWS_SMART; static gboolean raise_on_click = TRUE; static char* current_theme = NULL; static int num_workspaces = 4; -static MetaActionDoubleClickTitlebar action_double_click_titlebar = - META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE; +static MetaActionTitlebar action_double_click_titlebar = META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE; static gboolean application_based = FALSE; static gboolean disable_workarounds = FALSE; static gboolean auto_raise = FALSE; @@ -1630,31 +1629,35 @@ meta_prefs_get_disable_workarounds (void) } #ifdef HAVE_GCONF -static MetaActionDoubleClickTitlebar -action_double_click_titlebar_from_string (const char *str) +static MetaActionTitlebar +action_titlebar_from_string (const char *str) { if (strcmp (str, "toggle_shade") == 0) - return META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE; + return META_ACTION_TITLEBAR_TOGGLE_SHADE; else if (strcmp (str, "toggle_maximize") == 0) - return META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE; + return META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE; else if (strcmp (str, "minimize") == 0) - return META_ACTION_DOUBLE_CLICK_TITLEBAR_MINIMIZE; + return META_ACTION_TITLEBAR_MINIMIZE; else if (strcmp (str, "none") == 0) - return META_ACTION_DOUBLE_CLICK_TITLEBAR_NONE; + return META_ACTION_TITLEBAR_NONE; + else if (strcmp (str, "lower") == 0) + return META_ACTION_TITLEBAR_LOWER; + else if (strcmp (str, "menu") == 0) + return META_ACTION_TITLEBAR_MENU; else - return META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST; + return META_ACTION_TITLEBAR_LAST; } static gboolean update_action_double_click_titlebar (const char *value) { - MetaActionDoubleClickTitlebar old_action = action_double_click_titlebar; + MetaActionTitlebar old_action = action_double_click_titlebar; if (value != NULL) { - action_double_click_titlebar = action_double_click_titlebar_from_string (value); + action_double_click_titlebar = action_titlebar_from_string (value); - if (action_double_click_titlebar == META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST) + if (action_double_click_titlebar == META_ACTION_TITLEBAR_LAST) { action_double_click_titlebar = old_action; meta_warning (_("GConf key '%s' is set to an invalid value\n"), @@ -2873,7 +2876,7 @@ meta_prefs_get_window_bindings (const MetaKeyPref **bindings, *n_bindings = (int) G_N_ELEMENTS (window_bindings) - 1; } -MetaActionDoubleClickTitlebar +MetaActionTitlebar meta_prefs_get_action_double_click_titlebar (void) { return action_double_click_titlebar; diff --git a/src/prefs.h b/src/prefs.h index df1b947cc..f1f36b227 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -93,7 +93,7 @@ const char* meta_prefs_get_terminal_command (void); const char* meta_prefs_get_gconf_key_for_terminal_command (void); void meta_prefs_get_button_layout (MetaButtonLayout *button_layout); -MetaActionDoubleClickTitlebar meta_prefs_get_action_double_click_titlebar (void); +MetaActionTitlebar meta_prefs_get_action_double_click_titlebar (void); void meta_prefs_set_num_workspaces (int n_workspaces);