Commit d79a571d authored by Carlo Wood's avatar Carlo Wood Committed by Elijah Newren
Browse files

Fix cases when titlebar is allowed offscreen and shouldn't be (and

2006-10-13  Carlo Wood <carlo@alinoe.com>

	Fix cases when titlebar is allowed offscreen and shouldn't be (and
	vice-versa).  #333995.

	* src/display.[ch] (struct _MetaDisplay): add grab_frame_action
	member

	* src/display.[ch] (meta_display_begin_grab_op):
	* src/window.[ch] (meta_window_begin_grab_op):
	* src/core.[ch] (meta_core_begin_grab_op):
	Add frame_action parameter (core & window versions pass it on to
	display)

	* src/display.c (event_callback):
	* src/window.c (meta_window_begin_grab_op,
	  meta_window_client_message, menu_callback):
	* frames.c (meta_frames_button_press_event):
	* keybindings.c (do_choose_window, handle_begin_move,
	  handle_begin_resize, handle_workspace_switch):
	Pass whether the action should be considered a 'frame_action',
	which will be used to determine whether to force the titlebar to
	remain onscreen, to meta_*_begin_grab_op

	* constraints.c (constrain_titlebar_visible):
	Replace previous ugly hack by using grab_frame_action (and whether
	the action is a user action) to determine whether to enforce the
	titlebar_visible constraint.
