[PATCH 2/7] metacity: Add 'lower' and 'menu' to title bar action events



.. also, rename the enumeration from MetaActionDoubleClickTitlebar to
just MetaActionTitlebar, because now it handles any of the special
titlebar events, not just doubleclicks.

We also make middle- and right-click use these event enumerations.

This again changes no actual semantics, and the middle and right buttons
are still hard-coded to 'lower' and 'menu' respectively.  Although we
_do_ allow the double-click preference (which was configurable before
too) to be set to the new choices, of course.

Signed-off-by: Linus Torvalds <torvalds linux-foundation org>
---
 src/common.h |   14 ++++++++------
 src/frames.c |   38 ++++++++++++++++++++++----------------
 src/prefs.c  |   29 ++++++++++++++++-------------
 src/prefs.h  |    2 +-
 4 files changed, 47 insertions(+), 36 deletions(-)

diff --git a/src/common.h b/src/common.h
index b581799..087798e 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 d6e953b..35d94ca 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_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_DOUBLE_CLICK_TITLEBAR_LAST:
+    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 3313bd3..008b111 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 df1b947..f1f36b2 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);
 
-- 
1.5.0




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]