From 8037389c49fb2124cabe28f1392daeaa79d251e1 Mon Sep 17 00:00:00 2001 From: Susan Farley Date: Fri, 2 Jun 2000 20:36:29 +0000 Subject: [PATCH] Preserve WM hints that were set during window creation by calling XGetWMHints prior to XSetWMHints. --- include/ts_xutil.h | 1 + tsx11/X11_calls | 1 + tsx11/ts_xutil.c | 11 +++++++++++ windows/x11drv/wnd.c | 20 ++++++++++++-------- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/include/ts_xutil.h b/include/ts_xutil.h index 007b2b2554..a5bc7236ae 100644 --- a/include/ts_xutil.h +++ b/include/ts_xutil.h @@ -27,6 +27,7 @@ extern int TSXEmptyRegion(Region); extern int TSXEqualRegion(Region, Region); extern int TSXFindContext(Display*, XID, XContext, XPointer*); extern XVisualInfo * TSXGetVisualInfo(Display*, long, XVisualInfo*, int*); +extern XWMHints * TSXGetWMHints(Display*, Window); extern int TSXGetWMSizeHints(Display*, Window, XSizeHints*, long*, Atom); extern int TSXIntersectRegion(Region, Region, Region); extern int TSXLookupString(XKeyEvent*, char*, int, KeySym*, XComposeStatus*); diff --git a/tsx11/X11_calls b/tsx11/X11_calls index 5a558ca592..88b9c823bc 100644 --- a/tsx11/X11_calls +++ b/tsx11/X11_calls @@ -75,6 +75,7 @@ XGetModifierMapping XGetScreenSaver XGetSelectionOwner XGetVisualInfo +XGetWMHints XGetWMSizeHints XGetWindowAttributes XGetWindowProperty diff --git a/tsx11/ts_xutil.c b/tsx11/ts_xutil.c index 638a6149c0..0eb2a372c5 100644 --- a/tsx11/ts_xutil.c +++ b/tsx11/ts_xutil.c @@ -138,6 +138,17 @@ XVisualInfo * TSXGetVisualInfo(Display* a0, long a1, XVisualInfo* a2, int* a3) return r; } +XWMHints * TSXGetWMHints(Display* a0, Window a1) +{ + XWMHints * r; + TRACE("Call XGetWMHints\n"); + EnterCriticalSection( &X11DRV_CritSection ); + r = XGetWMHints(a0, a1); + LeaveCriticalSection( &X11DRV_CritSection ); + TRACE("Ret XGetWMHints\n"); + return r; +} + int TSXGetWMSizeHints(Display* a0, Window a1, XSizeHints* a2, long* a3, Atom a4) { int r; diff --git a/windows/x11drv/wnd.c b/windows/x11drv/wnd.c index 6f82203937..c9bd45874e 100644 --- a/windows/x11drv/wnd.c +++ b/windows/x11drv/wnd.c @@ -249,12 +249,14 @@ static void X11DRV_WND_UpdateIconHints(WND *wndPtr) X11DRV_WND_IconChanged(wndPtr); - wm_hints = TSXAllocWMHints(); - - X11DRV_WND_SetIconHints(wndPtr, wm_hints); - - TSXSetWMHints( display, X11DRV_WND_GetXWindow(wndPtr), wm_hints ); - TSXFree( wm_hints ); + wm_hints = TSXGetWMHints( display, X11DRV_WND_GetXWindow(wndPtr) ); + if (!wm_hints) wm_hints = TSXAllocWMHints(); + if (wm_hints) + { + X11DRV_WND_SetIconHints(wndPtr, wm_hints); + TSXSetWMHints( display, X11DRV_WND_GetXWindow(wndPtr), wm_hints ); + TSXFree( wm_hints ); + } } @@ -362,7 +364,7 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO WIN_ReleaseWndPtr(tmpWnd); } - wm_hints = TSXAllocWMHints(); + if ((wm_hints = TSXAllocWMHints())) { wm_hints->flags = InputHint | StateHint | WindowGroupHint; wm_hints->input = True; @@ -831,7 +833,9 @@ void X11DRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL bSetClipOrigin */ static BOOL X11DRV_SetWMHint(Display* display, WND* wndPtr, int hint, int val) { - XWMHints* wm_hints = TSXAllocWMHints(); + XWMHints* wm_hints = TSXGetWMHints( display, X11DRV_WND_GetXWindow(wndPtr) ); + if (!wm_hints) wm_hints = TSXAllocWMHints(); + if (wm_hints) { wm_hints->flags = hint; switch( hint ) -- 2.32.0.93.g670b81a890