diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2011-03-24 20:19:47 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2011-10-05 17:08:24 +0100 |
commit | f676f0ca762485c0516e10db8bbb83eaa161a7fd (patch) | |
tree | f63b7af53f968b4cd1092e09781118d152662b40 | |
parent | 1434ca29f57360a6fa816ca3315711b31ed83596 (diff) |
In multiwindow mode, don't grab native input focus for new windows which hint they don't want it
In multiwindow mode, avoid grabbing the input focus for newly
created windows which have InputHint FALSE
(this is used by e.g. glean to avoid every test window grabbing
the focus)
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-rw-r--r-- | hw/xwin/winmultiwindowclass.h | 10 | ||||
-rw-r--r-- | hw/xwin/winmultiwindowwndproc.c | 17 |
2 files changed, 26 insertions, 1 deletions
diff --git a/hw/xwin/winmultiwindowclass.h b/hw/xwin/winmultiwindowclass.h index c635ab20b..1c9a5e52d 100644 --- a/hw/xwin/winmultiwindowclass.h +++ b/hw/xwin/winmultiwindowclass.h @@ -47,6 +47,16 @@ typedef struct { /* this structure may be extended in the future */ } WinXWMHints; +/* Window manager hints mask bits */ +#define InputHint (1L << 0) +#define StateHint (1L << 1) +#define IconPixmapHint (1L << 2) +#define IconWindowHint (1L << 3) +#define IconPositionHint (1L << 4) +#define IconMaskHint (1L << 5) +#define WindowGroupHint (1L << 6) +#define UrgencyHint (1L << 8) +#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint|IconPositionHint|IconMaskHint|WindowGroupHint) /* * new version containing base_width, base_height, and win_gravity fields; diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index f19b480ce..dad0d627f 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -898,7 +898,22 @@ winTopLevelWindowProc (HWND hwnd, UINT message, & ~WS_CAPTION & ~WS_SIZEBOX); winUpdateWindowPosition (hwnd, FALSE, &zstyle); - SetForegroundWindow (hwnd); + + { + WinXWMHints hints; + if (winMultiWindowGetWMHints(pWin, &hints)) + { + /* + Give the window focus, unless it has an InputHint + which is FALSE (this is used by e.g. glean to + avoid every test window grabbing the focus) + */ + if (!((hints.flags & InputHint) && (!hints.input))) + { + SetForegroundWindow (hwnd); + } + } + } } wmMsg.msg = WM_WM_MAP3; } |