diff options
author | Aurélien Aptel <aurelien.aptel@gmail.com> | 2011-06-09 18:25:56 +0200 |
---|---|---|
committer | Aurélien Aptel <aurelien.aptel@gmail.com> | 2011-06-09 18:25:56 +0200 |
commit | e2809f3976adaaa641e116970a3611bf67332dfe (patch) | |
tree | 8923202cc65fbba717f304911cbbb42d7df1e8b4 | |
parent | ce547d3060308419da77465e122db437d7be056b (diff) | |
download | st-e2809f3976adaaa641e116970a3611bf67332dfe.tar.gz st-e2809f3976adaaa641e116970a3611bf67332dfe.tar.bz2 |
fix focus state when embed in another window.
-rw-r--r-- | st.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -241,6 +241,8 @@ static void (*handler[LASTEvent])(XEvent *) = { [VisibilityNotify] = visibility, [UnmapNotify] = unmap, [Expose] = expose, + [EnterNotify] = focus, + [LeaveNotify] = focus, [FocusIn] = focus, [FocusOut] = focus, [MotionNotify] = bmotion, @@ -1635,7 +1637,8 @@ xinit(void) { attrs.bit_gravity = NorthWestGravity; attrs.event_mask = FocusChangeMask | KeyPressMask | ExposureMask | VisibilityChangeMask | StructureNotifyMask - | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; + | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask + | EnterWindowMask | LeaveWindowMask; attrs.colormap = xw.cmap; parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr); @@ -1819,7 +1822,7 @@ xseturgency(int add) { void focus(XEvent *ev) { - if(ev->type == FocusIn) { + if(ev->type == FocusIn || ev->type == EnterNotify) { xw.state |= WIN_FOCUSED; xseturgency(0); } else |