[hackers] [tabbed] fixing focus/activation of embedded clients. || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Tue, 27 Oct 2009 12:41:10 +0000 (UTC)

changeset: 116:8672352fb0d6
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Tue Oct 27 13:13:15 2009 +0100
files: tabbed.c
description:
fixing focus/activation of embedded clients.

diff -r 16f6ba9bb55e -r 8672352fb0d6 tabbed.c
--- a/tabbed.c Tue Oct 27 12:54:22 2009 +0100
+++ b/tabbed.c Tue Oct 27 13:13:15 2009 +0100
@@ -116,6 +116,7 @@
 static void rotate(const Arg *arg);
 static void run(void);
 static void setup(void);
+static void sendxembed(Client *c, long msg, long detail, long d1, long d2);
 static void sigchld(int unused);
 static void spawn(const Arg *arg);
 static int textnw(const char *text, unsigned int len);
@@ -367,8 +368,6 @@
 
 void
 focus(Client *c) {
- XEvent e;
-
         if(!clients) {
                 XStoreName(dpy, win, "tabbed-"VERSION);
                 return;
@@ -377,16 +376,8 @@
                 return;
         XRaiseWindow(dpy, c->win);
         XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
- e.xclient.window = c->win;
- e.xclient.type = ClientMessage;
- e.xclient.message_type = xembedatom;
- e.xclient.format = 32;
- e.xclient.data.l[0] = CurrentTime;
- e.xclient.data.l[1] = XEMBED_FOCUS_IN;
- e.xclient.data.l[2] = XEMBED_FOCUS_CURRENT;
- e.xclient.data.l[3] = 0;
- e.xclient.data.l[4] = 0;
- XSendEvent(dpy, c->win, False, NoEventMask, &e);
+ sendxembed(c, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT, 0, 0);
+ sendxembed(c, XEMBED_WINDOW_ACTIVATE, 0, 0, 0);
         XStoreName(dpy, win, c->name);
         sel = c;
         drawbar();
@@ -708,6 +699,22 @@
 }
 
 void
+sendxembed(Client *c, long msg, long detail, long d1, long d2) {
+ XEvent e = { 0 };
+
+ e.xclient.window = c->win;
+ e.xclient.type = ClientMessage;
+ e.xclient.message_type = xembedatom;
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = CurrentTime;
+ e.xclient.data.l[1] = msg;
+ e.xclient.data.l[2] = detail;
+ e.xclient.data.l[3] = d1;
+ e.xclient.data.l[4] = d2;
+ XSendEvent(dpy, c->win, False, NoEventMask, &e);
+}
+
+void
 sigchld(int unused) {
         if(signal(SIGCHLD, sigchld) == SIG_ERR)
                 die("Can't install SIGCHLD handler");
Received on Tue Oct 27 2009 - 12:41:10 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 27 2009 - 12:48:05 UTC