head	1.18;
access;
symbols
	core-8-4-19:1.16.2.1
	core-8-4-18:1.16.2.1
	core-8-4-17:1.16.2.1
	core-8-4-16:1.16.2.1
	core-8-4-15:1.16.2.1
	core-8-4-14:1.16.2.1
	core-8-4-13:1.16.2.1
	core-8-4-12:1.16.2.1
	core-8-4-11:1.16.2.1
	core-8-4-10:1.16.2.1
	core-8-4-9-branch:1.16.2.1.0.2
	core-8-4-9:1.16.2.1
	core-8-4-8:1.16.2.1
	core-8-4-7:1.16.2.1
	core-8-5-a1:1.17
	core-8-4-6:1.16
	core-8-4-5:1.16
	mistachkin-dev-branch:1.16.0.4
	core-8-4-4:1.16
	core-8-4-3:1.16
	core-8-4-branch:1.16.0.2
	core-8-4-2:1.16
	core-8-4-1:1.16
	core-8-3-5:1.10
	core-8-4-0:1.15
	macosx-8-4-merge-2002-08-31-trunk:1.15
	macosx-8-4-premerge-2002-08-31-branch:1.10.8.3
	macosx-8-4-premerge-2002-08-31-trunk:1.15
	macosx-8-4-merge-2002-08-30-branch:1.10.8.3
	macosx-8-4-merge-2002-08-30-trunk:1.15
	macosx-8-4-merge-2002-08-20-branch:1.10.8.3
	macosx-8-4-merge-2002-08-20-trunk:1.15
	core-8-4-b2:1.15
	core-8-4-b1:1.15
	macosx-premerge-6-9-02:1.10.8.1
	core-8-4-a4:1.11
	core-8-3-4:1.10
	macosx-8-4-branch:1.10.0.8
	macosx-8-4-branchpoint:1.10
	core-8-4-a3:1.10
	core-8-3-3:1.10
	dgp-privates-into-namespace:1.10.0.6
	tclpro-1-5-0:1.10
	core-8-4-win-speedup:1.10.0.4
	core-8-4-a2:1.10
	tclpro-1-4-1:1.10
	tclpro-1-4-0:1.10
	core-8-3-2:1.10
	ajuba-ajuba2-2-1-base:1.10
	ajuba-ajuba2-2-0:1.10
	core-8-4-a1:1.10
	core-8-3-1-branch:1.10.0.2
	core-8-3-1:1.10
	scriptics-sc-2-0-b5:1.10
	scriptics-sc-2-0-fixed:1.10
	scriptics-sc-2-0-b2:1.10
	scriptics-sc-2-0-b1:1.10
	core-8-3-0:1.10
	core-8-3-b2:1.9
	core-8-3-b1:1.9
	scriptics-sc-1-1:1.7
	scriptics-sc-1-1-b1:1.7
	core-8-2-3:1.7
	scriptics-sc-1-1-branch:1.7.0.8
	scriptics-sc-1-1-base:1.7
	scriptics-sc-1-0:1.7
	scriptics-sc-1-0-branch:1.7.0.6
	scriptics-sc-1-0-base:1.7
	core-8-2-2:1.7
	core-8-2-1:1.7
	scriptics-bc-1-0-b1:1.7
	core-8-2-1-branch:1.7.0.4
	scriptics-tclpro-1-3-0:1.7
	core-8-2-0:1.7
	core-8-2-b3-branch:1.7.0.2
	core-8-2-b3-base:1.7
	scriptics-tclpro-1-3-b4:1.7
	core-8-2-b2:1.7
	scriptics-tclpro-1-3-b3:1.7
	core-8-2-b1:1.7
	scriptics-tclpro-1-3-b2:1.6
	merge-to-mainline-5/21/99:1.6
	scriptics-tclpro-1-3-b2-branch:1.6.0.2
	core-8-1-1:1.6
	scriptics-tclpro-1-3-b1:1.6
	core-8-1-1-base:1.6
	core-8-1-0:1.6
	merge-to-mainline-4-29-99:1.6
	merge-to-mainline-4-23-99:1.6
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.5.0.2
	core-8-0-6-base:1.5
	core-8-0-5:1.3.2.1
	core-8-1-b3:1.1.4.3
	core-8-1-b2:1.1.4.3
	dev-8-1-stubs-branch:1.1.4.2.0.2
	dev-stubs-branch:1.3.0.4
	scriptics-tclpro-1-2:1.3
	scriptics-tclpro-1-2-b2:1.3
	core-8-1-merge-2/10/99:1.3
	core-8-0-5-branch:1.3.0.2
	core-8-0-5-base:1.3
	scriptics-tclpro-1-2-b1:1.3
	scriptics-tclpro-1-2-a1:1.3
	core-8-1-b1:1.1.4.2
	core-8-0-4:1.3
	core-8-1-a2:1.1.4.1
	core-8-0-2:1.1
	core-8-0-3:1.3;
locks; strict;
comment	@ * @;


1.18
date	2004.03.17.18.15.49;	author das;	state dead;
branches;
next	1.17;

1.17
date	2004.01.13.02.06.01;	author davygrvy;	state Exp;
branches;
next	1.16;

1.16
date	2002.10.09.11.57.05;	author das;	state Exp;
branches
	1.16.2.1;
next	1.15;

1.15
date	2002.06.19.19.37.55;	author mdejong;	state Exp;
branches;
next	1.14;

1.14
date	2002.06.17.20.09.01;	author hobbs;	state Exp;
branches;
next	1.13;

1.13
date	2002.04.12.07.31.20;	author hobbs;	state Exp;
branches;
next	1.12;

1.12
date	2002.04.05.08.37.52;	author hobbs;	state Exp;
branches;
next	1.11;

