only handle events here if the modmask from our button grab is active.

2001-10-14  Havoc Pennington  <hp@pobox.com>

	* 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.
This commit is contained in:
Havoc Pennington 2001-10-14 04:11:42 +00:00 committed by Havoc Pennington
parent 9c8824542e
commit 282b52d6b7
4 changed files with 50 additions and 8 deletions

View File

@ -1,3 +1,14 @@
2001-10-14 Havoc Pennington <hp@pobox.com>
* 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 <hp@pobox.com>
* src/stack.c (meta_stack_sync_to_server): set last window before

View File

@ -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,

View File

@ -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;

View File

@ -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