diff --git a/ChangeLog b/ChangeLog index de4928e9a..a34cf4ee6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-10-11 Havoc Pennington + + * src/display.c (event_callback): don't raise window on button 2 + click, only on button 1 and button 3. + + * src/frames.c (meta_frames_button_press_event): lower on button 2 + press on frame + + * src/core.c (meta_core_user_lower): new function + 2002-10-11 Havoc Pennington * src/stack.c (window_is_fullscreen_size): make the checks here diff --git a/src/core.c b/src/core.c index fb3a185d8..dd331ada5 100644 --- a/src/core.c +++ b/src/core.c @@ -217,6 +217,22 @@ meta_core_user_raise (Display *xdisplay, meta_window_raise (window); } +void +meta_core_user_lower (Display *xdisplay, + Window frame_xwindow) +{ + MetaDisplay *display; + MetaWindow *window; + + display = meta_display_for_x_display (xdisplay); + window = meta_display_lookup_x_window (display, frame_xwindow); + + if (window == NULL || window->frame == NULL) + meta_bug ("No such frame window 0x%lx!\n", frame_xwindow); + + meta_window_lower (window); +} + void meta_core_user_focus (Display *xdisplay, Window frame_xwindow, diff --git a/src/core.h b/src/core.h index 80c9263c5..aab705c96 100644 --- a/src/core.h +++ b/src/core.h @@ -57,6 +57,8 @@ void meta_core_user_resize (Display *xdisplay, void meta_core_user_raise (Display *xdisplay, Window frame_xwindow); +void meta_core_user_lower (Display *xdisplay, + Window frame_xwindow); void meta_core_user_focus (Display *xdisplay, Window frame_xwindow, diff --git a/src/display.c b/src/display.c index a5d8daad2..1f3ecf34a 100644 --- a/src/display.c +++ b/src/display.c @@ -1071,7 +1071,7 @@ event_callback (XEvent *event, */ unmodified = (event->xbutton.state & grab_mask) == 0; - if (unmodified || + if ((unmodified && event->xbutton.button != 2) || event->xbutton.button == 1) { if (!frame_was_receiver) @@ -1087,33 +1087,6 @@ event_callback (XEvent *event, window->desc, event->xbutton.button); meta_window_focus (window, event->xbutton.time); } - - if (!frame_was_receiver && unmodified) - { - /* This is from our synchronous grab since - * it has no modifiers and was on the client window - */ - int mode; - - /* When clicking a different app in click-to-focus - * in application-based mode, and the different - * app is not a dock or desktop, eat the focus click. - */ - if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK && - meta_prefs_get_application_based () && - !window->has_focus && - window->type != META_WINDOW_DOCK && - window->type != META_WINDOW_DESKTOP && - (display->focus_window == NULL || - !meta_window_same_application (window, - display->focus_window))) - mode = AsyncPointer; /* eat focus click */ - else - mode = ReplayPointer; /* give event back */ - - XAllowEvents (display->xdisplay, - mode, event->xbutton.time); - } /* you can move on alt-click but not on * the click-to-focus @@ -1121,7 +1094,7 @@ event_callback (XEvent *event, if (!unmodified) begin_move = TRUE; } - else if (event->xbutton.button == 2) + else if (!unmodified && event->xbutton.button == 2) { if (window->has_resize_func) { @@ -1165,6 +1138,33 @@ event_callback (XEvent *event, event->xbutton.time); } + if (!frame_was_receiver && unmodified) + { + /* This is from our synchronous grab since + * it has no modifiers and was on the client window + */ + int mode; + + /* When clicking a different app in click-to-focus + * in application-based mode, and the different + * app is not a dock or desktop, eat the focus click. + */ + if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK && + meta_prefs_get_application_based () && + !window->has_focus && + window->type != META_WINDOW_DOCK && + window->type != META_WINDOW_DESKTOP && + (display->focus_window == NULL || + !meta_window_same_application (window, + display->focus_window))) + mode = AsyncPointer; /* eat focus click */ + else + mode = ReplayPointer; /* give event back */ + + XAllowEvents (display->xdisplay, + mode, event->xbutton.time); + } + if (begin_move && window->has_move_func) { meta_display_begin_grab_op (display, @@ -1882,9 +1882,23 @@ meta_spew_event (MetaDisplay *display, break; case ButtonPress: name = "ButtonPress"; + extra = g_strdup_printf ("button %d state 0x%x x %d y %d root 0x%lx same_screen %d", + event->xbutton.button, + event->xbutton.state, + event->xbutton.x, + event->xbutton.y, + event->xbutton.root, + event->xbutton.same_screen); break; case ButtonRelease: name = "ButtonRelease"; + extra = g_strdup_printf ("button %d state 0x%x x %d y %d root 0x%lx same_screen %d", + event->xbutton.button, + event->xbutton.state, + event->xbutton.x, + event->xbutton.y, + event->xbutton.root, + event->xbutton.same_screen); break; case MotionNotify: name = "MotionNotify"; diff --git a/src/frames.c b/src/frames.c index 936c75358..a6f0c4c2f 100644 --- a/src/frames.c +++ b/src/frames.c @@ -1228,6 +1228,10 @@ meta_frames_button_press_event (GtkWidget *widget, event->y_root); } } + else if (event->button == 2) + { + meta_core_user_lower (gdk_display, frame->xwindow); + } else if (event->button == 3) { meta_core_show_window_menu (gdk_display,