[PATCH 7/7] control center: gnome-window-properties: learn about mouse actions



It used to be that only the double-click action was configurable.

No more. Now you can configure double-, middle- and right-clicking
also using the graphical interfaces.

Signed-off-by: Linus Torvalds <torvalds linux-foundation org>
---
 capplets/windows/gnome-window-properties.c     |  103 +++++++++++++++---
 capplets/windows/gnome-window-properties.glade |  133 ++++++++++++++++++++++++
 libwindow-settings/gnome-window-manager.c      |   10 +-
 libwindow-settings/gnome-window-manager.h      |   20 +++--
 libwindow-settings/metacity-window-manager.c   |  103 ++++++++++++++-----
 5 files changed, 316 insertions(+), 53 deletions(-)

diff --git a/capplets/windows/gnome-window-properties.c b/capplets/windows/gnome-window-properties.c
index 0ae307d..c14494a 100644
--- a/capplets/windows/gnome-window-properties.c
+++ b/capplets/windows/gnome-window-properties.c
@@ -49,11 +49,13 @@ static GtkWidget *autoraise_checkbutton;
 static GtkWidget *autoraise_delay_slider;
 static GtkWidget *autoraise_delay_hbox;
 static GtkWidget *double_click_titlebar_optionmenu;
+static GtkWidget *middle_click_titlebar_optionmenu;
+static GtkWidget *right_click_titlebar_optionmenu;
 static GtkWidget *alt_click_hbox;
 
 static GnomeWMSettings *settings;
-static const GnomeWMDoubleClickAction *double_click_actions = NULL;
-static int n_double_click_actions = 0;
+static const GnomeWMDoubleClickAction *titlebar_actions = NULL;
+static int n_titlebar_actions = 0;
 
 static MouseClickModifier *mouse_modifiers = NULL;
 static int n_mouse_modifiers = 0;
@@ -117,6 +119,34 @@ double_click_titlebar_changed_callback (GtkWidget *optionmenu,
                 gnome_window_manager_change_settings (current_wm, &new_settings);
 }
 
+static void
+middle_click_titlebar_changed_callback (GtkWidget *optionmenu,
+                                        void      *data)
+{
+        GnomeWMSettings new_settings;
+        
+        new_settings.flags = GNOME_WM_SETTING_MIDDLE_CLICK_ACTION;
+        new_settings.middle_click_action =
+                gtk_option_menu_get_history (GTK_OPTION_MENU (optionmenu));
+
+        if (current_wm != NULL && new_settings.middle_click_action != settings->middle_click_action)
+                gnome_window_manager_change_settings (current_wm, &new_settings);
+}
+
+static void
+right_click_titlebar_changed_callback (GtkWidget *optionmenu,
+                                        void      *data)
+{
+        GnomeWMSettings new_settings;
+        
+        new_settings.flags = GNOME_WM_SETTING_RIGHT_CLICK_ACTION;
+        new_settings.right_click_action =
+                gtk_option_menu_get_history (GTK_OPTION_MENU (optionmenu));
+
+        if (current_wm != NULL && new_settings.right_click_action != settings->right_click_action)
+                gnome_window_manager_change_settings (current_wm, &new_settings);
+}
+
 #if 0
 /* This was for option menu */
 static void