1.11
date	2002.01.25.21.09.37;	author dgp;	state Exp;
branches;
next	1.10;

1.10
date	2000.02.10.09.00.31;	author jingham;	state Exp;
branches
	1.10.4.1
	1.10.8.1;
next	1.9;

1.9
date	99.12.22.03.09.59;	author hobbs;	state Exp;
branches;
next	1.8;

1.8
date	99.12.14.06.52.56;	author hobbs;	state Exp;
branches;
next	1.7;

1.7
date	99.05.22.06.35.49;	author jingham;	state Exp;
branches;
next	1.6;

1.6
date	99.04.16.01.51.33;	author stanton;	state Exp;
branches;
next	1.5;

1.5
date	99.04.16.01.25.55;	author stanton;	state Exp;
branches;
next	1.4;

1.4
date	99.03.10.07.04.45;	author stanton;	state Exp;
branches;
next	1.3;

1.3
date	98.09.14.18.23.40;	author stanton;	state Exp;
branches
	1.3.2.1
	1.3.4.1;
next	1.2;

1.2
date	98.06.27.18.07.16;	author welch;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.57.04;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.29.00.25.45;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	98.09.30.02.18.20;	author stanton;	state Exp;
branches
	1.1.4.2.2.1;
next	1.1.4.3;

1.1.4.3
date	99.03.10.07.13.49;	author stanton;	state Exp;
branches;
next	;

1.1.4.2.2.1
date	99.03.09.17.50.37;	author redman;	state Exp;
branches;
next	;

1.3.2.1
date	99.03.22.06.44.26;	author jingham;	state Exp;
branches;
next	;

1.3.4.1
date	99.03.06.00.06.40;	author redman;	state Exp;
branches;
next	;

1.10.4.1
date	2002.04.02.20.57.56;	author hobbs;	state Exp;
branches;
next	;

1.10.8.1
date	2002.02.05.02.25.17;	author wolfsuit;	state Exp;
branches;
next	1.10.8.2;

1.10.8.2
date	2002.06.10.05.38.26;	author wolfsuit;	state Exp;
branches;
next	1.10.8.3;

1.10.8.3
date	2002.08.20.20.27.11;	author das;	state Exp;
branches;
next	;

1.16.2.1
date	2004.05.03.22.23.09;	author hobbs;	state Exp;
branches;
next	;


desc
@@


1.18
log
@Removed support for Mac OS Classic platform [Patch 918139]
@
text
@/* 
 * tkMacXStubs.c --
 *
 *	This file contains most of the X calls called by Tk.  Many of
 * these calls are just stubs and either don't make sense on the
 * Macintosh or thier implamentation just doesn't do anything.  Other
 * calls will eventually be moved into other files.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.17 2004/01/13 02:06:01 davygrvy Exp $
 */

#include "tkInt.h"
#include <X.h>
#include <Xlib.h>
#include <stdio.h>
#include <tcl.h>

#include <Xatom.h>

#include <Windows.h>
#include <Fonts.h>
#include <QDOffscreen.h>
#include <ToolUtils.h>
#include <Sound.h>
#include "tkMacInt.h"
#include "tkPort.h"

/*
 * Because this file is still under major development Debugger statements are
 * used through out this file.  The define TCL_DEBUG will decide whether
 * the debugger statements actually call the debugger or not.
 */

#ifndef TCL_DEBUG
#   define Debugger()
#endif
 
#define ROOT_ID 10

/*
 * Declarations of static variables used in this file.
 */

static TkDisplay *gMacDisplay = NULL; /* Macintosh display. */
static char *macScreenName = ":0";
				/* Default name of macintosh display. */

/*
 * Forward declarations of procedures used in this file.
 */

static XID MacXIdAlloc _ANSI_ARGS_((Display *display));
static int DefaultErrorHandler _ANSI_ARGS_((Display* display,
	XErrorEvent* err_evt));

/*
 * Other declrations
 */

int TkMacXDestroyImage _ANSI_ARGS_((XImage *image));
unsigned long TkMacXGetPixel _ANSI_ARGS_((XImage *image, int x, int y));
int TkMacXPutPixel _ANSI_ARGS_((XImage *image, int x, int y,
	unsigned long pixel));
XImage *TkMacXSubImage _ANSI_ARGS_((XImage *image, int x, int y, 
	unsigned int width, unsigned int height));
int TkMacXAddPixel _ANSI_ARGS_((XImage *image, long value));
int _XInitImageFuncPtrs _ANSI_ARGS_((XImage *image));

/*
 *----------------------------------------------------------------------
 *
 * TkpOpenDisplay --
 *
 *	Create the Display structure and fill it with device
 *	specific information.
 *
 * Results:
 *	Returns a Display structure on success or NULL on failure.
 *
 * Side effects:
 *	Allocates a new Display structure.
 *
 *----------------------------------------------------------------------
 */

