summaryrefslogtreecommitdiff
path: root/src/netwm.c
diff options
context:
space:
mode:
authorViktor Odintsev <ninetls@xfce.org>2017-11-27 16:42:18 +0300
committerViktor Odintsev <ninetls@xfce.org>2017-11-27 16:42:18 +0300
commitef33ff7b2666ffc320700592fc7d4a300d5a8163 (patch)
treea495b19c503ef02b6faf136f74bbe99ddac23082 /src/netwm.c
parent6013f1ee9b3831991db6a0fb896f20537532b6ce (diff)
downloadxfwm4-ef33ff7b2666ffc320700592fc7d4a300d5a8163.tar.gz
Replace XEvent with XfwmEvent + add xfwm_device_* grabs usage
Diffstat (limited to 'src/netwm.c')
-rw-r--r--src/netwm.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/netwm.c b/src/netwm.c
index bc354c67b..501e25131 100644
--- a/src/netwm.c
+++ b/src/netwm.c
@@ -601,7 +601,8 @@ clientNetMoveResize (Client * c, XClientMessageEvent * ev)
int x_root, y_root, action, button;
int corner;
gboolean resize; /* true == resize, false == move */
- XEvent *event;
+ XEvent *xevent;
+ XfwmEvent *event;
g_return_if_fail (c != NULL);
TRACE ("entering clientNetMoveResize");
@@ -614,7 +615,7 @@ clientNetMoveResize (Client * c, XClientMessageEvent * ev)
y_root = (int) ev->data.l[1];
action = (int) ev->data.l[2];
button = (int) ev->data.l[3];
- event = (XEvent *) ev;
+ xevent = (XEvent *) ev;
/* We don't deal with button > 7, in such a case we pretent it's just any button */
if (button > Button7)
@@ -625,69 +626,69 @@ clientNetMoveResize (Client * c, XClientMessageEvent * ev)
corner = CORNER_BOTTOM_RIGHT;
resize = TRUE;
- event->xbutton.button = button;
- event->xbutton.x_root = event->xkey.x_root = x_root;
- event->xbutton.y_root = event->xkey.y_root = y_root;
- event->xbutton.time = event->xkey.time = (Time) myDisplayGetCurrentTime (display_info);
+ xevent->xbutton.button = button;
+ xevent->xbutton.x_root = xevent->xkey.x_root = x_root;
+ xevent->xbutton.y_root = xevent->xkey.y_root = y_root;
+ xevent->xbutton.time = xevent->xkey.time = (Time) myDisplayGetCurrentTime (display_info);
switch (action)
{
/* Keyboard */
case NET_WM_MOVERESIZE_SIZE_KEYBOARD:
- event->type = KeyPress;
+ xevent->type = KeyPress;
corner = CORNER_BOTTOM_RIGHT;
resize = TRUE; /* Resize */
break;
case NET_WM_MOVERESIZE_MOVE_KEYBOARD:
- event->type = KeyPress;
+ xevent->type = KeyPress;
resize = FALSE; /* Move */
break;
/* Sides */
case NET_WM_MOVERESIZE_SIZE_TOP:
- event->type = ButtonPress;
+ xevent->type = ButtonPress;
corner = CORNER_COUNT + SIDE_TOP;
resize = TRUE; /* Resize */
break;
case NET_WM_MOVERESIZE_SIZE_BOTTOM:
- event->type = ButtonPress;
+ xevent->type = ButtonPress;
corner = CORNER_COUNT + SIDE_BOTTOM;
resize = TRUE; /* Resize */
break;
case NET_WM_MOVERESIZE_SIZE_RIGHT:
- event->type = ButtonPress;
+ xevent->type = ButtonPress;
corner = CORNER_COUNT + SIDE_RIGHT;
resize = TRUE; /* Resize */
break;
case NET_WM_MOVERESIZE_SIZE_LEFT:
- event->type = ButtonPress;
+ xevent->type = ButtonPress;
corner = CORNER_COUNT + SIDE_LEFT;
resize = TRUE; /* Resize */
break;
/* Corners */
case NET_WM_MOVERESIZE_SIZE_TOPLEFT:
- event->type = ButtonPress;
+ xevent->type = ButtonPress;
corner = CORNER_TOP_LEFT;
resize = TRUE; /* Resize */
break;
case NET_WM_MOVERESIZE_SIZE_TOPRIGHT:
- event->type = ButtonPress;
+ xevent->type = ButtonPress;
corner = CORNER_TOP_RIGHT;
resize = TRUE; /* Resize */
break;
case NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT:
- event->type = ButtonPress;
+ xevent->type = ButtonPress;
corner = CORNER_BOTTOM_LEFT;
resize = TRUE; /* Resize */
break;
case NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT:
- event->type = ButtonPress;
+ xevent->type = ButtonPress;
corner = CORNER_BOTTOM_RIGHT;
resize = TRUE; /* Resize */
break;
case NET_WM_MOVERESIZE_MOVE:
- event->type = ButtonPress;
+ xevent->type = ButtonPress;
resize = FALSE; /* Move */
break;
case NET_WM_MOVERESIZE_CANCEL:
@@ -702,11 +703,15 @@ clientNetMoveResize (Client * c, XClientMessageEvent * ev)
{
if (resize && FLAG_TEST_ALL (c->xfwm_flags, XFWM_FLAG_HAS_RESIZE | XFWM_FLAG_IS_RESIZABLE))
{
- clientResize (c, corner, event);
+ event = xfwm_device_translate_event (display_info->devices, xevent, NULL);
+ clientResize (c, corner, event->meta.type == XFWM_EVENT_BUTTON ? &event->button : NULL);
+ xfwm_device_free_event (event);
}
else if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_MOVE))
{
- clientMove (c, event);
+ event = xfwm_device_translate_event (display_info->devices, xevent, NULL);
+ clientMove (c, event->meta.type == XFWM_EVENT_BUTTON ? &event->button : NULL);
+ xfwm_device_free_event (event);
}
}
}