Raise the sam window when sweeping a new text. - sam - An updated version of th… | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 0cb6ee7264d314996d32c6f211a6aa6d99e0a7e2 | |
parent 675674530d0371c1d64353df951a74a4dbb971c3 | |
Author: Rob King <[email protected]> | |
Date: Fri, 27 May 2016 11:21:39 -0500 | |
Raise the sam window when sweeping a new text. | |
Diffstat: | |
include/libg.h | 1 + | |
libXg/getrect.c | 3 +++ | |
libXg/gwin.c | 1 - | |
libXg/xtbinit.c | 28 ++++++++++++++++++++++++++++ | |
4 files changed, 32 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/include/libg.h b/include/libg.h | |
@@ -201,6 +201,7 @@ extern Rectangle getrect(int, Mouse*); | |
extern unsigned long rgbpix(Bitmap*, RGB); | |
extern void rdcolmap(Bitmap*, RGB*); | |
extern void wrcolmap(Bitmap*, RGB*); | |
+extern void raisewindow(void); | |
/* Extra functions supplied by libXg */ | |
extern int snarfswap(char*, int, char**); | |
diff --git a/libXg/getrect.c b/libXg/getrect.c | |
@@ -19,6 +19,8 @@ static Cursor sweep={ | |
static void | |
grabcursor(void) | |
{ | |
+ raisewindow(); | |
+ | |
/* Grab X server with an limp wrist. */ | |
while (XGrabPointer(_dpy, screen.id, False, | |
ButtonPressMask|ButtonReleaseMask| | |
@@ -26,6 +28,7 @@ grabcursor(void) | |
GrabModeAsync, GrabModeAsync, None, None, CurrentTime) | |
!= GrabSuccess) | |
sleep(2); | |
+ | |
/* Grab the keyboard too */ | |
XSetInputFocus(_dpy, screen.id, RevertToParent, CurrentTime); | |
} | |
diff --git a/libXg/gwin.c b/libXg/gwin.c | |
@@ -470,4 +470,3 @@ GwinSelectionSwap(Widget w, String s) | |
XtCheckSubclass(w, gwinWidgetClass, NULL); | |
return (*((GwinWidgetClass) XtClass(w))->gwin_class.select_swap)(w, s); | |
} | |
- | |
diff --git a/libXg/xtbinit.c b/libXg/xtbinit.c | |
@@ -865,3 +865,31 @@ printgc(char *msg, GC g) | |
} | |
#endif | |
+void | |
+raisewindow(void) | |
+{ | |
+ XEvent e; | |
+ Atom a = XInternAtom(_dpy, "_NET_ACTIVE_WINDOW", True); | |
+ Window w = XtWindow(_toplevel); | |
+ | |
+ XRaiseWindow(_dpy, w); | |
+ | |
+ if (a != None){ | |
+ fprintf(stderr, "raising window using EWMH\n"); | |
+ memset(&e, 0, sizeof(XEvent)); | |
+ e.type = ClientMessage; | |
+ e.xclient.window = w; | |
+ e.xclient.message_type = a; | |
+ e.xclient.format = 32; | |
+ e.xclient.data.l[0] = 1; | |
+ e.xclient.data.l[1] = CurrentTime; | |
+ e.xclient.data.l[2] = None; | |
+ e.xclient.data.l[3] = 0; | |
+ e.xclient.data.l[4] = 0; | |
+ | |
+ XSendEvent(_dpy, DefaultRootWindow(_dpy), False, | |
+ SubstructureRedirectMask | SubstructureNotifyMask, &e); | |
+ } | |
+ | |
+ XFlush(_dpy); | |
+} |