1
0
Fork 0

keybindings: Add toggle-tile-left/right bindings

Having keybindings for side-by-side tiling has been requested for
a long time, so add this support now.

https://bugzilla.gnome.org/show_bug.cgi?id=648700
This commit is contained in:
Florian Müllner 2011-11-15 17:29:56 +01:00
parent baeb9fbc4b
commit 34f6ffd1ad
7 changed files with 87 additions and 0 deletions

1
.gitignore vendored
View file

@ -19,6 +19,7 @@ libtool
ltmain.sh
missing
.deps
src/50-mutter-windows.xml
src/mutter-wm.desktop
src/mutter.desktop
*.o

View file

@ -1,5 +1,6 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
src/50-mutter-windows.xml.in
src/compositor/compositor.c
src/core/bell.c
src/core/core.c

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<KeyListEntries schema="org.gnome.mutter.keybindings"
group="system"
_name="Windows"
wm_name="Mutter"
package="mutter">
<KeyListEntry name="toggle-tiled-left"
_description="View split on left"/>
<KeyListEntry name="toggle-tiled-right"
_description="View split on right"/>
</KeyListEntries>

View file

@ -261,6 +261,11 @@ wmproperties_in_files=mutter-wm.desktop.in
wmproperties_files=$(wmproperties_in_files:.desktop.in=.desktop)
wmproperties_DATA = $(wmproperties_files)
xmldir = @GNOME_KEYBINDINGS_KEYSDIR@
xml_in_files = \
50-mutter-windows.xml.in
xml_DATA = $(xml_in_files:.xml.in=.xml)
gsettings_SCHEMAS = org.gnome.mutter.gschema.xml
@INTLTOOL_XML_NOMERGE_RULE@
@GSETTINGS_RULES@
@ -279,6 +284,7 @@ CLEANFILES = \
mutter.desktop \
mutter-wm.desktop \
org.gnome.mutter.gschema.xml \
$(xml_DATA) \
$(mutter_built_sources) \
$(typelib_DATA) \
$(gir_DATA)
@ -295,6 +301,7 @@ EXTRA_DIST=$(desktopfiles_files) \
$(IMAGES) \
$(desktopfiles_in_files) \
$(wmproperties_in_files) \
$(xml_in_files) \
org.gnome.mutter.gschema.xml.in \
mutter-schemas.convert \
libmutter.pc.in \

View file

@ -3232,6 +3232,45 @@ handle_toggle_above (MetaDisplay *display,
meta_window_make_above (window);
}
static void
handle_toggle_tiled (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
MetaTileMode mode = binding->handler->data;
if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
(META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
{
window->tile_monitor_number = window->saved_maximize ? window->monitor->number
: -1;
window->tile_mode = window->saved_maximize ? META_TILE_MAXIMIZED
: META_TILE_NONE;
if (window->saved_maximize)
meta_window_maximize (window, META_MAXIMIZE_VERTICAL |
META_MAXIMIZE_HORIZONTAL);
else
meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL |
META_MAXIMIZE_HORIZONTAL);
}
else if (meta_window_can_tile_side_by_side (window))
{
window->tile_monitor_number = window->monitor->number;
window->tile_mode = mode;
/* Maximization constraints beat tiling constraints, so if the window
* is maximized, tiling won't have any effect unless we unmaximize it
* horizontally first; rather than calling meta_window_unmaximize(),
* we just set the flag and rely on meta_window_tile() syncing it to
* save an additional roundtrip.
window->maximized_horizontally = FALSE;
meta_window_tile (window);
}
}
static void
handle_toggle_maximized (MetaDisplay *display,
MetaScreen *screen,
@ -3889,6 +3928,20 @@ init_builtin_key_bindings (MetaDisplay *display)
META_KEYBINDING_ACTION_TOGGLE_MAXIMIZED,
handle_toggle_maximized, 0);
add_builtin_keybinding (display,
"toggle-tiled-left",
SCHEMA_MUTTER_KEYBINDINGS,
META_KEY_BINDING_PER_WINDOW,
META_KEYBINDING_ACTION_TOGGLE_TILED_LEFT,
handle_toggle_tiled, META_TILE_LEFT);
add_builtin_keybinding (display,
"toggle-tiled-right",
SCHEMA_MUTTER_KEYBINDINGS,
META_KEY_BINDING_PER_WINDOW,
META_KEYBINDING_ACTION_TOGGLE_TILED_RIGHT,
handle_toggle_tiled, META_TILE_RIGHT);
add_builtin_keybinding (display,
"toggle-above",
SCHEMA_COMMON_KEYBINDINGS,

View file

@ -191,6 +191,8 @@ typedef enum _MetaKeyBindingAction
META_KEYBINDING_ACTION_ACTIVATE_WINDOW_MENU,
META_KEYBINDING_ACTION_TOGGLE_FULLSCREEN,
META_KEYBINDING_ACTION_TOGGLE_MAXIMIZED,
META_KEYBINDING_ACTION_TOGGLE_TILED_LEFT,
META_KEYBINDING_ACTION_TOGGLE_TILED_RIGHT,
META_KEYBINDING_ACTION_TOGGLE_ABOVE,
META_KEYBINDING_ACTION_MAXIMIZE,
META_KEYBINDING_ACTION_UNMAXIMIZE,

View file

@ -83,6 +83,14 @@
<default><![CDATA[['<Control><Shift><Alt>r']]]></default>
</key>
<key name="toggle-tiled-left" type="as">
<default><![CDATA[['<Super>Left']]]></default>
</key>
<key name="toggle-tiled-right" type="as">
<default><![CDATA[['<Super>Right']]]></default>
</key>
<key name="tab-popup-select" type="as">
<default>[]</default>
<_summary>Select window from tab popup</_summary>