From c39a03ad5992246e35a219a0c81254da9199c9ac Mon Sep 17 00:00:00 2001 From: Deepa Natarajan Date: Wed, 21 Aug 2002 06:47:16 +0000 Subject: [PATCH] add maximize and unmaximize keybinding setting. Partly fixes bug# 78999. 2002-08-21 Deepa Natarajan * src/keybindings.c, src/metacity.schemas.in, src/prefs.[ch]: add maximize and unmaximize keybinding setting. Partly fixes bug# 78999. --- ChangeLog | 6 ++++++ src/keybindings.c | 36 ++++++++++++++++++++++++++++++++++++ src/metacity.schemas.in | 40 ++++++++++++++++++++++++++++++++++++++++ src/prefs.c | 2 ++ src/prefs.h | 2 ++ 5 files changed, 86 insertions(+) diff --git a/ChangeLog b/ChangeLog index 24c4bcc3b..956962819 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-08-21 Deepa Natarajan + + * src/keybindings.c, src/metacity.schemas.in, src/prefs.[ch]: + add maximize and unmaximize keybinding setting. Partly fixes + bug# 78999. + 2002-08-20 Steve Fox * metacity.spec.in: Add so that the spec file gets auto-updated diff --git a/src/keybindings.c b/src/keybindings.c index 6eaaefdfb..f46ec266d 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -66,6 +66,14 @@ static void handle_toggle_maximize (MetaDisplay *display, MetaWindow *window, XEvent *event, MetaKeyBinding *binding); +static void handle_maximize (MetaDisplay *display, + MetaWindow *window, + XEvent *event, + MetaKeyBinding *binding); +static void handle_unmaximize (MetaDisplay *display, + MetaWindow *window, + XEvent *event, + MetaKeyBinding *binding); static void handle_toggle_shade (MetaDisplay *display, MetaWindow *window, XEvent *event, @@ -233,6 +241,8 @@ static const MetaKeyHandler window_handlers[] = { { META_KEYBINDING_WINDOW_MENU, handle_activate_menu, NULL }, { META_KEYBINDING_TOGGLE_FULLSCREEN, handle_toggle_fullscreen, NULL }, { META_KEYBINDING_TOGGLE_MAXIMIZE, handle_toggle_maximize, NULL }, + { META_KEYBINDING_MAXIMIZE, handle_maximize, NULL }, + { META_KEYBINDING_UNMAXIMIZE, handle_unmaximize, NULL }, { META_KEYBINDING_TOGGLE_SHADE, handle_toggle_shade, NULL }, { META_KEYBINDING_CLOSE, handle_close_window, NULL }, { META_KEYBINDING_MINIMIZE, handle_minimize_window, NULL }, @@ -2445,6 +2455,32 @@ handle_toggle_maximize (MetaDisplay *display, } } +static void +handle_maximize (MetaDisplay *display, + MetaWindow *window, + XEvent *event, + MetaKeyBinding *binding) +{ + if (window) + { + if (window->has_maximize_func) + meta_window_maximize (window); + } +} + +static void +handle_unmaximize (MetaDisplay *display, + MetaWindow *window, + XEvent *event, + MetaKeyBinding *binding) +{ + if (window) + { + if (window->maximized) + meta_window_unmaximize (window); + } +} + static void handle_toggle_shade (MetaDisplay *display, MetaWindow *window, diff --git a/src/metacity.schemas.in b/src/metacity.schemas.in index 980e7bad5..407918b91 100644 --- a/src/metacity.schemas.in +++ b/src/metacity.schemas.in @@ -187,6 +187,46 @@ you set + + /schemas/apps/metacity/window_keybindings/maximize + /apps/metacity/window_keybindings/maximize + metacity + string + <Alt>F10 + + Maximize a window + + The keybinding used to maximize a window + The format looks like "<Control>a" or "<Shift><Alt>F1. + The parser is + fairly liberal and allows lower or upper case, and also + abbreviations such as "<Ctl>" and "<Ctrl>". If you set + the option to the special string "disabled", then there + will be no keybinding for this action. + + + + + + /schemas/apps/metacity/window_keybindings/unmaximize + /apps/metacity/window_keybindings/unmaximize + metacity + string + <Alt>F5 + + Unmaximize a window + + The keybinding used to unmaximize a window. + The format looks like "<Control>a" or "<Shift><Alt>F1. + The parser is + fairly liberal and allows lower or upper case, and also + abbreviations such as "<Ctl>" and "<Ctrl>". If you set + the option to the special string "disabled", then there + will be no keybinding for this action. + + + + /schemas/apps/metacity/window_keybindings/toggle_shaded /apps/metacity/window_keybindings/toggle_shaded diff --git a/src/prefs.c b/src/prefs.c index 631464598..7cccde038 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -874,6 +874,8 @@ static MetaKeyPref window_bindings[] = { { META_KEYBINDING_WINDOW_MENU, 0, 0 }, { META_KEYBINDING_TOGGLE_FULLSCREEN, 0, 0 }, { META_KEYBINDING_TOGGLE_MAXIMIZE, 0, 0 }, + { META_KEYBINDING_MAXIMIZE, 0, 0 }, + { META_KEYBINDING_UNMAXIMIZE, 0, 0 }, { META_KEYBINDING_TOGGLE_SHADE, 0, 0 }, { META_KEYBINDING_MINIMIZE, 0, 0 }, { META_KEYBINDING_CLOSE, 0, 0 }, diff --git a/src/prefs.h b/src/prefs.h index 1658cd96f..243e9cbef 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -107,6 +107,8 @@ void meta_prefs_set_num_workspaces (int n_workspaces); #define META_KEYBINDING_WINDOW_MENU "activate_window_menu" #define META_KEYBINDING_TOGGLE_FULLSCREEN "toggle_fullscreen" #define META_KEYBINDING_TOGGLE_MAXIMIZE "toggle_maximized" +#define META_KEYBINDING_MAXIMIZE "maximize" +#define META_KEYBINDING_UNMAXIMIZE "unmaximize" #define META_KEYBINDING_TOGGLE_SHADE "toggle_shaded" #define META_KEYBINDING_MINIMIZE "minimize" #define META_KEYBINDING_CLOSE "close"