@@ -172,7 +202,13 @@ update_sensitivity (void)
                                   settings->focus_follows_mouse && settings->autoraise);
 
         gtk_widget_set_sensitive (double_click_titlebar_optionmenu,
-                                  n_double_click_actions > 1);
+                                  n_titlebar_actions > 1);
+
+        gtk_widget_set_sensitive (middle_click_titlebar_optionmenu,
+                                  n_titlebar_actions > 1);
+
+        gtk_widget_set_sensitive (right_click_titlebar_optionmenu,
+                                  n_titlebar_actions > 1);
 
         /* disable the whole dialog while no WM is running, or
          * a WM we don't understand is running. We should probably do
@@ -201,6 +237,12 @@ init_settings_struct (GnomeWMSettings *settings)
 
         if ((settings->flags & GNOME_WM_SETTING_DOUBLE_CLICK_ACTION) == 0)
                 settings->double_click_action = 0;
+
+        if ((settings->flags & GNOME_WM_SETTING_MIDDLE_CLICK_ACTION) == 0)
+                settings->middle_click_action = 0;
+
+        if ((settings->flags & GNOME_WM_SETTING_RIGHT_CLICK_ACTION) == 0)
+                settings->right_click_action = 0;
 }
 
 static void
@@ -230,17 +272,17 @@ set_alt_click_value (const GnomeWMSettings *settings)
 }
 
 static void
-rebuild_double_click_actions_menu (void)
+rebuild_titlebar_actions_menu (GtkWidget *optionmenu)
 {
         int i;
         GtkWidget *menu;
         
         menu = gtk_menu_new ();
         i = 0;
-        while (i < n_double_click_actions) {
+        while (i < n_titlebar_actions) {
                 GtkWidget *mi;
                 
-                mi = gtk_menu_item_new_with_label (double_click_actions[i].human_readable_name);
+                mi = gtk_menu_item_new_with_label (titlebar_actions[i].human_readable_name);
                 gtk_menu_shell_append (GTK_MENU_SHELL (menu),
                                        mi);
                 
@@ -249,8 +291,7 @@ rebuild_double_click_actions_menu (void)
                 ++i;
         }
         
-        gtk_option_menu_set_menu (GTK_OPTION_MENU (double_click_titlebar_optionmenu),
-                                  menu);
+        gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
 }
 
 static void
@@ -265,7 +306,9 @@ reload_settings (void)
                         GNOME_WM_SETTING_AUTORAISE |
                         GNOME_WM_SETTING_AUTORAISE_DELAY |
                         GNOME_WM_SETTING_MOUSE_MOVE_MODIFIER |
-                        GNOME_WM_SETTING_DOUBLE_CLICK_ACTION;
+                        GNOME_WM_SETTING_DOUBLE_CLICK_ACTION |
+                        GNOME_WM_SETTING_MIDDLE_CLICK_ACTION |
+                        GNOME_WM_SETTING_RIGHT_CLICK_ACTION;
 
                 /* this will clear any flags that don't get filled in */
                 gnome_window_manager_get_settings (current_wm, &new_settings);
@@ -287,12 +330,24 @@ reload_settings (void)
                 gtk_range_set_value (GTK_RANGE (autoraise_delay_slider),
                                      new_settings.autoraise_delay / 1000.0);
         