TkDisplay *
TkpOpenDisplay(
    CONST char *display_name)
{
    Display *display;
    Screen *screen;
    GDHandle graphicsDevice;

    if (gMacDisplay != NULL) {
	if (strcmp(gMacDisplay->display->display_name, display_name) == 0) {
	    return gMacDisplay;
	} else {
	    return NULL;
	}
    }

    graphicsDevice = GetMainDevice();
    display = (Display *) ckalloc(sizeof(Display));
    memset(display, 0, sizeof(Display));
    display->resource_alloc = MacXIdAlloc;
    screen = (Screen *) ckalloc(sizeof(Screen) * 2);
    display->default_screen = 0;
    display->request = 0;
    display->nscreens = 1;
    display->screens = screen;
    display->display_name = macScreenName;
    display->qlen = 0;
    
    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;
    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->bits_per_rgb = 24;
    screen->root_visual->map_entries = 2 ^ 8;

    gMacDisplay = (TkDisplay *) ckalloc(sizeof(TkDisplay));
    memset(gMacDisplay, 0, sizeof(TkDisplay));
    gMacDisplay->display = display;
    return gMacDisplay;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpCloseDisplay --
 *
 *	Deallocates a display structure created by TkpOpenDisplay.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Frees memory.
 *
 *----------------------------------------------------------------------
 */

void
TkpCloseDisplay(
    TkDisplay *displayPtr)
{
    Display *display = displayPtr->display;
    if (gMacDisplay != displayPtr) {
        Tcl_Panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display");
    }

    /*
     * Make sure that the local scrap is transfered to the global
     * scrap if needed.
     */

    TkSuspendClipboard();

    gMacDisplay = NULL;
    if (display->screens != (Screen *) NULL) {
        if (display->screens->root_visual != (Visual *) NULL) {
            ckfree((char *) display->screens->root_visual);
        }
        ckfree((char *) display->screens);
    }
    ckfree((char *) display);
}

/*
 *----------------------------------------------------------------------
 *
 * MacXIdAlloc --
 *
 *	This procedure is invoked by Xlib as the resource allocator
 *	for a display.
 *
 * Results:
 *	The return value is an X resource identifier that isn't currently
 *	in use.
 *
 * Side effects:
 *	The identifier is removed from the stack of free identifiers,
 *	if it was previously on the stack.
 *
 *----------------------------------------------------------------------
 */

static XID
MacXIdAlloc(
    Display *display)			/* Display for which to allocate. */
{
	static long int cur_id = 100;
	/*
	 * Some special XIds are reserved
	 *   - this is why we start at 100
	 */

	return ++cur_id;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpWindowWasRecentlyDeleted --
 *
 *	Tries to determine whether the given window was recently deleted.
 *	Called from the generic code error handler to attempt to deal with
 *	async BadWindow errors under some circumstances.
 *
 * Results:
 *	Always 0, we do not keep this information on the Mac, so we do not
 *	know whether the window was destroyed.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
TkpWindowWasRecentlyDeleted(
    Window win,
    TkDisplay *dispPtr)
{
    return 0;
}

/*
 *----------------------------------------------------------------------
 *
 * DefaultErrorHandler --
 *
 *	This procedure is the default X error handler.  Tk uses it's
 *	own error handler so this call should never be called.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	This function will call panic and exit.
 *
 *----------------------------------------------------------------------
 */

static int
DefaultErrorHandler(
    Display* display,
    XErrorEvent* err_evt)
{
    /*
     * This call should never be called.  Tk replaces
     * it with its own error handler.
     */
    Tcl_Panic("Warning hit bogus error handler!");
    return 0;
}


char *
XGetAtomName(
    Display * display,
    Atom atom)
{
    display->request++;
    return NULL;
}

int
_XInitImageFuncPtrs(XImage *image)
{
    return 0;
}

XErrorHandler
XSetErrorHandler(
    XErrorHandler handler)
{
    return DefaultErrorHandler;
}

Window
XRootWindow(Display *display, int screen_number)
{
    display->request++;
    return ROOT_ID;
}

XImage *
XGetImage(display, d, x, y, width, height, plane_mask, format)
    Display *display;
    Drawable d;
    int x;
    int y;
    unsigned int width;
    unsigned int height;
    unsigned long plane_mask;
    int format;
{
    Debugger();
    return NULL;
}

int
XGetGeometry(display, d, root_return, x_return, y_return, width_return,
	height_return, border_width_return, depth_return)
    Display* display;
    Drawable d;
    Window* root_return;
    int* x_return;
    int* y_return;
    unsigned int* width_return;
    unsigned int* height_return;
    unsigned int* border_width_return;
    unsigned int* depth_return;
{
    /* Used in tkCanvPs.c & wm code */
    Debugger();
    return 0;
}

void
XChangeProperty(
    Display* display,
    Window w,
    Atom property,
    Atom type,
    int format,
    int mode,
    _Xconst unsigned char* data,
    int nelements)
{
    Debugger();
}

void
XSelectInput(
    Display* display,
    Window w,
    long event_mask)
{
    Debugger();
}

void
XBell(
    Display* display,
    int percent)
{
    SysBeep(percent);
}

void
XSetWMNormalHints(
    Display* display,
    Window w,
    XSizeHints* hints)
{
    /*
     * Do nothing.  Shouldn't even be called.
     */
}

XSizeHints *
XAllocSizeHints()
{
    /*
     * Always return NULL.  Tk code checks to see if NULL
     * is returned & does nothing if it is.
     */
    
    return NULL;
}

XImage * 
XCreateImage(
    Display* display,
    Visual* visual,
    unsigned int depth,
    int format,
    int offset,
    char* data,
    unsigned int width,
    unsigned int height,
    int bitmap_pad,
    int bytes_per_line)
{ 
    XImage *ximage;

    display->request++;
    ximage = (XImage *) ckalloc(sizeof(XImage));

    ximage->height = height;
    ximage->width = width;
    ximage->depth = depth;
    ximage->xoffset = offset;
    ximage->format = format;
    ximage->data = data;
    ximage->bitmap_pad = bitmap_pad;
    if (bytes_per_line == 0) {
	ximage->bytes_per_line = width * 4;  /* assuming 32 bits per pixel */
    } else {
	ximage->bytes_per_line = bytes_per_line;
    }

    if (format == ZPixmap) {
	ximage->bits_per_pixel = 32;
	ximage->bitmap_unit = 32;
    } else {
	ximage->bits_per_pixel = 1;
	ximage->bitmap_unit = 8;
    }
    ximage->byte_order = LSBFirst;
    ximage->bitmap_bit_order = LSBFirst;
    ximage->red_mask = 0x00FF0000;
    ximage->green_mask = 0x0000FF00;
    ximage->blue_mask = 0x000000FF;

    ximage->f.destroy_image = TkMacXDestroyImage;
    ximage->f.get_pixel = TkMacXGetPixel;
    ximage->f.put_pixel = TkMacXPutPixel;
    ximage->f.sub_image = TkMacXSubImage;
    ximage->f.add_pixel = TkMacXAddPixel;

    return ximage;
}

GContext
XGContextFromGC(
    GC gc)
{
    /* TODO - currently a no-op */
    return 0;
}

Status
XSendEvent(
    Display* display,
    Window w,
    Bool propagate,
    long event_mask,
    XEvent* event_send)
{
    Debugger();
    return 0;
}

void
XClearWindow(
    Display* display,
    Window w)
{
}

/*
void
XDrawPoint(
    Display* display,
    Drawable d,
    GC gc,
    int x,
    int y)
{
}

void
XDrawPoints(
    Display* display,
    Drawable d,
    GC gc,
    XPoint* points,
    int npoints,
    int mode)
{
}
*/

void
XWarpPointer(
    Display* display,
    Window src_w,
    Window dest_w,
    int src_x,
    int src_y,
    unsigned int src_width,
    unsigned int src_height,
    int dest_x,
    int dest_y)
{
}

void
XQueryColor(
    Display* display,
    Colormap colormap,
    XColor* def_in_out)
{
}

void
XQueryColors(
    Display* display,
    Colormap colormap,
    XColor* defs_in_out,
    int ncolors)
{
}

int   
XQueryTree(display, w, root_return, parent_return, children_return,
        nchildren_return)
    Display* display;
    Window w;
    Window* root_return;
    Window* parent_return;
    Window** children_return;
    unsigned int* nchildren_return;
{
    return 0;
}

int
XGetWindowProperty(
    Display *display,
    Window w,
    Atom property,
    long long_offset,
    long long_length,
    Bool delete,
    Atom req_type,
    Atom *actual_type_return,
    int *actual_format_return,
    unsigned long *nitems_return,
    unsigned long *bytes_after_return,
    unsigned char ** prop_return)
{
    display->request++;
    *actual_type_return = None;
    *actual_format_return = *bytes_after_return = 0;
    *nitems_return = 0;
    return 0;
}

void
XRefreshKeyboardMapping()
{
    /* used by tkXEvent.c */
    Debugger();
}

void 
XSetIconName(
    Display* display,
    Window w,
    const char *icon_name)
{
    /*
     * This is a no-op, no icon name for Macs.
     */
    display->request++;
}

void 
XForceScreenSaver(
    Display* display,
    int mode)
{
    /* 
     * This function is just a no-op.  It is defined to 
     * reset the screen saver.  However, there is no real
     * way to do this on a Mac.  Let me know if there is!
     */
    display->request++;
}

void
Tk_FreeXId (
    Display *display,
    XID xid)
{
    /* no-op function needed for stubs implementation. */
}

/*
 *----------------------------------------------------------------------
 *
 * TkGetServerInfo --
 *
 *	Given a window, this procedure returns information about
 *	the window server for that window.  This procedure provides
 *	the guts of the "winfo server" command.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

void
TkGetServerInfo(
    Tcl_Interp *interp,		/* The server information is returned in
				 * this interpreter's result. */
    Tk_Window tkwin)		/* Token for window;  this selects a
				 * particular display and server. */
{
    char buffer[8 + TCL_INTEGER_SPACE * 2];
    char buffer2[TCL_INTEGER_SPACE];

    sprintf(buffer, "X%dR%d ", ProtocolVersion(Tk_Display(tkwin)),
	    ProtocolRevision(Tk_Display(tkwin)));
    sprintf(buffer2, " %d", VendorRelease(Tk_Display(tkwin)));
    Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)),
	    buffer2, (char *) NULL);
}
/*
 * Image stuff 
 */

