Import Tk 8.6.10

This commit is contained in:
Steve Dower
2020-09-24 22:55:34 +01:00
parent 5ba5cbc9af
commit 42c69189d9
365 changed files with 24323 additions and 12832 deletions

View File

@@ -33,9 +33,6 @@
#define ROOT_ID 10
CGFloat tkMacOSXZeroScreenHeight = 0;
CGFloat tkMacOSXZeroScreenTop = 0;
/*
* Declarations of static variables used in this file.
*/
@@ -90,13 +87,9 @@ TkMacOSXDisplayChanged(
nsScreens = [NSScreen screens];
if (nsScreens && [nsScreens count]) {
NSScreen *s = [nsScreens objectAtIndex:0];
NSRect bounds = [s frame], visible = [s visibleFrame];
NSRect bounds = [s frame];
NSRect maxBounds = NSZeroRect;
tkMacOSXZeroScreenHeight = bounds.size.height;
tkMacOSXZeroScreenTop = tkMacOSXZeroScreenHeight -
(visible.origin.y + visible.size.height);
screen->root_depth = NSBitsPerPixelFromDepth([s depth]);
screen->width = bounds.size.width;
screen->height = bounds.size.height;
@@ -110,6 +103,67 @@ TkMacOSXDisplayChanged(
}
}
/*
*----------------------------------------------------------------------
*
* TkMacOSXZeroScreenHeight --
*
* Replacement for the tkMacOSXZeroScreenHeight variable to avoid
* caching values from NSScreen (fixes bug aea00be199).
*
* Results:
* Returns the height of screen 0 (the screen assigned the menu bar
* in System Preferences), or 0.0 if getting [NSScreen screens] fails.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
CGFloat
TkMacOSXZeroScreenHeight()
{
NSArray *nsScreens = [NSScreen screens];
if (nsScreens && [nsScreens count]) {
NSScreen *s = [nsScreens objectAtIndex:0];
NSRect bounds = [s frame];
return bounds.size.height;
}
return 0.0;
}
/*
*----------------------------------------------------------------------
*
* TkMacOSXZeroScreenTop --
*
* Replacement for the tkMacOSXZeroScreenTop variable to avoid
* caching values from visibleFrame.
*
* Results:
* Returns how far below the top of screen 0 to draw
* (i.e. the height of the menu bar if it is always shown),
* or 0.0 if getting [NSScreen screens] fails.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
CGFloat
TkMacOSXZeroScreenTop()
{
NSArray *nsScreens = [NSScreen screens];
if (nsScreens && [nsScreens count]) {
NSScreen *s = [nsScreens objectAtIndex:0];
NSRect bounds = [s frame], visible = [s visibleFrame];
return bounds.size.height - (visible.origin.y + visible.size.height);
}
return 0.0;
}
/*
*----------------------------------------------------------------------
*
@@ -178,7 +232,7 @@ TkpOpenDisplay(
{
int major, minor, patch;
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000
Gestalt(gestaltSystemVersionMajor, (SInt32*)&major);
Gestalt(gestaltSystemVersionMinor, (SInt32*)&minor);
Gestalt(gestaltSystemVersionBugFix, (SInt32*)&patch);
@@ -202,7 +256,7 @@ TkpOpenDisplay(
screen->root_visual = ckalloc(sizeof(Visual));
screen->root_visual->visualid = 0;
screen->root_visual->class = TrueColor;
screen->root_visual->c_class = TrueColor;
screen->root_visual->red_mask = 0x00FF0000;
screen->root_visual->green_mask = 0x0000FF00;
screen->root_visual->blue_mask = 0x000000FF;
@@ -225,6 +279,12 @@ TkpOpenDisplay(
bzero(gMacDisplay, sizeof(TkDisplay));
gMacDisplay->display = display;
[pool drain];
/*
* Key map info must be available immediately, because of "send event".
*/
TkpInitKeymapInfo(gMacDisplay);
return gMacDisplay;
}
@@ -429,7 +489,7 @@ XGetGeometry(
return 1;
}
void
int
XChangeProperty(
Display* display,
Window w,
@@ -441,15 +501,17 @@ XChangeProperty(
int nelements)
{
Debugger();
return Success;
}
void
int
XSelectInput(
Display* display,
Window w,
long event_mask)
{
Debugger();
return Success;
}
int
@@ -508,11 +570,12 @@ XSendEvent(
return 0;
}
void
int
XClearWindow(
Display* display,
Window w)
{
return Success;
}
/*
@@ -524,6 +587,7 @@ XDrawPoint(
int x,
int y)
{
return Success;
}
int
@@ -535,6 +599,7 @@ XDrawPoints(
int npoints,
int mode)
{
return Success;
}
*/
@@ -553,7 +618,7 @@ XWarpPointer(
return Success;
}
void
int
XQueryColor(
Display* display,
Colormap colormap,
@@ -572,9 +637,10 @@ XQueryColor(
d->blue = (b << 8) | b;
d->flags = DoRed|DoGreen|DoBlue;
d->pad = 0;
return Success;
}
void
int
XQueryColors(
Display* display,
Colormap colormap,
@@ -597,6 +663,7 @@ XQueryColors(
d->flags = DoRed|DoGreen|DoBlue;
d->pad = 0;
}
return Success;
}
int
@@ -635,15 +702,16 @@ XGetWindowProperty(
return 0;
}
void
int
XRefreshKeyboardMapping(
XMappingEvent *x)
{
/* used by tkXEvent.c */
Debugger();
return Success;
}
void
int
XSetIconName(
Display* display,
Window w,
@@ -653,9 +721,10 @@ XSetIconName(
* This is a no-op, no icon name for Macs.
*/
display->request++;
return Success;
}
void
int
XForceScreenSaver(
Display* display,
int mode)
@@ -667,6 +736,7 @@ XForceScreenSaver(
*/
display->request++;
return Success;
}
void
@@ -680,7 +750,7 @@ Tk_FreeXId(
int
XSync(
Display *display,
Bool flag)
Bool discard)
{
TkMacOSXFlushWindows();
display->request++;
@@ -770,62 +840,69 @@ TkGetServerInfo(
*----------------------------------------------------------------------
*/
void
int
XChangeWindowAttributes(
Display *display,
Window w,
unsigned long value_mask,
XSetWindowAttributes *attributes)
{
return Success;
}
void
int
XSetWindowBackground(
Display *display,
Window window,
unsigned long value)
{
return Success;
}
void
int
XSetWindowBackgroundPixmap(
Display *display,
Window w,
Pixmap background_pixmap)
{
return Success;
}
void
int
XSetWindowBorder(
Display *display,
Window w,
unsigned long border_pixel)
{
return Success;
}
void
int
XSetWindowBorderPixmap(
Display *display,
Window w,
Pixmap border_pixmap)
{
return Success;
}
void
int
XSetWindowBorderWidth(
Display *display,
Window w,
unsigned int width)
{
return Success;
}
void
int
XSetWindowColormap(
Display *display,
Window w,
Colormap colormap)
{
Debugger();
return Success;
}
Status
@@ -848,12 +925,73 @@ XSetWMClientMachine(
}
XIC
XCreateIC(void)
XCreateIC(XIM xim, ...)
{
Debugger();
return (XIC) 0;
}
#undef XVisualIDFromVisual
VisualID
XVisualIDFromVisual(
Visual *visual)
{
return visual->visualid;
}
#undef XSynchronize
XAfterFunction
XSynchronize(
Display *display,
Bool onoff)
{
display->request++;
return NULL;
}
#undef XUngrabServer
int
XUngrabServer(
Display *display)
{
return 0;
}
#undef XNoOp
int
XNoOp(
Display *display)
{
display->request++;
return 0;
}
#undef XGrabServer
int
XGrabServer(
Display *display)
{
return 0;
}
#undef XFree
int
XFree(
void *data)
{
if ((data) != NULL) {
ckfree(data);
}
return 0;
}
#undef XFlush
int
XFlush(
Display *display)
{
return 0;
}
/*
*----------------------------------------------------------------------
*