aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2011-06-09 18:25:56 +0200
committerAurélien Aptel <aurelien.aptel@gmail.com>2011-06-09 18:25:56 +0200
commite2809f3976adaaa641e116970a3611bf67332dfe (patch)
tree8923202cc65fbba717f304911cbbb42d7df1e8b4
parentce547d3060308419da77465e122db437d7be056b (diff)
downloadst-patched-e2809f3976adaaa641e116970a3611bf67332dfe.tar.bz2
st-patched-e2809f3976adaaa641e116970a3611bf67332dfe.tar.xz
st-patched-e2809f3976adaaa641e116970a3611bf67332dfe.zip
fix focus state when embed in another window.
-rw-r--r--st.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/st.c b/st.c
index df8353a..f0c2cd2 100644
--- a/st.c
+++ b/st.c
@@ -241,6 +241,8 @@ static void (*handler[LASTEvent])(XEvent *) = {
241 [VisibilityNotify] = visibility, 241 [VisibilityNotify] = visibility,
242 [UnmapNotify] = unmap, 242 [UnmapNotify] = unmap,
243 [Expose] = expose, 243 [Expose] = expose,
244 [EnterNotify] = focus,
245 [LeaveNotify] = focus,
244 [FocusIn] = focus, 246 [FocusIn] = focus,
245 [FocusOut] = focus, 247 [FocusOut] = focus,
246 [MotionNotify] = bmotion, 248 [MotionNotify] = bmotion,
@@ -1635,7 +1637,8 @@ xinit(void) {
1635 attrs.bit_gravity = NorthWestGravity; 1637 attrs.bit_gravity = NorthWestGravity;
1636 attrs.event_mask = FocusChangeMask | KeyPressMask 1638 attrs.event_mask = FocusChangeMask | KeyPressMask
1637 | ExposureMask | VisibilityChangeMask | StructureNotifyMask 1639 | ExposureMask | VisibilityChangeMask | StructureNotifyMask
1638 | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; 1640 | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask
1641 | EnterWindowMask | LeaveWindowMask;
1639 attrs.colormap = xw.cmap; 1642 attrs.colormap = xw.cmap;
1640 1643
1641 parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr); 1644 parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr);
@@ -1819,7 +1822,7 @@ xseturgency(int add) {
1819 1822
1820void 1823void
1821focus(XEvent *ev) { 1824focus(XEvent *ev) {
1822 if(ev->type == FocusIn) { 1825 if(ev->type == FocusIn || ev->type == EnterNotify) {
1823 xw.state |= WIN_FOCUSED; 1826 xw.state |= WIN_FOCUSED;
1824 xseturgency(0); 1827 xseturgency(0);
1825 } else 1828 } else