int 
TkMacXDestroyImage(
    XImage *image)
{
    Debugger();
    return 0;
}

unsigned long 
TkMacXGetPixel(
    XImage *image,
    int x,
    int y)
{
    Debugger();
    return 0;
}

int 
TkMacXPutPixel(
    XImage *image,
    int x,
    int y,
    unsigned long pixel)
{
    /* Debugger(); */
    return 0;
}

XImage *
TkMacXSubImage(
    XImage *image,
    int x,
    int y,
    unsigned int width,
    unsigned int height)
{
    Debugger();
    return NULL;
}

int 
TkMacXAddPixel(
    XImage *image,
    long value)
{
    Debugger();
    return 0;
}

/*
 *----------------------------------------------------------------------
 *
 * XChangeWindowAttributes, XSetWindowBackground,
 * XSetWindowBackgroundPixmap, XSetWindowBorder, XSetWindowBorderPixmap,
 * XSetWindowBorderWidth, XSetWindowColormap
 *
 *	These functions are all no-ops.  They all have equivilent
 *	Tk calls that should always be used instead.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

void
XChangeWindowAttributes(
    Display* display,
    Window w,
    unsigned long value_mask,
    XSetWindowAttributes* attributes)
{
}

void 
XSetWindowBackground(
	Display *display,
	Window window,
	unsigned long value)
{
}

void
XSetWindowBackgroundPixmap(
    Display* display,
    Window w,
    Pixmap background_pixmap)
{
}

void
XSetWindowBorder(
    Display* display,
    Window w,
    unsigned long border_pixel)
{
}

void
XSetWindowBorderPixmap(
    Display* display,
    Window w,
    Pixmap border_pixmap)
{
}

void
XSetWindowBorderWidth(
    Display* display,
    Window w,
    unsigned int width)
{
}

void
XSetWindowColormap(
    Display* display,
    Window w,
    Colormap colormap)
{
    Debugger();
}

Status		
XStringListToTextProperty(
    char** list, 
    int count, 
    XTextProperty* text_prop_return)
{
    Debugger();
    return (Status) 0;
}
void		
XSetWMClientMachine(
    Display* display, 
    Window w, 
    XTextProperty* text_prop)
{
    Debugger();
}
XIC		
XCreateIC(
    void)
{
    Debugger();
    return (XIC) 0;
}

/*
 *----------------------------------------------------------------------
 *
 * TkGetDefaultScreenName --
 *
 *	Returns the name of the screen that Tk should use during
 *	initialization.
 *
 * Results:
 *	Returns a statically allocated string.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

CONST char *
TkGetDefaultScreenName(
    Tcl_Interp *interp,		/* Not used. */
    CONST char *screenName)	/* If NULL, use default string. */
{
    if ((screenName == NULL) || (screenName[0] == '\0')) {
	screenName = macScreenName;
    }
    return screenName;
}

