summaryrefslogtreecommitdiff
path: root/src/core/keybindings.c
diff options
context:
space:
mode:
authorOmar Zeidan <[email protected]>2017-12-30 03:52:32 +0100
committerraveit65 <[email protected]>2018-01-15 17:29:48 +0100
commit7e14f82c4b5e3137bbdc3a4e55dbfe01e5af28c0 (patch)
treeeec7bbf38d1ac51f46b06e516d67dc3498bdeaa0 /src/core/keybindings.c
parent11d5b89c337e0ba5a9ffd25dc3404db6afbbefbb (diff)
downloadmarco-7e14f82c4b5e3137bbdc3a4e55dbfe01e5af28c0.tar.bz2
marco-7e14f82c4b5e3137bbdc3a4e55dbfe01e5af28c0.tar.xz
Implemented simple shourtcuts to move window to another monitor
Diffstat (limited to 'src/core/keybindings.c')
-rw-r--r--src/core/keybindings.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 2b71b3fa..11b8daf4 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2672,6 +2672,47 @@ handle_move_to_center (MetaDisplay *display,
window->rect.height);
}
+
+static void
+handle_move_to_monitor (MetaDisplay *display,
+ MetaScreen *screen,
+ MetaWindow *window,
+ XEvent *event,
+ MetaKeyBinding *binding)
+{
+ MetaScreenDirection move_direction = binding->handler->data;
+ MetaXineramaScreenInfo* current;
+ MetaXineramaScreenInfo* neighbour;
+ MetaRectangle current_window_rect;
+ int new_x;
+ int new_y;
+
+
+ current = meta_screen_get_xinerama_for_window(screen, window);
+ neighbour = meta_screen_get_xinerama_neighbor(screen, current->number, move_direction);
+
+ if(neighbour == NULL ||
+ current->number == neighbour->number)
+ return;
+
+ if(META_WINDOW_TILED (window))
+ {
+ window->tile_monitor_number = neighbour->number;
+ return;
+ }
+
+ meta_window_get_client_root_coords(window, &current_window_rect);
+
+ new_x = current_window_rect.x - current->rect.x + neighbour->rect.x;
+ new_y = current_window_rect.y - current->rect.y + neighbour->rect.y;
+ /* target_rect.width = window->rect.width; */
+ /* target_rect.height = window->rect.height; */
+ /* Maybe do some resizing? */
+
+ meta_window_move(window, TRUE, new_x, new_y);
+
+}
+
static gboolean
process_workspace_switch_grab (MetaDisplay *display,
MetaScreen *screen,