Xinqi Bao's Git
projects
/
st.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
cddbd6e
)
fix focus state when embed in another window.
author
Aurélien Aptel <
[email protected]
>
Thu, 9 Jun 2011 16:25:56 +0000
(18:25 +0200)
committer
Aurélien Aptel <
[email protected]
>
Thu, 9 Jun 2011 16:25:56 +0000
(18:25 +0200)
st.c
patch
|
blob
|
history
diff --git
a/st.c
b/st.c
index
df8353a
..
f0c2cd2
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-241,6
+241,8
@@
static void (*handler[LASTEvent])(XEvent *) = {
[VisibilityNotify] = visibility,
[UnmapNotify] = unmap,
[Expose] = expose,
[VisibilityNotify] = visibility,
[UnmapNotify] = unmap,
[Expose] = expose,
+ [EnterNotify] = focus,
+ [LeaveNotify] = focus,
[FocusIn] = focus,
[FocusOut] = focus,
[MotionNotify] = bmotion,
[FocusIn] = focus,
[FocusOut] = focus,
[MotionNotify] = bmotion,
@@
-1635,7
+1637,8
@@
xinit(void) {
attrs.bit_gravity = NorthWestGravity;
attrs.event_mask = FocusChangeMask | KeyPressMask
| ExposureMask | VisibilityChangeMask | StructureNotifyMask
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);
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) {
void
focus(XEvent *ev) {
- if(ev->type == FocusIn) {
+ if(ev->type == FocusIn
|| ev->type == EnterNotify
) {
xw.state |= WIN_FOCUSED;
xseturgency(0);
} else
xw.state |= WIN_FOCUSED;
xseturgency(0);
} else