-        if (n_double_click_actions > 0 &&
+        if (n_titlebar_actions > 0 &&
             new_settings.double_click_action != settings->double_click_action) {
                 gtk_option_menu_set_history (GTK_OPTION_MENU (double_click_titlebar_optionmenu),
                                              new_settings.double_click_action);
         }
         
+        if (n_titlebar_actions > 0 &&
+            new_settings.middle_click_action != settings->middle_click_action) {
+                gtk_option_menu_set_history (GTK_OPTION_MENU (middle_click_titlebar_optionmenu),
+                                             new_settings.middle_click_action);
+        }
+        
+        if (n_titlebar_actions > 0 &&
+            new_settings.right_click_action != settings->right_click_action) {
+                gtk_option_menu_set_history (GTK_OPTION_MENU (right_click_titlebar_optionmenu),
+                                             new_settings.right_click_action);
+        }
+        
         if (settings->mouse_move_modifier == NULL ||
             new_settings.mouse_move_modifier == NULL ||
             strcmp (settings->mouse_move_modifier,
@@ -324,8 +379,8 @@ update_wm (GdkScreen *screen,
                                                       G_CALLBACK (wm_settings_changed_callback),
                                                       NULL);
                 current_wm = NULL;
-                double_click_actions = NULL;
-                n_double_click_actions = 0;
+                titlebar_actions = NULL;
+                n_titlebar_actions = 0;
         }
 
         current_wm = gnome_wm_manager_get_current (screen);
@@ -334,13 +389,15 @@ update_wm (GdkScreen *screen,
                 g_signal_connect (G_OBJECT (current_wm), "settings_changed",
                                   G_CALLBACK (wm_settings_changed_callback), NULL);
 
-                gnome_window_manager_get_double_click_actions (current_wm,
-                                                               &double_click_actions,
-                                                               &n_double_click_actions);
+                gnome_window_manager_get_titlebar_actions (current_wm,
+                                                           &titlebar_actions,
+                                                           &n_titlebar_actions);
                 
         }
 
-        rebuild_double_click_actions_menu ();
+        rebuild_titlebar_actions_menu (double_click_titlebar_optionmenu);
+        rebuild_titlebar_actions_menu (middle_click_titlebar_optionmenu);
+        rebuild_titlebar_actions_menu (right_click_titlebar_optionmenu);
         if (load_settings)
                 reload_settings ();
 }
@@ -453,6 +510,8 @@ main (int argc, char **argv)
         autoraise_delay_slider = WID ("autoraise-delay-slider");
         autoraise_delay_hbox = WID ("autoraise-delay-hbox");
         double_click_titlebar_optionmenu = WID ("double-click-titlebar-optionmenu");
+        middle_click_titlebar_optionmenu = WID ("middle-click-titlebar-optionmenu");
+        right_click_titlebar_optionmenu = WID ("right-click-titlebar-optionmenu");
         alt_click_hbox = WID ("alt-click-box");
 
         gtk_range_set_range (GTK_RANGE (autoraise_delay_slider),
@@ -464,6 +523,8 @@ main (int argc, char **argv)
 #if 0
         size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
         gtk_size_group_add_widget (size_group, double_click_titlebar_optionmenu);
+        gtk_size_group_add_widget (size_group, middle_click_titlebar_optionmenu);
+        gtk_size_group_add_widget (size_group, right_click_titlebar_optionmenu);
         gtk_size_group_add_widget (size_group, alt_click_optionmenu);
         g_object_unref (G_OBJECT (size_group));
 #endif
@@ -480,6 +541,10 @@ main (int argc, char **argv)
                              new_settings.autoraise_delay / 1000.0);
         gtk_option_menu_set_history (GTK_OPTION_MENU (double_click_titlebar_optionmenu),
                                      new_settings.double_click_action);
+        gtk_option_menu_set_history (GTK_OPTION_MENU (middle_click_titlebar_optionmenu),
+                                     new_settings.middle_click_action);
+        gtk_option_menu_set_history (GTK_OPTION_MENU (right_click_titlebar_optionmenu),
+                                     new_settings.right_click_action);
 
         reload_settings (); /* must come before below signal connections */
         
@@ -502,6 +567,12 @@ main (int argc, char **argv)
         g_signal_connect (G_OBJECT (double_click_titlebar_optionmenu), "changed",
                           G_CALLBACK (double_click_titlebar_changed_callback), NULL);
         
+        g_signal_connect (G_OBJECT (middle_click_titlebar_optionmenu), "changed",
+                          G_CALLBACK (middle_click_titlebar_changed_callback), NULL);
+        
+        g_signal_connect (G_OBJECT (right_click_titlebar_optionmenu), "changed",
+                          G_CALLBACK (right_click_titlebar_changed_callback), NULL);
+        
         g_signal_connect (G_OBJECT (screen), "window_manager_changed",
                           G_CALLBACK (wm_changed_callback), NULL);
 
diff --git a/capplets/windows/gnome-window-properties.glade b/capplets/windows/gnome-window-properties.glade
index 75012b1..18c21d8 100644
--- a/capplets/windows/gnome-window-properties.glade
+++ b/capplets/windows/gnome-window-properties.glade
@@ -375,6 +375,139 @@
 		  <property name="fill">True</property>
 		</packing>
 	      </child>
+
+	      <child>
+		<widget class="GtkHBox" id="hbox12">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">0</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="middle-click-titlebar-hbox">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">6</property>
+
+		      <child>
+			<widget class="GtkLabel" id="middle-click-label">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Middle-click titlebar to perform this action:</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">middle-click-titlebar-optionmenu</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkOptionMenu" id="middle-click-titlebar-optionmenu">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="history">-1</property>
+
+			  <child>
+			    <widget class="GtkMenu" id="menu1">
+			    </widget>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">18</property>
+		      <property name="expand">True</property>
+		      <property name="fill">True</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkHBox" id="hbox13">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">0</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="right-click-titlebar-hbox">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">6</property>
+
+		      <child>
+			<widget class="GtkLabel" id="right-click-label">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">R_ight-click titlebar to perform this action:</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">right-click-titlebar-optionmenu</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkOptionMenu" id="right-click-titlebar-optionmenu">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="history">-1</property>
+
+			  <child>
+			    <widget class="GtkMenu" id="menu1">
+			    </widget>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">18</property>
+		      <property name="expand">True</property>
+		      <property name="fill">True</property>
+		    </packing>
+		  </child>
+
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>
diff --git a/libwindow-settings/gnome-window-manager.c b/libwindow-settings/gnome-window-manager.c
index cc7a6f3..318e1f2 100644
--- a/libwindow-settings/gnome-window-manager.c
+++ b/libwindow-settings/gnome-window-manager.c
@@ -111,17 +111,17 @@ gnome_window_manager_get_user_theme_folder (GnomeWindowManager *wm)
 }
 
 void
