fix focus state when embed in another window.

dev
Aurélien Aptel 2011-06-09 18:25:56 +02:00
parent cddbd6eee5
commit 8503f954a1
1 changed files with 5 additions and 2 deletions

7
st.c
View File

@ -241,6 +241,8 @@ static void (*handler[LASTEvent])(XEvent *) = {
[VisibilityNotify] = visibility, [VisibilityNotify] = visibility,
[UnmapNotify] = unmap, [UnmapNotify] = unmap,
[Expose] = expose, [Expose] = expose,
[EnterNotify] = focus,
[LeaveNotify] = focus,
[FocusIn] = focus, [FocusIn] = focus,
[FocusOut] = focus, [FocusOut] = focus,
[MotionNotify] = bmotion, [MotionNotify] = bmotion,
@ -1635,7 +1637,8 @@ xinit(void) {
attrs.bit_gravity = NorthWestGravity; attrs.bit_gravity = NorthWestGravity;
attrs.event_mask = FocusChangeMask | KeyPressMask attrs.event_mask = FocusChangeMask | KeyPressMask
| ExposureMask | VisibilityChangeMask | StructureNotifyMask | ExposureMask | VisibilityChangeMask | StructureNotifyMask
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask
| EnterWindowMask | LeaveWindowMask;
attrs.colormap = xw.cmap; attrs.colormap = xw.cmap;
parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr); parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr);
@ -1819,7 +1822,7 @@ xseturgency(int add) {
void void
focus(XEvent *ev) { focus(XEvent *ev) {
if(ev->type == FocusIn) { if(ev->type == FocusIn || ev->type == EnterNotify) {
xw.state |= WIN_FOCUSED; xw.state |= WIN_FOCUSED;
xseturgency(0); xseturgency(0);
} else } else