/*
 *----------------------------------------------------------------------
 *
 * Tk_SetCaretPos --
 *
 *	This indicates the cursor position to Tk.
 *	This is currently a noop stub for MacX.
 *
 *----------------------------------------------------------------------
 */

void
Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height)
{
    TkCaret *caretPtr = &(((TkWindow *) tkwin)->dispPtr->caret);

    caretPtr->winPtr = ((TkWindow *) tkwin);
    caretPtr->x = x;
    caretPtr->y = y;
    caretPtr->height = height;
}
@


1.17
log
@	* generic/tk3d.c:	All uses of 'panic' (the macro) changed
	* generic/tkBind.c:	to 'Tcl_Panic' (the function).  The #define
	* generic/tkBitmap.c:	of panic in tcl.h clearly states it is
	* generic/tkCanvArc.c:	deprecated in the comments.
	* generic/tkCanvBmap.c: [Tcl Patch 865264]
	* generic/tkCanvImg.c:
	* generic/tkCanvLine.c:
	* generic/tkCanvPoly.c:
	* generic/tkCanvText.c:
	* generic/tkCanvWind.c:
	* generic/tkColor.c:
	* generic/tkConfig.c:
	* generic/tkCursor.c:
	* generic/tkError.c:
	* generic/tkEvent.c:
	* generic/tkFocus.c:
	* generic/tkFont.c:
	* generic/tkFrame.c:
	* generic/tkGC.c:
	* generic/tkGrid.c:
	* generic/tkImgBmap.c:
	* generic/tkImgPhoto.c:
	* generic/tkImgUtil.c:
	* generic/tkMenu.c:
	* generic/tkObj.c:
	* generic/tkPack.c:
	* generic/tkPlace.c:
	* generic/tkRectOval.c:
	* generic/tkSelect.c:
	* generic/tkText.c:
	* generic/tkTextBTree.c:
	* generic/tkTextDisp.c:
	* generic/tkTextImage.c:
	* generic/tkTextIndex.c:
	* generic/tkTextMark.c:
	* generic/tkTextWind.c:
	* generic/tkVisual.c:
	* generic/tkWindow.c:
	* mac/tkMacAppInit.c:
	* mac/tkMacAppearanceStubs.c:
	* mac/tkMacButton.c:
	* mac/tkMacDraw.c:
	* mac/tkMacEmbed.c:
	* mac/tkMacFont.c:
	* mac/tkMacInit.c:
	* mac/tkMacMenus.c:
	* mac/tkMacPort.h:
	* mac/tkMacSubwindows.c:
	* mac/tkMacWm.c:
	* mac/tkMacXStubs.c:
	* macosx/tkMacOSXEmbed.c:
	* macosx/tkMacOSXFont.c:
	* macosx/tkMacOSXMenus.c:
	* macosx/tkMacOSXNotify.c:
	* macosx/tkMacOSXPort.h:
	* macosx/tkMacOSXSubwindows.c:
	* macosx/tkMacOSXWm.c:
	* macosx/tkMacOSXXStubs.c:
	* unix/tkUnix3d.c:
	* unix/tkUnixColor.c:
	* unix/tkUnixEmbed.c:
	* unix/tkUnixEvent.c:
	* unix/tkUnixFocus.c:
	* unix/tkUnixFont.c:
	* unix/tkUnixSelect.c:
	* unix/tkUnixSend.c:
	* unix/tkUnixWm.c:
	* win/tkWin3d.c:
	* win/tkWinButton.c:
	* win/tkWinColor.c:
	* win/tkWinDialog.c:
	* win/tkWinDraw.c:
	* win/tkWinEmbed.c:
	* win/tkWinFont.c:
	* win/tkWinPixmap.c:
	* win/tkWinPointer.c:
	* win/tkWinScrlbr.c:
	* win/tkWinWm.c:
	* win/tkWinX.c:
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.16 2002/10/09 11:57:05 das Exp $
@


1.16
log
@	* generic/tkInt.decls(tkIntXlib): added XQueryTree declaration for
	mac & aqua, since it's now called from ParentXId via Tk_HandleEvent.
	* generic/tkIntXlibDecls.h:
	* generic/tkStubInit.c: regen.
	* mac/tkMacXStubs.c: added XQueryTree stub

	* mac/tkMacEmbed.c (TkpUseWindow): check that container window
	has -container option set (sync with other platforms).

	* mac/tkMacBitmap.c:
	* mac/tkMacFont.c:
	* mac/tkMacSend.c:
	* mac/tkMacTest.c:
	* mac/tkMacWm.c: CONSTification.

	* mac/tkMacProjects.sea.hqx: added tkStyle.c and tkUndo.c to
	tk library projects.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.15 2002/06/19 19:37:55 mdejong Exp $