-gnome_window_manager_get_double_click_actions (GnomeWindowManager              *wm,
-                                               const GnomeWMDoubleClickAction **actions,
-                                               int                             *n_actions)
+gnome_window_manager_get_titlebar_actions (GnomeWindowManager              *wm,
+                                           const GnomeWMDoubleClickAction **actions,
+                                           int                             *n_actions)
 {
         GnomeWindowManagerClass *klass = GNOME_WINDOW_MANAGER_GET_CLASS (wm);
 
         *actions = NULL;
         *n_actions = 0;
         
-        if (klass->get_double_click_actions)
-                klass->get_double_click_actions (wm, actions, n_actions);
+        if (klass->get_titlebar_actions)
+                klass->get_titlebar_actions (wm, actions, n_actions);
 }
 
 void
diff --git a/libwindow-settings/gnome-window-manager.h b/libwindow-settings/gnome-window-manager.h
index ea6d0d2..4fd529c 100644
--- a/libwindow-settings/gnome-window-manager.h
+++ b/libwindow-settings/gnome-window-manager.h
@@ -47,6 +47,8 @@ typedef enum
         GNOME_WM_SETTING_MOUSE_MOVE_MODIFIER = 1 << 4,
         GNOME_WM_SETTING_THEME               = 1 << 5,
         GNOME_WM_SETTING_DOUBLE_CLICK_ACTION = 1 << 6,
+        GNOME_WM_SETTING_MIDDLE_CLICK_ACTION = 1 << 7,
+        GNOME_WM_SETTING_RIGHT_CLICK_ACTION  = 1 << 8,
         GNOME_WM_SETTING_MASK                =
         GNOME_WM_SETTING_FONT                |
         GNOME_WM_SETTING_MOUSE_FOCUS         |
@@ -54,7 +56,9 @@ typedef enum
         GNOME_WM_SETTING_AUTORAISE_DELAY     |
         GNOME_WM_SETTING_MOUSE_MOVE_MODIFIER |
         GNOME_WM_SETTING_THEME               |
-        GNOME_WM_SETTING_DOUBLE_CLICK_ACTION
+        GNOME_WM_SETTING_DOUBLE_CLICK_ACTION |
+        GNOME_WM_SETTING_MIDDLE_CLICK_ACTION |
+        GNOME_WM_SETTING_RIGHT_CLICK_ACTION
 } GnomeWMSettingsFlags;
 
 typedef struct
@@ -74,6 +78,8 @@ typedef struct
         const char *mouse_move_modifier;
         const char *theme;
         int double_click_action;
+        int middle_click_action;
+        int right_click_action;
         
         guint focus_follows_mouse : 1;
         guint autoraise : 1;
@@ -115,9 +121,9 @@ struct _GnomeWindowManagerClass
 
         int          (* get_settings_mask)      (GnomeWindowManager *wm);
 
