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.
This commit is contained in:
Carlo Wood 2006-10-13 00:28:34 +00:00 committed by Elijah Newren
parent a34944d341
commit d79a571d0a
10 changed files with 64 additions and 8 deletions

View File

@ -1,3 +1,32 @@
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> 2006-10-10 Elijah Newren <newren gmail com>
* src/draw-workspace.c (draw_window, wnck_draw_workspace): Patch * src/draw-workspace.c (draw_window, wnck_draw_workspace): Patch

View File

@ -1125,13 +1125,10 @@ constrain_titlebar_visible (MetaWindow *window,
return TRUE; return TRUE;
/* Allow the titlebar beyond the top of the screen only if the user wasn't /* Allow the titlebar beyond the top of the screen only if the user wasn't
* clicking on the titlebar to start the move. * clicking on the frame to start the move.
* FIXME: This is kind of a hack; nearly as ugly as the old infinite edge
* resistance.
*/ */
unconstrained_user_action = unconstrained_user_action =
info->is_user_action && info->is_user_action && !window->display->grab_frame_action;
window->display->grab_anchor_root_y >= window->display->grab_initial_window_pos.y;
/* Exit early if we know the constraint won't apply--note that this constraint /* 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 * is only meant for normal windows (e.g. we don't want docks to be shoved

View File

@ -630,6 +630,7 @@ meta_core_begin_grab_op (Display *xdisplay,
Window frame_xwindow, Window frame_xwindow,
MetaGrabOp op, MetaGrabOp op,
gboolean pointer_already_grabbed, gboolean pointer_already_grabbed,
gboolean frame_action,
int event_serial, int event_serial,
int button, int button,
gulong modmask, gulong modmask,
@ -648,6 +649,7 @@ meta_core_begin_grab_op (Display *xdisplay,
return meta_display_begin_grab_op (display, screen, window, return meta_display_begin_grab_op (display, screen, window,
op, pointer_already_grabbed, op, pointer_already_grabbed,
frame_action,
event_serial, event_serial,
button, modmask, button, modmask,
timestamp, root_x, root_y); timestamp, root_x, root_y);

View File

@ -150,6 +150,7 @@ gboolean meta_core_begin_grab_op (Display *xdisplay,
Window frame_xwindow, Window frame_xwindow,
MetaGrabOp op, MetaGrabOp op,
gboolean pointer_already_grabbed, gboolean pointer_already_grabbed,
gboolean frame_action,
int event_serial, int event_serial,
int button, int button,
gulong modmask, gulong modmask,

View File

@ -1738,6 +1738,7 @@ event_callback (XEvent *event,
window, window,
op, op,
TRUE, TRUE,
FALSE,
event->xbutton.serial, event->xbutton.serial,
event->xbutton.button, event->xbutton.button,
0, 0,
@ -1795,6 +1796,7 @@ event_callback (XEvent *event,
window, window,
META_GRAB_OP_MOVING, META_GRAB_OP_MOVING,
TRUE, TRUE,
FALSE,
event->xbutton.serial, event->xbutton.serial,
event->xbutton.button, event->xbutton.button,
0, 0,
@ -3263,6 +3265,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,
MetaGrabOp op, MetaGrabOp op,
gboolean pointer_already_grabbed, gboolean pointer_already_grabbed,
gboolean frame_action,
int event_serial, int event_serial,
int button, int button,
gulong modmask, gulong modmask,
@ -3380,7 +3383,8 @@ meta_display_begin_grab_op (MetaDisplay *display,
display->grab_last_user_action_was_snap = FALSE; display->grab_last_user_action_was_snap = FALSE;
#endif #endif
display->grab_was_cancelled = FALSE; display->grab_was_cancelled = FALSE;
display->grab_frame_action = frame_action;
if (display->grab_resize_timeout_id) if (display->grab_resize_timeout_id)
{ {
g_source_remove (display->grab_resize_timeout_id); g_source_remove (display->grab_resize_timeout_id);

View File

@ -264,6 +264,7 @@ struct _MetaDisplay
guint grab_have_keyboard : 1; guint grab_have_keyboard : 1;
guint grab_wireframe_active : 1; guint grab_wireframe_active : 1;
guint grab_was_cancelled : 1; /* Only used in wireframe mode */ guint grab_was_cancelled : 1; /* Only used in wireframe mode */
guint grab_frame_action : 1;
MetaRectangle grab_wireframe_rect; MetaRectangle grab_wireframe_rect;
MetaRectangle grab_wireframe_last_xor_rect; MetaRectangle grab_wireframe_last_xor_rect;
MetaRectangle grab_initial_window_pos; MetaRectangle grab_initial_window_pos;
@ -446,6 +447,7 @@ gboolean meta_display_begin_grab_op (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,
MetaGrabOp op, MetaGrabOp op,
gboolean pointer_already_grabbed, gboolean pointer_already_grabbed,
gboolean frame_action,
int event_serial, int event_serial,
int button, int button,
gulong modmask, gulong modmask,

View File

@ -1351,6 +1351,7 @@ meta_frames_button_press_event (GtkWidget *widget,
frame->xwindow, frame->xwindow,
op, op,
TRUE, TRUE,
TRUE,
meta_ui_get_last_event_serial (gdk_display), meta_ui_get_last_event_serial (gdk_display),
event->button, event->button,
0, 0,
@ -1441,6 +1442,7 @@ meta_frames_button_press_event (GtkWidget *widget,
frame->xwindow, frame->xwindow,
op, op,
TRUE, TRUE,
TRUE,
meta_ui_get_last_event_serial (gdk_display), meta_ui_get_last_event_serial (gdk_display),
event->button, event->button,
0, 0,
@ -1461,6 +1463,7 @@ meta_frames_button_press_event (GtkWidget *widget,
frame->xwindow, frame->xwindow,
META_GRAB_OP_MOVING, META_GRAB_OP_MOVING,
TRUE, TRUE,
TRUE,
meta_ui_get_last_event_serial (gdk_display), meta_ui_get_last_event_serial (gdk_display),
event->button, event->button,
0, 0,

View File

@ -3122,6 +3122,7 @@ do_choose_window (MetaDisplay *display,
tab_op_from_tab_type (type) : tab_op_from_tab_type (type) :
cycle_op_from_tab_type (type), cycle_op_from_tab_type (type),
FALSE, FALSE,
FALSE,
event->xkey.serial, event->xkey.serial,
0, 0,
binding->mask, binding->mask,
@ -3343,6 +3344,7 @@ handle_begin_move (MetaDisplay *display,
{ {
meta_window_begin_grab_op (window, meta_window_begin_grab_op (window,
META_GRAB_OP_KEYBOARD_MOVING, META_GRAB_OP_KEYBOARD_MOVING,
FALSE,
event->xkey.time); event->xkey.time);
} }
} }
@ -3358,6 +3360,7 @@ handle_begin_resize (MetaDisplay *display,
{ {
meta_window_begin_grab_op (window, meta_window_begin_grab_op (window,
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN, META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
FALSE,
event->xkey.time); event->xkey.time);
} }
} }
@ -3555,6 +3558,7 @@ handle_workspace_switch (MetaDisplay *display,
NULL, NULL,
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING, META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
FALSE, FALSE,
FALSE,
event->xkey.serial, event->xkey.serial,
0, 0,
grab_mask, grab_mask,

View File

@ -4733,6 +4733,13 @@ meta_window_client_message (MetaWindow *window,
MetaGrabOp op; MetaGrabOp op;
int button; int button;
guint32 timestamp; 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]; x_root = event->xclient.data.l[0];
y_root = event->xclient.data.l[1]; 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_move_func && op == META_GRAB_OP_KEYBOARD_MOVING) ||
(window->has_resize_func && op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN))) (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 && else if (op != META_GRAB_OP_NONE &&
((window->has_move_func && op == META_GRAB_OP_MOVING) || ((window->has_move_func && op == META_GRAB_OP_MOVING) ||
@ -4841,7 +4848,9 @@ meta_window_client_message (MetaWindow *window,
window->screen, window->screen,
window, window,
op, op,
FALSE, 0 /* event_serial */, FALSE,
frame_action,
0 /* event_serial */,
button, 0, button, 0,
timestamp, timestamp,
x_root, x_root,
@ -6228,12 +6237,14 @@ menu_callback (MetaWindowMenu *menu,
case META_MENU_OP_MOVE: case META_MENU_OP_MOVE:
meta_window_begin_grab_op (window, meta_window_begin_grab_op (window,
META_GRAB_OP_KEYBOARD_MOVING, META_GRAB_OP_KEYBOARD_MOVING,
TRUE,
timestamp); timestamp);
break; break;
case META_MENU_OP_RESIZE: case META_MENU_OP_RESIZE:
meta_window_begin_grab_op (window, meta_window_begin_grab_op (window,
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN, META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
TRUE,
timestamp); timestamp);
break; break;
@ -7640,6 +7651,7 @@ warp_grab_pointer (MetaWindow *window,
void void
meta_window_begin_grab_op (MetaWindow *window, meta_window_begin_grab_op (MetaWindow *window,
MetaGrabOp op, MetaGrabOp op,
gboolean frame_action,
guint32 timestamp) guint32 timestamp)
{ {
int x, y; int x, y;
@ -7655,6 +7667,7 @@ meta_window_begin_grab_op (MetaWindow *window,
window, window,
op, op,
FALSE, FALSE,
frame_action,
grab_start_serial /* event_serial */, grab_start_serial /* event_serial */,
0 /* button */, 0 /* button */,
0, 0,

View File

@ -580,6 +580,7 @@ MetaWindow* meta_window_find_root_ancestor (MetaWindow *window);
void meta_window_begin_grab_op (MetaWindow *window, void meta_window_begin_grab_op (MetaWindow *window,
MetaGrabOp op, MetaGrabOp op,
gboolean frame_action,
guint32 timestamp); guint32 timestamp);
void meta_window_update_keyboard_resize (MetaWindow *window, void meta_window_update_keyboard_resize (MetaWindow *window,