d169 1
a169 1
        panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display");
d274 1
a274 1
    panic("Warning hit bogus error handler!");
@


1.16.2.1
log
@	* generic/tkClipboard.c:   Move TkClipCleanup from tkClipboard.c
	* mac/tkMacXStubs.c:       to being implemented in a platform
	* macosx/tkMacOSXXStubs.c: specific manner.  The cleanup order was
	* unix/tkUnixEvent.c:      bad at least on Windows, where we
	* win/tkWinX.c:            reset/cleared display info that was
	still needed for the clipboard to render.
	[Bug #939389, #822002, #732662]
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.16 2002/10/09 11:57:05 das Exp $
d172 7
a191 43
 * TkClipCleanup --
 *
 *	This procedure is called to cleanup resources associated with
 *	claiming clipboard ownership and for receiving selection get
 *	results.  This function is called in tkWindow.c.  This has to be
 *	called by the display cleanup function because we still need the
 *	access display elements.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Resources are freed - the clipboard may no longer be used.
 *
 *----------------------------------------------------------------------
 */

void
TkClipCleanup(dispPtr)
    TkDisplay *dispPtr;	/* display associated with clipboard */
{
    /*
     * Make sure that the local scrap is transfered to the global
     * scrap if needed.
     */

    TkSuspendClipboard();

    if (dispPtr->clipWindow != NULL) {
	Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
		dispPtr->applicationAtom);
	Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
		dispPtr->windowAtom);

	Tk_DestroyWindow(dispPtr->clipWindow);
	Tcl_Release((ClientData) dispPtr->clipWindow);
	dispPtr->clipWindow = NULL;
    }
}

/*
 *----------------------------------------------------------------------
 *
@


1.15
log
@	* generic/tkBind.c (TkBindDeadWindow):
	Handle case where Tk_DestroyWindow is invoked
	on clipboard and send windows.
	* generic/tkClipboard.c (TkClipCleanup):
	Invoke Tk_DestroyWindow to cleanup the
	dispPtr->clipWindow. Call Tcl_Preserve
	and Tcl_Release on the window to avoid an
	invalid memory ref on shutdown.
	* generic/tkEvent.c (Tk_HandleEvent):
	Panic if XCreateIC is invoked twice for
	the same window. This should never happen,
	the check were just added to make sure it
	does not since this could lead to crashes
	in XCloseIM.
	* generic/tkFocus.c (TkFocusDeadWindow):
	Handle case where Tk_DestroyWindow is invoked
	on clipboard and send windows.
	* generic/tkOption.c (TkOptionDeadWindow): Ditto.
	* generic/tkWindow.c (TkCloseDisplay): Move
	deletion of dispPtr->winTable after TkpCloseDisplay
	call since Tk_DestroyWindow uses it and could
	be called by TkpCloseDisplay for clipboard/send windows.
	Also invoke ckfree for the dispPtr instead of
	doing it in TkpCloseDisplay.
	(Tk_DestroyWindow): Check for a null winPtr->mainPtr
	before doing certain cleanup tasks so the we can
	invoke Tk_DestroyWindow on clipboard and send windows.
	We need to do this so that XDestroyIC will get invoked
	for the input contexts of each window.
	* mac/tkMacXStubs.c (TkpCloseDisplay): Don't free
	the displayPtr since this is now done in TkCloseDisplay.
	* unix/tkUnixEvent.c (TkpCloseDisplay, OpenIM): Remove
	conditional compilation around calls to XCloseIM
	since I am confident that the crashes related to
	input contexts has been fixed. Don't free
	the displayPtr since this is now done in TkCloseDisplay.
	* unix/tkUnixSend.c (TkSendCleanup): Invoke the
	Tk_DestroyWindow method to cleanup the special
	send window. This will call XDestroyIC and thereby
	avoid a crash in XCloseIM. The send window needs
	to be Tcl_Preserve and Tcl_Release to avoid an
	invalid memory ref on shutdown.
	* win/tkWinX.c (TkpCloseDisplay): Don't free
	the displayPtr since this is now done in TkCloseDisplay.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.14 2002/06/17 20:09:01 hobbs Exp $
d526 13
@


1.14
log
@	* generic/tkCmds.c (Tk_TkObjCmd):
	* generic/tkInt.h (struct TkCaret):
	* mac/tkMacXStubs.c (Tk_SetCaretPos):
	* unix/tkUnixKey.c (TkpGetString, Tk_SetCaretPos):
	* win/tkWinX.c (Tk_SetCaretPos):
	* tests/tk.test:        Added 'tk caret' implementation of TIP#96
	* doc/SetCaret.3 (new): which adds a TkCaret structure element to
	* doc/tk.n:             TkDisplay for maintaining state.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.13 2002/04/12 07:31:20 hobbs Exp $
a186 1
    ckfree((char *) displayPtr);
@


1.13
log
@	* mac/tkMacXStubs.c (TkpOpenDisplay): memset the initial display
	structures to 0.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.12 2002/04/05 08:37:52 hobbs Exp $
d814 2
a815 2
 *	This indicates the cursor position to Tk.  This is not used
 *	on the Mac currently.
d823 6
a828 1
    return;
@


1.12
log
@added Tk_SetCaretPos stub (does nothing)
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.11 2002/01/25 21:09:37 dgp Exp $
d109 1
d142 1
@


1.11
log
@	* Updated callers of Tcl_SplitList and Tcl_Merge.
	* Updated callers of Tcl_GetStringResult.
	  Rewrote PrintScrollFractions to ScrollFractions to stop scribbling
	  directly on interp->result.
	* Updated callers of Tcl_GetVar, Tcl_GetVar2
	* Updated callers of Tcl_SplitPath, Tcl_JoinPath, and
	  Tcl_TranslateFileName.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.10 2000/02/10 09:00:31 jingham Exp $
d805 17
@


1.10
log
@Comment some functions that have moved.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.9 1999/12/22 03:09:59 hobbs Exp $
d93 1
a93 1
    char *display_name)
d796 1
a796 1
char *
d799 1
a799 1
    char *screenName)		/* If NULL, use default string. */
