implement _NET_WM_MOVERESIZE enhancements, see #90077.

2002-08-06  Craig Black  <blackc@speakeasy.net>

  * src/window.c: (meta_window_client_message): implement
  _NET_WM_MOVERESIZE enhancements, see #90077.
This commit is contained in:
Craig Black 2002-08-07 05:26:20 +00:00 committed by Craig Black
parent ff652ff407
commit 1e0d6c3346
2 changed files with 63 additions and 28 deletions

View File

@ -1,3 +1,8 @@
2002-08-06 Craig Black <blackc@speakeasy.net>
* src/window.c: (meta_window_client_message): implement
_NET_WM_MOVERESIZE enhancements, see #90077.
2002-08-06 Havoc Pennington <hp@redhat.com> 2002-08-06 Havoc Pennington <hp@redhat.com>
* configure.in: 2.4.0 (this version number has no special * configure.in: 2.4.0 (this version number has no special

View File

@ -3167,6 +3167,8 @@ meta_window_property_notify (MetaWindow *window,
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6 #define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
#define _NET_WM_MOVERESIZE_SIZE_LEFT 7 #define _NET_WM_MOVERESIZE_SIZE_LEFT 7
#define _NET_WM_MOVERESIZE_MOVE 8 #define _NET_WM_MOVERESIZE_MOVE 8
#define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10
gboolean gboolean
meta_window_client_message (MetaWindow *window, meta_window_client_message (MetaWindow *window,
@ -3347,15 +3349,17 @@ meta_window_client_message (MetaWindow *window,
int y_root; int y_root;
int action; int action;
MetaGrabOp op; MetaGrabOp op;
int button;
x_root = event->xclient.data.l[0]; x_root = event->xclient.data.l[0];
y_root = event->xclient.data.l[1]; y_root = event->xclient.data.l[1];
action = event->xclient.data.l[2]; action = event->xclient.data.l[2];
button = event->xclient.data.l[3];
meta_topic (META_DEBUG_WINDOW_OPS, meta_topic (META_DEBUG_WINDOW_OPS,
"Received _NET_WM_MOVERESIZE message on %s, %d,%d action = %d\n", "Received _NET_WM_MOVERESIZE message on %s, %d,%d action = %d, button %d\n",
window->desc, window->desc,
x_root, y_root, action); x_root, y_root, action, button);
op = META_GRAB_OP_NONE; op = META_GRAB_OP_NONE;
switch (action) switch (action)
@ -3387,40 +3391,66 @@ meta_window_client_message (MetaWindow *window,
case _NET_WM_MOVERESIZE_MOVE: case _NET_WM_MOVERESIZE_MOVE:
op = META_GRAB_OP_MOVING; op = META_GRAB_OP_MOVING;
break; break;
case _NET_WM_MOVERESIZE_SIZE_KEYBOARD:
op = META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN;
break;
case _NET_WM_MOVERESIZE_MOVE_KEYBOARD:
op = META_GRAB_OP_KEYBOARD_MOVING;
break;
default: default:
break; break;
} }
if (op != META_GRAB_OP_NONE && if (op != META_GRAB_OP_NONE &&
((window->has_move_func && op == META_GRAB_OP_MOVING) || ((window->has_move_func && op == META_GRAB_OP_KEYBOARD_MOVING) ||
(window->has_resize_func && op != META_GRAB_OP_MOVING))) (window->has_resize_func && op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN)))
{ {
int x, y, query_root_x, query_root_y; meta_window_raise (window);
Window root, child; meta_display_begin_grab_op (window->display,
guint mask; window->screen,
int button; window,
op,
/* The race conditions in this _NET_WM_MOVERESIZE thing FALSE, 0, 0,
* are mind-boggling meta_display_get_current_time (window->display),
0, 0);
}
else if (op != META_GRAB_OP_NONE &&
((window->has_move_func && op == META_GRAB_OP_MOVING) ||
(window->has_resize_func &&
(op != META_GRAB_OP_MOVING &&
op != META_GRAB_OP_KEYBOARD_MOVING))))
{
/*
* the button SHOULD already be included in the message
*/ */
mask = 0; if (button == 0)
meta_error_trap_push (window->display); {
XQueryPointer (window->display->xdisplay, int x, y, query_root_x, query_root_y;
window->xwindow, Window root, child;
&root, &child, guint mask;
&query_root_x, &query_root_y,
&x, &y,
&mask);
meta_error_trap_pop (window->display);
if (mask & Button1Mask) /* The race conditions in this _NET_WM_MOVERESIZE thing
button = 1; * are mind-boggling
else if (mask & Button2Mask) */
button = 2; mask = 0;
else if (mask & Button3Mask) meta_error_trap_push (window->display);
button = 3; XQueryPointer (window->display->xdisplay,
else window->xwindow,
button = 0; &root, &child,
&query_root_x, &query_root_y,
&x, &y,
&mask);
meta_error_trap_pop (window->display);
if (mask & Button1Mask)
button = 1;
else if (mask & Button2Mask)
button = 2;
else if (mask & Button3Mask)
button = 3;
else
button = 0;
}
if (button != 0) if (button != 0)
{ {