From c7a967c13958ca51cd87ce6b074c8c1ef734913d Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Fri, 29 Apr 2011 01:11:03 +0000 Subject: Implement support for [wm forget] and [wm manage] on OS X; fix issue with library stripping in install-sh --- library/demos/toolbar.tcl | 6 +++--- macosx/tkMacOSXWm.c | 45 ++++++++++++++------------------------------- unix/install-sh | 6 +++++- 3 files changed, 22 insertions(+), 35 deletions(-) diff --git a/library/demos/toolbar.tcl b/library/demos/toolbar.tcl index 81724eb..d5f1159 100644 --- a/library/demos/toolbar.tcl +++ b/library/demos/toolbar.tcl @@ -17,7 +17,7 @@ wm title $w "Toolbar Demonstration" wm iconname $w "toolbar" positionWindow $w -if {[tk windowingsystem] ne "aqua"} { +if {[tk windowingsystem] ne {}} { ttk::label $w.msg -wraplength 4i -text "This is a demonstration of how to do\ a toolbar that is styled correctly and which can be torn off. The\ buttons are configured to be \u201Ctoolbar style\u201D buttons by\ @@ -38,7 +38,7 @@ ttk::label $w.msg -wraplength 4i -text "This is a demonstration of how to do\ set t [frame $w.toolbar] ;# Must be a frame! ttk::separator $w.sep ttk::frame $t.tearoff -cursor fleur -if {[tk windowingsystem] ne "aqua"} { +if {[tk windowingsystem] ne {}} { ttk::separator $t.tearoff.to -orient vertical ttk::separator $t.tearoff.to2 -orient vertical pack $t.tearoff.to -fill y -expand 1 -padx 2 -side left @@ -49,7 +49,7 @@ grid $t.tearoff $t.contents -sticky nsew grid columnconfigure $t $t.contents -weight 1 grid columnconfigure $t.contents 1000 -weight 1 -if {[tk windowingsystem] ne "aqua"} { +if {[tk windowingsystem] ne {}} { ## Bindings so that the toolbar can be torn off and reattached bind $t.tearoff [list tearoff $t %X %Y] bind $t.tearoff.to [list tearoff $t %X %Y] diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index d11c14b..17aa31f 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -563,6 +563,7 @@ TkWmNewWindow( UpdateVRootGeometry(wmPtr); + /* * Tk must monitor structure events for top-level windows, in order to * detect size and position changes caused by window managers. @@ -1637,41 +1638,28 @@ WmForgetCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { -#ifndef WM_FORGET_SUPPORTED - Tcl_AppendResult(interp, "wm forget is not yet supported", NULL); - return TCL_ERROR; -#else + register Tk_Window frameWin = (Tk_Window)winPtr; - char *oldClass = (char*)Tk_Class(frameWin); if (Tk_IsTopLevel(frameWin)) { - MacDrawable *macWin = (MacDrawable *) winPtr->window; - CGrafPtr destPort = TkMacOSXGetDrawablePort(winPtr->window); - - TkFocusJoin(winPtr); - Tk_UnmapWindow(frameWin); - - if (destPort != NULL) { - WindowRef winRef = GetWindowFromPort(destPort); - - TkMacOSXUnregisterMacWindow(winRef); - DisposeWindow(winRef); - } - macWin->grafPtr = NULL; - macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel; - macWin->flags &= ~TK_HOST_EXISTS; + MacDrawable *macWin = (MacDrawable *) winPtr->parentPtr->window; + TkFocusJoin(winPtr); + Tk_UnmapWindow(frameWin); RemapWindows(winPtr, macWin); - TkWmDeadWindow(winPtr); - winPtr->flags &= - ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED); + + TkWmDeadWindow(macWin); + winPtr->flags &=~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED); + + /* + * Flags (above) must be cleared before calling TkMapTopFrame (below). + */ TkMapTopFrame(frameWin); } else { - /* Already not managed by wm - ignore it */ + /* Already not managed by wm - ignore it */ } return TCL_OK; -#endif } /* @@ -2393,10 +2381,7 @@ WmManageCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { -#ifndef WM_FORGET_SUPPORTED - Tcl_AppendResult(interp, "wm manage is not yet supported", NULL); - return TCL_ERROR; -#else + register Tk_Window frameWin = (Tk_Window)winPtr; register WmInfo *wmPtr = winPtr->wmInfoPtr; char *oldClass = (char*)Tk_Class(frameWin); @@ -2423,7 +2408,6 @@ WmManageCmd( } wmPtr = winPtr->wmInfoPtr; winPtr->flags &= ~TK_MAPPED; - macWin->grafPtr = NULL; macWin->toplevel = macWin; RemapWindows(winPtr, macWin); winPtr->flags |= @@ -2433,7 +2417,6 @@ WmManageCmd( /* Already managed by wm - ignore it */ } return TCL_OK; -#endif } /* diff --git a/unix/install-sh b/unix/install-sh index 3f83ce9..5975819 100644 --- a/unix/install-sh +++ b/unix/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2010-02-06.18; # UTC +scriptversion=2011-04-20.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -120,6 +120,7 @@ Options: -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. + -S $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. @@ -155,6 +156,9 @@ while test $# -ne 0; do -s) stripcmd=$stripprog;; +-S) stripcmd="$stripprog $2" + shift;; + -t) dst_arg=$2 shift;; -- cgit v0.12