-        void         (* get_double_click_actions) (GnomeWindowManager              *wm,
-                                                   const GnomeWMDoubleClickAction **actions,
-                                                   int                             *n_actions);
+        void         (* get_titlebar_actions)   (GnomeWindowManager              *wm,
+                                                 const GnomeWMDoubleClickAction **actions,
+                                                 int                             *n_actions);
         
         void         (* padding_func_1)         (GnomeWindowManager *wm);
         void         (* padding_func_2)         (GnomeWindowManager *wm);
@@ -151,9 +157,9 @@ void              gnome_window_manager_get_settings     (GnomeWindowManager *wm,
 
 void              gnome_window_manager_settings_changed (GnomeWindowManager *wm);
 
-void gnome_window_manager_get_double_click_actions (GnomeWindowManager              *wm,
-                                                    const GnomeWMDoubleClickAction **actions,
-                                                    int                             *n_actions);
+void gnome_window_manager_get_titlebar_actions (GnomeWindowManager              *wm,
+                                                const GnomeWMDoubleClickAction **actions,
+                                                int                             *n_actions);
 
 /* Helper functions for GnomeWMSettings */
 GnomeWMSettings *gnome_wm_settings_copy (GnomeWMSettings *settings);
diff --git a/libwindow-settings/metacity-window-manager.c b/libwindow-settings/metacity-window-manager.c
index e0ccf48..34c1617 100644
--- a/libwindow-settings/metacity-window-manager.c
+++ b/libwindow-settings/metacity-window-manager.c
@@ -40,6 +40,8 @@
 #define METACITY_AUTORAISE_DELAY_KEY "/apps/metacity/general/auto_raise_delay"
 #define METACITY_MOUSE_MODIFIER_KEY "/apps/metacity/general/mouse_button_modifier"
 #define METACITY_DOUBLE_CLICK_TITLEBAR_KEY "/apps/metacity/general/action_double_click_titlebar"
+#define METACITY_MIDDLE_CLICK_TITLEBAR_KEY "/apps/metacity/general/action_middle_click_titlebar"
+#define METACITY_RIGHT_CLICK_TITLEBAR_KEY "/apps/metacity/general/action_right_click_titlebar"
 
 enum titlebar_actions
 {
@@ -190,6 +192,24 @@ metacity_titlebar_action(const char *string)
 }
 
 static void
+change_titlebar_action (MetacityWindowManager *meta_wm,
+                        const GnomeWMSettings *settings,
+                        unsigned int flag_mask,
+                        enum titlebar_actions action,
+                        const char *key)
+{
+        if (settings->flags & flag_mask) {
+                const char *action_string;
+
+                action_string = metacity_titlebar_action_string(action);
+                if (action_string != NULL) {
+                        gconf_client_set_string (meta_wm->p->gconf,
+                                                 key, action_string, NULL);
+                }
+        }
+}
+
+static void
 metacity_change_settings (GnomeWindowManager    *wm,
                           const GnomeWMSettings *settings)
 {
@@ -235,19 +255,45 @@ metacity_change_settings (GnomeWindowManager    *wm,
                                          settings->theme, NULL);
         }
 
-        if (settings->flags & GNOME_WM_SETTING_DOUBLE_CLICK_ACTION) {
-                const char *action;
+        change_titlebar_action (meta_wm, settings,
+                                GNOME_WM_SETTING_DOUBLE_CLICK_ACTION,
+                                settings->double_click_action,
+                                METACITY_DOUBLE_CLICK_TITLEBAR_KEY);
 
-                action = metacity_titlebar_action_string(settings->double_click_action);
-                if (action != NULL) {
-                        gconf_client_set_string (meta_wm->p->gconf,
-                                                 METACITY_DOUBLE_CLICK_TITLEBAR_KEY,
-                                                 action, NULL);
-                }
-        }
+        change_titlebar_action (meta_wm, settings,
+                                GNOME_WM_SETTING_MIDDLE_CLICK_ACTION,
+                                settings->middle_click_action,
+                                METACITY_MIDDLE_CLICK_TITLEBAR_KEY);
+
+        change_titlebar_action (meta_wm, settings,
+                                GNOME_WM_SETTING_RIGHT_CLICK_ACTION,
+                                settings->right_click_action,
+                                METACITY_RIGHT_CLICK_TITLEBAR_KEY);
 }
 
 static void
