mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
core: Delete now unused code
Since MetaWindowDrag took a lot of this code to handle window drags internally with less interactions with the rest of the stack, this code in display/window/keybindings is unused. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
This commit is contained in:
parent
bec8a5860a
commit
39f1b6dca0
@ -133,7 +133,6 @@ Getting started -- where to look
|
||||
update_move
|
||||
update_resize
|
||||
meta-window-drag.c
|
||||
meta_window_handle_mouse_grab_op_event
|
||||
_NET_MOVERESIZE_WINDOW
|
||||
_NET_WM_STRUT
|
||||
|
||||
|
@ -145,24 +145,7 @@ struct _MetaDisplay
|
||||
guint autoraise_timeout_id;
|
||||
MetaWindow* autoraise_window;
|
||||
|
||||
/* current window operation */
|
||||
MetaGrabOp grab_op;
|
||||
MetaWindow *grab_window;
|
||||
int grab_anchor_root_x;
|
||||
int grab_anchor_root_y;
|
||||
MetaRectangle grab_anchor_window_pos;
|
||||
MetaTileMode grab_tile_mode;
|
||||
int grab_tile_monitor_number;
|
||||
int grab_latest_motion_x;
|
||||
int grab_latest_motion_y;
|
||||
guint grab_have_pointer : 1;
|
||||
guint grab_have_keyboard : 1;
|
||||
MetaRectangle grab_initial_window_pos;
|
||||
int grab_initial_x, grab_initial_y; /* These are only relevant for */
|
||||
gboolean grab_threshold_movement_reached; /* raise_on_click == FALSE. */
|
||||
MetaEdgeResistanceData *grab_edge_resistance_data;
|
||||
unsigned int grab_last_edge_resistance_flags;
|
||||
unsigned int grab_move_resize_later_id;
|
||||
|
||||
MetaKeyBindingManager key_binding_manager;
|
||||
|
||||
@ -276,11 +259,7 @@ GSList* meta_display_list_windows (MetaDisplay *display,
|
||||
MetaListWindowsFlags flags);
|
||||
|
||||
void meta_display_reload_cursor (MetaDisplay *display);
|
||||
void meta_display_update_cursor (MetaDisplay *display);
|
||||
|
||||
void meta_display_check_threshold_reached (MetaDisplay *display,
|
||||
int x,
|
||||
int y);
|
||||
void meta_display_grab_window_buttons (MetaDisplay *display,
|
||||
Window xwindow);
|
||||
void meta_display_ungrab_window_buttons (MetaDisplay *display,
|
||||
@ -312,8 +291,6 @@ gboolean meta_grab_op_is_resizing (MetaGrabOp op);
|
||||
gboolean meta_grab_op_is_mouse (MetaGrabOp op);
|
||||
gboolean meta_grab_op_is_keyboard (MetaGrabOp op);
|
||||
|
||||
void meta_display_clear_grab_move_resize_later (MetaDisplay *display);
|
||||
|
||||
void meta_display_queue_autoraise_callback (MetaDisplay *display,
|
||||
MetaWindow *window);
|
||||
void meta_display_remove_autoraise_callback (MetaDisplay *display);
|
||||
@ -409,14 +386,4 @@ void meta_display_flush_queued_window (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
MetaQueueType queue_types);
|
||||
|
||||
gboolean meta_display_begin_grab_op (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
MetaGrabOp op,
|
||||
uint32_t timestamp,
|
||||
int root_x,
|
||||
int root_y);
|
||||
|
||||
void meta_display_end_grab_op (MetaDisplay *display,
|
||||
uint32_t timestamp);
|
||||
|
||||
#endif
|
||||
|
@ -898,11 +898,6 @@ meta_display_new (MetaContext *context,
|
||||
|
||||
display->current_time = META_CURRENT_TIME;
|
||||
|
||||
display->grab_op = META_GRAB_OP_NONE;
|
||||
display->grab_window = NULL;
|
||||
display->grab_tile_mode = META_TILE_NONE;
|
||||
display->grab_tile_monitor_number = -1;
|
||||
|
||||
meta_display_cleanup_edges (display);
|
||||
|
||||
meta_display_init_keys (display);
|
||||
@ -1653,57 +1648,6 @@ meta_display_notify_window_created (MetaDisplay *display,
|
||||
g_signal_emit (display, display_signals[WINDOW_CREATED], 0, window);
|
||||
}
|
||||
|
||||
static MetaCursor
|
||||
meta_cursor_for_grab_op (MetaGrabOp op)
|
||||
{
|
||||
op &= ~(META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED);
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case META_GRAB_OP_RESIZING_SE:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
||||
return META_CURSOR_SE_RESIZE;
|
||||
break;
|
||||
case META_GRAB_OP_RESIZING_S:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
||||
return META_CURSOR_SOUTH_RESIZE;
|
||||
break;
|
||||
case META_GRAB_OP_RESIZING_SW:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
||||
return META_CURSOR_SW_RESIZE;
|
||||
break;
|
||||
case META_GRAB_OP_RESIZING_N:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
||||
return META_CURSOR_NORTH_RESIZE;
|
||||
break;
|
||||
case META_GRAB_OP_RESIZING_NE:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
||||
return META_CURSOR_NE_RESIZE;
|
||||
break;
|
||||
case META_GRAB_OP_RESIZING_NW:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
||||
return META_CURSOR_NW_RESIZE;
|
||||
break;
|
||||
case META_GRAB_OP_RESIZING_W:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
||||
return META_CURSOR_WEST_RESIZE;
|
||||
break;
|
||||
case META_GRAB_OP_RESIZING_E:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
||||
return META_CURSOR_EAST_RESIZE;
|
||||
break;
|
||||
case META_GRAB_OP_MOVING:
|
||||
case META_GRAB_OP_KEYBOARD_MOVING:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
||||
return META_CURSOR_MOVE_OR_RESIZE_WINDOW;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return META_CURSOR_DEFAULT;
|
||||
}
|
||||
|
||||
static void
|
||||
root_cursor_prepare_at (MetaCursorSpriteXcursor *sprite_xcursor,
|
||||
float best_scale,
|
||||
@ -1786,204 +1730,6 @@ meta_display_set_cursor (MetaDisplay *display,
|
||||
meta_display_reload_cursor (display);
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_update_cursor (MetaDisplay *display)
|
||||
{
|
||||
meta_display_set_cursor (display, meta_cursor_for_grab_op (display->grab_op));
|
||||
}
|
||||
|
||||
static MetaWindow *
|
||||
get_first_freefloating_window (MetaWindow *window)
|
||||
{
|
||||
while (meta_window_is_attached_dialog (window))
|
||||
window = meta_window_get_transient_for (window);
|
||||
|
||||
/* Attached dialogs should always have a non-NULL transient-for */
|
||||
g_assert (window != NULL);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_clear_grab_move_resize_later (MetaDisplay *display)
|
||||
{
|
||||
if (display->grab_move_resize_later_id)
|
||||
{
|
||||
MetaCompositor *compositor;
|
||||
MetaLaters *laters;
|
||||
|
||||
compositor = meta_display_get_compositor (display);
|
||||
laters = meta_compositor_get_laters (compositor);
|
||||
meta_laters_remove (laters, display->grab_move_resize_later_id);
|
||||
display->grab_move_resize_later_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_display_begin_grab_op (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
MetaGrabOp op,
|
||||
guint32 timestamp,
|
||||
int root_x,
|
||||
int root_y)
|
||||
{
|
||||
MetaBackend *backend = backend_from_display (display);
|
||||
MetaWindow *grab_window = NULL;
|
||||
gboolean grab_have_pointer = FALSE, grab_have_keyboard = FALSE;
|
||||
|
||||
g_assert (window != NULL);
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Doing grab op %u on window %s pointer pos %d,%d",
|
||||
op, window->desc,
|
||||
root_x, root_y);
|
||||
|
||||
if (display->grab_op != META_GRAB_OP_NONE)
|
||||
{
|
||||
meta_warning ("Attempt to perform window operation %u on window %s when operation %u on %s already in effect",
|
||||
op, window->desc, display->grab_op,
|
||||
display->grab_window ? display->grab_window->desc : "none");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (meta_prefs_get_raise_on_click ())
|
||||
meta_window_raise (window);
|
||||
else
|
||||
{
|
||||
display->grab_initial_x = root_x;
|
||||
display->grab_initial_y = root_y;
|
||||
display->grab_threshold_movement_reached = FALSE;
|
||||
}
|
||||
|
||||
grab_window = window;
|
||||
|
||||
/* If we're trying to move a window, move the first
|
||||
* non-attached dialog instead.
|
||||
*/
|
||||
if (meta_grab_op_is_moving (op))
|
||||
grab_window = get_first_freefloating_window (window);
|
||||
|
||||
g_assert (grab_window != NULL);
|
||||
g_assert (op != META_GRAB_OP_NONE);
|
||||
|
||||
if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
|
||||
grab_have_pointer = TRUE;
|
||||
|
||||
if (!grab_have_pointer && !meta_grab_op_is_keyboard (op))
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS, "XIGrabDevice() failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Grab keys when beginning window ops; see #126497 */
|
||||
grab_have_keyboard = meta_window_grab_all_keys (grab_window, timestamp);
|
||||
|
||||
if (!grab_have_keyboard)
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS, "grabbing all keys failed, ungrabbing pointer");
|
||||
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
|
||||
grab_have_pointer = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
display->grab_op = op;
|
||||
display->grab_window = grab_window;
|
||||
display->grab_tile_mode = grab_window->tile_mode;
|
||||
display->grab_tile_monitor_number = grab_window->tile_monitor_number;
|
||||
display->grab_anchor_root_x = root_x;
|
||||
display->grab_anchor_root_y = root_y;
|
||||
display->grab_latest_motion_x = root_x;
|
||||
display->grab_latest_motion_y = root_y;
|
||||
display->grab_last_edge_resistance_flags = META_EDGE_RESISTANCE_DEFAULT;
|
||||
|
||||
meta_display_update_cursor (display);
|
||||
|
||||
meta_display_clear_grab_move_resize_later (display);
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Grab op %u on window %s successful",
|
||||
display->grab_op, window ? window->desc : "(null)");
|
||||
|
||||
meta_window_get_frame_rect (display->grab_window,
|
||||
&display->grab_initial_window_pos);
|
||||
display->grab_anchor_window_pos = display->grab_initial_window_pos;
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
meta_display_sync_wayland_input_focus (display);
|
||||
meta_display_cancel_touch (display);
|
||||
}
|
||||
|
||||
g_signal_emit (display, display_signals[GRAB_OP_BEGIN], 0,
|
||||
display->grab_window, display->grab_op);
|
||||
|
||||
meta_window_grab_op_began (display->grab_window, display->grab_op);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_end_grab_op (MetaDisplay *display,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaWindow *grab_window = display->grab_window;
|
||||
MetaGrabOp grab_op = display->grab_op;
|
||||
MetaBackend *backend = backend_from_display (display);
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Ending grab op %u at time %u", grab_op, timestamp);
|
||||
|
||||
if (display->grab_op == META_GRAB_OP_NONE)
|
||||
return;
|
||||
|
||||
g_assert (grab_window != NULL);
|
||||
|
||||
/* We need to reset this early, since the
|
||||
* meta_window_grab_op_ended callback relies on this being
|
||||
* up to date. */
|
||||
display->grab_op = META_GRAB_OP_NONE;
|
||||
|
||||
/* Clear out the edge cache */
|
||||
meta_display_cleanup_edges (display);
|
||||
|
||||
/* Only raise the window in orthogonal raise
|
||||
* ('do-not-raise-on-click') mode if the user didn't try to move
|
||||
* or resize the given window by at least a threshold amount.
|
||||
* For raise on click mode, the window was raised at the
|
||||
* beginning of the grab_op.
|
||||
*/
|
||||
if (!meta_prefs_get_raise_on_click () &&
|
||||
!display->grab_threshold_movement_reached)
|
||||
meta_window_raise (display->grab_window);
|
||||
|
||||
meta_window_grab_op_ended (grab_window, grab_op);
|
||||
|
||||
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Ungrabbing all keys timestamp %u", timestamp);
|
||||
meta_window_ungrab_all_keys (grab_window, timestamp);
|
||||
|
||||
display->grab_window = NULL;
|
||||
display->grab_tile_mode = META_TILE_NONE;
|
||||
display->grab_tile_monitor_number = -1;
|
||||
display->grab_anchor_root_x = 0;
|
||||
display->grab_anchor_root_y = 0;
|
||||
display->grab_latest_motion_x = 0;
|
||||
display->grab_latest_motion_y = 0;
|
||||
display->grab_last_edge_resistance_flags = META_EDGE_RESISTANCE_DEFAULT;
|
||||
|
||||
meta_display_update_cursor (display);
|
||||
|
||||
meta_display_clear_grab_move_resize_later (display);
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
meta_display_sync_wayland_input_focus (display);
|
||||
|
||||
g_signal_emit (display, display_signals[GRAB_OP_END], 0,
|
||||
grab_window, grab_op);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_display_is_grabbed:
|
||||
* @display: The #MetaDisplay that the window is on
|
||||
@ -1998,21 +1744,6 @@ meta_display_is_grabbed (MetaDisplay *display)
|
||||
return meta_compositor_get_current_window_drag (display->compositor) != NULL;
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_check_threshold_reached (MetaDisplay *display,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
/* Don't bother doing the check again if we've already reached the threshold */
|
||||
if (meta_prefs_get_raise_on_click () ||
|
||||
display->grab_threshold_movement_reached)
|
||||
return;
|
||||
|
||||
if (ABS (display->grab_initial_x - x) >= 8 ||
|
||||
ABS (display->grab_initial_y - y) >= 8)
|
||||
display->grab_threshold_movement_reached = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_queue_retheme_all_windows (MetaDisplay *display)
|
||||
{
|
||||
|
@ -1071,7 +1071,6 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
MetaEdgeResistanceFlags flags)
|
||||
{
|
||||
MetaRectangle old_outer, proposed_outer, new_outer;
|
||||
MetaEdgeResistanceFlags saved_flags;
|
||||
gboolean is_resize, is_keyboard_op, snap;
|
||||
|
||||
meta_window_get_frame_rect (window, &old_outer);
|
||||
@ -1083,9 +1082,7 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
|
||||
snap = flags & META_EDGE_RESISTANCE_SNAP;
|
||||
is_keyboard_op = flags & META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||
saved_flags = flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||
|
||||
window->display->grab_last_edge_resistance_flags = saved_flags;
|
||||
is_resize = FALSE;
|
||||
if (apply_edge_resistance_to_each_side (window->display,
|
||||
window,
|
||||
@ -1151,7 +1148,6 @@ meta_window_edge_resistance_for_resize (MetaWindow *window,
|
||||
MetaEdgeResistanceFlags flags)
|
||||
{
|
||||
MetaRectangle old_outer, new_outer;
|
||||
MetaEdgeResistanceFlags saved_flags;
|
||||
int proposed_outer_width, proposed_outer_height;
|
||||
|
||||
meta_window_get_frame_rect (window, &old_outer);
|
||||
@ -1163,9 +1159,6 @@ meta_window_edge_resistance_for_resize (MetaWindow *window,
|
||||
proposed_outer_width,
|
||||
proposed_outer_height);
|
||||
|
||||
saved_flags = flags & ~META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||
window->display->grab_last_edge_resistance_flags = saved_flags;
|
||||
|
||||
if (apply_edge_resistance_to_each_side (window->display,
|
||||
window,
|
||||
&old_outer,
|
||||
|
@ -134,10 +134,6 @@ void meta_display_init_keys (MetaDisplay *display);
|
||||
void meta_display_shutdown_keys (MetaDisplay *display);
|
||||
void meta_window_grab_keys (MetaWindow *window);
|
||||
void meta_window_ungrab_keys (MetaWindow *window);
|
||||
gboolean meta_window_grab_all_keys (MetaWindow *window,
|
||||
guint32 timestamp);
|
||||
void meta_window_ungrab_all_keys (MetaWindow *window,
|
||||
guint32 timestamp);
|
||||
gboolean meta_keybindings_process_event (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
const ClutterEvent *event);
|
||||
|
@ -181,18 +181,6 @@ meta_key_binding_is_builtin (MetaKeyBinding *binding)
|
||||
* handler functions and have some kind of flag to say they're unbindable.
|
||||
*/
|
||||
|
||||
static gboolean process_mouse_move_resize_grab (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event);
|
||||
|
||||
static gboolean process_keyboard_move_grab (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event);
|
||||
|
||||
static gboolean process_keyboard_resize_grab (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event);
|
||||
|
||||
static void maybe_update_locate_pointer_keygrab (MetaDisplay *display,
|
||||
gboolean grab);
|
||||
|
||||
@ -1590,8 +1578,6 @@ meta_window_grab_keys (MetaWindow *window)
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
return;
|
||||
if (window->all_keys_grabbed)
|
||||
return;
|
||||
|
||||
if (window->type == META_WINDOW_DOCK
|
||||
|| window->override_redirect)
|
||||
@ -1817,72 +1803,6 @@ ungrab_keyboard (MetaBackend *backend,
|
||||
XIUngrabDevice (xdisplay, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_grab_all_keys (MetaWindow *window,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
Window grabwindow;
|
||||
gboolean retval = TRUE;
|
||||
|
||||
if (window->all_keys_grabbed)
|
||||
return FALSE;
|
||||
|
||||
if (window->keys_grabbed)
|
||||
meta_window_ungrab_keys (window);
|
||||
|
||||
/* Make sure the window is focused, otherwise the grab
|
||||
* won't do a lot of good.
|
||||
*/
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Focusing %s because we're grabbing all its keys",
|
||||
window->desc);
|
||||
meta_window_focus (window, timestamp);
|
||||
|
||||
if (!meta_is_wayland_compositor ())
|
||||
{
|
||||
grabwindow = meta_window_x11_get_toplevel_xwindow (window);
|
||||
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Grabbing all keys on window %s", window->desc);
|
||||
retval = grab_keyboard (backend, grabwindow, timestamp, XIGrabModeAsync);
|
||||
}
|
||||
if (retval)
|
||||
{
|
||||
window->keys_grabbed = FALSE;
|
||||
window->all_keys_grabbed = TRUE;
|
||||
window->grab_on_frame = window->frame != NULL;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_ungrab_all_keys (MetaWindow *window,
|
||||
guint32 timestamp)
|
||||
{
|
||||
if (window->all_keys_grabbed)
|
||||
{
|
||||
if (!meta_is_wayland_compositor())
|
||||
{
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
|
||||
ungrab_keyboard (backend, timestamp);
|
||||
}
|
||||
|
||||
window->grab_on_frame = FALSE;
|
||||
window->all_keys_grabbed = FALSE;
|
||||
window->keys_grabbed = FALSE;
|
||||
|
||||
/* Re-establish our standard bindings */
|
||||
meta_window_grab_keys (window);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_freeze_keyboard (MetaDisplay *display, guint32 timestamp)
|
||||
{
|
||||
@ -1925,31 +1845,6 @@ meta_display_unfreeze_keyboard (MetaDisplay *display, guint32 timestamp)
|
||||
XIAsyncDevice, timestamp);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_modifier (xkb_keysym_t keysym)
|
||||
{
|
||||
switch (keysym)
|
||||
{
|
||||
case XKB_KEY_Shift_L:
|
||||
case XKB_KEY_Shift_R:
|
||||
case XKB_KEY_Control_L:
|
||||
case XKB_KEY_Control_R:
|
||||
case XKB_KEY_Caps_Lock:
|
||||
case XKB_KEY_Shift_Lock:
|
||||
case XKB_KEY_Meta_L:
|
||||
case XKB_KEY_Meta_R:
|
||||
case XKB_KEY_Alt_L:
|
||||
case XKB_KEY_Alt_R:
|
||||
case XKB_KEY_Super_L:
|
||||
case XKB_KEY_Super_R:
|
||||
case XKB_KEY_Hyper_L:
|
||||
case XKB_KEY_Hyper_R:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
invoke_handler (MetaDisplay *display,
|
||||
MetaKeyHandler *handler,
|
||||
@ -2264,12 +2159,6 @@ static gboolean
|
||||
process_key_event (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event)
|
||||
{
|
||||
gboolean keep_grab;
|
||||
gboolean all_keys_grabbed;
|
||||
|
||||
all_keys_grabbed = window ? window->all_keys_grabbed : FALSE;
|
||||
if (!all_keys_grabbed)
|
||||
{
|
||||
if (process_overlay_key (display, event, window))
|
||||
return TRUE;
|
||||
@ -2279,7 +2168,6 @@ process_key_event (MetaDisplay *display,
|
||||
|
||||
if (process_iso_next_group (display, event))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
@ -2294,43 +2182,6 @@ process_key_event (MetaDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
keep_grab = TRUE;
|
||||
if (all_keys_grabbed)
|
||||
{
|
||||
/* If we get here we have a global grab, because
|
||||
* we're in some special keyboard mode such as window move
|
||||
* mode.
|
||||
*/
|
||||
if (window == display->grab_window)
|
||||
{
|
||||
if (display->grab_op & META_GRAB_OP_WINDOW_FLAG_KEYBOARD)
|
||||
{
|
||||
if (display->grab_op == META_GRAB_OP_KEYBOARD_MOVING)
|
||||
{
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Processing event for keyboard move");
|
||||
keep_grab = process_keyboard_move_grab (display, window, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Processing event for keyboard resize");
|
||||
keep_grab = process_keyboard_resize_grab (display, window, event);
|
||||
}
|
||||
}
|
||||
else if (display->grab_op & META_GRAB_OP_MOVING)
|
||||
{
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Processing event for mouse-only move/resize");
|
||||
keep_grab = process_mouse_move_resize_grab (display, window, event);
|
||||
}
|
||||
}
|
||||
if (!keep_grab)
|
||||
meta_display_end_grab_op (display, event->time);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Do the normal keybindings */
|
||||
return process_event (display, window, event);
|
||||
}
|
||||
@ -2376,529 +2227,6 @@ meta_keybindings_process_event (MetaDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
process_mouse_move_resize_grab (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event)
|
||||
{
|
||||
/* don't care about releases, but eat them, don't end grab */
|
||||
if (event->type == CLUTTER_KEY_RELEASE)
|
||||
return TRUE;
|
||||
|
||||
if (event->keyval == CLUTTER_KEY_Escape)
|
||||
{
|
||||
MetaTileMode tile_mode;
|
||||
|
||||
/* Hide the tiling preview if necessary */
|
||||
if (display->preview_tile_mode != META_TILE_NONE)
|
||||
meta_display_hide_tile_preview (display);
|
||||
|
||||
/* Restore the original tile mode */
|
||||
tile_mode = display->grab_tile_mode;
|
||||
window->tile_monitor_number = display->grab_tile_monitor_number;
|
||||
|
||||
/* End move or resize and restore to original state. If the
|
||||
* window was a maximized window that had been "shaken loose" we
|
||||
* need to remaximize it. In normal cases, we need to do a
|
||||
* moveresize now to get the position back to the original.
|
||||
*/
|
||||
if (window->shaken_loose || tile_mode == META_TILE_MAXIMIZED)
|
||||
meta_window_maximize (window, META_MAXIMIZE_BOTH);
|
||||
else if (tile_mode != META_TILE_NONE)
|
||||
meta_window_restore_tile (window,
|
||||
tile_mode,
|
||||
display->grab_initial_window_pos.width,
|
||||
display->grab_initial_window_pos.height);
|
||||
else
|
||||
meta_window_move_resize_frame (display->grab_window,
|
||||
TRUE,
|
||||
display->grab_initial_window_pos.x,
|
||||
display->grab_initial_window_pos.y,
|
||||
display->grab_initial_window_pos.width,
|
||||
display->grab_initial_window_pos.height);
|
||||
|
||||
/* End grab */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
process_keyboard_move_grab (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event)
|
||||
{
|
||||
MetaEdgeResistanceFlags flags;
|
||||
gboolean handled;
|
||||
MetaRectangle frame_rect;
|
||||
int x, y;
|
||||
int incr;
|
||||
|
||||
handled = FALSE;
|
||||
|
||||
/* don't care about releases, but eat them, don't end grab */
|
||||
if (event->type == CLUTTER_KEY_RELEASE)
|
||||
return TRUE;
|
||||
|
||||
/* don't end grab on modifier key presses */
|
||||
if (is_modifier (event->keyval))
|
||||
return TRUE;
|
||||
|
||||
meta_window_get_frame_rect (window, &frame_rect);
|
||||
x = frame_rect.x;
|
||||
y = frame_rect.y;
|
||||
|
||||
flags = META_EDGE_RESISTANCE_KEYBOARD_OP | META_EDGE_RESISTANCE_WINDOWS;
|
||||
|
||||
if ((event->modifier_state & CLUTTER_SHIFT_MASK) != 0)
|
||||
flags |= META_EDGE_RESISTANCE_SNAP;
|
||||
|
||||
#define SMALL_INCREMENT 1
|
||||
#define NORMAL_INCREMENT 10
|
||||
|
||||
if (flags & META_EDGE_RESISTANCE_SNAP)
|
||||
incr = 1;
|
||||
else if (event->modifier_state & CLUTTER_CONTROL_MASK)
|
||||
incr = SMALL_INCREMENT;
|
||||
else
|
||||
incr = NORMAL_INCREMENT;
|
||||
|
||||
if (event->keyval == CLUTTER_KEY_Escape)
|
||||
{
|
||||
/* End move and restore to original state. If the window was a
|
||||
* maximized window that had been "shaken loose" we need to
|
||||
* remaximize it. In normal cases, we need to do a moveresize
|
||||
* now to get the position back to the original.
|
||||
*/
|
||||
if (window->shaken_loose)
|
||||
meta_window_maximize (window, META_MAXIMIZE_BOTH);
|
||||
else
|
||||
meta_window_move_resize_frame (display->grab_window,
|
||||
TRUE,
|
||||
display->grab_initial_window_pos.x,
|
||||
display->grab_initial_window_pos.y,
|
||||
display->grab_initial_window_pos.width,
|
||||
display->grab_initial_window_pos.height);
|
||||
}
|
||||
|
||||
/* When moving by increments, we still snap to edges if the move
|
||||
* to the edge is smaller than the increment. This is because
|
||||
* Shift + arrow to snap is sort of a hidden feature. This way
|
||||
* people using just arrows shouldn't get too frustrated.
|
||||
*/
|
||||
switch (event->keyval)
|
||||
{
|
||||
case CLUTTER_KEY_KP_Home:
|
||||
case CLUTTER_KEY_KP_Prior:
|
||||
case CLUTTER_KEY_Up:
|
||||
case CLUTTER_KEY_KP_Up:
|
||||
y -= incr;
|
||||
handled = TRUE;
|
||||
break;
|
||||
case CLUTTER_KEY_KP_End:
|
||||
case CLUTTER_KEY_KP_Next:
|
||||
case CLUTTER_KEY_Down:
|
||||
case CLUTTER_KEY_KP_Down:
|
||||
y += incr;
|
||||
handled = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (event->keyval)
|
||||
{
|
||||
case CLUTTER_KEY_KP_Home:
|
||||
case CLUTTER_KEY_KP_End:
|
||||
case CLUTTER_KEY_Left:
|
||||
case CLUTTER_KEY_KP_Left:
|
||||
x -= incr;
|
||||
handled = TRUE;
|
||||
break;
|
||||
case CLUTTER_KEY_KP_Prior:
|
||||
case CLUTTER_KEY_KP_Next:
|
||||
case CLUTTER_KEY_Right:
|
||||
case CLUTTER_KEY_KP_Right:
|
||||
x += incr;
|
||||
handled = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (handled)
|
||||
{
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Computed new window location %d,%d due to keypress",
|
||||
x, y);
|
||||
|
||||
meta_window_edge_resistance_for_move (window,
|
||||
&x,
|
||||
&y,
|
||||
flags);
|
||||
|
||||
meta_window_move_frame (window, TRUE, x, y);
|
||||
meta_window_update_keyboard_move (window);
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
process_keyboard_resize_grab_op_change (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event)
|
||||
{
|
||||
gboolean handled;
|
||||
|
||||
handled = FALSE;
|
||||
switch (display->grab_op)
|
||||
{
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
||||
switch (event->keyval)
|
||||
{
|
||||
case CLUTTER_KEY_Up:
|
||||
case CLUTTER_KEY_KP_Up:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
||||
handled = TRUE;
|
||||
break;
|
||||
case CLUTTER_KEY_Down:
|
||||
case CLUTTER_KEY_KP_Down:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
||||
handled = TRUE;
|
||||
break;
|
||||
case CLUTTER_KEY_Left:
|
||||
case CLUTTER_KEY_KP_Left:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
||||
handled = TRUE;
|
||||
break;
|
||||
case CLUTTER_KEY_Right:
|
||||
case CLUTTER_KEY_KP_Right:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
||||
handled = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
||||
switch (event->keyval)
|
||||
{
|
||||
case CLUTTER_KEY_Left:
|
||||
case CLUTTER_KEY_KP_Left:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
||||
handled = TRUE;
|
||||
break;
|
||||
case CLUTTER_KEY_Right:
|
||||
case CLUTTER_KEY_KP_Right:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
||||
handled = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
||||
switch (event->keyval)
|
||||
{
|
||||
case CLUTTER_KEY_Left:
|
||||
case CLUTTER_KEY_KP_Left:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
|
||||
handled = TRUE;
|
||||
break;
|
||||
case CLUTTER_KEY_Right:
|
||||
case CLUTTER_KEY_KP_Right:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
|
||||
handled = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
||||
switch (event->keyval)
|
||||
{
|
||||
case CLUTTER_KEY_Up:
|
||||
case CLUTTER_KEY_KP_Up:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
||||
handled = TRUE;
|
||||
break;
|
||||
case CLUTTER_KEY_Down:
|
||||
case CLUTTER_KEY_KP_Down:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
||||
handled = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
||||
switch (event->keyval)
|
||||
{
|
||||
case CLUTTER_KEY_Up:
|
||||
case CLUTTER_KEY_KP_Up:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
|
||||
handled = TRUE;
|
||||
break;
|
||||
case CLUTTER_KEY_Down:
|
||||
case CLUTTER_KEY_KP_Down:
|
||||
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
|
||||
handled = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
||||
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (handled)
|
||||
{
|
||||
meta_window_update_keyboard_resize (window, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
process_keyboard_resize_grab (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event)
|
||||
{
|
||||
MetaRectangle frame_rect;
|
||||
gboolean handled;
|
||||
int height_inc;
|
||||
int width_inc;
|
||||
int width, height;
|
||||
MetaEdgeResistanceFlags flags;
|
||||
MetaGravity gravity;
|
||||
|
||||
handled = FALSE;
|
||||
|
||||
/* don't care about releases, but eat them, don't end grab */
|
||||
if (event->type == CLUTTER_KEY_RELEASE)
|
||||
return TRUE;
|
||||
|
||||
/* don't end grab on modifier key presses */
|
||||
if (is_modifier (event->keyval))
|
||||
return TRUE;
|
||||
|
||||
if (event->keyval == CLUTTER_KEY_Escape)
|
||||
{
|
||||
/* End resize and restore to original state. */
|
||||
meta_window_move_resize_frame (display->grab_window,
|
||||
TRUE,
|
||||
display->grab_initial_window_pos.x,
|
||||
display->grab_initial_window_pos.y,
|
||||
display->grab_initial_window_pos.width,
|
||||
display->grab_initial_window_pos.height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (process_keyboard_resize_grab_op_change (display, window, event))
|
||||
return TRUE;
|
||||
|
||||
width = window->rect.width;
|
||||
height = window->rect.height;
|
||||
|
||||
meta_window_get_frame_rect (window, &frame_rect);
|
||||
width = frame_rect.width;
|
||||
height = frame_rect.height;
|
||||
|
||||
gravity = meta_resize_gravity_from_grab_op (display->grab_op);
|
||||
|
||||
flags = META_EDGE_RESISTANCE_KEYBOARD_OP;
|
||||
|
||||
if ((event->modifier_state & CLUTTER_SHIFT_MASK) != 0)
|
||||
flags |= META_EDGE_RESISTANCE_SNAP;
|
||||
|
||||
#define SMALL_INCREMENT 1
|
||||
#define NORMAL_INCREMENT 10
|
||||
|
||||
if (flags & META_EDGE_RESISTANCE_SNAP)
|
||||
{
|
||||
height_inc = 1;
|
||||
width_inc = 1;
|
||||
}
|
||||
else if (event->modifier_state & CLUTTER_CONTROL_MASK)
|
||||
{
|
||||
width_inc = SMALL_INCREMENT;
|
||||
height_inc = SMALL_INCREMENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
width_inc = NORMAL_INCREMENT;
|
||||
height_inc = NORMAL_INCREMENT;
|
||||
}
|
||||
|
||||
/* If this is a resize increment window, make the amount we resize
|
||||
* the window by match that amount (well, unless snap resizing...)
|
||||
*/
|
||||
if (window->size_hints.width_inc > 1)
|
||||
width_inc = window->size_hints.width_inc;
|
||||
if (window->size_hints.height_inc > 1)
|
||||
height_inc = window->size_hints.height_inc;
|
||||
|
||||
switch (event->keyval)
|
||||
{
|
||||
case CLUTTER_KEY_Up:
|
||||
case CLUTTER_KEY_KP_Up:
|
||||
switch (gravity)
|
||||
{
|
||||
case META_GRAVITY_NORTH:
|
||||
case META_GRAVITY_NORTH_WEST:
|
||||
case META_GRAVITY_NORTH_EAST:
|
||||
/* Move bottom edge up */
|
||||
height -= height_inc;
|
||||
break;
|
||||
|
||||
case META_GRAVITY_SOUTH:
|
||||
case META_GRAVITY_SOUTH_WEST:
|
||||
case META_GRAVITY_SOUTH_EAST:
|
||||
/* Move top edge up */
|
||||
height += height_inc;
|
||||
break;
|
||||
|
||||
case META_GRAVITY_EAST:
|
||||
case META_GRAVITY_WEST:
|
||||
case META_GRAVITY_CENTER:
|
||||
case META_GRAVITY_NONE:
|
||||
case META_GRAVITY_STATIC:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
handled = TRUE;
|
||||
break;
|
||||
|
||||
case CLUTTER_KEY_Down:
|
||||
case CLUTTER_KEY_KP_Down:
|
||||
switch (gravity)
|
||||
{
|
||||
case META_GRAVITY_NORTH:
|
||||
case META_GRAVITY_NORTH_WEST:
|
||||
case META_GRAVITY_NORTH_EAST:
|
||||
/* Move bottom edge down */
|
||||
height += height_inc;
|
||||
break;
|
||||
|
||||
case META_GRAVITY_SOUTH:
|
||||
case META_GRAVITY_SOUTH_WEST:
|
||||
case META_GRAVITY_SOUTH_EAST:
|
||||
/* Move top edge down */
|
||||
height -= height_inc;
|
||||
break;
|
||||
|
||||
case META_GRAVITY_EAST:
|
||||
case META_GRAVITY_WEST:
|
||||
case META_GRAVITY_CENTER:
|
||||
case META_GRAVITY_NONE:
|
||||
case META_GRAVITY_STATIC:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
handled = TRUE;
|
||||
break;
|
||||
|
||||
case CLUTTER_KEY_Left:
|
||||
case CLUTTER_KEY_KP_Left:
|
||||
switch (gravity)
|
||||
{
|
||||
case META_GRAVITY_EAST:
|
||||
case META_GRAVITY_SOUTH_EAST:
|
||||
case META_GRAVITY_NORTH_EAST:
|
||||
/* Move left edge left */
|
||||
width += width_inc;
|
||||
break;
|
||||
|
||||
case META_GRAVITY_WEST:
|
||||
case META_GRAVITY_SOUTH_WEST:
|
||||
case META_GRAVITY_NORTH_WEST:
|
||||
/* Move right edge left */
|
||||
width -= width_inc;
|
||||
break;
|
||||
|
||||
case META_GRAVITY_NORTH:
|
||||
case META_GRAVITY_SOUTH:
|
||||
case META_GRAVITY_CENTER:
|
||||
case META_GRAVITY_NONE:
|
||||
case META_GRAVITY_STATIC:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
handled = TRUE;
|
||||
break;
|
||||
|
||||
case CLUTTER_KEY_Right:
|
||||
case CLUTTER_KEY_KP_Right:
|
||||
switch (gravity)
|
||||
{
|
||||
case META_GRAVITY_EAST:
|
||||
case META_GRAVITY_SOUTH_EAST:
|
||||
case META_GRAVITY_NORTH_EAST:
|
||||
/* Move left edge right */
|
||||
width -= width_inc;
|
||||
break;
|
||||
|
||||
case META_GRAVITY_WEST:
|
||||
case META_GRAVITY_SOUTH_WEST:
|
||||
case META_GRAVITY_NORTH_WEST:
|
||||
/* Move right edge right */
|
||||
width += width_inc;
|
||||
break;
|
||||
|
||||
case META_GRAVITY_NORTH:
|
||||
case META_GRAVITY_SOUTH:
|
||||
case META_GRAVITY_CENTER:
|
||||
case META_GRAVITY_NONE:
|
||||
case META_GRAVITY_STATIC:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
handled = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* fixup hack (just paranoia, not sure it's required) */
|
||||
if (height < 1)
|
||||
height = 1;
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
|
||||
if (handled)
|
||||
{
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Computed new window size due to keypress: "
|
||||
"%dx%d, gravity %s",
|
||||
width, height, meta_gravity_to_string (gravity));
|
||||
|
||||
/* Do any edge resistance/snapping */
|
||||
meta_window_edge_resistance_for_resize (window,
|
||||
&width,
|
||||
&height,
|
||||
gravity,
|
||||
flags);
|
||||
|
||||
meta_window_resize_frame_with_gravity (window,
|
||||
TRUE,
|
||||
width,
|
||||
height,
|
||||
gravity);
|
||||
|
||||
meta_window_update_keyboard_resize (window, FALSE);
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_switch_to_last_workspace (MetaDisplay *display,
|
||||
MetaWindow *event_window,
|
||||
|
@ -519,7 +519,6 @@ struct _MetaWindow
|
||||
/* Used by keybindings.c */
|
||||
guint keys_grabbed : 1; /* normal keybindings grabbed */
|
||||
guint grab_on_frame : 1; /* grabs are on the frame */
|
||||
guint all_keys_grabbed : 1; /* AnyKey grabbed */
|
||||
|
||||
/* Set if the reason for unmanaging the window is that
|
||||
* it was withdrawn
|
||||
@ -729,9 +728,6 @@ void meta_window_show_menu_for_rect (MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
MetaRectangle *rect);
|
||||
|
||||
gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
||||
const ClutterEvent *event);
|
||||
|
||||
GList* meta_window_get_workspaces (MetaWindow *window);
|
||||
|
||||
void meta_window_get_work_area_for_logical_monitor (MetaWindow *window,
|
||||
@ -758,10 +754,6 @@ gboolean meta_window_same_application (MetaWindow *window,
|
||||
|
||||
void meta_window_free_delete_dialog (MetaWindow *window);
|
||||
|
||||
void meta_window_update_keyboard_resize (MetaWindow *window,
|
||||
gboolean update_cursor);
|
||||
void meta_window_update_keyboard_move (MetaWindow *window);
|
||||
|
||||
MetaStackLayer meta_window_get_default_layer (MetaWindow *window);
|
||||
void meta_window_update_layer (MetaWindow *window);
|
||||
|
||||
@ -850,11 +842,6 @@ cairo_surface_t * meta_window_get_mini_icon (MetaWindow *window);
|
||||
void meta_window_set_urgent (MetaWindow *window,
|
||||
gboolean urgent);
|
||||
|
||||
void meta_window_update_resize (MetaWindow *window,
|
||||
MetaEdgeResistanceFlags flags,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
void meta_window_move_resize_internal (MetaWindow *window,
|
||||
MetaMoveResizeFlags flags,
|
||||
MetaGravity gravity,
|
||||
|
@ -1086,7 +1086,6 @@ meta_window_constructed (GObject *object)
|
||||
window->unmanaging = FALSE;
|
||||
window->keys_grabbed = FALSE;
|
||||
window->grab_on_frame = FALSE;
|
||||
window->all_keys_grabbed = FALSE;
|
||||
window->withdrawn = FALSE;
|
||||
window->initial_workspace_set = FALSE;
|
||||
window->initial_timestamp_set = FALSE;
|
||||
@ -3184,17 +3183,6 @@ meta_window_unmaximize (MetaWindow *window,
|
||||
META_GRAVITY_NORTH_WEST,
|
||||
target_rect);
|
||||
|
||||
/* When we unmaximize, if we're doing a mouse move also we could
|
||||
* get the window suddenly jumping to the upper left corner of
|
||||
* the workspace, since that's where it was when the grab op
|
||||
* started. So we need to update the grab anchor position.
|
||||
*/
|
||||
if (meta_grab_op_is_moving (window->display->grab_op) &&
|
||||
window->display->grab_window == window)
|
||||
{
|
||||
window->display->grab_anchor_window_pos = target_rect;
|
||||
}
|
||||
|
||||
meta_window_recalc_features (window);
|
||||
set_net_wm_state (window);
|
||||
if (!window->monitor->in_fullscreen)
|
||||
@ -4661,8 +4649,7 @@ meta_window_focus (MetaWindow *window,
|
||||
backend = backend_from_window (window);
|
||||
stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||
|
||||
if (window->display->grab_op == META_GRAB_OP_NONE &&
|
||||
clutter_stage_get_grab_actor (stage) == NULL)
|
||||
if (clutter_stage_get_grab_actor (stage) == NULL)
|
||||
clutter_stage_set_key_focus (stage, NULL);
|
||||
|
||||
if (window->close_dialog &&
|
||||
@ -5797,590 +5784,6 @@ meta_window_titlebar_is_onscreen (MetaWindow *window)
|
||||
return is_onscreen;
|
||||
}
|
||||
|
||||
static void
|
||||
update_move_maybe_tile (MetaWindow *window,
|
||||
int shake_threshold,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
MetaBackend *backend = backend_from_window (window);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
MetaDisplay *display = window->display;
|
||||
MetaRectangle work_area;
|
||||
|
||||
/* For side-by-side tiling we are interested in the inside vertical
|
||||
* edges of the work area of the monitor where the pointer is located,
|
||||
* and in the outside top edge for maximized tiling.
|
||||
*
|
||||
* For maximized tiling we use the outside edge instead of the
|
||||
* inside edge, because we don't want to force users to maximize
|
||||
* windows they are placing near the top of their screens.
|
||||
*
|
||||
* The "current" idea of meta_window_get_work_area_current_monitor() and
|
||||
* meta_screen_get_current_monitor() is slightly different: the former
|
||||
* refers to the monitor which contains the largest part of the window,
|
||||
* the latter to the one where the pointer is located.
|
||||
*/
|
||||
logical_monitor =
|
||||
meta_monitor_manager_get_logical_monitor_at (monitor_manager, x, y);
|
||||
if (!logical_monitor)
|
||||
return;
|
||||
|
||||
meta_window_get_work_area_for_monitor (window,
|
||||
logical_monitor->number,
|
||||
&work_area);
|
||||
|
||||
/* Check if the cursor is in a position which triggers tiling
|
||||
* and set tile_mode accordingly.
|
||||
*/
|
||||
if (meta_window_can_tile_side_by_side (window) &&
|
||||
x >= logical_monitor->rect.x && x < (work_area.x + shake_threshold))
|
||||
display->preview_tile_mode = META_TILE_LEFT;
|
||||
else if (meta_window_can_tile_side_by_side (window) &&
|
||||
x >= work_area.x + work_area.width - shake_threshold &&
|
||||
x < (logical_monitor->rect.x + logical_monitor->rect.width))
|
||||
display->preview_tile_mode = META_TILE_RIGHT;
|
||||
else if (meta_window_can_tile_maximized (window) &&
|
||||
y >= logical_monitor->rect.y && y <= work_area.y)
|
||||
display->preview_tile_mode = META_TILE_MAXIMIZED;
|
||||
else
|
||||
display->preview_tile_mode = META_TILE_NONE;
|
||||
|
||||
if (display->preview_tile_mode != META_TILE_NONE)
|
||||
window->tile_monitor_number = logical_monitor->number;
|
||||
}
|
||||
|
||||
static void
|
||||
update_move (MetaWindow *window,
|
||||
MetaEdgeResistanceFlags flags,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
int dx, dy;
|
||||
int new_x, new_y;
|
||||
MetaRectangle old;
|
||||
int shake_threshold;
|
||||
MetaDisplay *display = window->display;
|
||||
|
||||
display->grab_latest_motion_x = x;
|
||||
display->grab_latest_motion_y = y;
|
||||
|
||||
meta_display_clear_grab_move_resize_later (display);
|
||||
|
||||
dx = x - display->grab_anchor_root_x;
|
||||
dy = y - display->grab_anchor_root_y;
|
||||
|
||||
new_x = display->grab_anchor_window_pos.x + dx;
|
||||
new_y = display->grab_anchor_window_pos.y + dy;
|
||||
|
||||
meta_verbose ("x,y = %d,%d anchor ptr %d,%d anchor pos %d,%d dx,dy %d,%d",
|
||||
x, y,
|
||||
display->grab_anchor_root_x,
|
||||
display->grab_anchor_root_y,
|
||||
display->grab_anchor_window_pos.x,
|
||||
display->grab_anchor_window_pos.y,
|
||||
dx, dy);
|
||||
|
||||
/* Don't bother doing anything if no move has been specified. (This
|
||||
* happens often, even in keyboard moving, due to the warping of the
|
||||
* pointer.
|
||||
*/
|
||||
if (dx == 0 && dy == 0)
|
||||
return;
|
||||
|
||||
/* Originally for detaching maximized windows, but we use this
|
||||
* for the zones at the sides of the monitor where trigger tiling
|
||||
* because it's about the right size
|
||||
*/
|
||||
#define DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR 6
|
||||
shake_threshold = meta_prefs_get_drag_threshold () *
|
||||
DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR;
|
||||
|
||||
if (flags & META_EDGE_RESISTANCE_SNAP)
|
||||
{
|
||||
/* We don't want to tile while snapping. Also, clear any previous tile
|
||||
request. */
|
||||
display->preview_tile_mode = META_TILE_NONE;
|
||||
window->tile_monitor_number = -1;
|
||||
}
|
||||
else if (meta_prefs_get_edge_tiling () &&
|
||||
!META_WINDOW_MAXIMIZED (window) &&
|
||||
!META_WINDOW_TILED_SIDE_BY_SIDE (window))
|
||||
{
|
||||
update_move_maybe_tile (window, shake_threshold, x, y);
|
||||
}
|
||||
|
||||
/* shake loose (unmaximize) maximized or tiled window if dragged beyond
|
||||
* the threshold in the Y direction. Tiled windows can also be pulled
|
||||
* loose via X motion.
|
||||
*/
|
||||
|
||||
if ((META_WINDOW_MAXIMIZED (window) && ABS (dy) >= shake_threshold) ||
|
||||
(META_WINDOW_TILED_SIDE_BY_SIDE (window) && (MAX (ABS (dx), ABS (dy)) >= shake_threshold)))
|
||||
{
|
||||
double prop;
|
||||
|
||||
/* Shake loose, so that the window snaps back to maximized
|
||||
* when dragged near the top; do not snap back if tiling
|
||||
* is enabled, as top edge tiling can be used in that case
|
||||
*/
|
||||
window->shaken_loose = !meta_prefs_get_edge_tiling ();
|
||||
window->tile_mode = META_TILE_NONE;
|
||||
|
||||
/* move the unmaximized window to the cursor */
|
||||
prop =
|
||||
((double)(x - display->grab_initial_window_pos.x)) /
|
||||
((double)display->grab_initial_window_pos.width);
|
||||
|
||||
display->grab_initial_window_pos.x = x - window->saved_rect.width * prop;
|
||||
|
||||
/* If we started dragging the window from above the top of the window,
|
||||
* pretend like we started dragging from the middle of the titlebar
|
||||
* instead, as the "correct" anchoring looks wrong. */
|
||||
if (display->grab_anchor_root_y < display->grab_initial_window_pos.y)
|
||||
{
|
||||
MetaRectangle titlebar_rect;
|
||||
meta_window_get_titlebar_rect (window, &titlebar_rect);
|
||||
display->grab_anchor_root_y = display->grab_initial_window_pos.y + titlebar_rect.height / 2;
|
||||
}
|
||||
|
||||
window->saved_rect.x = display->grab_initial_window_pos.x;
|
||||
window->saved_rect.y = display->grab_initial_window_pos.y;
|
||||
|
||||
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
|
||||
return;
|
||||
}
|
||||
|
||||
/* remaximize window on another monitor if window has been shaken
|
||||
* loose or it is still maximized (then move straight)
|
||||
*/
|
||||
else if ((window->shaken_loose || META_WINDOW_MAXIMIZED (window)) &&
|
||||
window->tile_mode != META_TILE_LEFT && window->tile_mode != META_TILE_RIGHT)
|
||||
{
|
||||
MetaBackend *backend = backend_from_window (window);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
int n_logical_monitors;
|
||||
const MetaLogicalMonitor *wmonitor;
|
||||
MetaRectangle work_area;
|
||||
int monitor;
|
||||
|
||||
window->tile_mode = META_TILE_NONE;
|
||||
wmonitor = window->monitor;
|
||||
n_logical_monitors =
|
||||
meta_monitor_manager_get_num_logical_monitors (monitor_manager);
|
||||
|
||||
for (monitor = 0; monitor < n_logical_monitors; monitor++)
|
||||
{
|
||||
meta_window_get_work_area_for_monitor (window, monitor, &work_area);
|
||||
|
||||
/* check if cursor is near the top of a monitor work area */
|
||||
if (x >= work_area.x &&
|
||||
x < (work_area.x + work_area.width) &&
|
||||
y >= work_area.y &&
|
||||
y < (work_area.y + shake_threshold))
|
||||
{
|
||||
/* move the saved rect if window will become maximized on an
|
||||
* other monitor so user isn't surprised on a later unmaximize
|
||||
*/
|
||||
if (wmonitor->number != monitor)
|
||||
{
|
||||
window->saved_rect.x = work_area.x;
|
||||
window->saved_rect.y = work_area.y;
|
||||
|
||||
if (window->frame)
|
||||
{
|
||||
window->saved_rect.x += window->frame->child_x;
|
||||
window->saved_rect.y += window->frame->child_y;
|
||||
}
|
||||
|
||||
window->unconstrained_rect.x = window->saved_rect.x;
|
||||
window->unconstrained_rect.y = window->saved_rect.y;
|
||||
|
||||
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
|
||||
|
||||
display->grab_initial_window_pos = work_area;
|
||||
display->grab_anchor_root_x = x;
|
||||
display->grab_anchor_root_y = y;
|
||||
window->shaken_loose = FALSE;
|
||||
|
||||
meta_window_maximize (window, META_MAXIMIZE_BOTH);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Delay showing the tile preview slightly to make it more unlikely to
|
||||
* trigger it unwittingly, e.g. when shaking loose the window or moving
|
||||
* it to another monitor.
|
||||
*/
|
||||
meta_display_update_tile_preview (window->display,
|
||||
window->tile_mode != META_TILE_NONE);
|
||||
|
||||
meta_window_get_frame_rect (window, &old);
|
||||
|
||||
/* Don't allow movement in the maximized directions or while tiled */
|
||||
if (window->maximized_horizontally || META_WINDOW_TILED_SIDE_BY_SIDE (window))
|
||||
new_x = old.x;
|
||||
if (window->maximized_vertically)
|
||||
new_y = old.y;
|
||||
|
||||
/* Do any edge resistance/snapping */
|
||||
meta_window_edge_resistance_for_move (window,
|
||||
&new_x,
|
||||
&new_y,
|
||||
flags);
|
||||
|
||||
meta_window_move_frame (window, TRUE, new_x, new_y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_move_cb (gpointer user_data)
|
||||
{
|
||||
MetaWindow *window = user_data;
|
||||
|
||||
window->display->grab_move_resize_later_id = 0;
|
||||
|
||||
update_move (window,
|
||||
window->display->grab_last_edge_resistance_flags,
|
||||
window->display->grab_latest_motion_x,
|
||||
window->display->grab_latest_motion_y);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
queue_update_move (MetaWindow *window,
|
||||
MetaEdgeResistanceFlags flags,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
MetaCompositor *compositor;
|
||||
MetaLaters *laters;
|
||||
|
||||
window->display->grab_last_edge_resistance_flags = flags;
|
||||
window->display->grab_latest_motion_x = x;
|
||||
window->display->grab_latest_motion_y = y;
|
||||
|
||||
if (window->display->grab_move_resize_later_id)
|
||||
return;
|
||||
|
||||
compositor = meta_display_get_compositor (window->display);
|
||||
laters = meta_compositor_get_laters (compositor);
|
||||
window->display->grab_move_resize_later_id =
|
||||
meta_laters_add (laters,
|
||||
META_LATER_BEFORE_REDRAW,
|
||||
update_move_cb,
|
||||
window, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
update_resize (MetaWindow *window,
|
||||
MetaEdgeResistanceFlags flags,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
int dx, dy;
|
||||
MetaGravity gravity;
|
||||
MetaRectangle new_rect;
|
||||
MetaRectangle old_rect;
|
||||
|
||||
window->display->grab_latest_motion_x = x;
|
||||
window->display->grab_latest_motion_y = y;
|
||||
|
||||
meta_display_clear_grab_move_resize_later (window->display);
|
||||
|
||||
dx = x - window->display->grab_anchor_root_x;
|
||||
dy = y - window->display->grab_anchor_root_y;
|
||||
|
||||
/* Attached modal dialogs are special in that size
|
||||
* changes apply to both sides, so that the dialog
|
||||
* remains centered to the parent.
|
||||
*/
|
||||
if (meta_window_is_attached_dialog (window))
|
||||
{
|
||||
dx *= 2;
|
||||
dy *= 2;
|
||||
}
|
||||
|
||||
new_rect.width = window->display->grab_anchor_window_pos.width;
|
||||
new_rect.height = window->display->grab_anchor_window_pos.height;
|
||||
|
||||
/* Don't bother doing anything if no move has been specified. (This
|
||||
* happens often, even in keyboard resizing, due to the warping of the
|
||||
* pointer.
|
||||
*/
|
||||
if (dx == 0 && dy == 0)
|
||||
return;
|
||||
|
||||
if (window->display->grab_op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN)
|
||||
{
|
||||
MetaGrabOp op = META_GRAB_OP_WINDOW_BASE | META_GRAB_OP_WINDOW_FLAG_KEYBOARD;
|
||||
|
||||
if (dx > 0)
|
||||
op |= META_GRAB_OP_WINDOW_DIR_EAST;
|
||||
else if (dx < 0)
|
||||
op |= META_GRAB_OP_WINDOW_DIR_WEST;
|
||||
|
||||
if (dy > 0)
|
||||
op |= META_GRAB_OP_WINDOW_DIR_SOUTH;
|
||||
else if (dy < 0)
|
||||
op |= META_GRAB_OP_WINDOW_DIR_NORTH;
|
||||
|
||||
window->display->grab_op = op;
|
||||
|
||||
meta_window_update_keyboard_resize (window, TRUE);
|
||||
}
|
||||
|
||||
if (window->display->grab_op & META_GRAB_OP_WINDOW_DIR_EAST)
|
||||
new_rect.width += dx;
|
||||
else if (window->display->grab_op & META_GRAB_OP_WINDOW_DIR_WEST)
|
||||
new_rect.width -= dx;
|
||||
|
||||
if (window->display->grab_op & META_GRAB_OP_WINDOW_DIR_SOUTH)
|
||||
new_rect.height += dy;
|
||||
else if (window->display->grab_op & META_GRAB_OP_WINDOW_DIR_NORTH)
|
||||
new_rect.height -= dy;
|
||||
|
||||
meta_window_maybe_apply_size_hints (window, &new_rect);
|
||||
|
||||
/* If we're waiting for a request for _NET_WM_SYNC_REQUEST, we'll
|
||||
* resize the window when the window responds, or when we time
|
||||
* the response out.
|
||||
*/
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
|
||||
meta_window_x11_is_awaiting_sync_response (window))
|
||||
return;
|
||||
|
||||
meta_window_get_frame_rect (window, &old_rect);
|
||||
|
||||
/* One sided resizing ought to actually be one-sided, despite the fact that
|
||||
* aspect ratio windows don't interact nicely with the above stuff. So,
|
||||
* to avoid some nasty flicker, we enforce that.
|
||||
*/
|
||||
|
||||
if ((window->display->grab_op & (META_GRAB_OP_WINDOW_DIR_WEST | META_GRAB_OP_WINDOW_DIR_EAST)) == 0)
|
||||
new_rect.width = old_rect.width;
|
||||
|
||||
if ((window->display->grab_op & (META_GRAB_OP_WINDOW_DIR_NORTH | META_GRAB_OP_WINDOW_DIR_SOUTH)) == 0)
|
||||
new_rect.height = old_rect.height;
|
||||
|
||||
/* compute gravity of client during operation */
|
||||
gravity = meta_resize_gravity_from_grab_op (window->display->grab_op);
|
||||
g_assert (gravity >= 0);
|
||||
|
||||
/* Do any edge resistance/snapping */
|
||||
meta_window_edge_resistance_for_resize (window,
|
||||
&new_rect.width,
|
||||
&new_rect.height,
|
||||
gravity,
|
||||
flags);
|
||||
|
||||
meta_window_resize_frame_with_gravity (window, TRUE,
|
||||
new_rect.width, new_rect.height,
|
||||
gravity);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_resize_cb (gpointer user_data)
|
||||
{
|
||||
MetaWindow *window = user_data;
|
||||
|
||||
window->display->grab_move_resize_later_id = 0;
|
||||
|
||||
update_resize (window,
|
||||
window->display->grab_last_edge_resistance_flags,
|
||||
window->display->grab_latest_motion_x,
|
||||
window->display->grab_latest_motion_y);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
queue_update_resize (MetaWindow *window,
|
||||
MetaEdgeResistanceFlags flags,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
MetaCompositor *compositor;
|
||||
MetaLaters *laters;
|
||||
|
||||
window->display->grab_last_edge_resistance_flags = flags;
|
||||
window->display->grab_latest_motion_x = x;
|
||||
window->display->grab_latest_motion_y = y;
|
||||
|
||||
if (window->display->grab_move_resize_later_id)
|
||||
return;
|
||||
|
||||
compositor = meta_display_get_compositor (window->display);
|
||||
laters = meta_compositor_get_laters (compositor);
|
||||
window->display->grab_move_resize_later_id =
|
||||
meta_laters_add (laters,
|
||||
META_LATER_BEFORE_REDRAW,
|
||||
update_resize_cb,
|
||||
window, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_maximize_tiled_window (MetaWindow *window)
|
||||
{
|
||||
MetaRectangle work_area;
|
||||
gint shake_threshold;
|
||||
|
||||
if (!META_WINDOW_TILED_SIDE_BY_SIDE (window))
|
||||
return;
|
||||
|
||||
shake_threshold = meta_prefs_get_drag_threshold ();
|
||||
|
||||
meta_window_get_work_area_for_monitor (window,
|
||||
window->tile_monitor_number,
|
||||
&work_area);
|
||||
if (window->rect.width >= work_area.width - shake_threshold)
|
||||
meta_window_maximize (window, META_MAXIMIZE_BOTH);
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_update_resize (MetaWindow *window,
|
||||
MetaEdgeResistanceFlags flags,
|
||||
int x, int y)
|
||||
{
|
||||
update_resize (window, flags, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
end_grab_op (MetaWindow *window,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
ClutterModifierType modifiers;
|
||||
MetaEdgeResistanceFlags last_flags;
|
||||
gfloat x, y;
|
||||
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
modifiers = clutter_event_get_state (event);
|
||||
meta_display_check_threshold_reached (window->display, x, y);
|
||||
|
||||
/* If the user was snap moving then ignore the button
|
||||
* release because they may have let go of shift before
|
||||
* releasing the mouse button and they almost certainly do
|
||||
* not want a non-snapped movement to occur from the button
|
||||
* release.
|
||||
*/
|
||||
last_flags = window->display->grab_last_edge_resistance_flags;
|
||||
if ((last_flags & META_EDGE_RESISTANCE_SNAP) == 0)
|
||||
{
|
||||
MetaEdgeResistanceFlags flags = META_EDGE_RESISTANCE_DEFAULT;
|
||||
|
||||
if (modifiers & CLUTTER_SHIFT_MASK)
|
||||
flags |= META_EDGE_RESISTANCE_SNAP;
|
||||
|
||||
if (modifiers & CLUTTER_CONTROL_MASK)
|
||||
flags |= META_EDGE_RESISTANCE_WINDOWS;
|
||||
|
||||
if (meta_grab_op_is_moving (window->display->grab_op))
|
||||
{
|
||||
if (window->display->preview_tile_mode != META_TILE_NONE)
|
||||
meta_window_tile (window, window->display->preview_tile_mode);
|
||||
else
|
||||
update_move (window, flags, x, y);
|
||||
}
|
||||
else if (meta_grab_op_is_resizing (window->display->grab_op))
|
||||
{
|
||||
if (window->tile_match != NULL)
|
||||
flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS);
|
||||
|
||||
update_resize (window, flags, x, y);
|
||||
maybe_maximize_tiled_window (window);
|
||||
}
|
||||
}
|
||||
window->display->preview_tile_mode = META_TILE_NONE;
|
||||
meta_display_end_grab_op (window->display, clutter_event_get_time (event));
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
||||
ClutterModifierType modifier_state;
|
||||
MetaEdgeResistanceFlags flags;
|
||||
gfloat x, y;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case CLUTTER_TOUCH_BEGIN:
|
||||
if (!meta_display_is_pointer_emulating_sequence (window->display, sequence))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
{
|
||||
/* This is the keybinding or menu case where we've
|
||||
* been dragging around the window without the button
|
||||
* pressed, or the case of pressing extra mouse buttons
|
||||
* while a grab op is ongoing.
|
||||
*/
|
||||
end_grab_op (window, event);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
case CLUTTER_TOUCH_END:
|
||||
if (!meta_display_is_pointer_emulating_sequence (window->display, sequence))
|
||||
return FALSE;
|
||||
|
||||
end_grab_op (window, event);
|
||||
return TRUE;
|
||||
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
if (event->button.button == 1 ||
|
||||
event->button.button == (unsigned int) meta_prefs_get_mouse_button_resize ())
|
||||
end_grab_op (window, event);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case CLUTTER_TOUCH_UPDATE:
|
||||
if (!meta_display_is_pointer_emulating_sequence (window->display, sequence))
|
||||
return FALSE;
|
||||
|
||||
/* Fall through */
|
||||
case CLUTTER_MOTION:
|
||||
modifier_state = clutter_event_get_state (event);
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
flags = META_EDGE_RESISTANCE_DEFAULT;
|
||||
|
||||
if (modifier_state & CLUTTER_SHIFT_MASK)
|
||||
flags |= META_EDGE_RESISTANCE_SNAP;
|
||||
|
||||
if (modifier_state & CLUTTER_CONTROL_MASK)
|
||||
flags |= META_EDGE_RESISTANCE_WINDOWS;
|
||||
|
||||
meta_display_check_threshold_reached (window->display, x, y);
|
||||
if (meta_grab_op_is_moving (window->display->grab_op))
|
||||
{
|
||||
queue_update_move (window, flags, x, y);
|
||||
}
|
||||
else if (meta_grab_op_is_resizing (window->display->grab_op))
|
||||
{
|
||||
if (window->tile_match != NULL)
|
||||
flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS);
|
||||
|
||||
queue_update_resize (window, flags, x, y);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case CLUTTER_TOUCH_CANCEL:
|
||||
end_grab_op (window, event);
|
||||
return FALSE;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_get_work_area_for_logical_monitor (MetaWindow *window,
|
||||
MetaLogicalMonitor *logical_monitor,
|
||||
@ -6683,72 +6086,6 @@ meta_window_is_ancestor_of_transient (MetaWindow *window,
|
||||
return d.found;
|
||||
}
|
||||
|
||||
/* Warp pointer to location appropriate for grab,
|
||||
* return root coordinates where pointer ended up.
|
||||
*/
|
||||
static gboolean
|
||||
warp_grab_pointer (MetaWindow *window,
|
||||
MetaGrabOp grab_op,
|
||||
int *x,
|
||||
int *y)
|
||||
{
|
||||
MetaRectangle rect;
|
||||
MetaRectangle display_rect = { 0 };
|
||||
MetaDisplay *display;
|
||||
ClutterSeat *seat;
|
||||
|
||||
display = window->display;
|
||||
meta_display_get_size (display,
|
||||
&display_rect.width,
|
||||
&display_rect.height);
|
||||
|
||||
/* We may not have done begin_grab_op yet, i.e. may not be in a grab
|
||||
*/
|
||||
|
||||
meta_window_get_frame_rect (window, &rect);
|
||||
|
||||
if (grab_op & META_GRAB_OP_WINDOW_DIR_WEST)
|
||||
*x = 0;
|
||||
else if (grab_op & META_GRAB_OP_WINDOW_DIR_EAST)
|
||||
*x = rect.width - 1;
|
||||
else
|
||||
*x = rect.width / 2;
|
||||
|
||||
if (grab_op & META_GRAB_OP_WINDOW_DIR_NORTH)
|
||||
*y = 0;
|
||||
else if (grab_op & META_GRAB_OP_WINDOW_DIR_SOUTH)
|
||||
*y = rect.height - 1;
|
||||
else
|
||||
*y = rect.height / 2;
|
||||
|
||||
*x += rect.x;
|
||||
*y += rect.y;
|
||||
|
||||
/* Avoid weird bouncing at the screen edge; see bug 154706 */
|
||||
*x = CLAMP (*x, 0, display_rect.width - 1);
|
||||
*y = CLAMP (*y, 0, display_rect.height - 1);
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Warping pointer to %d,%d with window at %d,%d",
|
||||
*x, *y, rect.x, rect.y);
|
||||
|
||||
/* Need to update the grab positions so that the MotionNotify and other
|
||||
* events generated by the XWarpPointer() call below don't cause complete
|
||||
* funkiness. See bug 124582 and bug 122670.
|
||||
*/
|
||||
display->grab_anchor_root_x = *x;
|
||||
display->grab_anchor_root_y = *y;
|
||||
display->grab_latest_motion_x = *x;
|
||||
display->grab_latest_motion_y = *y;
|
||||
meta_window_get_frame_rect (window,
|
||||
&display->grab_anchor_window_pos);
|
||||
|
||||
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||
clutter_seat_warp_pointer (seat, *x, *y);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_begin_grab_op (MetaWindow *window,
|
||||
MetaGrabOp op,
|
||||
@ -6759,30 +6096,6 @@ meta_window_begin_grab_op (MetaWindow *window,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_update_keyboard_resize (MetaWindow *window,
|
||||
gboolean update_cursor)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
warp_grab_pointer (window,
|
||||
window->display->grab_op,
|
||||
&x, &y);
|
||||
|
||||
if (update_cursor)
|
||||
meta_display_update_cursor (window->display);
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_update_keyboard_move (MetaWindow *window)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
warp_grab_pointer (window,
|
||||
window->display->grab_op,
|
||||
&x, &y);
|
||||
}
|
||||
|
||||
MetaStackLayer
|
||||
meta_window_get_default_layer (MetaWindow *window)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user