X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=st.c;h=46490798e9b867821c2b7dfb954c7325e16308f1;hb=d5f3d120eae2377b8a2f80c94fbb5e4bd7a6189d;hp=df8353a378e942f7dc3de8177502690b7c01e03b;hpb=cddbd6eee59104a029087c30f9ff5e7e415bc584;p=st.git diff --git a/st.c b/st.c index df8353a..4649079 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, @@ -1625,8 +1627,8 @@ xinit(void) { xloadcols(); /* window - default size */ - xw.bufh = 24 * xw.ch; - xw.bufw = 80 * xw.cw; + xw.bufh = term.row * xw.ch; + xw.bufw = term.col * xw.cw; xw.h = xw.bufh + 2*BORDER; xw.w = xw.bufw + 2*BORDER; @@ -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