From 6dff1084f0e0ea54d1b78ef8ba24df6bbc8fd68d Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 26 Jan 2012 09:34:42 +0100 Subject: In multiwindow mode, don't grab native input focus for new windows which hint they don't want it --- xorg-server/hw/xwin/winmultiwindowclass.h | 10 ++++++++++ xorg-server/hw/xwin/winmultiwindowwndproc.c | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'xorg-server/hw') diff --git a/xorg-server/hw/xwin/winmultiwindowclass.h b/xorg-server/hw/xwin/winmultiwindowclass.h index c635ab20b..9767656e8 100644 --- a/xorg-server/hw/xwin/winmultiwindowclass.h +++ b/xorg-server/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/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c index f4313d353..3142776b5 100644 --- a/xorg-server/hw/xwin/winmultiwindowwndproc.c +++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c @@ -886,7 +886,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; } -- cgit v1.2.3