summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Zeidan <[email protected]>2017-12-20 20:30:44 +0100
committerlukefromdc <[email protected]>2018-01-01 13:47:16 -0500
commit9e2b7eff713b6881a60538e08e222dad0d364647 (patch)
treedbee16b716703a6bb8ed9be8ab450a6c566c7d0d
parent294d3ec5a0ae4a818fb2ce53d27a0a935a9ef760 (diff)
downloadmarco-9e2b7eff713b6881a60538e08e222dad0d364647.tar.bz2
marco-9e2b7eff713b6881a60538e08e222dad0d364647.tar.xz
Implemented tabpopup when moving window to different workspace
-rw-r--r--src/core/display.c5
-rw-r--r--src/core/keybindings.c111
-rw-r--r--src/include/common.h1
-rw-r--r--src/include/prefs.h6
4 files changed, 79 insertions, 44 deletions
diff --git a/src/core/display.c b/src/core/display.c
index 9601b4ed..006cb6ff 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1156,6 +1156,7 @@ grab_op_is_keyboard (MetaGrabOp op)
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
+ case META_GRAB_OP_KEYBOARD_WORKSPACE_MOVING:
return TRUE;
default:
@@ -3736,6 +3737,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
META_TAB_SHOW_INSTANTLY);
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
+ case META_GRAB_OP_KEYBOARD_WORKSPACE_MOVING:
meta_screen_ensure_workspace_popup (screen);
break;
@@ -3785,7 +3787,8 @@ meta_display_end_grab_op (MetaDisplay *display,
}
if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op) ||
- display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING)
+ display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING ||
+ display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_MOVING)
{
meta_ui_tab_popup_free (display->grab_screen->tab_popup);
display->grab_screen->tab_popup = NULL;
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 4dff55a0..2b71b3fa 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -75,11 +75,12 @@ handler (MetaDisplay *display,\
* handler functions and have some kind of flag to say they're unbindable.
*/
-static void handle_workspace_switch (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
+static void handle_workspace_switch_or_move (MetaDisplay *display,
+ MetaScreen *screen,
+ MetaWindow *window,
+ XEvent *event,
+ MetaKeyBinding *binding,
+ gboolean is_move);
static gboolean process_mouse_move_resize_grab (MetaDisplay *display,
MetaScreen *screen,
@@ -106,6 +107,7 @@ static gboolean process_tab_grab (MetaDisplay *display,
static gboolean process_workspace_switch_grab (MetaDisplay *display,
MetaScreen *screen,
+ MetaWindow *window,
XEvent *event,
KeySym keysym);
@@ -1404,11 +1406,11 @@ meta_display_process_key_event (MetaDisplay *display,
break;
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
+ case META_GRAB_OP_KEYBOARD_WORKSPACE_MOVING:
meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard workspace switching\n");
- keep_grab = process_workspace_switch_grab (display, screen, event, keysym);
+ keep_grab = process_workspace_switch_grab (display, screen, window, event, keysym);
break;
-
default:
break;
}
@@ -2331,7 +2333,7 @@ handle_switch_to_workspace (MetaDisplay *display,
* Note that we're the only caller of that function, so perhaps
* we should merge with it.
*/
- handle_workspace_switch (display, screen, event_window, event, binding);
+ handle_workspace_switch_or_move (display, screen, event_window, event, binding, FALSE);
return;
}
@@ -2673,6 +2675,7 @@ handle_move_to_center (MetaDisplay *display,
static gboolean
process_workspace_switch_grab (MetaDisplay *display,
MetaScreen *screen,
+ MetaWindow *window,
XEvent *event,
KeySym keysym)
{
@@ -2701,12 +2704,15 @@ process_workspace_switch_grab (MetaDisplay *display,
"Ending grab so we can focus on the target workspace\n");
meta_display_end_grab_op (display, event->xkey.time);
- meta_topic (META_DEBUG_KEYBINDINGS,
- "Focusing default window on target workspace\n");
- meta_workspace_focus_default_window (target_workspace,
- NULL,
- event->xkey.time);
+ if(display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING)
+ {
+ meta_topic (META_DEBUG_KEYBINDINGS,
+ "Focusing default window on target workspace\n");
+ meta_workspace_focus_default_window (target_workspace,
+ NULL,
+ event->xkey.time);
+ }
return TRUE; /* we already ended the grab */
}
@@ -2742,21 +2748,25 @@ process_workspace_switch_grab (MetaDisplay *display,
switch (action)
{
case META_KEYBINDING_ACTION_WORKSPACE_UP:
+ case META_KEYBINDING_ACTION_WORKSPACE_MOVE_UP:
target_workspace = meta_workspace_get_neighbor (workspace,
META_MOTION_UP);
break;
case META_KEYBINDING_ACTION_WORKSPACE_DOWN:
+ case META_KEYBINDING_ACTION_WORKSPACE_MOVE_DOWN:
target_workspace = meta_workspace_get_neighbor (workspace,
META_MOTION_DOWN);
break;
case META_KEYBINDING_ACTION_WORKSPACE_LEFT:
+ case META_KEYBINDING_ACTION_WORKSPACE_MOVE_LEFT:
target_workspace = meta_workspace_get_neighbor (workspace,
META_MOTION_LEFT);
break;
case META_KEYBINDING_ACTION_WORKSPACE_RIGHT:
+ case META_KEYBINDING_ACTION_WORKSPACE_MOVE_RIGHT:
target_workspace = meta_workspace_get_neighbor (workspace,
META_MOTION_RIGHT);
break;
@@ -2776,7 +2786,18 @@ process_workspace_switch_grab (MetaDisplay *display,
meta_topic (META_DEBUG_KEYBINDINGS,
"Activating target workspace\n");
- meta_workspace_activate (target_workspace, event->xkey.time);
+ if(display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING)
+ meta_workspace_activate (target_workspace, event->xkey.time);
+ else
+ {
+ meta_window_change_workspace (window, target_workspace);
+ target_workspace->screen->display->mouse_mode = FALSE;
+ meta_workspace_activate_with_focus (target_workspace,
+ window,
+ event->xkey.time);
+ }
+
+
return TRUE; /* we already ended the grab */
}
@@ -2787,7 +2808,10 @@ process_workspace_switch_grab (MetaDisplay *display,
"Ending workspace tabbing & focusing default window; uninteresting key pressed\n");
workspace =
(MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->tab_popup);
- meta_workspace_focus_default_window (workspace, NULL, event->xkey.time);
+
+ if(display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING)
+ meta_workspace_focus_default_window (workspace, NULL, event->xkey.time);
+
return FALSE;
}
@@ -3252,7 +3276,6 @@ handle_move_to_workspace (MetaDisplay *display,
MetaKeyBinding *binding)
{
gint which = binding->handler->data;
- gboolean flip = (which < 0);
MetaWorkspace *workspace;
/* If which is zero or positive, it's a workspace number, and the window
@@ -3266,31 +3289,18 @@ handle_move_to_workspace (MetaDisplay *display,
if (window->always_sticky)
return;
- workspace = NULL;
- if (flip)
- {
- workspace = meta_workspace_get_neighbor (screen->active_workspace,
- which);
- }
- else
+ if (which < 0)
{
- workspace = meta_screen_get_workspace_by_index (screen, which);
+ handle_workspace_switch_or_move (display, screen, window, event, binding, TRUE);
+ return;
}
+
+ workspace = meta_screen_get_workspace_by_index (screen, which);
if (workspace)
{
/* Activate second, so the window is never unmapped */
meta_window_change_workspace (window, workspace);
- if (flip)
- {
- meta_topic (META_DEBUG_FOCUS,
- "Resetting mouse_mode to FALSE due to "
- "handle_move_to_workspace() call with flip set.\n");
- workspace->screen->display->mouse_mode = FALSE;
- meta_workspace_activate_with_focus (workspace,
- window,
- event->xkey.time);
- }
}
else
{
@@ -3365,11 +3375,12 @@ handle_lower (MetaDisplay *display,
}
static void
-handle_workspace_switch (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding)
+handle_workspace_switch_or_move (MetaDisplay *display,
+ MetaScreen *screen,
+ MetaWindow *window,
+ XEvent *event,
+ MetaKeyBinding *binding,
+ gboolean is_move)
{
gint motion = binding->handler->data;
unsigned int grab_mask;
@@ -3379,13 +3390,17 @@ handle_workspace_switch (MetaDisplay *display,
meta_topic (META_DEBUG_KEYBINDINGS,
"Starting tab between workspaces, showing popup\n");
+ MetaGrabOp grab_op = is_move ?
+ META_GRAB_OP_KEYBOARD_WORKSPACE_MOVING
+ : META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING;
+
/* FIXME should we use binding->mask ? */
grab_mask = event->xkey.state & ~(display->ignored_modifier_mask);
if (meta_display_begin_grab_op (display,
screen,
- NULL,
- META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
+ is_move ? window : NULL,
+ grab_op,
FALSE,
FALSE,
0,
@@ -3414,7 +3429,19 @@ handle_workspace_switch (MetaDisplay *display,
meta_display_end_grab_op (display, event->xkey.time);
}
- meta_workspace_activate (next, event->xkey.time);
+ if(is_move)
+ {
+ meta_window_change_workspace (window, next);
+ meta_topic (META_DEBUG_FOCUS,
+ "Resetting mouse_mode to FALSE due to "
+ "handle_move_to_workspace() call with flip set.\n");
+ next->screen->display->mouse_mode = FALSE;
+ meta_workspace_activate_with_focus (next,
+ window,
+ event->xkey.time);
+ }
+ else
+ meta_workspace_activate (next, event->xkey.time);
if (grabbed_before_release)
{
diff --git a/src/include/common.h b/src/include/common.h
index 74137967..fd7de17c 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -131,6 +131,7 @@ typedef enum
META_GRAB_OP_KEYBOARD_TABBING_GROUP,
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
+ META_GRAB_OP_KEYBOARD_WORKSPACE_MOVING,
/* Frame button ops */
META_GRAB_OP_CLICKING_MINIMIZE,
diff --git a/src/include/prefs.h b/src/include/prefs.h
index 86178647..76ee8958 100644
--- a/src/include/prefs.h
+++ b/src/include/prefs.h
@@ -195,7 +195,11 @@ typedef enum _MetaKeyBindingAction
META_KEYBINDING_ACTION_COMMAND_9,
META_KEYBINDING_ACTION_COMMAND_10,
META_KEYBINDING_ACTION_COMMAND_11,
- META_KEYBINDING_ACTION_COMMAND_12
+ META_KEYBINDING_ACTION_COMMAND_12,
+ META_KEYBINDING_ACTION_WORKSPACE_MOVE_LEFT = 94,
+ META_KEYBINDING_ACTION_WORKSPACE_MOVE_RIGHT = 95,
+ META_KEYBINDING_ACTION_WORKSPACE_MOVE_UP = 96,
+ META_KEYBINDING_ACTION_WORKSPACE_MOVE_DOWN = 97
} MetaKeyBindingAction;
typedef struct