diff --git a/ChangeLog b/ChangeLog index f33472476..005caf010 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,26 @@ +2003-06-26 Rob Adams + + 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 * po/id.po: Added Indonesian translation * configure.in: Added "id" to ALL_LINGUAS -2003-06-10 Rob Adams +2003-06-25 Rob Adams 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 050733a7f..50fc8d2c5 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 }, @@ -2860,6 +2866,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, diff --git a/src/metacity.schemas.in b/src/metacity.schemas.in index f03822b11..4350b67a4 100644 --- a/src/metacity.schemas.in +++ b/src/metacity.schemas.in @@ -302,6 +302,29 @@ you set + + /schemas/apps/metacity/window_keybindings/toggle_above + /apps/metacity/window_keybindings/toggle_above + metacity + string + disabled + + Toggle always on top state + + + 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. + + + + /schemas/apps/metacity/window_keybindings/toggle_maximized /apps/metacity/window_keybindings/toggle_maximized diff --git a/src/prefs.c b/src/prefs.c index e2efa47a4..9ed41bcd2 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 60376df2d..18a20df3f 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 fe5db8f29..8ff177ee6 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 bedef1dce..3b36872e8 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,