+metacity_get_titlebar_action (MetacityWindowManager *meta_wm,
+                              enum titlebar_actions *actionp,
+                              const char *key,
+                              enum titlebar_actions default_action)
+{
+        char *str;
+        enum titlebar_actions action;
+
+        str = gconf_client_get_string (meta_wm->p->gconf,
+                                       key,
+                                       NULL);
+        action = metacity_titlebar_action(str);
+        g_free (str);
+
+        if (action == TITLEBAR_DEFAULT)
+                action = default_action;
+
+        *actionp = action;
+}
+
+
+static void
 metacity_get_settings (GnomeWindowManager *wm,
                        GnomeWMSettings    *settings)
 {
@@ -369,20 +415,27 @@ metacity_get_settings (GnomeWindowManager *wm,
         }
 
         if (to_get & GNOME_WM_SETTING_DOUBLE_CLICK_ACTION) {
-                char *str;
-                enum titlebar_actions action;
-
-                str = gconf_client_get_string (meta_wm->p->gconf,
-                                               METACITY_DOUBLE_CLICK_TITLEBAR_KEY,
-                                               NULL);
-                action = metacity_titlebar_action(str);
-                g_free (str);
+                metacity_get_titlebar_action (meta_wm,
+                                              &settings->double_click_action,
+                                              METACITY_DOUBLE_CLICK_TITLEBAR_KEY,
+                                              TITLEBAR_SHADE);
+                settings->flags |= GNOME_WM_SETTING_DOUBLE_CLICK_ACTION;
+        }
 
-                if (action == TITLEBAR_DEFAULT)
-                        action = TITLEBAR_SHADE;
+        if (to_get & GNOME_WM_SETTING_MIDDLE_CLICK_ACTION) {
+                metacity_get_titlebar_action (meta_wm,
+                                              &settings->middle_click_action,
+                                              METACITY_MIDDLE_CLICK_TITLEBAR_KEY,
+                                              TITLEBAR_LOWER);
+                settings->flags |= GNOME_WM_SETTING_MIDDLE_CLICK_ACTION;
+        }
 
-                settings->double_click_action = action;
-                settings->flags |= GNOME_WM_SETTING_DOUBLE_CLICK_ACTION;             
+        if (to_get & GNOME_WM_SETTING_RIGHT_CLICK_ACTION) {
+                metacity_get_titlebar_action (meta_wm,
+                                              &settings->right_click_action,
+                                              METACITY_RIGHT_CLICK_TITLEBAR_KEY,
+                                              TITLEBAR_MENU);
+                settings->flags |= GNOME_WM_SETTING_RIGHT_CLICK_ACTION;
         }
 }
 
@@ -393,9 +446,9 @@ metacity_get_settings_mask (GnomeWindowManager *wm)
 }
 
 static void
-metacity_get_double_click_actions (GnomeWindowManager              *wm,
-                                   const GnomeWMDoubleClickAction **actions_p,
-                                   int                             *n_actions_p)
+metacity_get_titlebar_actions (GnomeWindowManager              *wm,
+                               const GnomeWMDoubleClickAction **actions_p,
+                               int                             *n_actions_p)
 {
         static GnomeWMDoubleClickAction actions[] = {
                 { TITLEBAR_MAXIMIZE, N_("Maximize") },
@@ -479,7 +532,7 @@ metacity_window_manager_class_init (MetacityWindowManagerClass *class)
         wm_class->get_settings_mask        = metacity_get_settings_mask;
         wm_class->get_user_theme_folder    = metacity_get_user_theme_folder;
         wm_class->get_theme_list           = metacity_get_theme_list;
-        wm_class->get_double_click_actions = metacity_get_double_click_actions;
+        wm_class->get_titlebar_actions     = metacity_get_titlebar_actions;
         
         parent_class = g_type_class_peek_parent (class);
 }
-- 
1.5.0




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