diff options
author | rhp <rhp> | 2001-06-07 02:42:24 +0000 |
---|---|---|
committer | rhp <rhp> | 2001-06-07 02:42:24 +0000 |
commit | 834452ca2c2cde16bd11351e90df44cbe20c96bf (patch) | |
tree | 34b9a049240c3a9522a8a5be06f9628e9d381d80 /src/frame.c | |
parent | 0f5fdeb1b15a84a790d14beb4488eb974c7e0cd0 (diff) | |
download | metacity-834452ca2c2cde16bd11351e90df44cbe20c96bf.tar.gz |
...
Diffstat (limited to 'src/frame.c')
-rw-r--r-- | src/frame.c | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/src/frame.c b/src/frame.c index 32e607d1..c10ce98b 100644 --- a/src/frame.c +++ b/src/frame.c @@ -35,6 +35,16 @@ struct _MetaFrameActionGrab int start_button; }; +/* This lacks ButtonReleaseMask to avoid the auto-grab + * since it breaks our popup menu + */ +#define EVENT_MASK (StructureNotifyMask | SubstructureNotifyMask | \ + ExposureMask | \ + ButtonPressMask | ButtonReleaseMask | \ + PointerMotionMask | PointerMotionHintMask | \ + EnterWindowMask | LeaveWindowMask) + + static void clear_tip (MetaFrame *frame); static void @@ -244,14 +254,7 @@ meta_window_ensure_frame (MetaWindow *window) window->size_hints.win_gravity); attrs.background_pixel = frame->bg_pixel; - attrs.event_mask = - StructureNotifyMask | SubstructureNotifyMask | ExposureMask | - /* We need OwnerGrabButtonMask because during a button - * press we may need to transfer control to the UI slave. - */ - ButtonPressMask | ButtonReleaseMask | OwnerGrabButtonMask | - PointerMotionMask | PointerMotionHintMask | - EnterWindowMask | LeaveWindowMask; + attrs.event_mask = EVENT_MASK; frame->xwindow = XCreateWindow (window->display->xdisplay, window->screen->xroot, @@ -804,6 +807,38 @@ meta_frame_event (MetaFrame *frame, frame->grab->start_window_y = frame->window->rect.height; frame->grab->start_button = event->xbutton.button; } + else if (control == META_FRAME_CONTROL_MENU && + event->xbutton.button == 1) + { + int x, y, width, height; + MetaFrameInfo info; + + meta_verbose ("Menu control clicked on %s\n", + frame->window->desc); + + meta_frame_init_info (frame, &info); + frame->window->screen->engine->get_control_rect (&info, + META_FRAME_CONTROL_MENU, + &x, &y, &width, &height, + frame->theme_data); + + /* Let the menu get a grab. The user could release button + * before the menu gets the grab, in which case the + * menu gets somewhat confused, but it's not that + * disastrous. + */ + XUngrabPointer (frame->window->display->xdisplay, + event->xbutton.time); + + meta_ui_slave_show_window_menu (frame->window->screen->uislave, + frame->window, + frame->rect.x + x, + frame->rect.y + y + height, + event->xbutton.button, + META_MESSAGE_MENU_ALL, + META_MESSAGE_MENU_MINIMIZE, + event->xbutton.time); + } } break; case ButtonRelease: |