summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordas <das>2007-05-09 12:55:15 (GMT)
committerdas <das>2007-05-09 12:55:15 (GMT)
commitc0e4ec8c452c01a8d95608e922f8bd3657c10ccb (patch)
tree506fdf03b09705deab71a428fb32dc8204a24c92 /macosx
parentb7ca14476921fec908be93647b91fe3947b5f824 (diff)
downloadtk-c0e4ec8c452c01a8d95608e922f8bd3657c10ccb.zip
tk-c0e4ec8c452c01a8d95608e922f8bd3657c10ccb.tar.gz
tk-c0e4ec8c452c01a8d95608e922f8bd3657c10ccb.tar.bz2
* macosx/tkMacOSXWindowEvent.c: ensure window is brought to the front
* macosx/tkMacOSXMouseEvent.c: at the start of a window drag (except * macosx/tkMacOSXInt.h: when cmd key is down); formatting and whitespace fixes. * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd): add -filetypes option processing (fixes fileDialog-0.1, fileDialog-0.2 failures). * macosx/tkMacOSXEmbed.c (TkpMakeWindow, TkpUseWindow): fix sending of Visibility event for embedded windows (fixes frame-3.9 hang). * macosx/tkMacOSXScrlbr.c (ScrollbarBindProc): fix testsuite * macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): crashes by adding sanity checks. * macosx/Wish.xcodeproj/project.pbxproj: add 'DebugUnthreaded' & * macosx/Wish.xcodeproj/default.pbxuser: 'DebugLeaks' targets and env var settings needed to run the 'leaks' tool. * macosx/tkMacOSXButton.c: fix debug msg typo.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Wish.xcodeproj/default.pbxuser38
-rw-r--r--macosx/Wish.xcodeproj/project.pbxproj59
-rw-r--r--macosx/tkMacOSXButton.c4
-rw-r--r--macosx/tkMacOSXDialog.c14
-rw-r--r--macosx/tkMacOSXEmbed.c107
-rw-r--r--macosx/tkMacOSXInt.h3
-rw-r--r--macosx/tkMacOSXMouseEvent.c81
-rw-r--r--macosx/tkMacOSXScrlbr.c13
-rw-r--r--macosx/tkMacOSXSubwindows.c10
-rw-r--r--macosx/tkMacOSXWindowEvent.c264
10 files changed, 350 insertions, 243 deletions
diff --git a/macosx/Wish.xcodeproj/default.pbxuser b/macosx/Wish.xcodeproj/default.pbxuser
index 853eaaa..8c7c7b7 100644
--- a/macosx/Wish.xcodeproj/default.pbxuser
+++ b/macosx/Wish.xcodeproj/default.pbxuser
@@ -33,13 +33,17 @@
NO,
NO,
NO,
+ NO,
+ NO,
);
argumentStrings = (
"${SRCROOT}/../../tk/library/demos/widget",
"${SRCROOT}/../../tk/library/demos/ttk_demo.tcl",
"${SRCROOT}/../../tk/tests/all.tcl",
+ "-geometry +0+0",
"-singleproc 1",
"-verbose \"bet\"",
+ "-skip 'unixfont-5.11 window-2.9'",
);
autoAttachOnCrash = 1;
configStateDict = {
@@ -88,13 +92,43 @@
value = /Library/Tcl;
},
{
- active = YES;
+ active = NO;
+ name = DYLD_PRINT_LIBRARIES;
+ },
+ {
+ active = NO;
+ name = EventDebug;
+ value = 1;
+ },
+ {
+ active = NO;
name = MallocBadFreeAbort;
value = 1;
},
{
active = NO;
- name = DYLD_PRINT_LIBRARIES;
+ name = MallocLogFile;
+ value = /tmp/malloc.log;
+ },
+ {
+ active = NO;
+ name = MallocStackLogging;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocStackLoggingNoCompact;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocPreScribble;
+ value = 1;
+ },
+ {
+ active = NO;
+ name = MallocScribble;
+ value = 1;
},
);
executableSystemSymbolLevel = 0;
diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj
index bcdd9f7..6da3e9d 100644
--- a/macosx/Wish.xcodeproj/project.pbxproj
+++ b/macosx/Wish.xcodeproj/project.pbxproj
@@ -1786,7 +1786,7 @@
F966C06F08F281DC005CB29B /* Frameworks */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
- comments = "Copyright (c) 2004-2007 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.19 2007/04/23 21:24:35 das Exp $\n";
+ comments = "Copyright (c) 2004-2007 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.20 2007/05/09 12:55:16 das Exp $\n";
name = Wish;
path = .;
sourceTree = SOURCE_ROOT;
@@ -4110,6 +4110,57 @@
};
name = DebugNoFixZL;
};
+ F98BA83E0BEB6A0100E34417 /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ };
+ name = DebugUnthreaded;
+ };
+ F98BA83F0BEB6A0100E34417 /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = Wish;
+ };
+ name = DebugLeaks;
+ };
+ F98BA8400BEB6A0100E34417 /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugUnthreaded;
+ };
+ F98BA8410BEB6A0100E34417 /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = tktest;
+ };
+ name = DebugLeaks;
+ };
+ F98BA8420BEB6A0100E34417 /* DebugUnthreaded */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ CONFIGURE_ARGS = "$(CONFIGURE_ARGS) --disable-threads";
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = NO;
+ };
+ name = DebugUnthreaded;
+ };
+ F98BA8430BEB6A0100E34417 /* DebugLeaks */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */;
+ buildSettings = {
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ PURIFY,
+ "$(GCC_PREPROCESSOR_DEFINITIONS)",
+ );
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
+ PREBINDING = NO;
+ };
+ name = DebugLeaks;
+ };
F9DB62080B65ADA800A370FB /* ReleaseUniversal10.4uSDK */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -4210,7 +4261,9 @@
buildConfigurations = (
F95CC8AC09158F3100EA5ACE /* Debug */,
F95CC8AE09158F3100EA5ACE /* DebugNoFixZL */,
+ F98BA83E0BEB6A0100E34417 /* DebugUnthreaded */,
F94173790BC145DD00C54E27 /* DebugMemCompile */,
+ F98BA83F0BEB6A0100E34417 /* DebugLeaks */,
F95CC8AD09158F3100EA5ACE /* Release */,
F91BCC4F093152310042A6BF /* ReleaseUniversal */,
F9DB62080B65ADA800A370FB /* ReleaseUniversal10.4uSDK */,
@@ -4225,7 +4278,9 @@
buildConfigurations = (
F95CC8B109158F3100EA5ACE /* Debug */,
F95CC8B309158F3100EA5ACE /* DebugNoFixZL */,
+ F98BA8400BEB6A0100E34417 /* DebugUnthreaded */,
F941737A0BC145DD00C54E27 /* DebugMemCompile */,
+ F98BA8410BEB6A0100E34417 /* DebugLeaks */,
F95CC8B209158F3100EA5ACE /* Release */,
F91BCC50093152310042A6BF /* ReleaseUniversal */,
F9DB62090B65ADA800A370FB /* ReleaseUniversal10.4uSDK */,
@@ -4240,7 +4295,9 @@
buildConfigurations = (
F95CC8B609158F3100EA5ACE /* Debug */,
F95CC8B809158F3100EA5ACE /* DebugNoFixZL */,
+ F98BA8420BEB6A0100E34417 /* DebugUnthreaded */,
F941737B0BC145DD00C54E27 /* DebugMemCompile */,
+ F98BA8430BEB6A0100E34417 /* DebugLeaks */,
F95CC8B709158F3100EA5ACE /* Release */,
F91BCC51093152310042A6BF /* ReleaseUniversal */,
F9DB620A0B65ADA800A370FB /* ReleaseUniversal10.4uSDK */,
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 3840861..93e73b9 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXButton.c,v 1.24 2007/04/25 15:06:13 das Exp $
+ * RCS: @(#) $Id: tkMacOSXButton.c,v 1.25 2007/05/09 12:55:15 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -833,7 +833,7 @@ TkMacOSXInitControl(
mbPtr->params.procID, controlReference);
if (!mbPtr->control) {
- TkMacOSXDbgMsg("failed to create control of type %d\n", procID);
+ TkMacOSXDbgMsg("Failed to create control of type %d\n", procID);
return 1;
}
if (ChkErr(EmbedControl, mbPtr->control,mbPtr->userPane) != noErr ) {
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 114962b..14117ac 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.24 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.25 2007/05/09 12:55:15 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -424,9 +424,14 @@ Tk_GetSaveFileObjCmd(
InitFileDialogs();
}
+ TkInitFileFilters(&ofd.fl);
+ ofd.curType = 0;
+ ofd.usePopup = 0;
+
for (i = 1; i < objc; i += 2) {
char *choice, *string;
int index, choiceLen;
+ Tcl_Obj *types;
if (Tcl_GetIndexFromObj(interp, objv[i], saveOptionStrings, "option",
TCL_EXACT, &index) != TCL_OK) {
@@ -442,7 +447,10 @@ Tk_GetSaveFileObjCmd(
case SAVE_DEFAULT:
break;
case SAVE_FILETYPES:
- /* Currently unimplemented - what would we do here anyway? */
+ types = objv[i + 1];
+ if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
+ goto end;
+ }
break;
case SAVE_INITDIR:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
@@ -480,8 +488,6 @@ Tk_GetSaveFileObjCmd(
}
}
- TkInitFileFilters(&ofd.fl);
- ofd.usePopup = 0;
if (initialDesc.descriptorType == typeFSRef) {
initialPtr = &initialDesc;
}
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index f8ca9a7..04d0e4d 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.11 2007/04/25 00:02:04 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.12 2007/05/09 12:55:15 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -135,49 +135,49 @@ TkpMakeWindow(
*/
if (Tk_IsEmbedded(winPtr)) {
- return (Window) winPtr->privatePtr;
- }
-
- /*
- * Allocate sub window
- */
-
- macWin = (MacDrawable *) ckalloc(sizeof(MacDrawable));
- if (macWin == NULL) {
- winPtr->privatePtr = NULL;
- return None;
- }
- macWin->winPtr = winPtr;
- winPtr->privatePtr = macWin;
- macWin->clipRgn = NewRgn();
- macWin->aboveClipRgn = NewRgn();
- macWin->drawRgn = NewRgn();
- macWin->referenceCount = 0;
- macWin->flags = TK_CLIP_INVALID;
-
- macWin->grafPtr = NULL;
- macWin->context = NULL;
- if (Tk_IsTopLevel(macWin->winPtr)) {
+ macWin = winPtr->privatePtr;
+ } else {
/*
- *This will be set when we are mapped.
+ * Allocate sub window
*/
- macWin->xOff = 0;
- macWin->yOff = 0;
- macWin->toplevel = macWin;
- } else {
- macWin->xOff = winPtr->parentPtr->privatePtr->xOff +
- winPtr->parentPtr->changes.border_width +
- winPtr->changes.x;
- macWin->yOff = winPtr->parentPtr->privatePtr->yOff +
- winPtr->parentPtr->changes.border_width +
- winPtr->changes.y;
- macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel;
- }
- macWin->toplevel->referenceCount++;
+ macWin = (MacDrawable *) ckalloc(sizeof(MacDrawable));
+ if (macWin == NULL) {
+ winPtr->privatePtr = NULL;
+ return None;
+ }
+ macWin->winPtr = winPtr;
+ winPtr->privatePtr = macWin;
+ macWin->clipRgn = NewRgn();
+ macWin->aboveClipRgn = NewRgn();
+ macWin->drawRgn = NewRgn();
+ macWin->referenceCount = 0;
+ macWin->flags = TK_CLIP_INVALID;
+
+ macWin->grafPtr = NULL;
+ macWin->context = NULL;
+ if (Tk_IsTopLevel(macWin->winPtr)) {
+ /*
+ *This will be set when we are mapped.
+ */
+ macWin->xOff = 0;
+ macWin->yOff = 0;
+ macWin->toplevel = macWin;
+ } else {
+ macWin->xOff = winPtr->parentPtr->privatePtr->xOff +
+ winPtr->parentPtr->changes.border_width +
+ winPtr->changes.x;
+ macWin->yOff = winPtr->parentPtr->privatePtr->yOff +
+ winPtr->parentPtr->changes.border_width +
+ winPtr->changes.y;
+ macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel;
+ }
+ macWin->toplevel->referenceCount++;
+ }
/*
* TODO: need general solution for visibility events.
*/
+
event.xany.serial = Tk_Display(winPtr)->request;
event.xany.send_event = False;
event.xany.display = Tk_Display(winPtr);
@@ -225,7 +225,6 @@ TkpUseWindow(
TkWindow *usePtr;
MacDrawable *parent, *macWin;
Container *containerPtr;
- XEvent event;
if (winPtr->window != None) {
Tcl_AppendResult(interp, "can't modify container after widget is "
@@ -235,7 +234,7 @@ TkpUseWindow(
/*
* Decode the container pointer, and look for it among the
- *list of available containers.
+ * list of available containers.
*
* N.B. For now, we are limiting the containers to be in the same Tk
* application as tkwin, since otherwise they would not be in our list
@@ -380,34 +379,6 @@ TkpUseWindow(
}
- /*
- * TODO: need general solution for visibility events.
- */
-
-
- event.xany.serial = Tk_Display(winPtr)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(winPtr);
-
- event.xvisibility.type = VisibilityNotify;
- event.xvisibility.window = (Window) macWin;;
- event.xvisibility.state = VisibilityUnobscured;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-
-
- /*
- * TODO: need general solution for visibility events.
- */
-
- event.xany.serial = Tk_Display(winPtr)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(winPtr);
-
- event.xvisibility.type = VisibilityNotify;
- event.xvisibility.window = (Window) macWin;;
- event.xvisibility.state = VisibilityUnobscured;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-
return TCL_OK;
}
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index 06f73bc..a6e7b86 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInt.h,v 1.23 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInt.h,v 1.24 2007/05/09 12:55:15 das Exp $
*/
#ifndef _TKMACINT
@@ -315,6 +315,7 @@ MODULE_SCOPE void TkMacOSXInstallWindowCarbonEventHandler(Tcl_Interp *interp,
MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr, WindowRef window,
int fullscreen, Tcl_Interp *interp);
MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr, int active);
+MODULE_SCOPE void TkMacOSXBringWindowForward(WindowRef wRef);
MODULE_SCOPE void* TkMacOSXGetNamedSymbol(const char* module,
const char* symbol);
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index d3d1f61..782ca69 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.28 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.29 2007/05/09 12:55:15 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -304,29 +304,31 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
*/
if ((result = HandleWindowTitlebarMouseDown(medPtr, tkwin)) != -1) {
return result;
- } else
- /*
- * Only windows with the kWindowNoActivatesAttribute can
- * receive mouse events in the background.
- */
- if (!(((TkWindow *)tkwin)->wmInfoPtr->attributes &
- kWindowNoActivatesAttribute)) {
- /*
- * Allow background window dragging & growing with Command down
- */
- if (!((medPtr->windowPart == inDrag ||
- medPtr->windowPart == inGrow) &&
- medPtr->state & Mod1Mask)) {
- TkMacOSXSetEatButtonUp(true);
- BringWindowForward(medPtr->whichWin, isFrontProcess);
- }
+ } else {
/*
- * Allow dragging & growing of windows that were/are in the
- * background.
+ * Only windows with the kWindowNoActivatesAttribute can
+ * receive mouse events in the background.
*/
- if (!(medPtr->windowPart == inDrag ||
- medPtr->windowPart == inGrow)) {
- return false;
+ if (!(((TkWindow *)tkwin)->wmInfoPtr->attributes &
+ kWindowNoActivatesAttribute)) {
+ /*
+ * Allow background window dragging & growing with Command
+ * down.
+ */
+ if (!((medPtr->windowPart == inDrag ||
+ medPtr->windowPart == inGrow) &&
+ medPtr->state & Mod1Mask)) {
+ TkMacOSXSetEatButtonUp(true);
+ BringWindowForward(medPtr->whichWin, isFrontProcess);
+ }
+ /*
+ * Allow dragging & growing of windows that were/are in the
+ * background.
+ */
+ if (!(medPtr->windowPart == inDrag ||
+ medPtr->windowPart == inGrow)) {
+ return false;
+ }
}
}
} else {
@@ -513,8 +515,7 @@ GeneratePollingEvents(MouseEventData * medPtr)
*
* BringWindowForward --
*
- * Bring this background window to the front. We also set state
- * so Tk thinks the button is currently up.
+ * Bring this background window to the front.
*
* Results:
* None.
@@ -546,6 +547,38 @@ BringWindowForward(
/*
*----------------------------------------------------------------------
*
+ * TkMacOSXBringWindowForward --
+ *
+ * Bring this background window to the front (wrapper around
+ * BringWindowForward()).
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The window is brought forward.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXBringWindowForward(
+ WindowRef wRef)
+{
+ OSStatus err;
+ ProcessSerialNumber frontPsn, ourPsn = {0, kCurrentProcess};
+ Boolean isFrontProcess = true;
+
+ err = ChkErr(GetFrontProcess, &frontPsn);
+ if (err == noErr) {
+ ChkErr(SameProcess, &frontPsn, &ourPsn, &isFrontProcess);
+ }
+ BringWindowForward(wRef, isFrontProcess);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* GenerateMouseWheelEvent --
*
* Generates a "MouseWheel" Tk event.
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 48d153a..8e1148e 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.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: tkMacOSXScrlbr.c,v 1.21 2007/04/23 21:24:34 das Exp $
+ * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.22 2007/05/09 12:55:16 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -846,7 +846,9 @@ ScrollbarBindProc(
* Workaround for Carbon bug where the scrollbar down arrow
* sometimes gets "stuck" after the mousebutton has been released.
*/
- TkMacOSXSetUpClippingRgn(Tk_WindowId(scrollPtr->tkwin));
+ if (scrollPtr->tkwin) {
+ TkMacOSXSetUpClippingRgn(Tk_WindowId(scrollPtr->tkwin));
+ }
Draw1Control(macScrollPtr->sbHandle);
}
TkMacOSXTrackingLoop(0);
@@ -855,8 +857,11 @@ ScrollbarBindProc(
* The HandleControlClick call will "eat" the ButtonUp event. We now
* generate a ButtonUp event so Tk will unset implicit grabs etc.
*/
- window = Tk_WindowId(scrollPtr->tkwin);
- TkGenerateButtonEventForXPointer(window);
+
+ if (scrollPtr->tkwin) {
+ window = Tk_WindowId(scrollPtr->tkwin);
+ TkGenerateButtonEventForXPointer(window);
+ }
if (portChanged) {
QDSwapPort(savePort, NULL);
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 377e528..f909800 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.17 2007/04/23 21:24:34 das Exp $
+ * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.18 2007/05/09 12:55:16 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -844,8 +844,10 @@ TkMacOSXUpdateClipRgn(
if (!Tk_IsTopLevel(winPtr)) {
TkMacOSXUpdateClipRgn(winPtr->parentPtr);
TkMacOSXCheckTmpRgnEmpty(1);
- SectRgn(rgn,
- winPtr->parentPtr->privatePtr->aboveClipRgn, rgn);
+ if (winPtr->parentPtr) {
+ SectRgn(rgn,
+ winPtr->parentPtr->privatePtr->aboveClipRgn, rgn);
+ }
win2Ptr = winPtr->nextPtr;
while (win2Ptr != NULL) {
@@ -1115,7 +1117,7 @@ TkMacOSXGetDrawablePort(
* of the time, this is harmless... However, we really need to
* find why the embedding loses.
*/
- DebugStr("\pTkMacOSXGetDrawablePort couldn't find container");
+ TkMacOSXDbgMsg("Couldn't find container");
return NULL;
}
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 41a9cb1..236bfdc 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.21 2007/04/23 21:24:34 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.22 2007/05/09 12:55:16 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -266,10 +266,10 @@ TkMacOSXProcessWindowEvent(
dispPtr = TkGetDisplayList();
winPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display, window);
- if (window != None) {
- switch (eventPtr->eKind) {
- case kEventWindowActivated:
- case kEventWindowDeactivated: {
+ switch (eventPtr->eKind) {
+ case kEventWindowActivated:
+ case kEventWindowDeactivated:
+ if (window != None) {
int activate = (eventPtr->eKind == kEventWindowActivated);
eventFound |= GenerateActivateEvents(window, activate);
@@ -278,146 +278,144 @@ TkMacOSXProcessWindowEvent(
TkMacOSXEnterExitFullscreen(winPtr, activate);
}
statusPtr->stopProcessing = 1;
- break;
}
- case kEventWindowUpdate:
- if (GenerateUpdateEvent(window)) {
- eventFound = true;
- statusPtr->stopProcessing = 1;
- }
- break;
- case kEventWindowExpanded:
- if (winPtr) {
- TkpWmSetState(winPtr, TkMacOSXIsWindowZoomed(winPtr) ?
- ZoomState : NormalState);
- }
- break;
- case kEventWindowBoundsChanged:
- if (winPtr) {
- WmInfo *wmPtr = winPtr->wmInfoPtr;
- UInt32 attr;
- Rect bounds;
- int x = -1, y = -1, width = -1, height = -1, flags = 0;
-
- ChkErr(GetEventParameter, eventPtr->eventRef,
- kEventParamAttributes, typeUInt32,
- NULL, sizeof(attr), NULL, &attr);
- ChkErr(GetEventParameter, eventPtr->eventRef,
- kEventParamCurrentBounds, typeQDRectangle,
- NULL, sizeof(bounds), NULL, &bounds);
- if (attr & kWindowBoundsChangeOriginChanged) {
- x = bounds.left - wmPtr->xInParent;
- y = bounds.top - wmPtr->yInParent;
- flags |= TK_LOCATION_CHANGED;
- }
- if (attr & kWindowBoundsChangeSizeChanged) {
- width = bounds.right - bounds.left;
- height = bounds.bottom - bounds.top;
- flags |= TK_SIZE_CHANGED;
- }
- TkGenWMConfigureEvent((Tk_Window)winPtr, x, y, width,
- height, flags);
- if (attr & kWindowBoundsChangeUserResize ||
- attr & kWindowBoundsChangeUserDrag) {
- TkMacOSXRunTclEventLoop();
- }
- if (wmPtr->attributes & kWindowResizableAttribute) {
- HIViewRef growBoxView;
-
- err = HIViewFindByID(HIViewGetRoot(whichWindow),
- kHIViewWindowGrowBoxID, &growBoxView);
- if (err == noErr) {
- ChkErr(HIViewSetNeedsDisplay, growBoxView, true);
- }
- }
+ break;
+ case kEventWindowUpdate:
+ if (window != None && GenerateUpdateEvent(window)) {
+ eventFound = true;
+ statusPtr->stopProcessing = 1;
+ }
+ break;
+ case kEventWindowExpanded:
+ if (winPtr) {
+ TkpWmSetState(winPtr, TkMacOSXIsWindowZoomed(winPtr) ?
+ ZoomState : NormalState);
+ }
+ break;
+ case kEventWindowBoundsChanged:
+ if (winPtr) {
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ UInt32 attr;
+ Rect bounds;
+ int x = -1, y = -1, width = -1, height = -1, flags = 0;
+
+ ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamAttributes, typeUInt32,
+ NULL, sizeof(attr), NULL, &attr);
+ ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamCurrentBounds, typeQDRectangle,
+ NULL, sizeof(bounds), NULL, &bounds);
+ if (attr & kWindowBoundsChangeOriginChanged) {
+ x = bounds.left - wmPtr->xInParent;
+ y = bounds.top - wmPtr->yInParent;
+ flags |= TK_LOCATION_CHANGED;
}
- break;
- case kEventWindowDragStarted:
- if (winPtr) {
- TkMacOSXTrackingLoop(1);
+ if (attr & kWindowBoundsChangeSizeChanged) {
+ width = bounds.right - bounds.left;
+ height = bounds.bottom - bounds.top;
+ flags |= TK_SIZE_CHANGED;
}
- break;
- case kEventWindowDragCompleted:
- if (winPtr) {
- Rect maxBounds, bounds, strWidths;
- int h = 0, v = 0;
-
- TkMacOSXTrackingLoop(0);
- ChkErr(GetWindowGreatestAreaDevice, whichWindow,
- kWindowDragRgn, NULL, &maxBounds);
- ChkErr(GetWindowBounds, whichWindow, kWindowStructureRgn,
- &bounds);
- ChkErr(GetWindowStructureWidths, whichWindow, &strWidths);
- if (bounds.left > maxBounds.right - strWidths.left) {
- h = maxBounds.right
- - (strWidths.left ? strWidths.left : 40)
- - bounds.left;
- } else if (bounds.right < maxBounds.left
- + strWidths.right) {
- h = maxBounds.left
- + (strWidths.right ? strWidths.right : 40)
- - bounds.right;
- }
- if (bounds.top > maxBounds.bottom - strWidths.top) {
- v = maxBounds.bottom
- - (strWidths.top ? strWidths.top : 40)
- - bounds.top;
- } else if (bounds.bottom < maxBounds.top
- + strWidths.bottom) {
- v = maxBounds.top
- + (strWidths.bottom ? strWidths.bottom : 40)
- - bounds.bottom;
- } else if (strWidths.top && bounds.top < maxBounds.top) {
- v = maxBounds.top - bounds.top;
- }
- if (h || v) {
- OffsetRect(&bounds, h, v);
- ChkErr(SetWindowBounds, whichWindow,
- kWindowStructureRgn, &bounds);
- }
+ TkGenWMConfigureEvent((Tk_Window)winPtr, x, y, width,
+ height, flags);
+ if (attr & kWindowBoundsChangeUserResize ||
+ attr & kWindowBoundsChangeUserDrag) {
+ TkMacOSXRunTclEventLoop();
}
- break;
- case kEventWindowConstrain:
- if (winPtr) {
- if (winPtr->wmInfoPtr->flags & WM_FULLSCREEN &&
- TkMacOSXMakeFullscreen(winPtr, whichWindow, 1,
- NULL) == TCL_OK) {
- statusPtr->stopProcessing = 1;
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ HIViewRef growBoxView;
+
+ err = HIViewFindByID(HIViewGetRoot(whichWindow),
+ kHIViewWindowGrowBoxID, &growBoxView);
+ if (err == noErr) {
+ ChkErr(HIViewSetNeedsDisplay, growBoxView, true);
}
}
- break;
- case kEventWindowGetRegion:
- if (winPtr && (winPtr->wmInfoPtr->flags & WM_TRANSPARENT)) {
- WindowRegionCode code;
+ }
+ break;
+ case kEventWindowDragStarted:
+ TkMacOSXTrackingLoop(1);
+ if (!(TkMacOSXModifierState() & cmdKey)) {
+ TkMacOSXBringWindowForward(whichWindow);
+ }
+ break;
+ case kEventWindowDragCompleted: {
+ Rect maxBounds, bounds, strWidths;
+ int h = 0, v = 0;
+
+ TkMacOSXTrackingLoop(0);
+ ChkErr(GetWindowGreatestAreaDevice, whichWindow,
+ kWindowDragRgn, NULL, &maxBounds);
+ ChkErr(GetWindowBounds, whichWindow, kWindowStructureRgn,
+ &bounds);
+ ChkErr(GetWindowStructureWidths, whichWindow, &strWidths);
+ if (bounds.left > maxBounds.right - strWidths.left) {
+ h = maxBounds.right
+ - (strWidths.left ? strWidths.left : 40)
+ - bounds.left;
+ } else if (bounds.right < maxBounds.left
+ + strWidths.right) {
+ h = maxBounds.left
+ + (strWidths.right ? strWidths.right : 40)
+ - bounds.right;
+ }
+ if (bounds.top > maxBounds.bottom - strWidths.top) {
+ v = maxBounds.bottom
+ - (strWidths.top ? strWidths.top : 40)
+ - bounds.top;
+ } else if (bounds.bottom < maxBounds.top
+ + strWidths.bottom) {
+ v = maxBounds.top
+ + (strWidths.bottom ? strWidths.bottom : 40)
+ - bounds.bottom;
+ } else if (strWidths.top && bounds.top < maxBounds.top) {
+ v = maxBounds.top - bounds.top;
+ }
+ if (h || v) {
+ OffsetRect(&bounds, h, v);
+ ChkErr(SetWindowBounds, whichWindow,
+ kWindowStructureRgn, &bounds);
+ }
+ break;
+ }
+ case kEventWindowConstrain:
+ if (winPtr && (winPtr->wmInfoPtr->flags & WM_FULLSCREEN) &&
+ TkMacOSXMakeFullscreen(winPtr, whichWindow, 1,
+ NULL) == TCL_OK) {
+ statusPtr->stopProcessing = 1;
+ }
+ break;
+ case kEventWindowGetRegion:
+ if (winPtr && (winPtr->wmInfoPtr->flags & WM_TRANSPARENT)) {
+ WindowRegionCode code;
+
+ statusPtr->stopProcessing = (CallNextEventHandler(
+ eventPtr->callRef, eventPtr->eventRef) == noErr);
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamWindowRegionCode, typeWindowRegionCode,
+ NULL, sizeof(code), NULL, &code);
+ if (err == noErr && code == kWindowOpaqueRgn) {
+ RgnHandle rgn;
- statusPtr->stopProcessing = (CallNextEventHandler(
- eventPtr->callRef, eventPtr->eventRef) == noErr);
err = ChkErr(GetEventParameter, eventPtr->eventRef,
- kEventParamWindowRegionCode, typeWindowRegionCode,
- NULL, sizeof(code), NULL, &code);
- if (err == noErr && code == kWindowOpaqueRgn) {
- RgnHandle rgn;
-
- err = ChkErr(GetEventParameter, eventPtr->eventRef,
- kEventParamRgnHandle, typeQDRgnHandle, NULL,
- sizeof(rgn), NULL, &rgn);
- if (err == noErr) {
- SetEmptyRgn(rgn);
- statusPtr->stopProcessing = 1;
- }
+ kEventParamRgnHandle, typeQDRgnHandle, NULL,
+ sizeof(rgn), NULL, &rgn);
+ if (err == noErr) {
+ SetEmptyRgn(rgn);
+ statusPtr->stopProcessing = 1;
}
}
- break;
- case kEventWindowDrawContent:
- if (winPtr && (winPtr->wmInfoPtr->flags & WM_TRANSPARENT)) {
- CGrafPtr port;
+ }
+ break;
+ case kEventWindowDrawContent:
+ if (winPtr && (winPtr->wmInfoPtr->flags & WM_TRANSPARENT)) {
+ CGrafPtr port;
- GetPort(&port);
- ClearPort(port);
- }
- break;
- }
+ GetPort(&port);
+ ClearPort(port);
+ }
+ break;
}
+
return 0;
}