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
This commit is contained in:
Rob Adams 2003-06-27 14:49:56 +00:00 committed by Rob Adams
parent b6389fbf60
commit 34ec58af0a
7 changed files with 84 additions and 1 deletions

View File

@ -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

View File

@ -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,

View File

@ -302,6 +302,29 @@ you set
</locale>
</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 "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1.
The parser is
fairly liberal and allows lower or upper case, and also
abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;". 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>

View File

@ -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 },

View File

@ -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"

View File

@ -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)

View File

@ -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,