diff options
author | Rob Adams <robadams@ucla.edu> | 2003-06-27 14:49:56 +0000 |
---|---|---|
committer | Rob Adams <readams@src.gnome.org> | 2003-06-27 14:49:56 +0000 |
commit | 34ec58af0a051443ec0f4bf9a0927858dd1638b0 (patch) | |
tree | b3ddf5b4bb0fb66f168629fd08d910ede25fc03d | |
parent | b6389fbf60ae2347830b6fa5ce0ff9fa910e733d (diff) | |
download | metacity-34ec58af0a051443ec0f4bf9a0927858dd1638b0.tar.gz |
Add keybinding to allow the user to toggle _NET_WM_STATE_ABOVE on windows.
2003-06-26 Rob Adams <robadams@ucla.edu>
Add keybinding to allow the user to toggle _NET_WM_STATE_ABOVE on
windows. Disabled by default. See #98387.
* src/keybindings.c (handle_toggle_above): new function implements
the keybinding
* src/metacity.schemas.in: add toggle_above keybinding
* src/prefs.[ch]: add toggle_above keybinding
* src/window.[ch] (meta_window_make_above): new function to put a
window into the above state
(meta_window_unmake_above): new function takes a window out of the
above state
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | src/keybindings.c | 22 | ||||
-rw-r--r-- | src/metacity.schemas.in | 23 | ||||
-rw-r--r-- | src/prefs.c | 1 | ||||
-rw-r--r-- | src/prefs.h | 1 | ||||
-rw-r--r-- | src/window.c | 17 | ||||
-rw-r--r-- | src/window.h | 2 |
7 files changed, 84 insertions, 1 deletions
@@ -1,9 +1,26 @@ +2003-06-26 Rob Adams <robadams@ucla.edu> + + Add keybinding to allow the user to toggle _NET_WM_STATE_ABOVE on + windows. Disabled by default. See #98387. + + * src/keybindings.c (handle_toggle_above): new function implements + the keybinding + + * src/metacity.schemas.in: add toggle_above keybinding + + * src/prefs.[ch]: add toggle_above keybinding + + * src/window.[ch] (meta_window_make_above): new function to put a + window into the above state + (meta_window_unmake_above): new function takes a window out of the + above state + 2003-06-26 Mohammad DAMT <mdamt@bisnisweb.com> * po/id.po: Added Indonesian translation * configure.in: Added "id" to ALL_LINGUAS -2003-06-10 Rob Adams <robadams@ucla.edu> +2003-06-25 Rob Adams <robadams@ucla.edu> Update constraints code to support the new _NET_WM_STRUT_PARTIAL EWMH draft specification. See #86682. Also, fix a bug involving diff --git a/src/keybindings.c b/src/keybindings.c index 050733a7..50fc8d2c 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -84,6 +84,11 @@ static void handle_panel_keybinding (MetaDisplay *display, MetaWindow *window, XEvent *event, MetaKeyBinding *binding); +static void handle_toggle_above (MetaDisplay *display, + MetaScreen *screen, + MetaWindow *window, + XEvent *event, + MetaKeyBinding *binding); static void handle_toggle_maximize (MetaDisplay *display, MetaScreen *screen, MetaWindow *window, @@ -353,6 +358,7 @@ static const MetaKeyHandler screen_handlers[] = { static const MetaKeyHandler window_handlers[] = { { META_KEYBINDING_WINDOW_MENU, handle_activate_menu, NULL }, { META_KEYBINDING_TOGGLE_FULLSCREEN, handle_toggle_fullscreen, NULL }, + { META_KEYBINDING_TOGGLE_ABOVE, handle_toggle_above, NULL }, { META_KEYBINDING_TOGGLE_MAXIMIZE, handle_toggle_maximize, NULL }, { META_KEYBINDING_MAXIMIZE, handle_maximize, NULL }, { META_KEYBINDING_UNMAXIMIZE, handle_unmaximize, NULL }, @@ -2861,6 +2867,22 @@ handle_toggle_fullscreen (MetaDisplay *display, } static void +handle_toggle_above (MetaDisplay *display, + MetaScreen *screen, + MetaWindow *window, + XEvent *event, + MetaKeyBinding *binding) +{ + if (window) + { + if (window->wm_state_above) + meta_window_unmake_above (window); + else + meta_window_make_above (window); + } +} + +static void handle_toggle_maximize (MetaDisplay *display, MetaScreen *screen, MetaWindow *window, diff --git a/src/metacity.schemas.in b/src/metacity.schemas.in index f03822b1..4350b67a 100644 --- a/src/metacity.schemas.in +++ b/src/metacity.schemas.in @@ -303,6 +303,29 @@ you set </schema> <schema> + <key>/schemas/apps/metacity/window_keybindings/toggle_above</key> + <applyto>/apps/metacity/window_keybindings/toggle_above</applyto> + <owner>metacity</owner> + <type>string</type> + <default>disabled</default> + <locale name="C"> + <short>Toggle always on top state</short> + <long> + + The keybinding used to toggle always on top. A window that + is always on top will always be visible over other overlapping windows. + 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. + </long> + </locale> + </schema> + + <schema> <key>/schemas/apps/metacity/window_keybindings/toggle_maximized</key> <applyto>/apps/metacity/window_keybindings/toggle_maximized</applyto> <owner>metacity</owner> diff --git a/src/prefs.c b/src/prefs.c index e2efa47a..9ed41bcd 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -1411,6 +1411,7 @@ static MetaKeyPref window_bindings[] = { { META_KEYBINDING_WINDOW_MENU, 0, 0, FALSE }, { META_KEYBINDING_TOGGLE_FULLSCREEN, 0, 0, FALSE }, { META_KEYBINDING_TOGGLE_MAXIMIZE, 0, 0, FALSE }, + { META_KEYBINDING_TOGGLE_ABOVE, 0, 0, FALSE }, { META_KEYBINDING_MAXIMIZE, 0, 0, FALSE }, { META_KEYBINDING_UNMAXIMIZE, 0, 0, FALSE }, { META_KEYBINDING_TOGGLE_SHADE, 0, 0, FALSE }, diff --git a/src/prefs.h b/src/prefs.h index 60376df2..18a20df3 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -150,6 +150,7 @@ void meta_prefs_change_workspace_name (int i, #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_TOGGLE_ABOVE "toggle_above" #define META_KEYBINDING_MAXIMIZE "maximize" #define META_KEYBINDING_UNMAXIMIZE "unmaximize" #define META_KEYBINDING_TOGGLE_SHADE "toggle_shaded" diff --git a/src/window.c b/src/window.c index fe5db8f2..8ff177ee 100644 --- a/src/window.c +++ b/src/window.c @@ -1867,6 +1867,23 @@ meta_window_unmaximize (MetaWindow *window) } } +void +meta_window_make_above (MetaWindow *window) +{ + window->wm_state_above = TRUE; + meta_window_update_layer (window); + meta_window_raise (window); + set_net_wm_state (window); +} + +void +meta_window_unmake_above (MetaWindow *window) +{ + window->wm_state_above = FALSE; + meta_window_raise (window); + meta_window_update_layer (window); + set_net_wm_state (window); +} void meta_window_make_fullscreen (MetaWindow *window) diff --git a/src/window.h b/src/window.h index bedef1dc..3b36872e 100644 --- a/src/window.h +++ b/src/window.h @@ -317,6 +317,8 @@ void meta_window_maximize (MetaWindow *window); void meta_window_maximize_internal (MetaWindow *window, MetaRectangle *saved_rect); void meta_window_unmaximize (MetaWindow *window); +void meta_window_make_above (MetaWindow *window); +void meta_window_unmake_above (MetaWindow *window); void meta_window_shade (MetaWindow *window); void meta_window_unshade (MetaWindow *window); void meta_window_change_workspace (MetaWindow *window, |