aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-19 23:54:49 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-19 23:54:49 +0200
commitf9cf1a4e89bbef715422665206949dfca561f770 (patch)
treed3d2f9b023af9233bd9ce850562eb1cc64d7cdcc
parent2373ba632fda25af978b0b7bae52cd514e194fce (diff)
downloadjwm-f9cf1a4e89bbef715422665206949dfca561f770.tar.gz
Move cursor to center of window on raise
-rw-r--r--src/event.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/event.c b/src/event.c
index 222764f..d0e80fa 100644
--- a/src/event.c
+++ b/src/event.c
@@ -338,6 +338,7 @@ void HandleButtonEvent(const XButtonEvent *event) {
void HandleKeyPress(const XKeyEvent *event) {
ClientNode *np;
KeyType key;
+ int height, width, x, y;
key = GetKey(event);
@@ -373,7 +374,24 @@ void HandleKeyPress(const XKeyEvent *event) {
FocusPreviousStackedCircular();
break;
case KEY_RAISE:
- RaiseClient(np);
+ if(np) {
+ RaiseClient(np);
+ x = np->x;
+ y = np->y;
+ width = np->width;
+ height = np->height;
+ if(np->state.border & BORDER_OUTLINE) {
+ x -= borderWidth;
+ y -= borderWidth;
+ width += borderWidth * 2;
+ height += borderWidth * 2;
+ }
+ if(np->state.border & BORDER_TITLE) {
+ y -= titleHeight;
+ height += titleHeight;
+ }
+ MoveMouse(rootWindow, x + width / 2, y + height / 2);
+ }
break;
case KEY_CLOSE:
if(np) {