summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixWm.c
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2009-12-08 20:34:23 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2009-12-08 20:34:23 (GMT)
commit23e96237d65ce3c376c137556d831dbd7d0a30b1 (patch)
tree35e4fd484a5e5bc2ea797ceef274e896083ff6d4 /unix/tkUnixWm.c
parent0497ee90f268c6a29d29c88057e594fc8a93c487 (diff)
downloadtk-23e96237d65ce3c376c137556d831dbd7d0a30b1.zip
tk-23e96237d65ce3c376c137556d831dbd7d0a30b1.tar.gz
tk-23e96237d65ce3c376c137556d831dbd7d0a30b1.tar.bz2
[Bug 2864685] Set correct extended window manager hints on Tk menus.
Diffstat (limited to 'unix/tkUnixWm.c')
-rw-r--r--unix/tkUnixWm.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 195a9e1..7b47a51 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.74 2009/11/24 15:06:23 dkf Exp $
+ * RCS: @(#) $Id: tkUnixWm.c,v 1.75 2009/12/08 20:34:23 patthoyts Exp $
*/
#include "tkUnixInt.h"
@@ -6608,6 +6608,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
@@ -6634,6 +6658,7 @@ TkpMakeMenuWindow(
WmInfo *wmPtr;
XSetWindowAttributes atts;
TkWindow *wrapperPtr;
+ Atom atom;
if (!Tk_HasWrapper(tkwin)) {
return;
@@ -6646,10 +6671,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