parent a34944d3
2006-10-13 Carlo Wood <carlo@alinoe.com>
Fix cases when titlebar is allowed offscreen and shouldn't be (and
vice-versa). #333995.
* src/display.[ch] (struct _MetaDisplay): add grab_frame_action
member
* src/display.[ch] (meta_display_begin_grab_op):
* src/window.[ch] (meta_window_begin_grab_op):
* src/core.[ch] (meta_core_begin_grab_op):
Add frame_action parameter (core & window versions pass it on to
display)
* src/display.c (event_callback):
* src/window.c (meta_window_begin_grab_op,
meta_window_client_message, menu_callback):
* frames.c (meta_frames_button_press_event):
* keybindings.c (do_choose_window, handle_begin_move,
handle_begin_resize, handle_workspace_switch):
Pass whether the action should be considered a 'frame_action',
which will be used to determine whether to force the titlebar to
remain onscreen, to meta_*_begin_grab_op
* constraints.c (constrain_titlebar_visible):
Replace previous ugly hack by using grab_frame_action (and whether
the action is a user action) to determine whether to enforce the
titlebar_visible constraint.
2006-10-10 Elijah Newren <newren gmail com>
* src/draw-workspace.c (draw_window, wnck_draw_workspace): Patch
......
......@@ -1125,13 +1125,10 @@ constrain_titlebar_visible (MetaWindow *window,
return TRUE;
/* Allow the titlebar beyond the top of the screen only if the user wasn't
* clicking on the titlebar to start the move.
* FIXME: This is kind of a hack; nearly as ugly as the old infinite edge
* resistance.
* clicking on the frame to start the move.
*/
unconstrained_user_action =
info->is_user_action &&
window->display->grab_anchor_root_y >= window->display->grab_initial_window_pos.y;
info->is_user_action && !window->display->grab_frame_action;
/* Exit early if we know the constraint won't apply--note that this constraint
* is only meant for normal windows (e.g. we don't want docks to be shoved
......
......@@ -630,6 +630,7 @@ meta_core_begin_grab_op (Display *xdisplay,
Window frame_xwindow,
MetaGrabOp op,
gboolean pointer_already_grabbed,
gboolean frame_action,
int event_serial,
int button,
gulong modmask,
......@@ -648,6 +649,7 @@ meta_core_begin_grab_op (Display *xdisplay,
return meta_display_begin_grab_op (display, screen, window,
op, pointer_already_grabbed,
frame_action,
event_serial,
button, modmask,
timestamp, root_x, root_y);
......
......@@ -150,6 +150,7 @@ gboolean meta_core_begin_grab_op (Display *xdisplay,
Window frame_xwindow,
MetaGrabOp op,
gboolean pointer_already_grabbed,
gboolean frame_action,
int event_serial,
int button,
gulong modmask,
......
......@@ -1738,6 +1738,7 @@ event_callback (XEvent *event,
window,
op,
TRUE,
FALSE,
event->xbutton.serial,
event->xbutton.button,
0,
......@@ -1795,6 +1796,7 @@ event_callback (XEvent *event,
window,
META_GRAB_OP_MOVING,
TRUE,
FALSE,
event->xbutton.serial,
event->xbutton.button,
0,
......@@ -3263,6 +3265,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
MetaWindow *window,
MetaGrabOp op,
gboolean pointer_already_grabbed,
gboolean frame_action,
int event_serial,
int button,
gulong modmask,
......@@ -3380,7 +3383,8 @@ meta_display_begin_grab_op (MetaDisplay *display,
display->grab_last_user_action_was_snap = FALSE;
#endif
display->grab_was_cancelled = FALSE;
display->grab_frame_action = frame_action;
if (display->grab_resize_timeout_id)
{
g_source_remove (display->grab_resize_timeout_id);
......
......@@ -264,6 +264,7 @@ struct _MetaDisplay
guint grab_have_keyboard : 1;
guint grab_wireframe_active : 1;
guint grab_was_cancelled : 1; /* Only used in wireframe mode */
guint grab_frame_action : 1;
MetaRectangle grab_wireframe_rect;
MetaRectangle grab_wireframe_last_xor_rect;
MetaRectangle grab_initial_window_pos;
......@@ -446,6 +447,7 @@ gboolean meta_display_begin_grab_op (MetaDisplay *display,
MetaWindow *window,
MetaGrabOp op,
gboolean pointer_already_grabbed,
gboolean frame_action,
int event_serial,
int button,
gulong modmask,
......
......@@ -1351,6 +1351,7 @@ meta_frames_button_press_event (GtkWidget *widget,
frame->xwindow,
op,
TRUE,
TRUE,
meta_ui_get_last_event_serial (gdk_display),
event->button,
0,
......@@ -1441,6 +1442,7 @@ meta_frames_button_press_event (GtkWidget *widget,
frame->xwindow,
op,
TRUE,
TRUE,
meta_ui_get_last_event_serial (gdk_display),
event->button,
0,
......@@ -1461,6 +1463,7 @@ meta_frames_button_press_event (GtkWidget *widget,
frame->xwindow,
META_GRAB_OP_MOVING,
TRUE,
TRUE,
meta_ui_get_last_event_serial (gdk_display),
event->button,
0,
......
......@@ -3122,6 +3122,7 @@ do_choose_window (MetaDisplay *display,
tab_op_from_tab_type (type) :
cycle_op_from_tab_type (type),
FALSE,
FALSE,
event->xkey.serial,
0,
binding->mask,
......@@ -3343,6 +3344,7 @@ handle_begin_move (MetaDisplay *display,
{
meta_window_begin_grab_op (window,
META_GRAB_OP_KEYBOARD_MOVING,
FALSE,
event->xkey.time);
}
}
......@@ -3358,6 +3360,7 @@ handle_begin_resize (MetaDisplay *display,
{
meta_window_begin_grab_op (window,
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
FALSE,
event->xkey.time);
}
}
......@@ -3555,6 +3558,7 @@ handle_workspace_switch (MetaDisplay *display,
NULL,
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
FALSE,
FALSE,
event->xkey.serial,
0,
grab_mask,
......
......@@ -4733,6 +4733,13 @@ meta_window_client_message (MetaWindow *window,
MetaGrabOp op;
int button;
guint32 timestamp;
/* _NET_WM_MOVERESIZE messages are almost certainly going to come from
* clients when users click on the fake "frame" that the client has,
* thus we should also treat such messages as though it were a
* "frame action".
*/
gboolean const frame_action = TRUE;
x_root = event->xclient.data.l[0];
y_root = event->xclient.data.l[1];
......@@ -4793,7 +4800,7 @@ meta_window_client_message (MetaWindow *window,
((window->has_move_func && op == META_GRAB_OP_KEYBOARD_MOVING) ||
(window->has_resize_func && op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN)))
{
meta_window_begin_grab_op (window, op, timestamp);
meta_window_begin_grab_op (window, op, frame_action, timestamp);
}
else if (op != META_GRAB_OP_NONE &&
((window->has_move_func && op == META_GRAB_OP_MOVING) ||
......@@ -4841,7 +4848,9 @@ meta_window_client_message (MetaWindow *window,
window->screen,
window,
op,
FALSE, 0 /* event_serial */,
FALSE,
frame_action,
0 /* event_serial */,
button, 0,
timestamp,
x_root,
......@@ -6228,12 +6237,14 @@ menu_callback (MetaWindowMenu *menu,
case META_MENU_OP_MOVE:
meta_window_begin_grab_op (window,
META_GRAB_OP_KEYBOARD_MOVING,
TRUE,
timestamp);
break;
case META_MENU_OP_RESIZE:
meta_window_begin_grab_op (window,
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
TRUE,
timestamp);
break;
......@@ -7640,6 +7651,7 @@ warp_grab_pointer (MetaWindow *window,
void
meta_window_begin_grab_op (MetaWindow *window,
MetaGrabOp op,
gboolean frame_action,
guint32 timestamp)
{
int x, y;
......@@ -7655,6 +7667,7 @@ meta_window_begin_grab_op (MetaWindow *window,
window,
op,
FALSE,
frame_action,
grab_start_serial /* event_serial */,
0 /* button */,
0,
......
......@@ -580,6 +580,7 @@ MetaWindow* meta_window_find_root_ancestor (MetaWindow *window);
void meta_window_begin_grab_op (MetaWindow *window,
MetaGrabOp op,
gboolean frame_action,
guint32 timestamp);
void meta_window_update_keyboard_resize (MetaWindow *window,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment