summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas James Alexander Thurman <tthurman@src.gnome.org>2009-01-27 21:05:42 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2009-01-27 21:05:42 +0000
commit0a172cc053d019612e672d7e943e7f466fb3866a (patch)
treede64c64bcd41604c3f6f4e8528de421941286b74
parentf5fa4a386690180e029ccd471c60874ae3d07c47 (diff)
downloadmetacity-0a172cc053d019612e672d7e943e7f466fb3866a.tar.gz
Added a gconf key to swap the meanings of the right and
middle buttons when the modifier key is held down. Closes #437910. Thanks to Matt Kraai for looking over the patch. * src/core/display.c: * src/core/prefs.c: * src/include/prefs.h: * src/metacity.schemas.in.in: svn path=/trunk/; revision=4091
-rw-r--r--ChangeLog12
-rw-r--r--src/core/display.c4
-rw-r--r--src/core/prefs.c21
-rw-r--r--src/include/prefs.h5
-rw-r--r--src/metacity.schemas.in.in19
5 files changed, 58 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index dbacc59a..0fdf6d3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2009-01-27 Thomas Thurman <tthurman@gnome.org>
+ Added a gconf key to swap the meanings of the right and
+ middle buttons when the modifier key is held down.
+ Closes #437910. Thanks to Matt Kraai for looking over
+ the patch.
+
+ * src/core/display.c:
+ * src/core/prefs.c:
+ * src/include/prefs.h:
+ * src/metacity.schemas.in.in:
+
+2009-01-27 Thomas Thurman <tthurman@gnome.org>
+
All the window properties are now handled using simple
window property handlers. Closes #549886.
diff --git a/src/core/display.c b/src/core/display.c
index daac23f3..cd56da84 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1669,7 +1669,7 @@ event_callback (XEvent *event,
if (!unmodified)
begin_move = TRUE;
}
- else if (!unmodified && event->xbutton.button == 2)
+ else if (!unmodified && event->xbutton.button == meta_prefs_get_mouse_button_resize())
{
if (window->has_resize_func)
{
@@ -1718,7 +1718,7 @@ event_callback (XEvent *event,
event->xbutton.y_root);
}
}
- else if (event->xbutton.button == 3)
+ else if (event->xbutton.button == meta_prefs_get_mouse_button_menu())
{
if (meta_prefs_get_raise_on_click ())
meta_window_raise (window);
diff --git a/src/core/prefs.c b/src/core/prefs.c
index ca928e9e..2a2e8e90 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -94,6 +94,7 @@ static gboolean gnome_animations = TRUE;
static char *cursor_theme = NULL;
static int cursor_size = 24;
static gboolean compositing_manager = FALSE;
+static gboolean resize_with_right_button = FALSE;
static MetaVisualBellType visual_bell_type = META_VISUAL_BELL_FULLSCREEN_FLASH;
static MetaButtonLayout button_layout;
@@ -403,6 +404,11 @@ static MetaBoolPreference preferences_bool[] =
&compositing_manager,
FALSE,
},
+ { "/apps/metacity/general/resize_with_right_button",
+ META_PREF_RESIZE_WITH_RIGHT_BUTTON,
+ &resize_with_right_button,
+ FALSE,
+ },
{ NULL, 0, NULL, FALSE },
};
@@ -1740,6 +1746,9 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_COMPOSITING_MANAGER:
return "COMPOSITING_MANAGER";
+
+ case META_PREF_RESIZE_WITH_RIGHT_BUTTON:
+ return "RESIZE_WITH_RIGHT_BUTTON";
}
return "(unknown)";
@@ -2714,6 +2723,18 @@ meta_prefs_get_compositing_manager (void)
return compositing_manager;
}
+guint
+meta_prefs_get_mouse_button_resize (void)
+{
+ return resize_with_right_button ? 3: 2;
+}
+
+guint
+meta_prefs_get_mouse_button_menu (void)
+{
+ return resize_with_right_button ? 2: 3;
+}
+
void
meta_prefs_set_compositing_manager (gboolean whether)
{
diff --git a/src/include/prefs.h b/src/include/prefs.h
index 5acad233..2f1ce8e7 100644
--- a/src/include/prefs.h
+++ b/src/include/prefs.h
@@ -58,7 +58,8 @@ typedef enum
META_PREF_GNOME_ANIMATIONS,
META_PREF_CURSOR_THEME,
META_PREF_CURSOR_SIZE,
- META_PREF_COMPOSITING_MANAGER
+ META_PREF_COMPOSITING_MANAGER,
+ META_PREF_RESIZE_WITH_RIGHT_BUTTON
} MetaPreference;
typedef void (* MetaPrefsChangedFunc) (MetaPreference pref,
@@ -73,6 +74,8 @@ void meta_prefs_init (void);
const char* meta_preference_to_string (MetaPreference pref);
MetaVirtualModifier meta_prefs_get_mouse_button_mods (void);
+guint meta_prefs_get_mouse_button_resize (void);
+guint meta_prefs_get_mouse_button_menu (void);
MetaFocusMode meta_prefs_get_focus_mode (void);
MetaFocusNewWindows meta_prefs_get_focus_new_windows (void);
gboolean meta_prefs_get_raise_on_click (void);
diff --git a/src/metacity.schemas.in.in b/src/metacity.schemas.in.in
index 41b7c267..a9dd3977 100644
--- a/src/metacity.schemas.in.in
+++ b/src/metacity.schemas.in.in
@@ -15,6 +15,8 @@
Clicking a window while holding down this modifier key
will move the window (left click), resize the window
(middle click), or show the window menu (right click).
+ The left and right operations may be swapped
+ using the "mouse_button_resize" key.
Modifier is expressed as "&lt;Alt&gt;" or "&lt;Super&gt;"
for example.
</long>
@@ -22,6 +24,23 @@
</schema>
<schema>
+ <key>/schemas/apps/metacity/general/resize_with_right_button</key>
+ <applyto>/apps/metacity/general/resize_with_right_button</applyto>
+ <owner>metacity</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Whether to resize with the right button</short>
+ <long>
+ Set this to true to resize with the right button and show a menu
+ with the middle button while holding down the key given in
+ "mouse_button_modifier"; set it to false to make it work the
+ opposite way around.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/metacity/general/button_layout</key>
<applyto>/apps/metacity/general/button_layout</applyto>
<owner>metacity</owner>