don't raise window on button 2 click, only on button 1 and button 3.

2002-10-11  Havoc Pennington  <hp@redhat.com>

	* 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
This commit is contained in:
Havoc Pennington 2002-10-11 18:42:40 +00:00 committed by Havoc Pennington
parent 4ba0ce89c4
commit 82e5cb578c
5 changed files with 75 additions and 29 deletions

View File

@ -1,3 +1,13 @@
2002-10-11 Havoc Pennington <hp@redhat.com>
* 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 <hp@pobox.com> 2002-10-11 Havoc Pennington <hp@pobox.com>
* src/stack.c (window_is_fullscreen_size): make the checks here * src/stack.c (window_is_fullscreen_size): make the checks here

View File

@ -217,6 +217,22 @@ meta_core_user_raise (Display *xdisplay,
meta_window_raise (window); 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 void
meta_core_user_focus (Display *xdisplay, meta_core_user_focus (Display *xdisplay,
Window frame_xwindow, Window frame_xwindow,

View File

@ -57,6 +57,8 @@ void meta_core_user_resize (Display *xdisplay,
void meta_core_user_raise (Display *xdisplay, void meta_core_user_raise (Display *xdisplay,
Window frame_xwindow); Window frame_xwindow);
void meta_core_user_lower (Display *xdisplay,
Window frame_xwindow);
void meta_core_user_focus (Display *xdisplay, void meta_core_user_focus (Display *xdisplay,
Window frame_xwindow, Window frame_xwindow,

View File

@ -1071,7 +1071,7 @@ event_callback (XEvent *event,
*/ */
unmodified = (event->xbutton.state & grab_mask) == 0; unmodified = (event->xbutton.state & grab_mask) == 0;
if (unmodified || if ((unmodified && event->xbutton.button != 2) ||
event->xbutton.button == 1) event->xbutton.button == 1)
{ {
if (!frame_was_receiver) if (!frame_was_receiver)
@ -1087,33 +1087,6 @@ event_callback (XEvent *event,
window->desc, event->xbutton.button); window->desc, event->xbutton.button);
meta_window_focus (window, event->xbutton.time); 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 /* you can move on alt-click but not on
* the click-to-focus * the click-to-focus
@ -1121,7 +1094,7 @@ event_callback (XEvent *event,
if (!unmodified) if (!unmodified)
begin_move = TRUE; begin_move = TRUE;
} }
else if (event->xbutton.button == 2) else if (!unmodified && event->xbutton.button == 2)
{ {
if (window->has_resize_func) if (window->has_resize_func)
{ {
@ -1165,6 +1138,33 @@ event_callback (XEvent *event,
event->xbutton.time); 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) if (begin_move && window->has_move_func)
{ {
meta_display_begin_grab_op (display, meta_display_begin_grab_op (display,
@ -1882,9 +1882,23 @@ meta_spew_event (MetaDisplay *display,
break; break;
case ButtonPress: case ButtonPress:
name = "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; break;
case ButtonRelease: case ButtonRelease:
name = "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; break;
case MotionNotify: case MotionNotify:
name = "MotionNotify"; name = "MotionNotify";

View File

@ -1228,6 +1228,10 @@ meta_frames_button_press_event (GtkWidget *widget,
event->y_root); event->y_root);
} }
} }
else if (event->button == 2)
{
meta_core_user_lower (gdk_display, frame->xwindow);
}
else if (event->button == 3) else if (event->button == 3)
{ {
meta_core_show_window_menu (gdk_display, meta_core_show_window_menu (gdk_display,