@


1.10.4.1
log
@sync with head
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.11 2002/01/25 21:09:37 dgp Exp $
d93 1
a93 1
    CONST char *display_name)
d796 1
a796 1
CONST char *
d799 1
a799 1
    CONST char *screenName)	/* If NULL, use default string. */
@


1.10.8.1
log
@Merge with current TOT
Added support for the wm stackorder command
Fixed crash when selecting Menu items in the Application menu that we didn't
put there.
Added first bits of the use of CG for low-level drawing.  The line-drawing works,
the rest doesn't yet.  You have to set the file static useCGDrawing to 1 and
rebuild to activate this code.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.10 2000/02/10 09:00:31 jingham Exp $
d93 1
a93 1
    CONST char *display_name)
d796 1
a796 1
CONST char *
d799 1
a799 1
    CONST char *screenName)	/* If NULL, use default string. */
@


1.10.8.2
log
@Merging with TOT as of 06/09/2002.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id$
a108 1
    memset(display, 0, sizeof(Display));
a140 1
    memset(gMacDisplay, 0, sizeof(TkDisplay));
a804 17
}

/*
 *----------------------------------------------------------------------
 *
 * Tk_SetCaretPos --
 *
 *	This indicates the cursor position to Tk.  This is not used
 *	on the Mac currently.
 *
 *----------------------------------------------------------------------
 */

void
Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height)
{
    return;
@


1.10.8.3
log
@merged with trunk at tag macosx-8-4-merge-2002-08-20-trunk
@
text
@d187 1
d814 2
a815 2
 *	This indicates the cursor position to Tk.
 *	This is currently a noop stub for MacX.
d823 1
a823 6
    TkCaret *caretPtr = &(((TkWindow *) tkwin)->dispPtr->caret);

    caretPtr->winPtr = ((TkWindow *) tkwin);
    caretPtr->x = x;
    caretPtr->y = y;
    caretPtr->height = height;
@


1.9
log
@fix for mac happiness
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.8 1999/12/14 06:52:56 hobbs Exp $
d473 1
d494 1
@


1.8
log
@	* mac/tkMacDraw.c: mac still needs pointer warping routine
	* mac/tkMacXStubs.c:
	* win/tkWinDraw.c:
	* win/tkWinPointer.c: added support for pointer warping and
	platform specific support for dash patch items
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.7 1999/05/22 06:35:49 jingham Exp $
d467 3
a469 3
XClearWindow(display, w)
    Display* display;
    Window w;
d474 6
a479 6
XDrawPoint(display, d, gc, x, y)
    Display* display;
    Drawable d;
    GC gc;
    int x;
    int y;
d484 7
a490 7
XDrawPoints(display, d, gc, points, npoints, mode)
    Display* display;
    Drawable d;
    GC gc;
    XPoint* points;
    int npoints;
    int mode;
d495 10
a504 11
XWarpPointer(display, src_w, dest_w, src_x, src_y, src_width,
	src_height, dest_x, dest_y)
    Display* display;
    Window src_w;
    Window dest_w;
    int src_x;
    int src_y;
    unsigned int src_width;
    unsigned int src_height;
    int dest_x;
    int dest_y;
d509 4
a512 4
XQueryColor(display, colormap, def_in_out)
    Display* display;
    Colormap colormap;
    XColor* def_in_out;
d517 5
a521 5
XQueryColors(display, colormap, defs_in_out, ncolors)
    Display* display;
    Colormap colormap;
    XColor* defs_in_out;
    int ncolors;
@


1.7
log
@Changes needed to get Tk8.1 to compile with stubs on the Mac
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.6 1999/04/16 01:51:33 stanton Exp $
d464 60
@


1.6
log
@* Merged 8.1 branch into the main trunk
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id$
d31 1
a526 33

void
Tk_3DHorizontalBevel (
    Tk_Window tkwin,
    Drawable d,
    Tk_3DBorder b,
    int x,
    int y,
    int width,
    int height,
    int leftIn,
    int rightIn,
    int topBevel,
    int relief)
{
    /* no-op function needed for stubs implementation. */
}

void
Tk_3DVerticalBevel (
    Tk_Window tkwin,
    Drawable d,
    Tk_3DBorder b,
    int x,
    int y,
    int width,
    int height,
    int leftBevel,
    int relief)
{
    /* no-op function needed for stubs implementation. */
}

d691 25
@


1.5
log
@* Merged changes from 8.0.5:
    - Updated for Mac release
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.4 1999/03/10 07:04:45 stanton Exp $
a24 1
#include <Gestalt.h>
a276 9

void
Tk_FreeXId (
    Display *display,
    XID xid)
{
    /* no-op function needed for stubs implementation */
}

d518 41
d585 8
a592 11
    char buffer[50];
    long result;
    short low, major, minor, micro;
   
    Gestalt(gestaltSystemVersion, &result);
    low = LoWord(result);
    major = (low & 0x0F00) >> 8;
    minor = (low & 0x00F0) >> 4;
    micro = (low & 0x000F);
    sprintf(buffer, "MacOS %d.%d.%d", major, minor, micro); 
    Tcl_AppendResult(interp, buffer, (char *) NULL);
a751 21

void Tk_3DHorizontalBevel (
    Tk_Window tkwin,
    Drawable drawable, Tk_3DBorder border, int x,
    int y, int width, int height, int leftIn,
    int rightIn, int topBevel, int relief )
{
    /* no-op required for stubs implementation */
    /* this function will probably be filled in at some point */
}

void Tk_3DVerticalBevel (
    Tk_Window tkwin,
    Drawable drawable, Tk_3DBorder border, int x,
    int y, int width, int height, int leftBevel,
    int relief )
{
    /* no-op required for stubs implementation */
    /* this function will probably be filled in at some point */
}

@


1.4
log
@integrated stubs into 8.0 main branch
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.3.4.1 1999/03/06 00:06:40 redman Exp $
d25 1
d554 11
a564 7
    char buffer[50], buffer2[50];

    sprintf(buffer, "X%dR%d ", ProtocolVersion(Tk_Display(tkwin)),
	    ProtocolRevision(Tk_Display(tkwin)));
    sprintf(buffer2, " %d", VendorRelease(Tk_Display(tkwin)));
    Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)),
	    buffer2, (char *) NULL);
