summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tclets.r172
-rw-r--r--macosx/tkMacOSXCarbonEvents.c146
-rw-r--r--macosx/tkMacOSXDebug.c2
-rw-r--r--macosx/tkMacOSXDebug.h2
-rw-r--r--macosx/tkMacOSXDialog.c12
-rw-r--r--macosx/tkMacOSXEmbed.c9
-rw-r--r--macosx/tkMacOSXEntry.c2
-rw-r--r--macosx/tkMacOSXEvent.c10
-rw-r--r--macosx/tkMacOSXEvent.h4
-rw-r--r--macosx/tkMacOSXFont.c11
-rw-r--r--macosx/tkMacOSXHLEvents.c68
-rw-r--r--macosx/tkMacOSXInit.c3
-rw-r--r--macosx/tkMacOSXInt.h4
-rw-r--r--macosx/tkMacOSXKeyEvent.c19
-rw-r--r--macosx/tkMacOSXMenu.c17
-rw-r--r--macosx/tkMacOSXMenus.c32
-rw-r--r--macosx/tkMacOSXMouseEvent.c770
-rw-r--r--macosx/tkMacOSXPort.h5
-rw-r--r--macosx/tkMacOSXScale.c84
-rw-r--r--macosx/tkMacOSXScrlbr.c5
-rw-r--r--macosx/tkMacOSXSubwindows.c171
-rw-r--r--macosx/tkMacOSXTest.c7
-rw-r--r--macosx/tkMacOSXWindowEvent.c51
-rw-r--r--macosx/tkMacOSXWm.c71
-rw-r--r--macosx/tkMacOSXWm.h2
-rw-r--r--macosx/tkMacOSXXStubs.c6
26 files changed, 895 insertions, 790 deletions
diff --git a/macosx/tclets.r b/macosx/tclets.r
deleted file mode 100644
index ce68db4..0000000
--- a/macosx/tclets.r
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * tclets.r --
- *
- */
-
-/*
- * New style DLOG templates have an extra field for the positioning
- * options for the Dialog Box. We will not use this, for now, so we
- * turn it off here.
- */
-
-#define DLOG_RezTemplateVersion 0
-
-#include <Types.r>
-#include <SysTypes.r>
-#include <AEUserTermTypes.r>
-
-/*
- * We now load the Tclets code into the resource fork
- */
-
-#define TK_LIBRARY_RESOURCES 3000
-
-read 'TEXT' (TK_LIBRARY_RESOURCES+114, "tclshrc", purgeable)
- "::mac:tclets.tcl";
-
-data 'icns' (-16455) {
- $"6963 6E73 0000 08F8 6963 7323 0000 0048" /* icns...ics#...H */
- $"0100 02EE 05CE 09EE 13DE 23FF 47CE 86C6" /* .....#GΆ */
- $"4681 22C2 12C4 0888 0410 0220 0140 0080" /* F"..... .@. */
- $"0100 03EE 07CE 0FEE 1FFE 3FFF 7FFE FFFE" /* ......?. */
- $"7FFF 3FFE 1FFC 0FF8 07F0 03E0 01C0 0080" /* .?...... */
- $"6963 7334 0000 0088 0000 000F 0000 0000" /* ics4........... */
- $"0000 00FC F6D0 FFF0 0000 0FC5 DD00 F6F0" /* ....... */
- $"0000 FCCD 66F0 F6F0 000F CC6E 66CE F6F0" /* ..f..nf */
- $"00FC CC6E 67EF F6FF 0FCC CD66 66CC F6F0" /* .ng.ff */
- $"FCCC CDDC 66CC CFA0 0FCC CD6C EDCC CC0F" /* fϠ.l. */
- $"00FC CC6C E6CC CCF0 000F CC6C 66CC CF00" /* .l..lf. */
- $"0000 FCCC 6CCC F000 0000 0FCC DCCF 0000" /* ..l...... */
- $"0000 00FD DCF0 0000 0000 000F CF00 0000" /* ............ */
- $"0000 0000 F000 0000 6963 7338 0000 0108" /* .......ics8.... */
- $"0000 0000 0000 00FF 0000 0000 0000 0000" /* ............... */
- $"0000 0000 0000 FF2B FFEC 7F00 FFFF FF00" /* ......+... */
- $"0000 0000 00FF 2BB0 7F7F 0000 FFEC FF00" /* .....+..... */
- $"0000 0000 FF2B 2B7F ECEC FF00 FFEC FF00" /* ....++... */
- $"0000 00FF 2B2B ECFC ECEC 2BFB FFEC FF00" /* ...+++. */
- $"0000 FF2B 2B2B ECFC ECC0 FBFF FFEC FFFF" /* ..+++ */
- $"00FF 2B2B 2B7F ECEC ECEC 2B2B FFEC FF00" /* .+++.++. */
- $"FF2B 2B2B 2B7F 7FF6 ECEC 2B2B 2BFF FD00" /* ++++..+++. */
- $"00FF 2B2B 2B7F ECF6 FCF9 2B2B 2B2B 00FF" /* .+++.++++. */
- $"0000 FF2B 2B2B ECF6 FCEC 2B2B 2B2B FF00" /* ..+++++++. */
- $"0000 00FF 2B2B ECF6 ECEC 2B2B 2BFF 0000" /* ...+++++.. */
- $"0000 0000 FF2B 2BF6 EC2B 2B2B FF00 0000" /* ....+++++... */
- $"0000 0000 00FF 2BF6 F92B 2BFF 0000 0000" /* .....+++.... */
- $"0000 0000 0000 FFF9 F92B FF00 0000 0000" /* ......+..... */
- $"0000 0000 0000 00FF 2BFF 0000 0000 0000" /* .......+...... */
- $"0000 0000 0000 0000 FF00 0000 0000 0000" /* ............... */
- $"4943 4E23 0000 0108 0001 0000 0002 8000" /* ICN#........... */
- $"0004 78F8 0008 70F8 0010 F0F8 0021 E8F8" /* ..x..p...! */
- $"0043 C4F8 0081 FAF8 0107 F1F8 0207 F0F8" /* .C..... */
- $"0407 F7FF 0807 E3FE 1007 E1FC 200E E0F8" /* ...... . */
- $"4002 E074 800E E022 400E E001 200E C002" /* @.t."@.. .. */
- $"1006 E004 0806 C008 0406 E010 0202 C020" /* ........... */
- $"0102 C040 0080 8080 0040 0100 0020 0200" /* ..@..@... .. */
- $"0010 0400 0008 0800 0004 1000 0002 2000" /* .............. . */
- $"0001 4000 0000 8000 0001 0000 0003 8000" /* ..@........... */
- $"0007 F8F8 000F F0F8 001F F0F8 003F F8F8" /* .......? */
- $"007F FCF8 00FF FEF8 01FF FFF8 03FF FFF8" /* ..... */
- $"07FF FFFF 0FFF FFFE 1FFF FFFC 3FFF FFF8" /* ...? */
- $"7FFF FFFC FFFF FFFE 7FFF FFFF 3FFF FFFE" /* ..? */
- $"1FFF FFFC 0FFF FFF8 07FF FFF0 03FF FFE0" /* .... */
- $"01FF FFC0 00FF FF80 007F FF00 003F FE00" /* ......?. */
- $"001F FC00 000F F800 0007 F000 0003 E000" /* ............ */
- $"0001 C000 0000 8000 6963 6C34 0000 0208" /* ......icl4.... */
- $"0000 0000 0000 000F 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 00FC F000 0000 0000 0000" /* .............. */
- $"0000 0000 0000 0FCC CFD6 D000 FFFF F000" /* ......... */
- $"0000 0000 0000 FCCC C556 0000 F767 F000" /* ......V..g. */
- $"0000 0000 000F CCCC 566F 0000 F676 F000" /* ......Vo..v. */
- $"0000 0000 00FC CCC5 6F5C F000 F767 F000" /* .....o\.g. */
- $"0000 0000 0FCC CC66 66CC 0F00 F676 F000" /* .....ff..v. */
- $"0000 0000 FCCC CCD5 5666 FCF0 F767 F000" /* ....Vfg. */
- $"0000 000F CCCC C656 5667 CCCF F676 F000" /* ....VVgv. */
- $"0000 00FC CCCC C6E5 5566 CCCC F767 F000" /* ...Ufg. */
- $"0000 0FCC CCCC C656 5657 CFFF F676 FFFF" /* ...VVWv */
- $"0000 FCCC CCCC C6E5 565C CCF7 6767 67F0" /* ..V\ggg */
- $"000F CCCC CCCC C655 565C CCCF 7676 7F00" /* ..UV\vv.. */
- $"00FC CCCC CCCC 7660 556C CCCC F767 F000" /* .v`Ulg. */
- $"0FCC CCCC CCCC CD5D 567C CCCC CF7F CF00" /* .]V|.. */
- $"FCCC CCCC CCCC 6660 556C CCCC CCFC CCF0" /* f`Ul */
- $"0FCC CCCC CCCC 665C 565C CCCC CCCC CCCF" /* .f\V\ */
- $"00FC CCCC CCCC 6660 E6DC CCCC CCCC CCF0" /* .f` */
- $"000F CCCC CCCC C650 656C CCCC CCCC CF00" /* ..Pel. */
- $"0000 FCCC CCCC C6EC 5ECC CCCC CCCC F000" /* ..^. */
- $"0000 0FCC CCCC C650 566C CCCC CCCF 0000" /* ...PVl.. */
- $"0000 00FC CCCC CC50 D5CC CCCC CCF0 0000" /* ...P.. */
- $"0000 000F CCCC CC50 56CC CCCC CF00 0000" /* ....PV... */
- $"0000 0000 FCCC CCD0 5CCC CCCC F000 0000" /* ....\... */
- $"0000 0000 0FCC CCD0 DCCC CCCF 0000 0000" /* ......... */
- $"0000 0000 00FC CCD0 DCCC CCF0 0000 0000" /* ......... */
- $"0000 0000 000F CCD0 DCCC CF00 0000 0000" /* ........... */
- $"0000 0000 0000 FCC0 CCCC F000 0000 0000" /* ........... */
- $"0000 0000 0000 0FCD CCCF 0000 0000 0000" /* ............. */
- $"0000 0000 0000 00FC CCF0 0000 0000 0000" /* ............. */
- $"0000 0000 0000 000F CF00 0000 0000 0000" /* ............... */
- $"0000 0000 0000 0000 F000 0000 0000 0000" /* ............... */
- $"6963 6C38 0000 0408 0000 0000 0000 0000" /* icl8............ */
- $"0000 0000 0000 00FF 0000 0000 0000 0000" /* ............... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 FF2B FF00 0000 0000 0000" /* ......+....... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 00FF 2B2B 2BFF 7FEC 7F00 0000" /* .....+++..... */
- $"FFFF FFFF FF00 0000 0000 0000 0000 0000" /* ........... */
- $"0000 0000 FF2B 2B2B 2BB0 B0EC 0000 0000" /* ....++++.... */
- $"FFC0 ECC0 FF00 0000 0000 0000 0000 0000" /* ........... */
- $"0000 00FF 2B2B 2B2B B0EC ECFF 0000 0000" /* ...++++.... */
- $"FFEC C0EC FF00 0000 0000 0000 0000 0000" /* ........... */
- $"0000 FF2B 2B2B 2BB0 ECFF B02B FF00 0000" /* ..+++++... */
- $"FFC0 ECC0 FF00 0000 0000 0000 0000 0000" /* ........... */
- $"00FF 2B2B 2B2B ECEC ECEC 2B2B 00FF 0000" /* .++++++... */
- $"FFEC C0EC FF00 0000 0000 0000 0000 0000" /* ........... */
- $"FF2B 2B2B 2B2B F9B0 B0EC ECEC FF2B FF00" /* ++++++. */
- $"FFC0 ECC0 FF00 0000 0000 0000 0000 00FF" /* .......... */
- $"2B2B 2B2B 2BEC B0EC B0EC ECC0 2B2B 2BFF" /* ++++++++ */
- $"FFEC C0EC FF00 0000 0000 0000 0000 FF2B" /* .........+ */
- $"2B2B 2B2B 2BEC FCB0 B0B0 ECEC 2B2B 2B2B" /* +++++++++ */
- $"FFC0 ECC0 FF00 0000 0000 0000 00FF 2B2B" /* ........++ */
- $"2B2B 2B2B 2BEC B0EC B0EC B0C0 2BFF FFFF" /* ++++++ */
- $"FFEC C0EC FFFF FFFF 0000 0000 FF2B 2B2B" /* ....+++ */
- $"2B2B 2B2B 2BEC FCB0 B0EC B02B 2B2B FFC0" /* ++++++++ */
- $"ECC0 ECC0 ECC0 FF00 0000 00FF 2B2B 2B2B" /* ....++++ */
- $"2B2B 2B2B 2BEC B0B0 B0EC B02B 2B2B 2BFF" /* +++++찰++++ */
- $"C0EC C0EC C0FF 0000 0000 FF2B 2B2B 2B2B" /* ....+++++ */
- $"2B2B 2B2B C0EC EC00 B0B0 EC2B 2B2B 2B2B" /* ++++.+++++ */
- $"FFC0 ECC0 FF00 0000 00FF 2B2B 2B2B 2B2B" /* ....++++++ */
- $"2B2B 2B2B 2BF9 B0F9 B0EC C02B 2B2B 2B2B" /* ++++++++++ */
- $"2BFF C0FF 2BFF 0000 FF2B 2B2B 2B2B 2B2B" /* ++..+++++++ */
- $"2B2B 2B2B ECEC EC00 B0B0 EC2B 2B2B 2B2B" /* ++++.+++++ */
- $"2B2B FF2B 2B2B FF00 00FF 2B2B 2B2B 2B2B" /* +++++..++++++ */
- $"2B2B 2B2B ECEC B02B B0EC B02B 2B2B 2B2B" /* ++++++++++ */
- $"2B2B 2B2B 2B2B 2BFF 0000 FF2B 2B2B 2B2B" /* +++++++..+++++ */
- $"2B2B 2B2B ECEC EC00 FCEC F92B 2B2B 2B2B" /* ++++.+++++ */
- $"2B2B 2B2B 2B2B FF00 0000 00FF 2B2B 2B2B" /* ++++++....++++ */
- $"2B2B 2B2B 2BEC B000 ECB0 EC2B 2B2B 2B2B" /* +++++.+++++ */
- $"2B2B 2B2B 2BFF 0000 0000 0000 FF2B 2B2B" /* +++++......+++ */
- $"2B2B 2B2B 2BEC FC2B B0FC 2B2B 2B2B 2B2B" /* ++++++++++++ */
- $"2B2B 2B2B FF00 0000 0000 0000 00FF 2B2B" /* ++++........++ */
- $"2B2B 2B2B 2BEC B000 B0EC EC2B 2B2B 2B2B" /* +++++.+++++ */
- $"2B2B 2BFF 0000 0000 0000 0000 0000 FF2B" /* +++..........+ */
- $"2B2B 2B2B 2B2B B000 7FB0 2B2B 2B2B 2B2B" /* ++++++..++++++ */
- $"2B2B FF00 0000 0000 0000 0000 0000 00FF" /* ++............ */
- $"2B2B 2B2B 2B2B B000 B0EC 2B2B 2B2B 2B2B" /* ++++++.++++++ */
- $"2BFF 0000 0000 0000 0000 0000 0000 0000" /* +.............. */
- $"FF2B 2B2B 2B2B F900 B02B 2B2B 2B2B 2B2B" /* +++++.+++++++ */
- $"FF00 0000 0000 0000 0000 0000 0000 0000" /* ............... */
- $"00FF 2B2B 2B2B F900 F92B 2B2B 2B2B 2BFF" /* .++++.++++++ */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 FF2B 2B2B F900 F92B 2B2B 2B2B FF00" /* ..+++.+++++. */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 00FF 2B2B F900 F92B 2B2B 2BFF 0000" /* ...++.++++.. */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 FF2B 2B00 2B2B 2B2B FF00 0000" /* ....++.++++... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 00FF 2BF9 2B2B 2BFF 0000 0000" /* .....++++.... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 FF2B 2B2B FF00 0000 0000" /* ......+++..... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 00FF 2BFF 0000 0000 0000" /* .......+...... */
- $"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
- $"0000 0000 0000 0000 FF00 0000 0000 0000" /* ............... */
- $"0000 0000 0000 0000" /* ........ */
-};
diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c
new file mode 100644
index 0000000..c0539d2
--- /dev/null
+++ b/macosx/tkMacOSXCarbonEvents.c
@@ -0,0 +1,146 @@
+/*
+ * tkMacOSXCarbonEvents.c --
+ *
+ * This file implements functions that register for and handle
+ * various Carbon Events. The reason a separate set of handlers
+ * is necessary is that not all interesting events get delivered
+ * directly to the event queue through ReceiveNextEvent. Some only
+ * get delivered if you register a Carbon Event Handler for the event.
+ *
+ * Copyright 2001, Apple Computer, Inc.
+ *
+ * The following terms apply to all files originating from Apple
+ * Computer, Inc. ("Apple") and associated with the software
+ * unless explicitly disclaimed in individual files.
+ *
+ *
+ * Apple hereby grants permission to use, copy, modify,
+ * distribute, and license this software and its documentation
+ * for any purpose, provided that existing copyright notices are
+ * retained in all copies and that this notice is included
+ * verbatim in any distributions. No written agreement, license,
+ * or royalty fee is required for any of the authorized
+ * uses. Modifications to this software may be copyrighted by
+ * their authors and need not follow the licensing terms
+ * described here, provided that the new terms are clearly
+ * indicated on the first page of each file where they apply.
+ *
+ *
+ * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE
+ * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
+ * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
+ * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
+ * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND
+ * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS
+ * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE
+ * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf
+ * of the U.S. government, the Government shall have only
+ * "Restricted Rights" in the software and related documentation
+ * as defined in the Federal Acquisition Regulations (FARs) in
+ * Clause 52.227.19 (c) (2). If you are acquiring the software
+ * on behalf of the Department of Defense, the software shall be
+ * classified as "Commercial Computer Software" and the
+ * Government shall have only "Restricted Rights" as defined in
+ * Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the
+ * foregoing, the authors grant the U.S. Government and others
+ * acting in its behalf permission to use and distribute the
+ * software in accordance with the terms specified in this
+ * license.
+ *
+ * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.2 2005/08/09 07:39:54 das Exp $
+ */
+
+#include "tkInt.h"
+#include "tkMacOSXInt.h"
+#include "tkMacOSXEvent.h"
+
+static EventHandlerRef ApplicationCarbonEventHandler;
+
+/* Definitions of functions used only in this file */
+static OSStatus AppEventHandlerProc (
+ EventHandlerCallRef callRef,
+ EventRef inEvent,
+ void *userData);
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * AppEventHandlerProc --
+ *
+ * This procedure is the Application CarbonEvent
+ * handler. Currently, it handles the Hide & Show
+ * events.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Dispatches CarbonEvents.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSStatus
+AppEventHandlerProc (
+ EventHandlerCallRef callRef,
+ EventRef inEvent,
+ void *inUserData)
+{
+ OSStatus result = eventNotHandledErr;
+ TkMacOSXEvent macEvent;
+ MacEventStatus eventStatus;
+
+ macEvent.eventRef = inEvent;
+ macEvent.eClass = GetEventClass(macEvent.eventRef);
+ macEvent.eKind = GetEventKind(macEvent.eventRef);
+ macEvent.interp = (Tcl_Interp *) inUserData;
+ bzero(&eventStatus, sizeof(eventStatus));
+ TkMacOSXProcessEvent(&macEvent,&eventStatus);
+ if (!eventStatus.stopProcessing) {
+ result = noErr;
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInitCarbonEvents --
+ *
+ * This procedure initializes the Application CarbonEvent
+ * handler.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A handler for Application targeted Carbon Events is registered.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXInitCarbonEvents (
+ Tcl_Interp *interp)
+{
+ const EventTypeSpec inAppEventTypes[] = {
+ {kEventClassApplication, kEventAppHidden},
+ {kEventClassApplication, kEventAppShown},
+ {kEventClassWindow, kEventWindowExpanded},
+ };
+
+ InstallEventHandler(GetApplicationEventTarget(),
+ NewEventHandlerUPP(AppEventHandlerProc),
+ GetEventTypeCount(inAppEventTypes),
+ inAppEventTypes, (void *) interp,
+ &ApplicationCarbonEventHandler);
+
+}
+
diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c
index 674d5a3..7dac4c8 100644
--- a/macosx/tkMacOSXDebug.c
+++ b/macosx/tkMacOSXDebug.c
@@ -49,6 +49,8 @@
* acting in its behalf permission to use and distribute the
* software in accordance with the terms specified in this
* license.
+ *
+ * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.2.2.2 2005/08/09 07:39:54 das Exp $
*/
#include "tkMacOSXDebug.h"
diff --git a/macosx/tkMacOSXDebug.h b/macosx/tkMacOSXDebug.h
index 0b3185d..abcc62f 100644
--- a/macosx/tkMacOSXDebug.h
+++ b/macosx/tkMacOSXDebug.h
@@ -49,6 +49,8 @@
* acting in its behalf permission to use and distribute the
* software in accordance with the terms specified in this
* license.
+ *
+ * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.2.2.1 2005/08/09 07:39:54 das Exp $
*/
#ifndef _TKMACDEBUG
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 0d7cc2b..34f3fc0 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -9,7 +9,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.4.2.4 2005/05/14 20:53:31 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.4.2.5 2005/08/09 07:39:54 das Exp $
*/
#include <Carbon/Carbon.h>
@@ -883,13 +883,13 @@ NavServicesGetFile(
!= noErr ) {
fprintf(stderr,"AEGetDescData failed %d\n", err );
} else {
- if (err = FSRefMakePath(&fsRef, (unsigned char*) pathPtr, 1024) ) {
+ if ((err = FSRefMakePath(&fsRef, (unsigned char*) pathPtr, 1024))) {
fprintf(stderr,"FSRefMakePath failed, %d\n", err );
} else {
if (isOpen == SAVE_FILE) {
CFStringRef saveNameRef;
char saveName [1024];
- if (saveNameRef = NavDialogGetSaveFileName(dialogRef)) {
+ if ((saveNameRef = NavDialogGetSaveFileName(dialogRef))) {
if (CFStringGetCString(saveNameRef, saveName,
1024, kCFStringEncodingUTF8)) {
if (strlen(pathPtr) + strlen(saveName) < 1023) {
@@ -1005,7 +1005,7 @@ OpenFileFilterProc(
fileName[len] = '\0';
fileNamePtr = (unsigned char*) fileName;
- } else if (theItem->descriptorType = typeFSRef) {
+ } else if ((theItem->descriptorType = typeFSRef)) {
OSStatus err;
FSRef *theRef = (FSRef *) *theItem->dataHandle;
HFSUniStr255 uniFileName;
@@ -1080,7 +1080,7 @@ OpenEventProc(
chosenItem = (NavMenuItemSpec *) callBackParams->eventData.eventDataParms.param;
ofd->curType = chosenItem->menuType;
} else if (callBackSelector == kNavCBAdjustRect
- || callBackSelector & otherEvent != 0) {
+ || (callBackSelector & otherEvent) != 0) {
while (Tcl_DoOneEvent(TCL_IDLE_EVENTS
| TCL_DONT_WAIT
| TCL_WINDOW_EVENTS)) {
@@ -1248,7 +1248,7 @@ TkAboutDlg()
DisposeDialog(aboutDlog);
aboutDlog = NULL;
- SelectWindow(FrontNonFloatingWindow());
+ SelectWindow(ActiveNonFloatingWindow());
return;
}
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index 3405014..deed9e6 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -14,7 +14,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.2 2002/08/31 06:12:29 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.2.2.1 2005/08/09 07:39:54 das Exp $
*/
#include "tkInt.h"
@@ -242,7 +242,8 @@ TkpUseWindow(
int result;
if (winPtr->window != None) {
- panic("TkpUseWindow: X window already assigned");
+ Tcl_AppendResult(interp, "can't modify container after widget is created", (char *) NULL);
+ return TCL_ERROR;
}
/*
@@ -502,7 +503,7 @@ TkMacOSXContainerId(winPtr)
return (MacDrawable *) containerPtr->parent;
}
}
- panic("TkMacOSXContainerId couldn't find window");
+ Tcl_Panic("TkMacOSXContainerId couldn't find window");
return None;
}
@@ -831,7 +832,7 @@ ContainerEventProc(clientData, eventPtr)
containerPtr->parent != eventPtr->xmaprequest.parent;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
- panic("ContainerEventProc couldn't find Container record");
+ Tcl_Panic("ContainerEventProc couldn't find Container record");
}
}
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c
index 3d9a6f0..2df8dfc 100644
--- a/macosx/tkMacOSXEntry.c
+++ b/macosx/tkMacOSXEntry.c
@@ -49,6 +49,8 @@
* acting in its behalf permission to use and distribute the
* software in accordance with the terms specified in this
* license.
+ *
+ * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.2.2.4 2005/08/09 07:39:55 das Exp $
*/
#include "tk.h"
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index 838c0a9..46e563f 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.3.2.1 2004/02/16 00:42:34 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.3.2.2 2005/08/09 07:39:55 das Exp $
*/
#include <stdio.h>
@@ -30,8 +30,6 @@
static int TkMacOSXProcessAppleEvent(
TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr);
-static int TkMacOSXProcessEvent(
- TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr);
static int ReceiveAndProcessEvent (void);
@@ -184,7 +182,7 @@ TkMacOSXProcessAppleEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr)
*----------------------------------------------------------------------
*/
-static int
+int
TkMacOSXProcessEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr)
{
switch (eventPtr->eClass) {
@@ -219,8 +217,7 @@ TkMacOSXProcessEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr)
break;
}
return 0;
-}
-
+}
/*
*----------------------------------------------------------------------
@@ -260,6 +257,7 @@ ReceiveAndProcessEvent()
} else {
macEvent.eClass = GetEventClass(macEvent.eventRef);
macEvent.eKind = GetEventKind(macEvent.eventRef);
+ macEvent.interp = NULL;
bzero(&eventStatus, sizeof(eventStatus));
TkMacOSXProcessEvent(&macEvent,&eventStatus);
if (!eventStatus.stopProcessing) {
diff --git a/macosx/tkMacOSXEvent.h b/macosx/tkMacOSXEvent.h
index 4c5ad59..5764b92 100644
--- a/macosx/tkMacOSXEvent.h
+++ b/macosx/tkMacOSXEvent.h
@@ -49,6 +49,8 @@
* acting in its behalf permission to use and distribute the
* software in accordance with the terms specified in this
* license.
+ *
+ * RCS: @(#) $Id: tkMacOSXEvent.h,v 1.3.2.1 2005/08/09 07:39:55 das Exp $
*/
#ifndef _TKMACEVENT
@@ -74,10 +76,12 @@ typedef struct {
EventRef eventRef;
UInt32 eClass; /* Defines the class of event : see CarbonEvents.h */
UInt32 eKind; /* Defines the kind of the event : see CarbonEvents.h */
+ Tcl_Interp *interp; /* Interp to handle events in */
} TkMacOSXEvent;
int TkMacOSXCountAndProcessMacEvents _ANSI_ARGS_(());
void tkMacOSXFlushWindows _ANSI_ARGS_(());
+int TkMacOSXProcessEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr);
int TkMacOSXProcessMouseEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr);
int TkMacOSXProcessWindowEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr);
int TkMacOSXProcessKeyboardEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr);
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 50a51b1..39a06db 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.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: tkMacOSXFont.c,v 1.3.2.3 2005/05/14 20:53:31 das Exp $
+ * RCS: @(#) $Id: tkMacOSXFont.c,v 1.3.2.4 2005/08/09 07:39:55 das Exp $
*/
#include <Carbon/Carbon.h>
@@ -294,7 +294,7 @@ TkpFontPkgInit(mainPtr)
* Used for saving and restoring state while drawing and measuring.
*/
if (NewGWorld(&gWorld, 0, &rect, NULL, NULL, 0) != noErr) {
- panic("TkpFontPkgInit: NewGWorld failed");
+ Tcl_Panic("TkpFontPkgInit: NewGWorld failed");
}
/*
* The name of each font is stored in the encoding of that font.
@@ -361,7 +361,7 @@ TkpFontPkgInit(mainPtr)
}
}
if (fontMapOffset != numFonts) {
- panic("TkpFontPkgInit: unexpected number of fonts");
+ Tcl_Panic("TkpFontPkgInit: unexpected number of fonts");
}
mapPtr = &newFontNameMap[numFonts];
@@ -2113,7 +2113,7 @@ GetUtfFaceName(
return mapPtr->utfName;
}
}
- panic("GetUtfFaceName: unexpected nativeName");
+ Tcl_Panic("GetUtfFaceName: unexpected nativeName");
return NULL;
}
@@ -2260,7 +2260,8 @@ TkMacOSXAntialiasedTextVariableProc(clientData, interp, name1, name2, flags)
return (char *) NULL;
}
-int TkMacOSXUseAntialiasedText(interp, enable)
+int
+TkMacOSXUseAntialiasedText(interp, enable)
Tcl_Interp *interp;
int enable;
{
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index 8afef06..424f62f 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.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: tkMacOSXHLEvents.c,v 1.5.2.5 2005/05/14 20:53:31 das Exp $
+ * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.5.2.6 2005/08/09 07:40:00 das Exp $
*/
#include "tkMacOSXPort.h"
@@ -45,58 +45,7 @@ static OSErr PrefsHandler (const AppleEvent * event, AppleEvent * reply, long ha
static int MissedAnyParameters _ANSI_ARGS_((const AppleEvent *theEvent));
static int ReallyKillMe _ANSI_ARGS_((Tcl_Event *eventPtr, int flags));
static OSErr FSRefToDString _ANSI_ARGS_((const FSRef *fsref, Tcl_DString *ds));
-
-OSStatus ApplicationCarbonEventsHandler (EventHandlerCallRef inHandlerCallRef,
- EventRef inEvent,
- void *inUserData);
-OSStatus ApplicationCarbonEventsHandler (EventHandlerCallRef inHandlerCallRef,
- EventRef inEvent,
- void *inUserData)
-{
- Tcl_CmdInfo dummy;
- Tcl_Interp *interp = (Tcl_Interp *) inUserData;
-
- /*
- * This is a bit of a hack. We get "show" events both when we come back
- * from being hidden, and whenever we are activated. I only want to run the
- * "show" proc when we have been hidden already, not as a substitute for
- * <Activate>. So I use this toggle...
- */
-
- static int toggleHide = 0;
-
- switch(GetEventKind (inEvent))
- {
- case kEventAppHidden:
- /*
- * Don't bother if we don't have an interp or
- * the show preferences procedure doesn't exist.
- */
-
- toggleHide = 1;
- if ((interp == NULL) ||
- (Tcl_GetCommandInfo(interp,
- "::tk::mac::OnHide", &dummy)) == 0) {
- return eventNotHandledErr;
- }
- Tcl_GlobalEval(interp, "::tk::mac::OnHide");
- break;
- case kEventAppShown:
- if (toggleHide == 1) {
- toggleHide = 0;
- if ((interp == NULL) ||
- (Tcl_GetCommandInfo(interp,
- "::tk::mac::OnShow", &dummy)) == 0) {
- return eventNotHandledErr;
- }
- Tcl_GlobalEval(interp, "::tk::mac::OnShow");
- }
- break;
- default:
- break;
- }
- return eventNotHandledErr;
-}
+
/*
*----------------------------------------------------------------------
*
@@ -122,11 +71,7 @@ TkMacOSXInitAppleEvents(
AEEventHandlerUPP OappHandlerUPP, RappHandlerUPP, OdocHandlerUPP,
PrintHandlerUPP, QuitHandlerUPP, ScriptHandlerUPP,
PrefsHandlerUPP;
- const EventTypeSpec inAppEventTypes[] = {
- {kEventClassApplication, kEventAppHidden},
- {kEventClassApplication, kEventAppShown}};
- UInt32 inNumTypes = 2;
-
+
/*
* Install event handlers for the core apple events.
*/
@@ -159,13 +104,6 @@ TkMacOSXInitAppleEvents(
err = AEInstallEventHandler(kAEMiscStandards, kAEDoScript,
ScriptHandlerUPP, (long) interp, false);
}
-
- InstallEventHandler(GetApplicationEventTarget(),
- NewEventHandlerUPP (ApplicationCarbonEventsHandler),
- inNumTypes,
- inAppEventTypes,
- (void *) interp,
- NULL);
}
/*
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index ad825b4..0902388 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.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: tkMacOSXInit.c,v 1.3.2.8 2005/05/29 07:00:47 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.3.2.9 2005/08/09 07:40:00 das Exp $
*/
#include "tkInt.h"
@@ -132,6 +132,7 @@ TkpInit(interp)
tkMacOSXInitialized = true;
TkMacOSXInitAppleEvents(interp);
+ TkMacOSXInitCarbonEvents(interp);
TkMacOSXInitMenus(interp);
TkMacOSXUseAntialiasedText(interp, TRUE);
TkMacOSXInitCGDrawing(interp, TRUE, 3);
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index 9d202b4..799d957 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -9,7 +9,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.3.2.4 2005/07/28 03:45:03 hobbs Exp $
+ * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3.2.5 2005/08/09 07:40:00 das Exp $
*/
#ifndef _TKMACINT
@@ -68,6 +68,7 @@ typedef struct TkMacOSXWindowList {
#define TK_CLIP_INVALID 2
#define TK_HOST_EXISTS 4
#define TK_DRAWN_UNDER_MENU 8
+#define TK_MAPPED_IN_PARENT 16
/*
* I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags
@@ -151,6 +152,7 @@ extern TkMacOSXWindowList *tkMacOSXWindowListPtr;
extern Tcl_Encoding TkMacOSXCarbonEncoding;
extern int TkMacOSXUseAntialiasedText(Tcl_Interp *interp, int enable);
+extern void TkMacOSXInitCarbonEvents(Tcl_Interp *interp);
extern int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable, int antiAlias);
extern void TkMacOSXDefaultStartupScript(void);
extern int TkMacOSXGenerateFocusEvent( Window window, int activeFlag);
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 3742399..0429cb2 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -49,6 +49,8 @@
* acting in its behalf permission to use and distribute the
* software in accordance with the terms specified in this
* license.
+ *
+ * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.6.2.4 2005/08/09 07:40:00 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -172,7 +174,9 @@ int TkMacOSXProcessKeyboardEvent(
* handler.
*/
- if (IsMenuKeyEvent(NULL, eventPtr->eventRef,
+ if ((eventPtr->eKind == kEventRawKeyDown
+ || eventPtr->eKind == kEventRawKeyRepeat)
+ && IsMenuKeyEvent(NULL, eventPtr->eventRef,
kMenuEventQueryOnly, &menuRef, &menuItemIndex)) {
MenuCommand menuCmd;
@@ -425,16 +429,19 @@ GenerateKeyEvent(
static int
InitKeyData(KeyEventData * keyEventDataPtr)
{
+ int x, y;
memset (keyEventDataPtr, 0, sizeof(*keyEventDataPtr));
- keyEventDataPtr->whichWindow = FrontNonFloatingWindow();
+ keyEventDataPtr->whichWindow = ActiveNonFloatingWindow();
if (keyEventDataPtr->whichWindow == NULL) {
return false;
}
- GetMouse(&keyEventDataPtr->local);
- keyEventDataPtr->global = keyEventDataPtr->local;
- LocalToGlobal(&keyEventDataPtr->global);
- keyEventDataPtr->state = TkMacOSXButtonKeyState();
+ XQueryPointer(NULL, None, NULL, NULL, &x, &y,
+ NULL, NULL, &keyEventDataPtr->state);
+ keyEventDataPtr->global.v = x;
+ keyEventDataPtr->global.v = y;
+ keyEventDataPtr->local = keyEventDataPtr->global;
+ GlobalToLocal(&keyEventDataPtr->local);
return true;
}
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 9f69c28..f4ed585 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.6.2.8 2005/05/15 20:57:08 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.6.2.9 2005/08/09 07:40:00 das Exp $
*/
#include "tkMacOSXInt.h"
#include "tkMenubutton.h"
@@ -1284,9 +1284,11 @@ ReconfigureMacintoshMenu(
ReconfigureIndividualMenu(menuPtr, macMenuHdl, 0);
+ /* Not necessary in Carbon:
if (menuPtr->menuFlags & MENU_APPLE_MENU) {
AppendResMenu(macMenuHdl, 'DRVR');
}
+ */
if (GetMenuID(macMenuHdl) == currentHelpMenuID) {
MenuItemIndex helpIndex;
HMGetHelpMenu(&helpMenuHdl,&helpIndex);
@@ -1958,7 +1960,7 @@ TkpSetMainMenubar(
}
macWindowPtr = GetWindowFromPort(winPort);
- frontNonFloating = FrontNonFloatingWindow();
+ frontNonFloating = ActiveNonFloatingWindow();
if ((macWindowPtr == NULL) || (macWindowPtr != frontNonFloating)) {
return;
}
@@ -3660,9 +3662,6 @@ MenuSelectEvent(
TkMenu *menuPtr) /* the menu we have selected. */
{
XVirtualEvent event;
- Point where;
- CGrafPtr port;
- Rect bounds;
event.type = VirtualEvent;
event.serial = menuPtr->display->request;
@@ -3674,12 +3673,8 @@ MenuSelectEvent(
event.subwindow = None;
event.time = TkpGetMS();
- GetMouse(&where);
- GetPort(&port);
- GetPortBounds(port,&bounds);
- event.x_root = where.h + bounds.left;
- event.y_root = where.v + bounds.top;
- event.state = TkMacOSXButtonKeyState();
+ XQueryPointer(NULL, None, NULL, NULL,
+ &event.x_root, &event.y_root, NULL, NULL, &event.state);
event.same_screen = true;
event.name = Tk_GetUid("MenuSelect");
Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c
index b1aebe8..4d04235 100644
--- a/macosx/tkMacOSXMenus.c
+++ b/macosx/tkMacOSXMenus.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: tkMacOSXMenus.c,v 1.2.2.3 2004/11/11 01:26:43 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.2.2.4 2005/08/09 07:40:01 das Exp $
*/
#include "tk.h"
@@ -104,7 +104,7 @@ TkMacOSXHandleMenuSelect(
break;
case kCloseItem:
/* Send close event */
- window = TkMacOSXGetXWindow(FrontNonFloatingWindow());
+ window = TkMacOSXGetXWindow(ActiveNonFloatingWindow());
dispPtr = TkGetDisplayList();
tkwin = Tk_IdToWindow(dispPtr->display, window);
TkGenWMDestroyEvent(tkwin);
@@ -157,11 +157,11 @@ TkMacOSXInitMenus(
*/
if (TkMacOSXUseMenuID(256) != TCL_OK) {
- panic("Menu ID 256 is already in use!");
+ Tcl_Panic("Menu ID 256 is already in use!");
}
tkAppleMenu = NewMenu(256, "\p\024");
if (tkAppleMenu == NULL) {
- panic("memory - menus");
+ Tcl_Panic("memory - menus");
}
InsertMenu(tkAppleMenu, 0);
AppendMenu(tkAppleMenu, "\pAbout Tcl & Tk");
@@ -171,11 +171,11 @@ TkMacOSXInitMenus(
*/
if (TkMacOSXUseMenuID(kFileMenu) != TCL_OK) {
- panic("Menu ID %d is already in use!", kFileMenu);
+ Tcl_Panic("Menu ID %d is already in use!", kFileMenu);
}
tkFileMenu = NewMenu(kFileMenu, "\pFile");
if (tkFileMenu == NULL) {
- panic("memory - menus");
+ Tcl_Panic("memory - menus");
}
InsertMenu(tkFileMenu, 0);
AppendMenu(tkFileMenu, "\pSource");
@@ -183,11 +183,11 @@ TkMacOSXInitMenus(
if (TkMacOSXUseMenuID(kEditMenu) != TCL_OK) {
- panic("Menu ID %d is already in use!", kEditMenu);
+ Tcl_Panic("Menu ID %d is already in use!", kEditMenu);
}
tkEditMenu = NewMenu(kEditMenu, "\pEdit");
if (tkEditMenu == NULL) {
- panic("memory - menus");
+ Tcl_Panic("memory - menus");
}
InsertMenu(tkEditMenu, 0);
AppendMenu(tkEditMenu, "\pCut/X");
@@ -195,7 +195,7 @@ TkMacOSXInitMenus(
AppendMenu(tkEditMenu, "\pPaste/V");
AppendMenu(tkEditMenu, "\pClear");
if (TkMacOSXUseMenuID(kHMHelpMenuID) != TCL_OK) {
- panic("Help menu ID %s is already in use!", kHMHelpMenuID);
+ Tcl_Panic("Help menu ID %s is already in use!", kHMHelpMenuID);
}
DrawMenuBar();
@@ -229,7 +229,7 @@ GenerateEditEvent(
Window window;
TkDisplay *dispPtr;
- window = TkMacOSXGetXWindow(FrontNonFloatingWindow());
+ window = TkMacOSXGetXWindow(ActiveNonFloatingWindow());
dispPtr = TkGetDisplayList();
tkwin = Tk_IdToWindow(dispPtr->display, window);
tkwin = (Tk_Window) ((TkWindow *) tkwin)->dispPtr->focusPtr;
@@ -246,15 +246,15 @@ GenerateEditEvent(
event.subwindow = None;
event.time = TkpGetMS();
- GetMouse(&where);
+ XQueryPointer(NULL, None, NULL, NULL,
+ &event.x_root, &event.y_root, NULL, NULL, &event.state);
+ where.h = event.x_root;
+ where.v = event.y_root;
+ GlobalToLocal(&where);
tkwin = Tk_TopCoordsToWindow(tkwin, where.h, where.v,
&event.x, &event.y);
- LocalToGlobal(&where);
- event.x_root = where.h;
- event.y_root = where.v;
- event.state = TkMacOSXButtonKeyState();
event.same_screen = true;
-
+
switch (flag) {
case EDIT_CUT:
event.name = Tk_GetUid("Cut");
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index a542091..3f911d7 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -2,7 +2,7 @@
* tkMacOSXMouseEvent.c --
*
* This file implements functions that decode & handle mouse events
- * on MacOS X.
+ * on MacOS X.
*
* Copyright 2001, Apple Computer, Inc.
*
@@ -49,6 +49,8 @@
* acting in its behalf permission to use and distribute the
* software in accordance with the terms specified in this
* license.
+ *
+ * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.6.2.7 2005/08/09 07:40:01 das Exp $
*/
#include "tkInt.h"
@@ -60,20 +62,21 @@
#include "tkMacOSXDebug.h"
typedef struct {
- WindowRef whichWin;
- WindowRef activeNonFloating;
+ WindowRef whichWin;
+ WindowRef activeNonFloating;
WindowPartCode windowPart;
- Point global;
- Point local;
+ Point global;
+ Point local;
unsigned int state;
- long delta;
+ long delta;
+ Window window;
} MouseEventData;
/*
* Declarations of static variables used in this file.
*/
-static int gEatButtonUp = 0; /* 1 if we need to eat the next * up event */
+static int gEatButtonUp = 0; /* 1 if we need to eat the next * up event */
/*
* Declarations of functions used only in this file.
@@ -82,8 +85,10 @@ static int gEatButtonUp = 0; /* 1 if we need to eat the next * up event */
static void BringWindowForward _ANSI_ARGS_((WindowRef wRef));
static int GeneratePollingEvents(MouseEventData * medPtr);
static int GenerateMouseWheelEvent(MouseEventData * medPtr);
-static int HandleInGoAway(Tk_Window tkwin, WindowRef winPtr, Point where);
-static int TkMacOSXToolarbuttonEvent(MouseEventData * medPtr, Point where);
+static int GenerateButtonEvent(MouseEventData * medPtr);
+static int GenerateToolbarButtonEvent(MouseEventData * medPtr);
+static int HandleWindowTitlebarMouseDown(MouseEventData * medPtr, Tk_Window tkwin);
+static unsigned int ButtonModifiers2State(UInt32 buttonState, UInt32 keyModifiers);
extern int TkMacOSXGetEatButtonUp();
extern void TkMacOSXSetEatButtonUp(int f);
@@ -93,14 +98,14 @@ extern void TkMacOSXSetEatButtonUp(int f);
*
* TkMacOSXProcessMouseEvent --
*
- * This routine processes the event in eventPtr, and
- * generates the appropriate Tk events from it.
+ * This routine processes the event in eventPtr, and
+ * generates the appropriate Tk events from it.
*
* Results:
- * True if event(s) are generated - false otherwise.
+ * True if event(s) are generated - false otherwise.
*
* Side effects:
- * Additional events may be place on the Tk event queue.
+ * Additional events may be place on the Tk event queue.
*
*----------------------------------------------------------------------
*/
@@ -108,78 +113,73 @@ extern void TkMacOSXSetEatButtonUp(int f);
int
TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
{
- WindowRef frontWindow;
- Tk_Window tkwin;
- Point where, where2;
- int xOffset, yOffset;
- TkDisplay * dispPtr;
- Window window;
- int status,err;
+ Tk_Window tkwin;
+ Point where, where2;
+ int xOffset, yOffset, result;
+ TkDisplay * dispPtr;
+ OSStatus status;
MouseEventData mouseEventData, * medPtr = &mouseEventData;
- KeyMap keyMap;
- long modif;
switch (eventPtr->eKind) {
- case kEventMouseUp:
- case kEventMouseDown:
- case kEventMouseMoved:
- case kEventMouseDragged:
- case kEventMouseWheelMoved:
- break;
- default:
- return 0;
- break;
+ case kEventMouseUp:
+ case kEventMouseDown:
+ case kEventMouseMoved:
+ case kEventMouseDragged:
+ case kEventMouseWheelMoved:
+ break;
+ default:
+ return 0;
+ break;
}
status = GetEventParameter(eventPtr->eventRef,
- kEventParamMouseLocation,
- typeQDPoint, NULL,
- sizeof(where), NULL,
- &where);
+ kEventParamMouseLocation,
+ typeQDPoint, NULL,
+ sizeof(where), NULL,
+ &where);
if (status != noErr) {
- fprintf (stderr, "Failed to retrieve mouse location,%d\n", status);
- return 0;
- }
- medPtr->state = 0;
- GetKeys(keyMap);
- modif = EndianS32_BtoN(*(long*)(&keyMap[1]));
-
- if (modif & 2) {
- medPtr->state |= LockMask;
+ GetGlobalMouse(&where);
}
- if (modif & 1) {
- medPtr->state |= ShiftMask;
- }
- if (modif & 8) {
- medPtr->state |= ControlMask;
- }
- if (modif & 32768) {
- medPtr->state |= Mod1Mask; /* command key */
+ status = GetEventParameter(eventPtr->eventRef,
+ kEventParamWindowRef,
+ typeWindowRef, NULL,
+ sizeof(WindowRef), NULL,
+ &medPtr->whichWin);
+ if (status == noErr) {
+ status = GetEventParameter(eventPtr->eventRef,
+ kEventParamWindowPartCode,
+ typeWindowPartCode, NULL,
+ sizeof(WindowPartCode), NULL,
+ &medPtr->windowPart);
}
- if (modif & 4) {
- medPtr->state |= Mod2Mask; /* option key */
+ if (status != noErr) {
+ medPtr->windowPart = FindWindow(where, &medPtr->whichWin);
}
- if (eventPtr->eKind == kEventMouseDown
- || eventPtr->eKind == kEventMouseDragged ) {
- EventMouseButton mouseButton;
- status = GetEventParameter(eventPtr->eventRef,
- kEventParamMouseButton,
- typeMouseButton, NULL,
- sizeof(mouseButton), NULL,&mouseButton);
- if (status != noErr ) {
- fprintf (stderr, "Failed to retrieve mouse button, %d\n", status);
- statusPtr->err = 1;
- return 0;
- }
- medPtr->state |= 1 << ((mouseButton-1)+8);
+ medPtr->window = TkMacOSXGetXWindow(medPtr->whichWin);
+ if (medPtr->whichWin != NULL && medPtr->window == None) {
+ return 0;
}
-
- medPtr->windowPart = FindWindow(where, &medPtr->whichWin);
- window = TkMacOSXGetXWindow(medPtr->whichWin);
- if (medPtr->whichWin != NULL && window == None) {
- return 0;
+ medPtr->state = ButtonModifiers2State(GetCurrentEventButtonState(),
+ GetCurrentEventKeyModifiers());
+ medPtr->global = where;
+ status = GetEventParameter(eventPtr->eventRef,
+ kEventParamWindowMouseLocation,
+ typeQDPoint, NULL,
+ sizeof(Point), NULL,
+ &medPtr->local);
+ if (status == noErr) {
+ if (medPtr->whichWin) {
+ Rect widths;
+ GetWindowStructureWidths(medPtr->whichWin, &widths);
+ medPtr->local.h -= widths.left;
+ medPtr->local.v -= widths.top;
+ }
+ } else {
+ medPtr->local = where;
+ if (medPtr->whichWin) {
+ QDGlobalToLocalPoint(GetWindowPort(medPtr->whichWin),
+ &medPtr->local);
+ }
}
-
- frontWindow = FrontWindow();
medPtr->activeNonFloating = ActiveNonFloatingWindow();
/*
@@ -189,48 +189,33 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
*/
if (eventPtr->eKind == kEventMouseUp) {
- if (TkMacOSXGetEatButtonUp()) {
- TkMacOSXSetEatButtonUp(false);
- return false;
- }
- return TkGenerateButtonEvent(where.h, where.v,
- window, medPtr->state);
+ if (TkMacOSXGetEatButtonUp()) {
+ TkMacOSXSetEatButtonUp(false);
+ return false;
+ }
+ return GenerateButtonEvent(medPtr);
}
if (eventPtr->eKind == kEventMouseWheelMoved) {
- status = GetEventParameter(eventPtr->eventRef,
- kEventParamMouseWheelDelta,
- typeLongInteger, NULL,
- sizeof(medPtr->delta), NULL,&medPtr->delta);
- if (status != noErr ) {
- fprintf (stderr,
- "Failed to retrieve mouse wheel delta, %d\n", status);
- statusPtr->err = 1;
- return false;
- }
+ status = GetEventParameter(eventPtr->eventRef,
+ kEventParamMouseWheelDelta,
+ typeLongInteger, NULL,
+ sizeof(long), NULL, &medPtr->delta);
+ if (status != noErr ) {
+ fprintf (stderr,
+ "Failed to retrieve mouse wheel delta, %d\n", (int)status);
+ statusPtr->err = 1;
+ return false;
+ }
}
dispPtr = TkGetDisplayList();
- tkwin = Tk_IdToWindow(dispPtr->display, window);
+ tkwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
if (eventPtr->eKind != kEventMouseDown) {
/*
* MouseMoved, MouseDragged or kEventMouseWheelMoved
*/
- medPtr->global = where;
- medPtr->local = where;
- /*
- * We must set the port to the right window -- the one
- * we are actually going to use -- before finding
- * the local coordinates, otherwise we will have completely
- * wrong local x,y!
- *
- * I'm pretty sure this window is medPtr->whichWin, unless
- * perhaps there is a grab. Certainly 'frontWindow' or
- * 'medPtr->activeNonFloating' are wrong.
- */
- SetPortWindowPort(medPtr->whichWin);
- GlobalToLocal(&medPtr->local);
if (eventPtr->eKind == kEventMouseWheelMoved) {
return GenerateMouseWheelEvent(medPtr);
} else {
@@ -238,44 +223,15 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
}
}
- if (medPtr->whichWin && eventPtr->eKind == kEventMouseDown) {
- ProcessSerialNumber frontPsn, ourPsn;
- Boolean flag;
- err = GetFrontProcess(&frontPsn);
- if (err != noErr) {
- fprintf(stderr, "GetFrontProcess failed, %d\n", err);
- statusPtr->err = 1;
- return 1;
- }
-
- GetCurrentProcess(&ourPsn);
- err = SameProcess(&frontPsn, &ourPsn, &flag);
- if (err != noErr) {
- fprintf(stderr, "SameProcess failed, %d\n", err);
- statusPtr->err = 1;
- return 1;
- } else {
- if (!flag) {
- err = SetFrontProcess(&ourPsn);
- if (err != noErr) {
- fprintf(stderr,"SetFrontProcess failed,%d\n", err);
- statusPtr->err = 1;
- return 1;
- }
- }
- }
-
- }
-
if (medPtr->whichWin) {
/*
* We got a mouse down in a window
* See if this is the activate click
- * This click moves the window forward. We don't want
+ * This click moves the window forward. We don't want
* the corresponding mouse-up to be reported to the application
* or else it will mess up some Tk scripts.
*/
-
+
if (!(TkpIsWindowFloating(medPtr->whichWin))
&& (medPtr->whichWin != medPtr->activeNonFloating)) {
Tk_Window grabWin = TkMacOSXGetCapture();
@@ -305,42 +261,20 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
* Clicks in the stoplights on a MacOS X title bar are processed
* directly even for background windows. Do that here.
*/
-
- switch (medPtr->windowPart) {
- case inGoAway:
- return HandleInGoAway(tkwin, medPtr->whichWin, where);
- break;
- case inCollapseBox:
- /*
- * The Appearance Manager handles collapsing for us,
- * but we need to make sure we propagate the event in Tk.
- */
- if (TrackBox(medPtr->whichWin, where, inCollapseBox)) {
- TkpWmSetState((TkWindow *)tkwin, IconicState);
- }
- return false;
- break;
- case inZoomIn:
- return false;
- break;
- case inZoomOut:
- return false;
- break;
- case inToolbarButton:
- BringWindowForward(medPtr->whichWin);
- if (TrackBox(medPtr->whichWin, where, inToolbarButton)) {
- return TkMacOSXToolarbuttonEvent(medPtr, where);
- }
- return false;
- break;
- default:
- TkMacOSXSetEatButtonUp(true);
- BringWindowForward(medPtr->whichWin);
- return false;
- }
+ if ((result = HandleWindowTitlebarMouseDown(medPtr, tkwin)) != -1) {
+ return result;
+ } else {
+ TkMacOSXSetEatButtonUp(true);
+ BringWindowForward(medPtr->whichWin);
+ return false;
+ }
}
}
+
+ if ((result = HandleWindowTitlebarMouseDown(medPtr, tkwin)) != -1) {
+ return result;
+ }
switch (medPtr->windowPart) {
case inDrag: {
CGrafPtr saveWorld;
@@ -368,8 +302,7 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
break;
}
case inContent:
- return TkGenerateButtonEvent(where.h, where.v,
- window, medPtr->state);
+ return GenerateButtonEvent(medPtr);
break;
case inGrow:
/*
@@ -382,18 +315,12 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
if (TkMacOSXGrowToplevel(medPtr->whichWin, where) == true) {
return true;
} else {
- return TkGenerateButtonEvent(where.h,
- where.v, window, medPtr->state);
+ return GenerateButtonEvent(medPtr);
}
break;
- case inGoAway:
- return HandleInGoAway(tkwin, medPtr->whichWin, where);
- break;
case inMenuBar: {
int oldMode;
- KeyMap theKeys;
- GetKeys(theKeys);
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
TkMacOSXClearMenubarActive();
@@ -403,39 +330,11 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
TkMacOSXPreprocessMenu();
TkMacOSXHandleMenuSelect(MenuSelect(where),
- EndianS32_BtoN(*(long*)(&theKeys[1])) & 4);
+ medPtr->state & Mod2Mask);
Tcl_SetServiceMode(oldMode);
return true; /* TODO: may not be on event on queue. */
break;
}
- case inZoomIn:
- case inZoomOut:
- if (TkMacOSXZoomToplevel(medPtr->whichWin, where,
- medPtr->windowPart) == true) {
- return true;
- } else {
- return false;
- }
- break;
- case inCollapseBox:
- /*
- * The Appearance Manager handles collapsing for us,
- * but we need to make sure we propagate the event in Tk.
- */
- if (TrackBox(medPtr->whichWin, where, inCollapseBox)) {
- TkpWmSetState((TkWindow *)tkwin, IconicState);
- }
- return false;
- break;
- case inToolbarButton:
- /*
- * ToolbarButton attribute pressed while active
- */
- if (TrackBox(medPtr->whichWin, where, inToolbarButton)) {
- return TkMacOSXToolarbuttonEvent(medPtr, where);
- }
- return false;
- break;
default:
return false;
break;
@@ -446,30 +345,59 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
/*
*----------------------------------------------------------------------
*
- * HandleInGoAway --
+ * HandleWindowTitlebarMouseDown --
*
- * Tracks the cursor in the go away box and deletes the window
- * if the button stays depressed on button up.
+ * Handle clicks in window titlebar.
*
* Results:
- * True if no errors - false otherwise.
+ * 1 if event was handled, 0 if event was not handled,
+ * -1 if MouseDown was not in window titlebar.
*
* Side effects:
- * The window tkwin may be destroyed.
+ * Additional events may be place on the Tk event queue.
*
*----------------------------------------------------------------------
*/
+
int
-HandleInGoAway(Tk_Window tkwin, WindowRef win, Point where)
+HandleWindowTitlebarMouseDown(MouseEventData * medPtr, Tk_Window tkwin)
{
- if (TrackGoAway(win, where)) {
- if (tkwin == NULL) {
- return false;
- }
- TkGenWMDestroyEvent(tkwin);
- return true;
- }
- return false;
+ int result = 0;
+
+ switch (medPtr->windowPart) {
+ case inGoAway:
+ if (TrackGoAway(medPtr->whichWin, medPtr->global)) {
+ if (tkwin) {
+ TkGenWMDestroyEvent(tkwin);
+ result = 1;
+ }
+ }
+ break;
+ case inCollapseBox:
+ if (TrackBox(medPtr->whichWin, medPtr->global, medPtr->windowPart)) {
+ if (tkwin) {
+ TkpWmSetState((TkWindow *)tkwin, IconicState);;
+ result = 1;
+ }
+ }
+ break;
+ case inZoomIn:
+ case inZoomOut:
+ if (TrackBox(medPtr->whichWin, medPtr->global, medPtr->windowPart)) {
+ result = TkMacOSXZoomToplevel(medPtr->whichWin, medPtr->windowPart);
+ }
+ break;
+ case inToolbarButton:
+ if (TrackBox(medPtr->whichWin, medPtr->global, medPtr->windowPart)) {
+ result = GenerateToolbarButtonEvent(medPtr);
+ }
+ break;
+ default:
+ result = -1;
+ break;
+ }
+
+ return result;
}
/*
@@ -477,16 +405,16 @@ HandleInGoAway(Tk_Window tkwin, WindowRef win, Point where)
*
* GeneratePollingEvents --
*
- * This function polls the mouse position and generates X Motion,
- * Enter & Leave events. The cursor is also updated at this
- * time.
+ * This function polls the mouse position and generates X Motion,
+ * Enter & Leave events. The cursor is also updated at this
+ * time.
*
* Results:
- * True if event(s) are generated - false otherwise.
+ * True if event(s) are generated - false otherwise.
*
* Side effects:
- * Additional events may be place on the Tk event queue.
- * The cursor may be changed.
+ * Additional events may be place on the Tk event queue.
+ * The cursor may be changed.
*
*----------------------------------------------------------------------
*/
@@ -495,7 +423,6 @@ static int
GeneratePollingEvents(MouseEventData * medPtr)
{
Tk_Window tkwin, rootwin, grabWin;
- Window window;
int local_x, local_y;
TkDisplay *dispPtr;
@@ -503,34 +430,33 @@ GeneratePollingEvents(MouseEventData * medPtr)
grabWin = TkMacOSXGetCapture();
if ((!TkpIsWindowFloating(medPtr->whichWin)
- && (medPtr->activeNonFloating != medPtr->whichWin))) {
- /*
- * If the window for this event is not floating, and is not the
- * active non-floating window, don't generate polling events.
- * We don't send events to backgrounded windows. So either send
- * it to the grabWin, or NULL if there is no grabWin.
- */
-
- tkwin = grabWin;
+ && (medPtr->activeNonFloating != medPtr->whichWin))) {
+ /*
+ * If the window for this event is not floating, and is not the
+ * active non-floating window, don't generate polling events.
+ * We don't send events to backgrounded windows. So either send
+ * it to the grabWin, or NULL if there is no grabWin.
+ */
+
+ tkwin = grabWin;
} else {
- /*
- * First check whether the toplevel containing this mouse
- * event is the grab window. If not, then send the event
- * to the grab window. Otherwise, set tkWin to the subwindow
- * which most closely contains the mouse event.
- */
+ /*
+ * First check whether the toplevel containing this mouse
+ * event is the grab window. If not, then send the event
+ * to the grab window. Otherwise, set tkWin to the subwindow
+ * which most closely contains the mouse event.
+ */
- window = TkMacOSXGetXWindow(medPtr->whichWin);
- dispPtr = TkGetDisplayList();
- rootwin = Tk_IdToWindow(dispPtr->display, window);
- if ((rootwin == NULL)
- || ((grabWin != NULL) && (rootwin != grabWin))) {
- tkwin = grabWin;
- } else {
- tkwin = Tk_TopCoordsToWindow(rootwin,
- medPtr->local.h, medPtr->local.v,
- &local_x, &local_y);
- }
+ dispPtr = TkGetDisplayList();
+ rootwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
+ if ((rootwin == NULL)
+ || ((grabWin != NULL) && (rootwin != grabWin))) {
+ tkwin = grabWin;
+ } else {
+ tkwin = Tk_TopCoordsToWindow(rootwin,
+ medPtr->local.h, medPtr->local.v,
+ &local_x, &local_y);
+ }
}
/*
@@ -539,7 +465,7 @@ GeneratePollingEvents(MouseEventData * medPtr)
*/
Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v,
- medPtr->state);
+ medPtr->state);
return true;
}
@@ -549,14 +475,14 @@ 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. We also set state
+ * so Tk thinks the button is currently up.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * The window is brought forward.
+ * The window is brought forward.
*
*----------------------------------------------------------------------
*/
@@ -564,36 +490,75 @@ GeneratePollingEvents(MouseEventData * medPtr)
static void
BringWindowForward(WindowRef wRef)
{
+ do {
+ ProcessSerialNumber frontPsn, ourPsn = {0, kCurrentProcess};
+ Boolean flag;
+ int err;
+
+ err = GetFrontProcess(&frontPsn);
+ if (err != noErr) {
+ fprintf(stderr, "GetFrontProcess failed, %d\n", err);
+ break;
+ }
+ err = SameProcess(&frontPsn, &ourPsn, &flag);
+ if (err != noErr) {
+ fprintf(stderr, "SameProcess failed, %d\n", err);
+ break;
+ } else {
+ if (!flag) {
+ err = SetFrontProcess(&ourPsn);
+ if (err != noErr) {
+ fprintf(stderr,"SetFrontProcess failed,%d\n", err);
+ break;
+ }
+ }
+ }
+ } while (0);
+
if (!TkpIsWindowFloating(wRef)) {
- if (IsValidWindowPtr(wRef))
+ if (IsValidWindowPtr(wRef))
SelectWindow(wRef);
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateMouseWheelEvent --
+ *
+ * Generates a "MouseWheel" Tk event.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Places a mousewheel event on the event queue.
+ *
+ *----------------------------------------------------------------------
+ */
static int
GenerateMouseWheelEvent(MouseEventData * medPtr)
{
Tk_Window tkwin, rootwin, grabWin;
- Window window;
int local_x, local_y;
TkDisplay *dispPtr;
TkWindow *winPtr;
XEvent xEvent;
if ((!TkpIsWindowFloating(medPtr->whichWin)
- && (medPtr->activeNonFloating != medPtr->whichWin))) {
- tkwin = NULL;
+ && (medPtr->activeNonFloating != medPtr->whichWin))) {
+ tkwin = NULL;
} else {
- window = TkMacOSXGetXWindow(medPtr->whichWin);
- dispPtr = TkGetDisplayList();
- rootwin = Tk_IdToWindow(dispPtr->display, window);
- if (rootwin == NULL) {
- tkwin = NULL;
- } else {
- tkwin = Tk_TopCoordsToWindow(rootwin,
- medPtr->local.h, medPtr->local.v,
- &local_x, &local_y);
- }
+ dispPtr = TkGetDisplayList();
+ rootwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
+ if (rootwin == NULL) {
+ tkwin = NULL;
+ } else {
+ tkwin = Tk_TopCoordsToWindow(rootwin,
+ medPtr->local.h, medPtr->local.v,
+ &local_x, &local_y);
+ }
}
/*
@@ -604,7 +569,7 @@ GenerateMouseWheelEvent(MouseEventData * medPtr)
grabWin = TkMacOSXGetCapture();
if ((tkwin == NULL) && (grabWin != NULL)) {
- tkwin = grabWin;
+ tkwin = grabWin;
}
if (!tkwin) {
return true;
@@ -621,18 +586,18 @@ GenerateMouseWheelEvent(MouseEventData * medPtr)
return true;
}
-
+
/*
*----------------------------------------------------------------------
*
* TkMacOSXGetEatButtonUp --
*
* Results:
- * Returns the flag indicating if we need to eat the
- * next mouse up event
+ * Returns the flag indicating if we need to eat the
+ * next mouse up event
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
@@ -643,36 +608,39 @@ TkMacOSXGetEatButtonUp()
}
/*
+ *----------------------------------------------------------------------
+ *
* TkMacOSXSetEatButtonUp --
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Sets the flag indicating if we need to eat the
- * next mouse up event
+ * Sets the flag indicating if we need to eat the
+ * next mouse up event
*
+ *----------------------------------------------------------------------
*/
void
TkMacOSXSetEatButtonUp(int f)
{
gEatButtonUp = f;
}
-
+
/*
*----------------------------------------------------------------------
*
* TkMacOSXButtonKeyState --
*
- * Returns the current state of the button & modifier keys.
+ * Returns the current state of the button & modifier keys.
*
* Results:
- * A bitwise inclusive OR of a subset of the following:
- * Button1Mask, ShiftMask, LockMask, ControlMask, Mod?Mask,
- * Mod?Mask.
+ * A bitwise inclusive OR of a subset of the following:
+ * Button1Mask, ShiftMask, LockMask, ControlMask, Mod?Mask,
+ * Mod?Mask.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
@@ -680,36 +648,62 @@ TkMacOSXSetEatButtonUp(int f)
unsigned int
TkMacOSXButtonKeyState()
{
- unsigned int state = 0;
- KeyMap theKeys;
- long modif;
-
- if (Button() & !gEatButtonUp) {
- state |= Button1Mask;
+ UInt32 buttonState = 0, keyModifiers;
+ EventRef ev = GetCurrentEvent();
+
+ if (!gEatButtonUp) {
+ buttonState = ev ? GetCurrentEventButtonState() : GetCurrentButtonState();
}
-
- GetKeys(theKeys);
+ keyModifiers = ev ? GetCurrentEventKeyModifiers() : GetCurrentKeyModifiers();
- modif = EndianS32_BtoN(*(long*)(&theKeys[1]));
+ return ButtonModifiers2State(buttonState, keyModifiers);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ButtonModifiers2State --
+ *
+ * Converts Carbon mouse button state and modifier values into a Tk
+ * button/modifier state.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
- if (modif & 2) {
- state |= LockMask;
+static unsigned int
+ButtonModifiers2State(UInt32 buttonState, UInt32 keyModifiers)
+{
+ unsigned int state;
+
+ /* Tk supports at most 5 buttons */
+ state = (buttonState & ((1<<5) - 1)) << 8;
+
+ if (keyModifiers & alphaLock) {
+ state |= LockMask;
}
-
- if (modif & 1) {
- state |= ShiftMask;
+ if (keyModifiers & shiftKey) {
+ state |= ShiftMask;
}
-
- if (modif & 8) {
- state |= ControlMask;
+ if (keyModifiers & controlKey) {
+ state |= ControlMask;
}
-
- if (modif & 32768) {
- state |= Mod1Mask; /* command key */
+ if (keyModifiers & cmdKey) {
+ state |= Mod1Mask; /* command key */
}
-
- if (modif & 4) {
- state |= Mod2Mask; /* option key */
+ if (keyModifiers & optionKey) {
+ state |= Mod2Mask; /* option key */
+ }
+ if (keyModifiers & kEventKeyModifierNumLockMask) {
+ state |= Mod3Mask;
+ }
+ if (keyModifiers & kEventKeyModifierFnMask) {
+ state |= Mod4Mask;
}
return state;
@@ -720,16 +714,16 @@ TkMacOSXButtonKeyState()
*
* XQueryPointer --
*
- * Check the current state of the mouse. This is not a complete
- * implementation of this function. It only computes the root
- * coordinates and the current mask.
+ * Check the current state of the mouse. This is not a complete
+ * implementation of this function. It only computes the root
+ * coordinates and the current mask.
*
* Results:
- * Sets root_x_return, root_y_return, and mask_return. Returns
- * true on success.
+ * Sets root_x_return, root_y_return, and mask_return. Returns
+ * true on success.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
@@ -746,83 +740,120 @@ XQueryPointer(
int* win_y_return,
unsigned int* mask_return)
{
- Point where;
- CGrafPtr port;
- GDHandle dev;
-
- GetGWorld(&port,&dev);
- GetMouse(&where);
- LocalToGlobal(&where);
+ if (root_x_return && root_y_return) {
+ Point where;
+ EventRef ev;
+ OSStatus status;
+
+ if ((ev = GetCurrentEvent())) {
+ status = GetEventParameter(ev,
+ kEventParamMouseLocation,
+ typeQDPoint, NULL,
+ sizeof(where), NULL,
+ &where);
+ }
+ if (!ev || status != noErr) {
+ GetGlobalMouse(&where);
+ }
- *root_x_return = where.h;
- *root_y_return = where.v;
- *mask_return = TkMacOSXButtonKeyState();
+ *root_x_return = where.h;
+ *root_y_return = where.v;
+ }
+ if (mask_return) {
+ *mask_return = TkMacOSXButtonKeyState();
+ }
return True;
}
-
-
+
/*
*----------------------------------------------------------------------
*
* TkGenerateButtonEvent --
*
- * Given a global x & y position and the button key status this
- * procedure generates the appropiate X button event. It also
- * handles the state changes needed to implement implicit grabs.
+ * Given a global x & y position and the button key status this
+ * procedure generates the appropiate X button event. It also
+ * handles the state changes needed to implement implicit grabs.
*
* Results:
- * True if event(s) are generated - false otherwise.
+ * True if event(s) are generated - false otherwise.
*
* Side effects:
- * Additional events may be place on the Tk event queue.
- * Grab state may also change.
+ * Additional events may be place on the Tk event queue.
+ * Grab state may also change.
*
*----------------------------------------------------------------------
*/
int
TkGenerateButtonEvent(
- int x, /* X location of mouse */
- int y, /* Y location of mouse */
- Window window, /* X Window containing button event. */
- unsigned int state) /* Button Key state suitable for X event */
+ int x, /* X location of mouse */
+ int y, /* Y location of mouse */
+ Window window, /* X Window containing button event. */
+ unsigned int state) /* Button Key state suitable for X event */
+{
+ MouseEventData med;
+
+ bzero(&med, sizeof(MouseEventData));
+ med.state = state;
+ med.window = window;
+ med.global.h = x;
+ med.global.v = y;
+ FindWindow(med.global, &med.whichWin);
+ med.activeNonFloating = ActiveNonFloatingWindow();
+ med.local = med.global;
+ QDGlobalToLocalPoint(GetWindowPort(med.whichWin), &med.local);
+
+ return GenerateButtonEvent(&med);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateButtonEvent --
+ *
+ * Generate an X button event from a MouseEventData structure.
+ * Handles the state changes needed to implement implicit grabs.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ * Grab state may also change.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GenerateButtonEvent(MouseEventData * medPtr)
{
- WindowRef whichWin, frontWin;
- Point where;
Tk_Window tkwin;
int dummy;
TkDisplay *dispPtr;
/*
* ButtonDown events will always occur in the front
- * window. ButtonUp events, however, may occur anywhere
+ * window. ButtonUp events, however, may occur anywhere
* on the screen. ButtonUp events should only be sent
* to Tk if in the front window or during an implicit grab.
*/
-
- where.h = x;
- where.v = y;
- FindWindow(where, &whichWin);
- frontWin = FrontNonFloatingWindow();
-
- if (0 && ((frontWin == NULL) || ((!(TkpIsWindowFloating(whichWin))
- && (frontWin != whichWin))
- && TkMacOSXGetCapture() == NULL))) {
- return false;
+ if (0
+ && ((medPtr->activeNonFloating == NULL)
+ || ((!(TkpIsWindowFloating(medPtr->whichWin))
+ && (medPtr->activeNonFloating != medPtr->whichWin))
+ && TkMacOSXGetCapture() == NULL))) {
+ return false;
}
dispPtr = TkGetDisplayList();
- tkwin = Tk_IdToWindow(dispPtr->display, window);
+ tkwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
- /* SetPortWindowPort(ActiveNonFloatingWindow()); */
- SetPortWindowPort(whichWin);
- GlobalToLocal(&where);
if (tkwin != NULL) {
- tkwin = Tk_TopCoordsToWindow(tkwin, where.h, where.v,
- &dummy, &dummy);
+ tkwin = Tk_TopCoordsToWindow(tkwin, medPtr->local.h, medPtr->local.v,
+ &dummy, &dummy);
}
- Tk_UpdatePointer(tkwin, x, y, state);
+ Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v, medPtr->state);
return true;
}
@@ -830,7 +861,7 @@ TkGenerateButtonEvent(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXToolarbuttonEvent --
+ * GenerateToolbarButtonEvent --
*
* Generates a "ToolbarButton" virtual event.
* This can be used to manage disappearing toolbars.
@@ -845,23 +876,18 @@ TkGenerateButtonEvent(
*/
static int
-TkMacOSXToolarbuttonEvent(MouseEventData * medPtr, Point where)
+GenerateToolbarButtonEvent(MouseEventData * medPtr)
{
Tk_Window rootwin, tkwin = NULL;
- Window window;
TkDisplay *dispPtr;
TkWindow *winPtr;
XVirtualEvent event;
- CGrafPtr port;
- Rect bounds;
- window = TkMacOSXGetXWindow(medPtr->whichWin);
dispPtr = TkGetDisplayList();
- rootwin = Tk_IdToWindow(dispPtr->display, window);
+ rootwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
if (rootwin) {
- int local_x, local_y;
tkwin = Tk_TopCoordsToWindow(rootwin,
- medPtr->local.h, medPtr->local.v, &local_x, &local_y);
+ medPtr->local.h, medPtr->local.v, &event.x, &event.y);
}
if (!tkwin) {
return true;
@@ -877,14 +903,8 @@ TkMacOSXToolarbuttonEvent(MouseEventData * medPtr, Point where)
event.subwindow = None;
event.time = TkpGetMS();
- event.x = where.h;
- event.y = where.v;
-
- GetMouse(&where);
- GetPort(&port);
- GetPortBounds(port, &bounds);
- event.x_root = where.h + bounds.left;
- event.y_root = where.v + bounds.top;
+ event.x_root = medPtr->global.h;
+ event.y_root = medPtr->global.v;
event.state = medPtr->state;
event.same_screen = true;
event.name = Tk_GetUid("ToolbarButton");
diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h
index dcb8359..fd157dd 100644
--- a/macosx/tkMacOSXPort.h
+++ b/macosx/tkMacOSXPort.h
@@ -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: tkMacOSXPort.h,v 1.3.2.1 2004/02/16 00:42:34 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXPort.h,v 1.3.2.2 2005/08/09 07:40:01 das Exp $
*/
#ifndef _TKMACPORT
@@ -137,9 +137,6 @@ extern int errno;
* in any other header file.
*/
-#ifndef panic /* In a stubs-aware setting, this could confuse the #define */
-extern void panic _ANSI_ARGS_(TCL_VARARGS(char *, string));
-#endif
#ifndef strcasecmp
extern int strcasecmp _ANSI_ARGS_((CONST char *s1,
CONST char *s2));
diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c
index 9022387..709b3e4 100644
--- a/macosx/tkMacOSXScale.c
+++ b/macosx/tkMacOSXScale.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: tkMacOSXScale.c,v 1.2.2.1 2004/02/16 00:42:34 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXScale.c,v 1.2.2.2 2005/08/09 07:40:01 das Exp $
*/
#include "tkScale.h"
@@ -147,12 +147,11 @@ TkpDisplayScale(clientData)
CGrafPtr saveWorld;
GDHandle saveDevice;
MacDrawable *macDraw;
- SInt16 initialValue;
- SInt16 minValue;
- SInt16 maxValue;
- SInt16 procID;
- SInt32 controlReference;
- Boolean initiallyVisible = true;
+ SInt32 initialValue;
+ SInt32 minValue;
+ SInt32 maxValue;
+ UInt16 numTicks;
+
fprintf(stderr,"TkpDisplayScale\n");
scalePtr->flags &= ~REDRAW_PENDING;
@@ -215,21 +214,58 @@ TkpDisplayScale(clientData)
/*
* Create Macintosh control.
*/
- if (macScalePtr->scaleHandle == NULL) {
- fprintf(stderr,"Initialising scale\n");
- r.left = macDraw->xOff;
- r.top = macDraw->yOff;
+
+#define MAC_OSX_SCROLL_WIDTH 10
+
+ if (scalePtr->orient == ORIENT_HORIZONTAL) {
+ int offset;
+ offset = (Tk_Height(tkwin) - MAC_OSX_SCROLL_WIDTH)/2;
+ if (offset < 0) {
+ offset = 0;
+ }
+
+ r.left = macDraw->xOff + scalePtr->inset;
+ r.top = macDraw->yOff + offset;
r.right = macDraw->xOff+Tk_Width(tkwin) - scalePtr->inset;
+ r.bottom = macDraw->yOff + offset + MAC_OSX_SCROLL_WIDTH/2;
+ } else {
+ int offset;
+
+ offset = (Tk_Width(tkwin) - MAC_OSX_SCROLL_WIDTH)/2;
+ if (offset < 0) {
+ offset = 0;
+ }
+
+ r.left = macDraw->xOff + offset;
+ r.top = macDraw->yOff + scalePtr->inset;
+ r.right = macDraw->xOff + offset + MAC_OSX_SCROLL_WIDTH/2;
r.bottom = macDraw->yOff+Tk_Height(tkwin) - scalePtr->inset;
+ }
+
+ if (macScalePtr->scaleHandle == NULL) {
+
+ fprintf(stderr,"Initialising scale\n");
initialValue = scalePtr->value;
- minValue = scalePtr->toValue;
- maxValue = scalePtr->fromValue;
- procID = kControlSliderProc;
- controlReference = (SInt32) macScalePtr;
- macScalePtr->scaleHandle = NewControl(windowRef,
- &r, "\p", initiallyVisible, initialValue,minValue,maxValue,
- procID, controlReference);
+ if (scalePtr->orient == ORIENT_HORIZONTAL) {
+ minValue = scalePtr->fromValue;
+ maxValue = scalePtr->toValue;
+ } else {
+ minValue = scalePtr->fromValue;
+ maxValue = scalePtr->toValue;
+ }
+
+ if (scalePtr->tickInterval == 0) {
+ numTicks = 0;
+ } else {
+ numTicks = (maxValue - minValue)/scalePtr->tickInterval;
+ }
+
+ CreateSliderControl(windowRef, &r, initialValue, minValue, maxValue,
+ kControlSliderPointsDownOrRight, numTicks,
+ 1, scaleActionProc,
+ &(macScalePtr->scaleHandle));
+ SetControlReference(macScalePtr->scaleHandle, (UInt32) scalePtr);
/*
* If we are foremost than make us active.
@@ -237,6 +273,11 @@ TkpDisplayScale(clientData)
if (windowRef == FrontWindow()) {
macScalePtr->flags |= ACTIVE;
}
+ } else {
+ SetControlBounds(macScalePtr->scaleHandle, &r);
+ SetControl32BitValue(macScalePtr->scaleHandle, scalePtr->value);
+ SetControl32BitMinimum(macScalePtr->scaleHandle, scalePtr->fromValue);
+ SetControl32BitMaximum(macScalePtr->scaleHandle, scalePtr->toValue);
}
/*
@@ -387,7 +428,6 @@ MacScaleEventProc(clientData, eventPtr)
* The TrackControl call will "eat" the ButtonUp event. We now
* generate a ButtonUp event so Tk will unset implicit grabs etc.
*/
- GetMouse(&where);
XQueryPointer(NULL, None, &dummyWin, &dummyWin, &x,
&y, &dummy, &dummy, &state);
TkGenerateButtonEvent(x, y, Tk_WindowId(macScalePtr->info.tkwin), state);
@@ -414,9 +454,9 @@ MacScaleEventProc(clientData, eventPtr)
*/
static pascal void
-ScaleActionProc(ControlRef theControl, ControlPartCode partCode)
- /* ControlRef theControl; /* Handle to scrollbat control */
- /* ControlPartCode partCode; /* Part of scrollbar that was "hit" */
+ScaleActionProc(
+ ControlRef theControl, /* Handle to scrollbat control */
+ ControlPartCode partCode) /* Part of scrollbar that was "hit" */
{
int value;
TkScale *scalePtr = (TkScale *) GetControlReference(theControl);
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 786bfc5..c56a15b 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.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: tkMacOSXScrlbr.c,v 1.5.2.4 2005/06/03 00:53:29 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.5.2.5 2005/08/09 07:40:01 das Exp $
*/
#include "tkScrollbar.h"
@@ -269,7 +269,7 @@ TkpDisplayScrollbar(
* If we are foremost then make us active.
*/
- frontNonFloating = FrontNonFloatingWindow();
+ frontNonFloating = ActiveNonFloatingWindow();
if ((windowRef == FrontWindow()) || TkpIsWindowFloating(windowRef)) {
macScrollPtr->macFlags |= ACTIVE;
@@ -877,7 +877,6 @@ ScrollbarBindProc(
* The TrackControl call will "eat" the ButtonUp event. We now
* generate a ButtonUp event so Tk will unset implicit grabs etc.
*/
- GetMouse(&where);
XQueryPointer(NULL, None, &window, &window, &x,
&y, &dummy, &dummy, &state);
window = Tk_WindowId(scrollPtr->tkwin);
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index c889a38..7e7bfc0 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -9,7 +9,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.2.2.5 2005/07/28 03:45:03 hobbs Exp $
+ * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.2.2.6 2005/08/09 07:40:01 das Exp $
*/
#include "tkInt.h"
@@ -32,8 +32,7 @@ static RgnHandle tmpRgn = NULL;
*/
static void GenerateConfigureNotify (TkWindow *winPtr, int includeWin);
-static void UpdateOffsets _ANSI_ARGS_((TkWindow *winPtr,
- int deltaX, int deltaY));
+static void UpdateOffsets (TkWindow *winPtr, int deltaX, int deltaY);
/*
*----------------------------------------------------------------------
@@ -86,7 +85,7 @@ XDestroyWindow(
if (TkpIsWindowFloating (winRef)) {
Window window;
- window = TkMacOSXGetXWindow(FrontNonFloatingWindow());
+ window = TkMacOSXGetXWindow(ActiveNonFloatingWindow());
if (window != None) {
TkMacOSXGenerateFocusEvent(window, 1);
}
@@ -156,6 +155,57 @@ XDestroyWindow(
ckfree((char *) macWin);
}
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FixMappingFlags --
+ *
+ * If on is 0, mark the child windows of the window passed in in winPtr
+ * as unmapped, but remember whether they were originally mapped in their
+ * parent.
+ * If on is 1, set all the child windows of winPtr that WERE mapped in
+ * their parent before the parent was unmapped back to mapped.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The TkWindow and MacDrawable flags may be adjusted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+FixMappingFlags (TkWindow *winPtr, int on)
+{
+ TkWindow *childPtr;
+ childPtr = winPtr->childList;
+
+ while (childPtr != NULL) {
+ /*
+ * We might get called before the Mac OS X side of the widget
+ * is created yet. If so, wait till later...
+ */
+
+ if (childPtr->privatePtr != NULL) {
+
+ if (((MacDrawable *)childPtr->privatePtr)->flags
+ & TK_MAPPED_IN_PARENT) {
+ if (on) {
+ childPtr->flags |= TK_MAPPED;
+ } else {
+ childPtr->flags &= ~TK_MAPPED;
+ }
+ }
+ if (!Tk_TopWinHierarchy(childPtr)) {
+ FixMappingFlags (childPtr, on);
+ }
+ }
+ childPtr = childPtr->nextPtr;
+ }
+
+}
/*
*----------------------------------------------------------------------
@@ -197,6 +247,8 @@ XMapWindow(
display->request++;
macWin->winPtr->flags |= TK_MAPPED;
+ macWin->flags |= TK_MAPPED_IN_PARENT;
+ FixMappingFlags(macWin->winPtr, 1);
if (Tk_IsTopLevel(macWin->winPtr)) {
if (!Tk_IsEmbedded(macWin->winPtr)) {
/*
@@ -268,8 +320,11 @@ XUnmapWindow(
display->request++;
macWin->winPtr->flags &= ~TK_MAPPED;
+ macWin->flags &= ~TK_MAPPED_IN_PARENT;
+ FixMappingFlags(macWin->winPtr, 0);
if (Tk_IsTopLevel(macWin->winPtr)) {
- if (!Tk_IsEmbedded(macWin->winPtr)) {
+ if (!Tk_IsEmbedded(macWin->winPtr)
+ && macWin->winPtr->wmInfoPtr->hints.initial_state != IconicState) {
/*
* XXX This should be HideSheetWindow for kSheetWindowClass
* XXX windows that have a wmPtr->master parent set.
@@ -332,14 +387,14 @@ XResizeWindow(
{
MacDrawable *macWin = (MacDrawable *) window;
CGrafPtr destPort;
+ int havePort = 1;
destPort = TkMacOSXGetDrawablePort(window);
if (destPort == NULL) {
- return;
+ havePort = 0;
}
display->request++;
- SetPort( destPort);
if (Tk_IsTopLevel(macWin->winPtr)) {
if (!Tk_IsEmbedded(macWin->winPtr)) {
/*
@@ -347,10 +402,13 @@ XResizeWindow(
* region. It is currently assumed that Tk will need
* to completely redraw anway.
*/
- SizeWindow(GetWindowFromPort(destPort),
- (short) width, (short) height, false);
- TkMacOSXInvalidateWindow(macWin, TK_WINDOW_ONLY);
- TkMacOSXInvalClipRgns(macWin->winPtr);
+ if (havePort) {
+ SetPort(destPort);
+ SizeWindow(GetWindowFromPort(destPort),
+ (short) width, (short) height, false);
+ TkMacOSXInvalidateWindow(macWin, TK_WINDOW_ONLY);
+ TkMacOSXInvalClipRgns(macWin->winPtr);
+ }
} else {
int deltaX, deltaY;
@@ -365,9 +423,11 @@ XResizeWindow(
if (contWinPtr != NULL) {
MacDrawable *macParent = contWinPtr->privatePtr;
- TkMacOSXInvalClipRgns(macParent->winPtr);
- TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
-
+ if (havePort) {
+ SetPort(destPort);
+ TkMacOSXInvalClipRgns(macParent->winPtr);
+ TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ }
deltaX = macParent->xOff +
macWin->winPtr->changes.x - macWin->xOff;
deltaY = macParent->yOff +
@@ -397,9 +457,11 @@ XResizeWindow(
return; /* TODO: Probably should be a panic */
}
- TkMacOSXInvalClipRgns(macParent->winPtr);
- TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
-
+ if (havePort) {
+ SetPort(destPort);
+ TkMacOSXInvalClipRgns(macParent->winPtr);
+ TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ }
deltaX = - macWin->xOff;
deltaY = - macWin->yOff;
@@ -479,13 +541,13 @@ XMoveResizeWindow(
{
MacDrawable * macWin = (MacDrawable *) window;
CGrafPtr destPort;
+ int havePort = 1;
destPort = TkMacOSXGetDrawablePort(window);
if (destPort == NULL) {
- return;
+ havePort = 0;
}
- SetPort( destPort);
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
/*
* NOTE: we are not adding the new space to the update
@@ -493,13 +555,16 @@ XMoveResizeWindow(
* to completely redraw anway.
*/
- SizeWindow(GetWindowFromPort(destPort),
- (short) width, (short) height, false);
- MoveWindowStructure(GetWindowFromPort(destPort), x, y);
+ if (havePort) {
+ SetPort( destPort);
+ SizeWindow(GetWindowFromPort(destPort),
+ (short) width, (short) height, false);
+ MoveWindowStructure(GetWindowFromPort(destPort), x, y);
- /* TODO: is the following right? */
- TkMacOSXInvalidateWindow(macWin, TK_WINDOW_ONLY);
- TkMacOSXInvalClipRgns(macWin->winPtr);
+ /* TODO: is the following right? */
+ TkMacOSXInvalidateWindow(macWin, TK_WINDOW_ONLY);
+ TkMacOSXInvalClipRgns(macWin->winPtr);
+ }
} else {
int deltaX, deltaY, parentBorderwidth;
Rect bounds;
@@ -515,7 +580,7 @@ XMoveResizeWindow(
contWinPtr = TkpGetOtherWindow(macWin->winPtr);
if (contWinPtr == NULL) {
- panic("XMoveResizeWindow could not find container");
+ Tcl_Panic("XMoveResizeWindow could not find container");
}
macParent = contWinPtr->privatePtr;
@@ -530,9 +595,12 @@ XMoveResizeWindow(
return; /* TODO: Probably should be a panic */
}
}
-
- TkMacOSXInvalClipRgns(macParent->winPtr);
- TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+
+ if (havePort) {
+ SetPort( destPort);
+ TkMacOSXInvalClipRgns(macParent->winPtr);
+ TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ }
deltaX = - macWin->xOff;
deltaY = - macWin->yOff;
@@ -553,8 +621,10 @@ XMoveResizeWindow(
macWin->winPtr->changes.y;
UpdateOffsets(macWin->winPtr, deltaX, deltaY);
- TkMacOSXWinBounds(macWin->winPtr, &bounds);
- InvalWindowRect(GetWindowFromPort(destPort),&bounds);
+ if (havePort) {
+ TkMacOSXWinBounds(macWin->winPtr, &bounds);
+ InvalWindowRect(GetWindowFromPort(destPort),&bounds);
+ }
GenerateConfigureNotify(macWin->winPtr, 0);
}
}
@@ -585,24 +655,27 @@ XMoveWindow(
{
MacDrawable *macWin = (MacDrawable *) window;
CGrafPtr destPort;
+ int havePort = 1;
destPort = TkMacOSXGetDrawablePort(window);
if (destPort == NULL) {
- return;
+ havePort = 0;
}
- SetPort( destPort);
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
/*
* NOTE: we are not adding the new space to the update
* region. It is currently assumed that Tk will need
* to completely redraw anway.
*/
- MoveWindowStructure( GetWindowFromPort(destPort), x, y);
+ if (havePort) {
+ SetPort(destPort);
+ MoveWindowStructure( GetWindowFromPort(destPort), x, y);
- /* TODO: is the following right? */
- TkMacOSXInvalidateWindow(macWin, TK_WINDOW_ONLY);
- TkMacOSXInvalClipRgns(macWin->winPtr);
+ /* TODO: is the following right? */
+ TkMacOSXInvalidateWindow(macWin, TK_WINDOW_ONLY);
+ TkMacOSXInvalClipRgns(macWin->winPtr);
+ }
} else {
int deltaX, deltaY, parentBorderwidth;
Rect bounds;
@@ -618,7 +691,7 @@ XMoveWindow(
contWinPtr = TkpGetOtherWindow(macWin->winPtr);
if (contWinPtr == NULL) {
- panic("XMoveWindow could not find container");
+ Tcl_Panic("XMoveWindow could not find container");
}
macParent = contWinPtr->privatePtr;
@@ -633,9 +706,12 @@ XMoveWindow(
}
}
- TkMacOSXInvalClipRgns(macParent->winPtr);
- TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
-
+ if (havePort) {
+ SetPort(destPort);
+ TkMacOSXInvalClipRgns(macParent->winPtr);
+ TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ }
+
deltaX = - macWin->xOff;
deltaY = - macWin->yOff;
@@ -655,8 +731,10 @@ XMoveWindow(
macWin->winPtr->changes.y;
UpdateOffsets(macWin->winPtr, deltaX, deltaY);
- TkMacOSXWinBounds(macWin->winPtr, &bounds);
- InvalWindowRect(GetWindowFromPort(destPort),&bounds);
+ if (havePort) {
+ TkMacOSXWinBounds(macWin->winPtr, &bounds);
+ InvalWindowRect(GetWindowFromPort(destPort),&bounds);
+ }
GenerateConfigureNotify(macWin->winPtr, 0);
}
}
@@ -817,7 +895,7 @@ TkMacOSXUpdateClipRgn(
if (winPtr == NULL) {
return;
}
-
+
if (winPtr->privatePtr->flags & TK_CLIP_INVALID) {
rgn = winPtr->privatePtr->aboveClipRgn;
if (tmpRgn == NULL) {
@@ -1231,7 +1309,8 @@ TkMacOSXWinBounds(
winPtr->changes.width);
bounds->bottom = (short) (winPtr->privatePtr->yOff +
winPtr->changes.height);
-}
+}
+
/*
*----------------------------------------------------------------------
*
@@ -1351,7 +1430,7 @@ Tk_GetPixmap(
err = NewGWorld(&gWorld, depth, &bounds, NULL, NULL, useTempMem);
}
if (err != noErr) {
- panic("Out of memory: NewGWorld failed in Tk_GetPixmap");
+ Tcl_Panic("Out of memory: NewGWorld failed in Tk_GetPixmap");
}
/*
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 02cad5f..87b025b 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -10,10 +10,11 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXTest.c,v 1.2 2002/08/31 06:12:30 das Exp $
+ * RCS: @(#) $Id: tkMacOSXTest.c,v 1.2.2.1 2005/08/09 07:40:01 das Exp $
*/
#include <tcl.h>
+#include <Carbon/Carbon.h>
/*
* Forward declarations of procedures defined later in this file:
@@ -21,7 +22,7 @@
int TkplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
static int DebuggerCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, char **argv));
+ Tcl_Interp *interp, int argc, CONST char **argv));
/*
*----------------------------------------------------------------------
@@ -75,7 +76,7 @@ DebuggerCmd(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Not used. */
int argc, /* Not used. */
- char **argv) /* Not used. */
+ CONST char **argv) /* Not used. */
{
Debugger();
return TCL_OK;
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index dbb94cc..366c1c8 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -49,6 +49,8 @@
* acting in its behalf permission to use and distribute the
* software in accordance with the terms specified in this
* license.
+ *
+ * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.3 2005/08/09 07:40:01 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -99,6 +101,16 @@ TkMacOSXProcessApplicationEvent(
TkMacOSXEvent *eventPtr,
MacEventStatus *statusPtr)
{
+ Tcl_CmdInfo dummy;
+
+ /*
+ * This is a bit of a hack. We get "show" events both when we come back
+ * from being hidden, and whenever we are activated. I only want to run the
+ * "show" proc when we have been hidden already, not as a substitute for
+ * <Activate>. So I use this toggle...
+ */
+ static int toggleHide = 0;
+
switch (eventPtr->eKind) {
case kEventAppActivated:
tkMacOSXAppInFront = true;
@@ -115,6 +127,34 @@ TkMacOSXProcessApplicationEvent(
case kEventAppTerminated:
case kEventAppFrontSwitched:
break;
+ case kEventAppHidden:
+ /*
+ * Don't bother if we don't have an interp or
+ * the show preferences procedure doesn't exist.
+ */
+ toggleHide = 1;
+ if ((eventPtr->interp == NULL) ||
+ (Tcl_GetCommandInfo(eventPtr->interp,
+ "::tk::mac::OnHide", &dummy)) == 0) {
+ break;
+ }
+ Tcl_GlobalEval(eventPtr->interp, "::tk::mac::OnHide");
+ statusPtr->stopProcessing = 1;
+ break;
+ case kEventAppShown:
+ if (toggleHide == 1) {
+ toggleHide = 0;
+ if ((eventPtr->interp == NULL) ||
+ (Tcl_GetCommandInfo(eventPtr->interp,
+ "::tk::mac::OnShow", &dummy)) == 0) {
+ break;
+ }
+ Tcl_GlobalEval(eventPtr->interp, "::tk::mac::OnShow");
+ }
+ statusPtr->stopProcessing = 1;
+ break;
+ default:
+ break;
}
return 0;
}
@@ -150,6 +190,7 @@ TkMacOSXProcessWindowEvent(
case kEventWindowActivated:
case kEventWindowDeactivated:
case kEventWindowUpdate:
+ case kEventWindowExpanded:
break;
default:
return 0;
@@ -181,6 +222,16 @@ TkMacOSXProcessWindowEvent(
eventFound = true;
}
break;
+ case kEventWindowExpanded: {
+ TkDisplay *dispPtr;
+ TkWindow *winPtr;
+ dispPtr = TkGetDisplayList();
+ winPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display, window);
+ if (winPtr) {
+ TkpWmSetState(winPtr, NormalState);
+ }
+ break;
+ }
}
return 0;
}
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index ef075b5..f3087fb 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.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: tkMacOSXWm.c,v 1.7.2.11 2005/07/28 08:00:57 hobbs Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.12 2005/08/09 07:40:01 das Exp $
*/
#include <Carbon/Carbon.h>
@@ -265,6 +265,7 @@ TkWmNewWindow(
wmPtr->attributes = kWindowStandardDocumentAttributes;
wmPtr->scrollWinPtr = NULL;
winPtr->wmInfoPtr = wmPtr;
+
UpdateVRootGeometry(wmPtr);
/*
@@ -2492,7 +2493,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
if (objc == 3) {
windows = TkWmStackorderToplevel(winPtr);
if (windows == NULL) {
- panic("TkWmStackorderToplevel failed");
+ Tcl_Panic("TkWmStackorderToplevel failed");
} else {
for (window_ptr = windows; *window_ptr ; window_ptr++) {
Tcl_AppendElement(interp, (*window_ptr)->pathName);
@@ -2547,9 +2548,9 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
index2 = (window_ptr - windows);
}
if (index1 == -1)
- panic("winPtr window not found");
+ Tcl_Panic("winPtr window not found");
if (index2 == -1)
- panic("winPtr2 window not found");
+ Tcl_Panic("winPtr2 window not found");
ckfree((char *) windows);
}
@@ -2867,7 +2868,7 @@ WmInfo *wmPtr;
TkWindow *winPtr;
{
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -2961,7 +2962,7 @@ Tk_SetGrid(
wmPtr->sizeHintsFlags |= PBaseSize|PResizeInc;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3019,7 +3020,7 @@ Tk_UnsetGrid(
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3071,7 +3072,7 @@ TopLevelEventProc(
printf("TopLevelEventProc: %s deleted\n", winPtr->pathName);
}
} else if (eventPtr->type == ReparentNotify) {
- panic("recieved unwanted reparent event");
+ Tcl_Panic("recieved unwanted reparent event");
}
}
@@ -3105,7 +3106,7 @@ TopLevelReqProc(
wmPtr = winPtr->wmInfoPtr;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
@@ -3503,7 +3504,7 @@ ParseGeometry(
wmPtr->flags = flags;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
return TCL_OK;
@@ -3986,7 +3987,7 @@ Tk_MoveToplevelWindow(
WmInfo *wmPtr = winPtr->wmInfoPtr;
if (!(winPtr->flags & TK_TOP_LEVEL)) {
- panic("Tk_MoveToplevelWindow called with non-toplevel window");
+ Tcl_Panic("Tk_MoveToplevelWindow called with non-toplevel window");
}
wmPtr->x = x;
wmPtr->y = y;
@@ -4077,7 +4078,7 @@ TkWmRestackToplevel(
otherMacWindow = NULL;
}
- frontWindow = FrontNonFloatingWindow();
+ frontWindow = ActiveNonFloatingWindow();
if (aboveBelow == Above) {
if (macWindow == frontWindow) {
@@ -4110,7 +4111,7 @@ TkWmRestackToplevel(
}
} else {
/*
- * Send behind. If it was in front find another window to make active.
+ * Send behind. If it was in front find another window to make active.
*/
if (macWindow == frontWindow) {
if ( ( tmpWindow = GetNextWindow ( macWindow )) != NULL) {
@@ -4311,12 +4312,7 @@ TkGetPointerCoords(
* on which lookup is to be done. */
int *xPtr, int *yPtr) /* Store pointer coordinates here. */
{
- Point where;
-
- GetMouse(&where);
- LocalToGlobal(&where);
- *xPtr = where.h;
- *yPtr = where.v;
+ XQueryPointer(NULL, None, NULL, NULL, xPtr, yPtr, NULL, NULL, NULL);
}
/*
@@ -4621,7 +4617,6 @@ TkMacOSXGetXWindow(
int
TkMacOSXZoomToplevel(
WindowRef whichWindow, /* The Macintosh window to zoom. */
- Point where, /* The current mouse position. */
short zoomPart) /* Either inZoomIn or inZoomOut */
{
Window window;
@@ -4633,9 +4628,6 @@ TkMacOSXZoomToplevel(
Rect portRect;
SetPort( GetWindowPort(whichWindow));
- if (!TrackBox(whichWindow, where, zoomPart)) {
- return false;
- }
/*
* We should now zoom the window (as long as it's one of ours). We
@@ -5033,12 +5025,12 @@ TkMacOSXMakeRealWindowExist(
} else if (gMacEmbedHandler != NULL) {
if (gMacEmbedHandler->containerExistProc != NULL) {
if (gMacEmbedHandler->containerExistProc((Tk_Window) winPtr) != TCL_OK) {
- panic("ContainerExistProc could not make container");
+ Tcl_Panic("ContainerExistProc could not make container");
}
}
return;
} else {
- panic("TkMacOSXMakeRealWindowExist could not find container");
+ Tcl_Panic("TkMacOSXMakeRealWindowExist could not find container");
}
/*
@@ -5073,10 +5065,10 @@ TkMacOSXMakeRealWindowExist(
}
if (newWindow == NULL) {
- panic("couldn't allocate new Mac window");
+ Tcl_Panic("couldn't allocate new Mac window");
}
if (CreateRootControl(newWindow,&rootControl) != noErr ) {
- panic("couldn't create root control for new Mac window");
+ Tcl_Panic("couldn't create root control for new Mac window");
}
/*
@@ -5088,7 +5080,7 @@ TkMacOSXMakeRealWindowExist(
listPtr->winPtr = winPtr;
tkMacOSXWindowListPtr = listPtr;
- macWin->grafPtr = GetWindowPort (newWindow);
+ macWin->grafPtr = GetWindowPort(newWindow);
macWin->rootControl = rootControl;
MoveWindowStructure(newWindow, geometry.left, geometry.top);
SetPort(GetWindowPort(newWindow));
@@ -5111,7 +5103,7 @@ TkMacOSXMakeRealWindowExist(
valueHashPtr = Tcl_CreateHashEntry(&windowTable,
(char *) newWindow, &new);
if (!new) {
- panic("same macintosh window allocated twice!");
+ Tcl_Panic("same macintosh window allocated twice!");
}
Tcl_SetHashValue(valueHashPtr, macWin);
@@ -5155,7 +5147,7 @@ TkMacOSXRegisterOffScreenWindow(
valueHashPtr = Tcl_CreateHashEntry(&windowTable,
(char *) portPtr, &new);
if (!new) {
- panic("same macintosh window allocated twice!");
+ Tcl_Panic("same macintosh window allocated twice!");
}
Tcl_SetHashValue(valueHashPtr, macWin);
}
@@ -5184,7 +5176,7 @@ TkMacOSXUnregisterMacWindow(
{
Tcl_HashEntry *entryPtr;
if (!windowHashInit) {
- panic("TkMacOSXUnregisterMacWindow: unmapping before inited");
+ Tcl_Panic("TkMacOSXUnregisterMacWindow: unmapping before inited");
}
entryPtr = Tcl_FindHashEntry(&windowTable,(char *) macWinPtr);
if (!entryPtr) {
@@ -5328,22 +5320,19 @@ TkpWmSetState(winPtr, state)
if (state == WithdrawnState) {
Tk_UnmapWindow((Tk_Window) winPtr);
} else if (state == IconicState) {
- Tk_UnmapWindow((Tk_Window) winPtr);
/*
- * The window always gets unmapped. However, if we can show the
- * icon version of the window (collapsed) we make the window visable
- * and then collapse it.
- *
- * TODO: This approach causes flashing!
+ * The window always gets unmapped. If we can show the
+ * icon version of the window we also collapse it.
*/
-
if (IsWindowCollapsable(macWin) && !IsWindowCollapsed(macWin)) {
- ShowWindow(macWin);
CollapseWindow(macWin, true);
}
+ Tk_UnmapWindow((Tk_Window) winPtr);
} else if (state == NormalState) {
Tk_MapWindow((Tk_Window) winPtr);
- CollapseWindow((WindowPtr) macWin, false);
+ if (IsWindowCollapsable(macWin) && IsWindowCollapsed(macWin)) {
+ CollapseWindow((WindowPtr) macWin, false);
+ }
} else if (state == ZoomState) {
/* TODO: need to support zoomed windows */
}
@@ -5693,7 +5682,7 @@ TkWmStackorderToplevel(parentPtr)
frontWindow = GetNextWindow(frontWindow);
}
if (window_ptr != (windows-1))
- panic("num matched toplevel windows does not equal num children");
+ Tcl_Panic("num matched toplevel windows does not equal num children");
}
done:
diff --git a/macosx/tkMacOSXWm.h b/macosx/tkMacOSXWm.h
index fb17959..5c33a5d 100644
--- a/macosx/tkMacOSXWm.h
+++ b/macosx/tkMacOSXWm.h
@@ -49,6 +49,8 @@
* acting in its behalf permission to use and distribute the
* software in accordance with the terms specified in this
* license.
+ *
+ * RCS: @(#) $Id: tkMacOSXWm.h,v 1.2.2.2 2005/08/09 07:40:02 das Exp $
*/
#ifndef _TKMACWM
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 033e917..8da13aa 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.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: tkMacOSXXStubs.c,v 1.2.2.6 2005/05/15 20:57:08 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.7 2005/08/09 07:40:02 das Exp $
*/
#include "tkInt.h"
@@ -178,7 +178,7 @@ TkpCloseDisplay(
{
Display *display = displayPtr->display;
if (gMacDisplay != displayPtr) {
- panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display");
+ Tcl_Panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display");
}
gMacDisplay = NULL;
@@ -319,7 +319,7 @@ DefaultErrorHandler(
* This call should never be called. Tk replaces
* it with its own error handler.
*/
- panic("Warning hit bogus error handler!");
+ Tcl_Panic("Warning hit bogus error handler!");
return 0;
}