Attachment "wm-wrapper-2.patch" to
ticket [540920ff]
added by
jenglish
2002-08-10 01:53:32.
Index: doc/wm.n
===================================================================
RCS file: /cvsroot/tktoolkit/tk/doc/wm.n,v
retrieving revision 1.11
diff -u -r1.11 wm.n
--- doc/wm.n 16 Jul 2002 18:06:41 -0000 1.11
+++ doc/wm.n 9 Aug 2002 18:51:49 -0000
@@ -483,6 +483,13 @@
window and then re-map it (e.g. with \fBwm deiconify\fR) to get some
window managers to pay attention to changes in window attributes
such as group.
+.TP
+\fBwm wrapper \fIwindow\fR
+(Unix only.)
+Under X11, Tk creates a wrapper window around top-level windows
+to hold the menu bar.
+This command returns the platform specific window identifier
+for the wrapper window.
.SH "GEOMETRY MANAGEMENT"
.PP
Index: unix/tkUnixWm.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/tkUnixWm.c,v
retrieving revision 1.33
diff -u -r1.33 tkUnixWm.c
--- unix/tkUnixWm.c 8 Aug 2002 23:49:50 -0000 1.33
+++ unix/tkUnixWm.c 9 Aug 2002 18:51:50 -0000
@@ -436,6 +436,9 @@
static int WmWithdrawCmd _ANSI_ARGS_((Tk_Window tkwin,
TkWindow *winPtr, Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[]));
+static int WmWrapperCmd _ANSI_ARGS_((Tk_Window tkwin,
+ TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]));
static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr,
TkWindow *winPtr));
@@ -972,7 +975,7 @@
"iconwindow", "maxsize", "minsize", "overrideredirect",
"positionfrom", "protocol", "resizable", "sizefrom",
"stackorder", "state", "title", "transient",
- "withdraw", (char *) NULL };
+ "withdraw", "wrapper", (char *) NULL };
enum options {
WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FRAME,
@@ -981,7 +984,7 @@
WMOPT_ICONWINDOW, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
- WMOPT_WITHDRAW };
+ WMOPT_WITHDRAW, WMOPT_WRAPPER };
int index;
int length;
char *argv1;
@@ -1097,6 +1100,8 @@
return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
case WMOPT_WITHDRAW:
return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_WRAPPER:
+ return WmWrapperCmd(tkwin, winPtr, interp, objc, objv);
}
/* This should not happen */
@@ -3142,6 +3147,50 @@
TCL_STATIC);
return TCL_ERROR;
}
+ return TCL_OK;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmWrapperCmd --
+ *
+ * This procedure is invoked to process the "wm wrapper" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmWrapperCmd(tkwin, winPtr, interp, objc, objv)
+ Tk_Window tkwin; /* Main window of the application. */
+ TkWindow *winPtr; /* Toplevel to work with */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj *CONST objv[]; /* Argument objects. */
+{
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+ Window window;
+ char buf[TCL_INTEGER_SPACE];
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window");
+ return TCL_ERROR;
+ }
+ if (wmPtr->wrapperPtr == NULL || wmPtr->wrapperPtr->window == None) {
+ window = Tk_WindowId((Tk_Window) winPtr);
+ } else {
+ window = wmPtr->wrapperPtr->window;
+ }
+ sprintf(buf, "0x%x", (unsigned int) window);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}