From e545052fdbc990efe71a596ad9a39d3ff655141b Mon Sep 17 00:00:00 2001 From: patthoyts Date: Tue, 8 Dec 2009 21:48:24 +0000 Subject: [Bug 2864685] backported extended window manager hinting from HEAD --- ChangeLog | 5 +++++ unix/tkUnixWm.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2aa4465..ce353fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-08 Pat Thoyts + + * unix/tkUnixWm.c: [Bug 2864685] backported window manager hinting + update from HEAD + 2009-12-06 Benjamin Riefenstahl * macosx/tkMacOSXFont.c (GetFontFamilyName): [Bug #2548661] Merge fix diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index a7038c6..9a5467a 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixWm.c,v 1.58.2.4 2009/11/24 15:18:17 dkf Exp $ + * RCS: @(#) $Id: tkUnixWm.c,v 1.58.2.5 2009/12/08 21:48:24 patthoyts Exp $ */ #include "tkUnixInt.h" @@ -6605,6 +6605,30 @@ GetMaxSize( /* *---------------------------------------------------------------------- * + * TkSetTransientFor -- + * + * Set a Tk window to be transient with reference to a specified + * parent or the toplevel ancestor if None is passed as parent. + * + *---------------------------------------------------------------------- + */ + +void +TkSetTransientFor(Tk_Window tkwin, Tk_Window parent) +{ + if (parent == None) { + parent = Tk_Parent(tkwin); + while (!Tk_IsTopLevel(parent)) + parent = Tk_Parent(tkwin); + } + XSetTransientForHint(Tk_Display(tkwin), + ((TkWindow *)tkwin)->wmInfoPtr->wrapperPtr->window, + ((TkWindow *)parent)->wmInfoPtr->wrapperPtr->window); +} + +/* + *---------------------------------------------------------------------- + * * TkpMakeMenuWindow -- * * Configure the window to be either a pull-down (or pop-up) menu, or as @@ -6631,6 +6655,7 @@ TkpMakeMenuWindow( WmInfo *wmPtr; XSetWindowAttributes atts; TkWindow *wrapperPtr; + Atom atom; if (!Tk_HasWrapper(tkwin)) { return; @@ -6643,10 +6668,17 @@ TkpMakeMenuWindow( if (transient) { atts.override_redirect = True; atts.save_under = True; + atom = Tk_InternAtom((Tk_Window) tkwin, "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"); } else { atts.override_redirect = False; atts.save_under = False; + atom = Tk_InternAtom((Tk_Window) tkwin, "_NET_WM_WINDOW_TYPE_MENU"); + TkSetTransientFor(tkwin, NULL); } + XChangeProperty(Tk_Display(tkwin), wrapperPtr->window, + Tk_InternAtom((Tk_Window) tkwin, "_NET_WM_WINDOW_TYPE"), + XA_ATOM, 32, PropModeReplace, + (unsigned char *) &atom, 1); /* * The override-redirect and save-under bits must be set on the wrapper -- cgit v0.12