@


1.3
log
@Replaced SCCS strings, fixed binary files
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id$
d277 9
d719 21
@


1.3.2.1
log
@winfo server used to crash on the Mac.  Get the MacOS version and return that instead.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.3 1998/09/14 18:23:40 stanton Exp $
a24 1
#include <Gestalt.h>
d544 7
a550 11
    char buffer[50];
    long result;
    short low, major, minor, micro;
   
    Gestalt(gestaltSystemVersion, &result);
    low = LoWord(result);
    major = (low & 0x0F00) >> 8;
    minor = (low & 0x00F0) >> 4;
    micro = (low & 0x000F);
    sprintf(buffer, "MacOS %d.%d.%d", major, minor, micro); 
    Tcl_AppendResult(interp, buffer, (char *) NULL);
@


1.3.4.1
log
@Modifications for Tk Stubs implementation
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.3 1998/09/14 18:23:40 stanton Exp $
a276 9

void
Tk_FreeXId (
    Display *display,
    XID xid)
{
    /* no-op function needed for stubs implementation */
}

a709 21

void Tk_3DHorizontalBevel (
    Tk_Window tkwin,
    Drawable drawable, Tk_3DBorder border, int x,
    int y, int width, int height, int leftIn,
    int rightIn, int topBevel, int relief )
{
    /* no-op required for stubs implementation */
    /* this function will probably be filled in at some point */
}

void Tk_3DVerticalBevel (
    Tk_Window tkwin,
    Drawable drawable, Tk_3DBorder border, int x,
    int y, int width, int height, int leftBevel,
    int relief )
{
    /* no-op required for stubs implementation */
    /* this function will probably be filled in at some point */
}

@


1.2
log
@plugin updates
@
text
@d14 1
a14 1
 * SCCS: @@(#) tkMacXStubs.c 1.87 97/11/20 18:35:29
@


1.1
log
@Initial revision
@
text
@d49 1
a49 1
static char *macScreenName = "Macintosh:0";
@


1.1.4.1
log
@initial tk8.1a2 version
@
text
@d14 1
a14 1
 * SCCS: @@(#) tkMacXStubs.c 1.89 97/11/26 13:10:52
d49 1
a49 1
static char *macScreenName = ":0";
d544 1
a544 2
    char buffer[8 + TCL_INTEGER_SPACE * 2];
    char buffer2[TCL_INTEGER_SPACE];
@


1.1.4.2
log
@Merged 8.0.3 changes into 8.1
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.3 1998/09/14 18:23:40 stanton Exp $
@


1.1.4.3
log
@integrated stubs from development branch
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.1.4.2 1998/09/30 02:18:20 stanton Exp $
a517 41

void
Tk_FreeXId (
    Display *display,
    XID xid)
{
    /* no-op function needed for stubs implementation. */
}

void
Tk_3DHorizontalBevel (
    Tk_Window tkwin,
    Drawable d,
    Tk_3DBorder b,
    int x,
    int y,
    int width,
    int height,
    int leftIn,
    int rightIn,
    int topBevel,
    int relief)
{
    /* no-op function needed for stubs implementation. */
}

void
Tk_3DVerticalBevel (
    Tk_Window tkwin,
    Drawable d,
    Tk_3DBorder b,
    int x,
    int y,
    int width,
    int height,
    int leftBevel,
    int relief)
{
    /* no-op function needed for stubs implementation. */
}

@


1.1.4.2.2.1
log
@Changes to support stubs in 8.1. Merged from 8.0.6 code base.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacXStubs.c,v 1.1.4.2 1998/09/30 02:18:20 stanton Exp $
a517 41

void
Tk_FreeXId (
    Display *display,
    XID xid)
{
    /* no-op function needed for stubs implementation. */
}

void
Tk_3DHorizontalBevel (
    Tk_Window tkwin,
    Drawable d,
    Tk_3DBorder b,
    int x,
    int y,
    int width,
    int height,
    int leftIn,
    int rightIn,
    int topBevel,
    int relief)
{
    /* no-op function needed for stubs implementation. */
}

void
Tk_3DVerticalBevel (
    Tk_Window tkwin,
    Drawable d,
    Tk_3DBorder b,
    int x,
    int y,
    int width,
    int height,
    int leftBevel,
    int relief)
{
    /* no-op function needed for stubs implementation. */
}

@


