From 282b52d6b7c5675d49e113073af3f66bbaadd8b8 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 14 Oct 2001 04:11:42 +0000 Subject: [PATCH] only handle events here if the modmask from our button grab is active. 2001-10-14 Havoc Pennington * src/display.c (event_callback): only handle events here if the modmask from our button grab is active. i.e. only the Alt-click is handled here. * src/frames.c: add check for whether button presses are in the frame client area before handling them, so we don't weirdly let you move a frame by clicking in its client area if the client hasn't selected button press events. --- ChangeLog | 11 +++++++++++ src/display.c | 23 +++++++++++++++++++---- src/frames.c | 21 ++++++++++++++++++--- src/frames.h | 3 ++- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 61e2f2fa5..768ea1e49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2001-10-14 Havoc Pennington + + * src/display.c (event_callback): only handle events here if + the modmask from our button grab is active. i.e. only the + Alt-click is handled here. + + * src/frames.c: add check for whether button presses are in the + frame client area before handling them, so we don't weirdly let + you move a frame by clicking in its client area if the client + hasn't selected button press events. + 2001-10-13 Havoc Pennington * src/stack.c (meta_stack_sync_to_server): set last window before diff --git a/src/display.c b/src/display.c index c3e80e89e..de548c733 100644 --- a/src/display.c +++ b/src/display.c @@ -693,15 +693,25 @@ event_callback (XEvent *event, else if (window && display->grab_op == META_GRAB_OP_NONE) { gboolean begin_move = FALSE; + guint grab_mask; + + grab_mask = Mod1Mask; + if (g_getenv ("METACITY_DEBUG_BUTTON_GRABS")) + grab_mask |= ControlMask; - if (event->xbutton.button == 1) + if ((event->xbutton.state & grab_mask) == 0) + { + ; /* nothing, not getting event from our button grabs, + * rather from a client that just let button presses + * pass through to our frame + */ + } + else if (event->xbutton.button == 1) { meta_window_raise (window); meta_window_focus (window, event->xbutton.time); - /* frames.c handles it if frame was receiver */ - if (!frame_was_receiver) - begin_move = TRUE; + begin_move = TRUE; } else if (event->xbutton.button == 2) { @@ -1600,6 +1610,11 @@ meta_display_grab_window_buttons (MetaDisplay *display, { int result; + /* Note: changing the modifier for this keybinding also + * requires a change to the button press handling + * in the display event handler + */ + meta_error_trap_push (display); XGrabButton (display->xdisplay, i, Mod1Mask, xwindow, False, diff --git a/src/frames.c b/src/frames.c index 6af4ecd14..7e1c38b98 100644 --- a/src/frames.c +++ b/src/frames.c @@ -81,7 +81,7 @@ struct _MetaFrameGeometry GdkRectangle min_rect; GdkRectangle spacer_rect; GdkRectangle menu_rect; - GdkRectangle title_rect; + GdkRectangle title_rect; }; static void meta_frames_class_init (MetaFramesClass *klass); @@ -496,6 +496,12 @@ meta_frames_calc_geometry (MetaFrames *frames, props = *(frames->props); + /* FIXME this is totally broken - the w/h here are the size of the + * frame xwindow, which is computed from the size the frame wants to + * be, which we are currently computing - stuff just happens to work + * now because we always go through this codepath twice, or don't + * really use these values, or something. + */ meta_core_get_frame_size (gdk_display, frame->xwindow, &width, &height); @@ -910,7 +916,9 @@ show_tip_now (MetaFrames *frames) break; case META_FRAME_CONTROL_RESIZE_E: break; - case META_FRAME_CONTROL_NONE: + case META_FRAME_CONTROL_NONE: + break; + case META_FRAME_CONTROL_CLIENT_AREA: break; } @@ -1015,6 +1023,9 @@ meta_frames_button_press_event (GtkWidget *widget, control = get_control (frames, frame, event->x, event->y); + if (control == META_FRAME_CONTROL_CLIENT_AREA) + return FALSE; /* not on the frame, just passed through from client */ + /* We want to shade even if we have a GrabOp, since we'll have a move grab * if we double click the titlebar. */ @@ -1357,6 +1368,8 @@ meta_frames_motion_notify_event (GtkWidget *widget, switch (control) { + case META_FRAME_CONTROL_CLIENT_AREA: + break; case META_FRAME_CONTROL_NONE: break; case META_FRAME_CONTROL_TITLE: @@ -2151,6 +2164,8 @@ control_rect (MetaFrameControl control, break; case META_FRAME_CONTROL_NONE: break; + case META_FRAME_CONTROL_CLIENT_AREA: + break; } return rect; @@ -2181,7 +2196,7 @@ get_control (MetaFrames *frames, client.height = fgeom.height - fgeom.top_height - fgeom.bottom_height; if (POINT_IN_RECT (x, y, client)) - return META_FRAME_CONTROL_NONE; + return META_FRAME_CONTROL_CLIENT_AREA; if (POINT_IN_RECT (x, y, fgeom.close_rect)) return META_FRAME_CONTROL_DELETE; diff --git a/src/frames.h b/src/frames.h index b3ee7c65b..8cfa31017 100644 --- a/src/frames.h +++ b/src/frames.h @@ -42,7 +42,8 @@ typedef enum META_FRAME_CONTROL_RESIZE_NE, META_FRAME_CONTROL_RESIZE_NW, META_FRAME_CONTROL_RESIZE_W, - META_FRAME_CONTROL_RESIZE_E + META_FRAME_CONTROL_RESIZE_E, + META_FRAME_CONTROL_CLIENT_AREA } MetaFrameControl; /* This is one widget that manages all the window frames