# HG changeset patch # User Roman Z (romanz@lavabit.com) # Date 1316737168 -7200 # Node ID a6e79969664bf738c40daa4357e7aaa00f35c938 # Parent af9499282ed599d8a40b555cace28170543d3b84 Partially reverted 138 and fixed some resulting bugs diff -r af9499282ed5 -r a6e79969664b tabbed.c --- a/tabbed.c Sat Jun 18 14:37:43 2011 +0100 +++ b/tabbed.c Fri Sep 23 02:19:28 2011 +0200 @@ -94,7 +94,6 @@ static void drawbar(); static void drawtext(const char *text, unsigned long col[ColLast]); static void *emallocz(size_t size); -static void enternotify(const XEvent *e); static void expose(const XEvent *e); static void focus(Client *c); static void focusin(const XEvent *e); @@ -134,7 +133,6 @@ [ConfigureRequest] = configurerequest, [CreateNotify] = createnotify, [DestroyNotify] = destroynotify, - [EnterNotify] = enternotify, [Expose] = expose, [FocusIn] = focusin, [KeyPress] = keypress, @@ -368,11 +366,6 @@ } void -enternotify(const XEvent *e) { - focus(sel); -} - -void expose(const XEvent *e) { const XExposeEvent *ev = &e->xexpose; @@ -390,6 +383,7 @@ } resize(c, ww, wh - bh); XRaiseWindow(dpy, c->win); + XSetInputFocus(dpy, c->win, RevertToParent, CurrentTime); sendxembed(c, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT, 0, 0); sendxembed(c, XEMBED_WINDOW_ACTIVATE, 0, 0, 0); XStoreName(dpy, win, c->name); @@ -402,7 +396,14 @@ void focusin(const XEvent *e) { - focus(sel); + const XFocusChangeEvent *ev = &e->xfocus; + int dummy; + Window focused_win; + if (ev->mode != NotifyUngrab) { + XGetInputFocus(dpy, &focused_win, &dummy); + if (focused_win == win) + focus(sel); + } } void