diff --git a/ChangeLog b/ChangeLog index 18128dc64..570b9a5bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2006-10-13 Carlo Wood + + 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 * src/draw-workspace.c (draw_window, wnck_draw_workspace): Patch diff --git a/src/constraints.c b/src/constraints.c index 96bdf4912..c6044ef4c 100644 --- a/src/constraints.c +++ b/src/constraints.c @@ -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 diff --git a/src/core.c b/src/core.c index 832e0b3ef..be3dc4d78 100644 --- a/src/core.c +++ b/src/core.c @@ -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); diff --git a/src/core.h b/src/core.h index 1f0f1825f..5cb60337c 100644 --- a/src/core.h +++ b/src/core.h @@ -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, diff --git a/src/display.c b/src/display.c index 9aa9d1d3c..754f01927 100644 --- a/src/display.c +++ b/src/display.c @@ -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); diff --git a/src/display.h b/src/display.h index 8973159ac..1d837a4ff 100644 --- a/src/display.h +++ b/src/display.h @@ -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, diff --git a/src/frames.c b/src/frames.c index a2971dec5..d5ccb6a34 100644 --- a/src/frames.c +++ b/src/frames.c @@ -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, diff --git a/src/keybindings.c b/src/keybindings.c index 102af63e9..22547a0c1 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -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, diff --git a/src/window.c b/src/window.c index 2cba81788..61170f48e 100644 --- a/src/window.c +++ b/src/window.c @@ -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, diff --git a/src/window.h b/src/window.h index e33f3e0d9..580b8cbed 100644 --- a/src/window.h +++ b/src/window.h @@ -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,