[hackers] [st] fix focus state when embed in another window. || Aurélien Aptel

From: <hg_AT_suckless.org>
Date: Thu, 9 Jun 2011 18:26:00 +0200 (CEST)

changeset: 206:e64c97268f1a
tag: tip
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Thu Jun 09 18:25:56 2011 +0200
files: st.c
description:
fix focus state when embed in another window.

diff -r 76d7ec4d159e -r e64c97268f1a st.c
--- a/st.c Thu Jun 09 14:27:07 2011 +0200
+++ b/st.c Thu Jun 09 18:25:56 2011 +0200
@@ -241,6 +241,8 @@
         [VisibilityNotify] = visibility,
         [UnmapNotify] = unmap,
         [Expose] = expose,
+ [EnterNotify] = focus,
+ [LeaveNotify] = focus,
         [FocusIn] = focus,
         [FocusOut] = focus,
         [MotionNotify] = bmotion,
@@ -1635,7 +1637,8 @@
         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 @@
 
 void
 focus(XEvent *ev) {
- if(ev->type == FocusIn) {
+ if(ev->type == FocusIn || ev->type == EnterNotify) {
                 xw.state |= WIN_FOCUSED;
                 xseturgency(0);
         } else
Received on Thu Jun 09 2011 - 18:26:00 CEST

This archive was generated by hypermail 2.2.0 : Thu Jun 09 2011 - 18:36:06 CEST