summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog25
-rw-r--r--macosx/tkMacOSXCarbonEvents.c3
-rw-r--r--macosx/tkMacOSXInt.h22
-rw-r--r--macosx/tkMacOSXWindowEvent.c28
-rw-r--r--macosx/tkMacOSXXStubs.c113
5 files changed, 127 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog
index c70fa9f..6330bad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2005-11-29 Jeff Hobbs <jeffh@ActiveState.com>
+ * macosx/tkMacOSXXStubs.c (TkpOpenDisplay, TkMacOSXDisplayChanged):
+ * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
+ * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessApplicationEvent):
+ * macosx/tkMacOSXInt.h: Trap kEventAppAvailableWindowBoundsChanged
+ event to watch for change in display size and adjust internal
+ state appropriately.
+
* win/tcl.m4: Add build support for Windows-x64 builds.
* win/configure: --enable-64bit now accepts =amd64|ia64 for
* win/Makefile.in: Windows 64-bit build variants (default: amd64)
@@ -21,11 +28,12 @@
* unix/configure.in: fix obsolete autoconf macros, sync gratuitous
formatting/ordering differences with tcl/unix/configure.in.
- * unix/Makefile.in: add CFLAGS to wish/tktest link to make executable
- linking the same as during configure (needed to avoid loosing any linker
- relevant flags in CFLAGS, in particular flags that can't be in LDFLAGS).
- Avoid concurrent linking of wish and compiling of tkTestInit.o during
- parallel make, fix dependencies and flags for building tkMacOSXInit.o
+ * unix/Makefile.in: add CFLAGS to wish/tktest link to make
+ executable linking the same as during configure (needed to avoid
+ loosing any linker relevant flags in CFLAGS, in particular flags
+ that can't be in LDFLAGS). Avoid concurrent linking of wish and
+ compiling of tkTestInit.o during parallel make, fix dependencies
+ and flags for building tkMacOSXInit.o
(checkstubs, checkexports): dependency and Darwin fixes
* macosx/tkMacOSXEvent.c (TkMacOSXProcessEvent):
@@ -64,7 +72,8 @@
* macosx/tkMacOSXWm.c (UpdateSizeHints): remove code that is never
executed.
- * generic/tk.h: add/correct location of version numbers in macosx files.
+ * generic/tk.h: add/correct location of version numbers in macosx
+ files.
* generic/tkInt.h: clarify fat compile comment.
@@ -77,8 +86,8 @@
* macosx/README: clarification/cleanup, sync with HEAD, document
universal (fat) builds via CFLAGS (i.e. ppc and i386 at the same time).
- * macosx/Makefile: add support for reusing configure cache, build target
- fixes.
+ * macosx/Makefile: add support for reusing configure cache, build
+ target fixes.
* generic/tkMenu.c:
* macosx/tkMacOSXButton.c:
diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c
index 855ab7b..196002a 100644
--- a/macosx/tkMacOSXCarbonEvents.c
+++ b/macosx/tkMacOSXCarbonEvents.c
@@ -60,7 +60,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.5 2005/11/27 02:36:46 das Exp $
+ * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.6 2005/11/30 01:02:55 hobbs Exp $
*/
#include "tkInt.h"
@@ -196,6 +196,7 @@ TkMacOSXInitCarbonEvents (
{kEventClassWindow, kEventWindowExpanded},
{kEventClassApplication, kEventAppHidden},
{kEventClassApplication, kEventAppShown},
+ {kEventClassApplication, kEventAppAvailableWindowBoundsChanged},
};
EventHandlerUPP handler = NewEventHandlerUPP(CarbonEventHandlerProc);
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index 514680a..a6c90f8 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.6 2005/11/27 02:36:46 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3.2.7 2005/11/30 01:02:55 hobbs Exp $
*/
#ifndef _TKMACINT
@@ -137,15 +137,15 @@ extern int tkUseMenuCascadeRgn; /* If this is 1, clipping code
* tkMenuCascadeRgn will only
* be valid when the value of this
* variable is 1. */
-extern int tkPictureIsOpen; /* If this is 1, we are drawing to a picture
- * The clipping should then be done relative
- * to the bounds of the picture rather than the window
- * As of OS X.0.4, something is seriously wrong:
- * The clipping bounds only seem to work if the
- * top,left values are 0,0
- * The destination rectangle for CopyBits
- * should also have top,left values of 0,0
- */
+extern int tkPictureIsOpen; /* If this is 1, we are drawing to a picture
+ * The clipping should then be done relative
+ * to the bounds of the picture rather than
+ * the window As of OS X.0.4, something is
+ * seriously wrong: The clipping bounds only
+ * seem to work if the top,left values are 0,0
+ * The destination rectangle for CopyBits
+ * should also have top,left values of 0,0
+ */
extern TkMacOSXWindowList *tkMacOSXWindowListPtr;
/* The list of toplevels */
@@ -166,6 +166,8 @@ extern void* TkMacOSXGetNamedSymbol(const char* module, const char* symbol);
symbol = TkMacOSXGetNamedSymbol(STRINGIFY(module), STRINGIFY(_##symbol));\
}
+extern void TkMacOSXDisplayChanged(Display *display);
+
#include "tkIntPlatDecls.h"
#endif /* _TKMACINT */
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index a653b02..b6c039a 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.5 2005/11/27 02:36:46 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.6 2005/11/30 01:02:55 hobbs Exp $
*/
#include "tkMacOSXInt.h"
@@ -106,12 +106,12 @@ TkMacOSXProcessApplicationEvent(
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...
+ * 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;
@@ -129,10 +129,10 @@ TkMacOSXProcessApplicationEvent(
statusPtr->stopProcessing = 1;
break;
case kEventAppHidden:
- /*
- * Don't bother if we don't have an interp or
- * the show preferences procedure doesn't exist.
- */
+ /*
+ * 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,
@@ -154,6 +154,14 @@ TkMacOSXProcessApplicationEvent(
}
statusPtr->stopProcessing = 1;
break;
+ case kEventAppAvailableWindowBoundsChanged: {
+ TkDisplay *dispPtr = TkGetDisplayList();
+ TkMacOSXDisplayChanged(dispPtr->display);
+ /*
+ * Should we call ::tk::mac::OnDisplayChanged?
+ */
+ break;
+ }
default:
break;
}
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index eea58fc..592c760 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.9 2005/11/27 02:36:46 das Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.10 2005/11/30 01:02:55 hobbs Exp $
*/
#include "tkInt.h"
@@ -74,6 +74,46 @@ int _XInitImageFuncPtrs _ANSI_ARGS_((XImage *image));
/*
*----------------------------------------------------------------------
*
+ * TkMacOSXDisplayChanged --
+ *
+ * Called to set up initial screen info or when an event indicated
+ * display (screen) change.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May change info regarding the screen.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXDisplayChanged(Display *display)
+{
+ GDHandle graphicsDevice;
+ Screen *screen;
+
+ if (display == NULL || display->screens == NULL) {
+ return;
+ }
+ screen = display->screens;
+
+ graphicsDevice = GetMainDevice();
+ screen->root_depth = (*(*graphicsDevice)->gdPMap)->cmpSize *
+ (*(*graphicsDevice)->gdPMap)->cmpCount;
+ screen->height = (*graphicsDevice)->gdRect.bottom -
+ (*graphicsDevice)->gdRect.top;
+ screen->width = (*graphicsDevice)->gdRect.right -
+ (*graphicsDevice)->gdRect.left;
+
+ screen->mwidth = (screen->width * 254 + 360) / 720;
+ screen->mheight = (screen->height * 254 + 360) / 720;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpOpenDisplay --
*
* Create the Display structure and fill it with device
@@ -94,8 +134,8 @@ TkpOpenDisplay(
{
Display *display;
Screen *screen;
- GDHandle graphicsDevice;
int fd = 0;
+
if (gMacDisplay != NULL) {
if (strcmp(gMacDisplay->display->display_name, display_name) == 0) {
return gMacDisplay;
@@ -104,54 +144,57 @@ TkpOpenDisplay(
}
}
InitCursor();
-
- graphicsDevice = GetMainDevice();
+
display = (Display *) ckalloc(sizeof(Display));
+ screen = (Screen *) ckalloc(sizeof(Screen));
+ bzero(display, sizeof(Display));
+ bzero(screen, sizeof(Screen));
+
display->resource_alloc = MacXIdAlloc;
- screen = (Screen *) ckalloc(sizeof(Screen) * 2);
+ display->request = 0;
+ display->qlen = 0;
+ display->fd = fd;
+ display->screens = screen;
+ display->nscreens = 1;
display->default_screen = 0;
- display->request = 0;
- display->nscreens = 1;
- display->screens = screen;
- display->display_name = macScreenName;
- display->qlen = 0;
- display->fd = fd;
- display->proto_major_version = 10;
+ display->display_name = macScreenName;
+
Gestalt(gestaltQuickdrawVersion, (long*)&display->proto_minor_version);
+ display->proto_major_version = 10;
display->proto_minor_version -= gestaltMacOSXQD;
display->vendor = "Apple";
Gestalt(gestaltSystemVersion, (long*)&display->release);
-
- screen->root = ROOT_ID;
- screen->display = display;
- screen->root_depth = (*(*graphicsDevice)->gdPMap)->cmpSize *
- (*(*graphicsDevice)->gdPMap)->cmpCount;
- screen->height = (*graphicsDevice)->gdRect.bottom -
- (*graphicsDevice)->gdRect.top;
- screen->width = (*graphicsDevice)->gdRect.right -
- (*graphicsDevice)->gdRect.left;
-
- screen->mwidth = (screen->width * 254 + 360) / 720;
- screen->mheight = (screen->height * 254 + 360) / 720;
+
+ /*
+ * These screen bits never change
+ */
+ screen->root = ROOT_ID;
+ screen->display = display;
screen->black_pixel = 0x00000000;
screen->white_pixel = 0x00FFFFFF;
+
screen->root_visual = (Visual *) ckalloc(sizeof(Visual));
- screen->root_visual->visualid = 0;
- screen->root_visual->class = TrueColor;
- screen->root_visual->red_mask = 0x00FF0000;
- screen->root_visual->green_mask = 0x0000FF00;
- screen->root_visual->blue_mask = 0x000000FF;
+ screen->root_visual->visualid = 0;
+ screen->root_visual->class = TrueColor;
+ screen->root_visual->red_mask = 0x00FF0000;
+ screen->root_visual->green_mask = 0x0000FF00;
+ screen->root_visual->blue_mask = 0x000000FF;
screen->root_visual->bits_per_rgb = 24;
- screen->root_visual->map_entries = 256;
+ screen->root_visual->map_entries = 256;
+
+ /*
+ * Initialize screen bits that may change
+ */
+ TkMacOSXDisplayChanged(display);
gMacDisplay = (TkDisplay *) ckalloc(sizeof(TkDisplay));
-
+
/*
* This is the quickest way to make sure that all the *Init
* flags get properly initialized
*/
-
- bzero (gMacDisplay, sizeof (TkDisplay));
+
+ bzero(gMacDisplay, sizeof(TkDisplay));
gMacDisplay->display = display;
return gMacDisplay;
}
@@ -931,7 +974,7 @@ XStringListToTextProperty(
Debugger();
return (Status) 0;
}
-void
+void
XSetWMClientMachine(
Display* display,
Window w,
@@ -939,7 +982,7 @@ XSetWMClientMachine(
{
Debugger();
}
-XIC
+XIC
XCreateIC(
void)
{