X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=f0c2cd20a66ab7c434fe5b0b6b0208f38f4df91b;hb=8503f954a1cb2d08124fe2c1f0227bd23dffff46;hp=b331eadebdeb2208ae77916cc2ece6a4291a07a4;hpb=3959a99293785e603270d8798fbe0cb2ba0ae0ee;p=st.git diff --git a/st.c b/st.c index b331ead..f0c2cd2 100644 --- a/st.c +++ b/st.c @@ -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, @@ -615,7 +617,7 @@ bmotion(XEvent *e) { if(oldey != sel.ey || oldex != sel.ex) { int starty = MIN(oldey, sel.ey); int endy = MAX(oldey, sel.ey); - drawregion(0, (starty > 0 ? starty : 0), term.col, (sel.ey < term.row ? endy+1 : term.row)); + drawregion(0, (starty > 0 ? starty : 0), term.col, (endy < term.row ? endy+1 : term.row)); } } } @@ -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