renamed from MetaActionDoubleClickTitleBar; added _LOWER and _MENU.

2007-02-17  Linus Torvalds  <torvalds@woody.linux-foundation.org>

        * 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
This commit is contained in:
Linus Torvalds 2007-02-17 21:34:00 +00:00 committed by Thomas James Alexander Thurman
parent 85e43a402f
commit 4e478159b6
5 changed files with 62 additions and 36 deletions

View File

@ -1,3 +1,18 @@
2007-02-17 Linus Torvalds <torvalds@woody.linux-foundation.org>
* 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 <torvalds@woody.linux-foundation.org> 2007-02-17 Linus Torvalds <torvalds@woody.linux-foundation.org>
* src/frames.c (meta_frames_button_press_event): Split out * src/frames.c (meta_frames_button_press_event): Split out

View File

@ -171,12 +171,14 @@ typedef enum
typedef enum typedef enum
{ {
META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE, META_ACTION_TITLEBAR_TOGGLE_SHADE,
META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE, META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE,
META_ACTION_DOUBLE_CLICK_TITLEBAR_MINIMIZE, META_ACTION_TITLEBAR_MINIMIZE,
META_ACTION_DOUBLE_CLICK_TITLEBAR_NONE, META_ACTION_TITLEBAR_NONE,
META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST META_ACTION_TITLEBAR_LOWER,
} MetaActionDoubleClickTitlebar; META_ACTION_TITLEBAR_MENU,
META_ACTION_TITLEBAR_LAST
} MetaActionTitlebar;
typedef enum typedef enum
{ {

View File

@ -1196,7 +1196,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
switch (action) 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); flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
@ -1214,7 +1214,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
} }
break; 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); flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
@ -1225,7 +1225,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
} }
break; break;
case META_ACTION_DOUBLE_CLICK_TITLEBAR_MINIMIZE: case META_ACTION_TITLEBAR_MINIMIZE:
{ {
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow); flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
@ -1236,11 +1236,26 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
} }
break; 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! */ /* Yaay, a sane user that doesn't use that other weird crap! */
break; 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; break;
} }
@ -1260,23 +1275,14 @@ static gboolean
meta_frame_middle_click_event (MetaUIFrame *frame, meta_frame_middle_click_event (MetaUIFrame *frame,
GdkEventButton *event) GdkEventButton *event)
{ {
meta_core_user_lower_and_unfocus (gdk_display, return meta_frame_titlebar_event (frame, event, META_ACTION_TITLEBAR_LOWER);
frame->xwindow,
event->time);
return TRUE;
} }
static gboolean static gboolean
meta_frame_right_click_event(MetaUIFrame *frame, meta_frame_right_click_event(MetaUIFrame *frame,
GdkEventButton *event) GdkEventButton *event)
{ {
meta_core_show_window_menu (gdk_display, return meta_frame_titlebar_event (frame, event, META_ACTION_TITLEBAR_MENU);
frame->xwindow,
event->x_root,
event->y_root,
event->button,
event->time);
return TRUE;
} }
static gboolean static gboolean

View File

@ -91,8 +91,7 @@ static MetaFocusNewWindows focus_new_windows = META_FOCUS_NEW_WINDOWS_SMART;
static gboolean raise_on_click = TRUE; static gboolean raise_on_click = TRUE;
static char* current_theme = NULL; static char* current_theme = NULL;
static int num_workspaces = 4; static int num_workspaces = 4;
static MetaActionDoubleClickTitlebar action_double_click_titlebar = static MetaActionTitlebar action_double_click_titlebar = META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE;
META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE;
static gboolean application_based = FALSE; static gboolean application_based = FALSE;
static gboolean disable_workarounds = FALSE; static gboolean disable_workarounds = FALSE;
static gboolean auto_raise = FALSE; static gboolean auto_raise = FALSE;
@ -1630,31 +1629,35 @@ meta_prefs_get_disable_workarounds (void)
} }
#ifdef HAVE_GCONF #ifdef HAVE_GCONF
static MetaActionDoubleClickTitlebar static MetaActionTitlebar
action_double_click_titlebar_from_string (const char *str) action_titlebar_from_string (const char *str)
{ {
if (strcmp (str, "toggle_shade") == 0) 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) 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) else if (strcmp (str, "minimize") == 0)
return META_ACTION_DOUBLE_CLICK_TITLEBAR_MINIMIZE; return META_ACTION_TITLEBAR_MINIMIZE;
else if (strcmp (str, "none") == 0) 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 else
return META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST; return META_ACTION_TITLEBAR_LAST;
} }
static gboolean static gboolean
update_action_double_click_titlebar (const char *value) 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) 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; action_double_click_titlebar = old_action;
meta_warning (_("GConf key '%s' is set to an invalid value\n"), 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; *n_bindings = (int) G_N_ELEMENTS (window_bindings) - 1;
} }
MetaActionDoubleClickTitlebar MetaActionTitlebar
meta_prefs_get_action_double_click_titlebar (void) meta_prefs_get_action_double_click_titlebar (void)
{ {
return action_double_click_titlebar; return action_double_click_titlebar;

View File

@ -93,7 +93,7 @@ const char* meta_prefs_get_terminal_command (void);
const char* meta_prefs_get_gconf_key_for_terminal_command (void); const char* meta_prefs_get_gconf_key_for_terminal_command (void);
void meta_prefs_get_button_layout (MetaButtonLayout *button_layout); 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); void meta_prefs_set_num_workspaces (int n_workspaces);