aboutsummaryrefslogtreecommitdiff
path: root/x11-wm/awesome/files/extrapatch-warp
blob: ef27961d3af6f4cf08b2a847c711c90e8af3bc66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- layout.c.orig	2007-09-26 13:18:33.000000000 +0300
+++ layout.c	2007-09-26 13:20:48.000000000 +0300
@@ -114,6 +114,22 @@
     Client *c;
     XEvent ev;
     XWindowChanges wc;
+	 Window dummy, root;
+	 int wex, wey, ex, ey, i;
+	 unsigned int dmask;
+
+	 if(sel) {
+		 ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, &awesomeconf->statusbar);
+		 root = RootWindow(disp, awesomeconf->screen);
+		 XQueryPointer(disp, sel->win, &dummy, &dummy, &i, &i, &wex, &wey, &dmask);
+		 XTranslateCoordinates(disp, sel->win, root, wex, wey, &ex, &ey, &dummy);
+		 /* I'm so sorry for this... Shame on me... */
+		 if(ex > si[awesomeconf->screen].x_org && ex < si[awesomeconf->screen].width && ey > si[awesomeconf->screen].y_org && ey < si[awesomeconf->screen].height) {
+			 XSelectInput(disp, root, SubstructureRedirectMask & EnterWindowMask);
+			 XWarpPointer(disp, None, sel->win, 0, 0, 0, 0, sel->w / 2, sel->h / 2);
+			 XSelectInput(disp, root, SubstructureRedirectMask);
+		 }
+	 }
 
     drawstatusbar(disp, awesomeconf->screen, drawcontext, awesomeconf);
     if(!sel)