head	1.13;
access;
symbols
	core-8-5-9:1.7.4.2
	core-8-5-8:1.7.4.1
	macosx-cocoa-merge:1.8
	macosx-cocoa-premerge:1.8
	macosx-carbon-freeze:1.8
	core-8-5-7:1.7
	core-8-5-6:1.7
	core-8-6-b1:1.7
	core-8-6-a3:1.7
	core-8-5-5:1.7
	core-8-6-a2:1.7
	core-8-5-4:1.7
	core-8-5-3:1.7
	core-8-6-a1:1.7
	core-8-4-19:1.3
	core-8-5-branch:1.7.0.4
	core-8-5-2:1.7
	core-8-4-18:1.3
	core-8-5-1:1.7
	core-8-4-17:1.3
	core-8-5-0:1.7
	core-8-5-b3:1.7
	core-8-5-b2:1.7
	core-8-4-16:1.3
	core-8-5-b1:1.7
	core-stablilizer-merge:1.7
	core-stabilizer-branch:1.7.0.2
	core-stabilizer-merge:1.7
	core-8-4-15:1.3
	core-8-5-a6:1.7
	core-8-5-a5:1.6
	core-8-4-14:1.3
	core-8-5-a4:1.6
	core-8-4-13:1.3
	core-8-4-12:1.3
	core-8-4-11:1.3
	core-8-5-a3:1.4
	core-8-4-10:1.3
	core-8-4-9-branch:1.3.0.14
	core-8-5-a2:1.4
	core-8-4-9:1.3
	core-8-4-8:1.3
	core-8-4-7:1.3
	core-8-5-a1:1.4
	core-8-4-6:1.3
	core-8-4-5:1.3
	mistachkin-dev-branch:1.3.0.12
	core-8-4-4:1.3
	core-8-4-3:1.3
	core-8-4-branch:1.3.0.10
	core-8-4-2:1.3
	core-8-4-1:1.3
	core-8-3-5:1.3
	core-8-4-0:1.3
	macosx-8-4-merge-2002-08-31-trunk:1.3
	macosx-8-4-premerge-2002-08-31-branch:1.3
	macosx-8-4-premerge-2002-08-31-trunk:1.3
	macosx-8-4-merge-2002-08-30-branch:1.3
	macosx-8-4-merge-2002-08-30-trunk:1.3
	macosx-8-4-merge-2002-08-20-branch:1.3
	macosx-8-4-merge-2002-08-20-trunk:1.3
	core-8-4-b2:1.3
	core-8-4-b1:1.3
	macosx-premerge-6-9-02:1.3
	core-8-4-a4:1.3
	core-8-3-4:1.3
	macosx-8-4-branch:1.3.0.8
	macosx-8-4-branchpoint:1.3
	core-8-4-a3:1.3
	core-8-3-3:1.3
	dgp-privates-into-namespace:1.3.0.6
	tclpro-1-5-0:1.3
	core-8-4-win-speedup:1.3.0.4
	core-8-4-a2:1.3
	tclpro-1-4-1:1.3
	tclpro-1-4-0:1.3
	core-8-3-2:1.3
	ajuba-ajuba2-2-1-base:1.3
	ajuba-ajuba2-2-0:1.3
	core-8-4-a1:1.3
	core-8-3-1-branch:1.3.0.2
	core-8-3-1:1.3
	scriptics-sc-2-0-b5:1.3
	scriptics-sc-2-0-fixed:1.3
	scriptics-sc-2-0-b2:1.3
	scriptics-sc-2-0-b1:1.3
	core-8-3-0:1.3
	core-8-3-b2:1.2
	core-8-3-b1:1.2
	scriptics-sc-1-1:1.2
	scriptics-sc-1-1-b1:1.2
	core-8-2-3:1.2
	scriptics-sc-1-1-branch:1.2.0.16
	scriptics-sc-1-1-base:1.2
	scriptics-sc-1-0:1.2
	scriptics-sc-1-0-branch:1.2.0.14
	scriptics-sc-1-0-base:1.2
	core-8-2-2:1.2
	core-8-2-1:1.2
	scriptics-bc-1-0-b1:1.2
	core-8-2-1-branch:1.2.0.12
	scriptics-tclpro-1-3-0:1.2
	core-8-2-0:1.2
	core-8-2-b3-branch:1.2.0.10
	core-8-2-b3-base:1.2
	scriptics-tclpro-1-3-b4:1.2
	core-8-2-b2:1.2
	scriptics-tclpro-1-3-b3:1.2
	core-8-2-b1:1.2
	scriptics-tclpro-1-3-b2:1.2
	merge-to-mainline-5/21/99:1.2
	scriptics-tclpro-1-3-b2-branch:1.2.0.8
	core-8-1-1:1.2
	scriptics-tclpro-1-3-b1:1.2
	core-8-1-1-base:1.2
	core-8-1-0:1.2
	merge-to-mainline-4-29-99:1.2
	merge-to-mainline-4-23-99:1.2
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.1
	core-8-1-b2:1.1.4.1
	dev-8-1-stubs-branch:1.1.4.1.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.2
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@ * @;


1.13
date	2010.11.29.09.07.13;	author nijtmans;	state Exp;
branches;
next	1.12;

1.12
date	2010.10.06.14.33.29;	author nijtmans;	state Exp;
branches;
next	1.11;

1.11
date	2010.09.10.08.59.25;	author nijtmans;	state Exp;
branches;
next	1.10;

1.10
date	2010.01.13.23.08.12;	author nijtmans;	state Exp;
branches;
next	1.9;

1.9
date	2009.08.10.23.16.28;	author nijtmans;	state Exp;
branches;
next	1.8;

1.8
date	2009.04.30.13.44.19;	author dkf;	state Exp;
branches;
next	1.7;

1.7
date	2007.01.11.15.35.41;	author dkf;	state Exp;
branches
	1.7.4.1;
next	1.6;

1.6
date	2005.12.02.13.42.29;	author dkf;	state Exp;
branches;
next	1.5;

1.5
date	2005.12.02.00.19.04;	author dkf;	state Exp;
branches;
next	1.4;

1.4
date	2004.01.13.02.06.02;	author davygrvy;	state Exp;
branches;
next	1.3;

1.3
date	2000.02.01.11.41.44;	author hobbs;	state Exp;
branches
	1.3.4.1
	1.3.10.1;
next	1.2;

1.2
date	98.09.14.18.24.01;	author stanton;	state Exp;
branches;
next	1.1;

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

1.1.4.1
date	98.09.30.02.19.36;	author stanton;	state Exp;
branches;
next	;

1.3.4.1
date	2000.11.03.22.49.28;	author hobbs;	state Exp;
branches;
next	;

1.3.10.1
date	2009.04.30.14.57.43;	author dgp;	state Exp;
branches;
next	;

1.7.4.1
date	2009.04.30.13.48.00;	author dkf;	state Exp;
branches;
next	1.7.4.2;

1.7.4.2
date	2010.03.12.13.02.36;	author nijtmans;	state Exp;
branches;
next	;


desc
@@


1.13
log
@Fix various 64-bit gcc(-4.5.2) warnings: cast from pointer to integer of different size
@
text
@/*
 * tkWinPixmap.c --
 *
 *	This file contains the Xlib emulation functions pertaining to creating
 *	and destroying pixmaps.
 *
 * Copyright (c) 1995 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: tkWinPixmap.c,v 1.12 2010/10/06 14:33:29 nijtmans Exp $
 */

#include "tkWinInt.h"

/*
 *----------------------------------------------------------------------
 *
 * Tk_GetPixmap --
 *
 *	Creates an in memory drawing surface.
 *
 * Results:
 *	Returns a handle to a new pixmap.
 *
 * Side effects:
 *	Allocates a new Win32 bitmap.
 *
 *----------------------------------------------------------------------
 */

Pixmap
Tk_GetPixmap(
    Display *display,
    Drawable d,
    int width,
    int height,
    int depth)
{
    TkWinDrawable *newTwdPtr, *twdPtr;
    int planes;
    Screen *screen;

    display->request++;

    newTwdPtr = (TkWinDrawable *) ckalloc(sizeof(TkWinDrawable));
    newTwdPtr->type = TWD_BITMAP;
    newTwdPtr->bitmap.depth = depth;
    twdPtr = (TkWinDrawable *) d;
    if (twdPtr->type != TWD_BITMAP) {
	if (twdPtr->window.winPtr == NULL) {
	    newTwdPtr->bitmap.colormap = DefaultColormap(display,
		    DefaultScreen(display));
	} else {
	    newTwdPtr->bitmap.colormap = twdPtr->window.winPtr->atts.colormap;
	}
    } else {
	newTwdPtr->bitmap.colormap = twdPtr->bitmap.colormap;
    }
    screen = &display->screens[0];
    planes = 1;
    if (depth == screen->root_depth) {
	planes = PTR2INT(screen->ext_data);
	depth /= planes;
    }
    newTwdPtr->bitmap.handle =
	    CreateBitmap(width, height, (DWORD) planes, (DWORD) depth, NULL);

    /*
     * CreateBitmap tries to use memory on the graphics card. If it fails,
     * call CreateDIBSection which uses real memory; slower, but at least
     * still works. [Bug 2080533]
     */

    if (newTwdPtr->bitmap.handle == NULL) {
	static int repeatError = 0;
	void *bits = NULL;
	BITMAPINFO bitmapInfo;
	HDC dc;

	memset(&bitmapInfo, 0, sizeof(bitmapInfo));
	bitmapInfo.bmiHeader.biSize = sizeof(bitmapInfo.bmiHeader);
	bitmapInfo.bmiHeader.biWidth = width;
	bitmapInfo.bmiHeader.biHeight = height;
	bitmapInfo.bmiHeader.biPlanes = planes;
	bitmapInfo.bmiHeader.biBitCount = depth;
	bitmapInfo.bmiHeader.biCompression = BI_RGB;
	bitmapInfo.bmiHeader.biSizeImage = 0;
	dc = GetDC(NULL);
	newTwdPtr->bitmap.handle = CreateDIBSection(dc, &bitmapInfo,
		DIB_RGB_COLORS, &bits, 0, 0);
	ReleaseDC(NULL, dc);

	/*
	 * Oh no! Things are still going wrong. Pop up a warning message here
	 * (because things will probably crash soon) which will encourage
	 * people to report this as a bug...
	 */

	if (newTwdPtr->bitmap.handle == NULL && !repeatError) {
	    LPVOID lpMsgBuf;

	    repeatError = 1;
	    if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
		    FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
		    NULL, GetLastError(),
		    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		    (LPSTR) &lpMsgBuf, 0, NULL)) {
		MessageBoxA(NULL, (LPCSTR) lpMsgBuf,
			"Tk_GetPixmap: Error from CreateDIBSection",
			MB_OK | MB_ICONINFORMATION);
		LocalFree(lpMsgBuf);
	    }
	}
    }

    if (newTwdPtr->bitmap.handle == NULL) {
	ckfree((char *) newTwdPtr);
	return None;
    }

    return (Pixmap) newTwdPtr;
}

/*
 *----------------------------------------------------------------------
 *
 * Tk_FreePixmap --
 *
 *	Release the resources associated with a pixmap.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Deletes the bitmap created by Tk_GetPixmap.
 *
 *----------------------------------------------------------------------
 */

void
Tk_FreePixmap(
    Display *display,
    Pixmap pixmap)
{
    TkWinDrawable *twdPtr = (TkWinDrawable *) pixmap;

    display->request++;
    if (twdPtr != NULL) {
	DeleteObject(twdPtr->bitmap.handle);
	ckfree((char *) twdPtr);
    }
}

/*
 *----------------------------------------------------------------------
 *
 * TkSetPixmapColormap --
 *
 *	The following function is a hack used by the photo widget to
 *	explicitly set the colormap slot of a Pixmap.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

void
TkSetPixmapColormap(
    Pixmap pixmap,
    Colormap colormap)
{
    TkWinDrawable *twdPtr = (TkWinDrawable *)pixmap;
    twdPtr->bitmap.colormap = colormap;
}

/*
 *----------------------------------------------------------------------
 *
 * XGetGeometry --
 *
 *	Retrieve the geometry of the given drawable. Note that this is a
 *	degenerate implementation that only returns the size of a pixmap or
 *	window.
 *
 * Results:
 *	Returns 0.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
XGetGeometry(
    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)
{
    TkWinDrawable *twdPtr = (TkWinDrawable *)d;

    if (twdPtr->type == TWD_BITMAP) {
	HDC dc;
	BITMAPINFO info;

	if (twdPtr->bitmap.handle == NULL) {
	    Tcl_Panic("XGetGeometry: invalid pixmap");
	}
	dc = GetDC(NULL);
	info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
	info.bmiHeader.biBitCount = 0;
	if (!GetDIBits(dc, twdPtr->bitmap.handle, 0, 0, NULL, &info,
		DIB_RGB_COLORS)) {
	    Tcl_Panic("XGetGeometry: unable to get bitmap size");
	}
	ReleaseDC(NULL, dc);

	*width_return = info.bmiHeader.biWidth;
	*height_return = info.bmiHeader.biHeight;
    } else if (twdPtr->type == TWD_WINDOW) {
	RECT rect;

	if (twdPtr->window.handle == NULL) {
	    Tcl_Panic("XGetGeometry: invalid window");
	}
	GetClientRect(twdPtr->window.handle, &rect);
	*width_return = rect.right - rect.left;
	*height_return = rect.bottom - rect.top;
    } else {
	Tcl_Panic("XGetGeometry: invalid window");
    }
    return 1;
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
@


1.12
log
@ [FRQ 2965056]: Windows build with -DUNICODE
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.11 2010/09/10 08:59:25 nijtmans Exp $
d64 1
a64 1
	planes = (int) screen->ext_data;
@


1.11
log
@Make compilable with -DUNICODE, or mark files with a TODO which are not done yet.
tkWinPort.h:  mingw/cygwin fixes: <tchar.h> should always be included here.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.10 2010/01/13 23:08:12 nijtmans Exp $
a14 6
/* TODO: This file does not compile in UNICODE mode.
 * See [Freq 2965056]: Windows build with -DUNICODE
 */
#undef UNICODE
#undef _UNICODE

d105 1
a105 1
	    if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
d109 2
a110 2
		    (LPTSTR) &lpMsgBuf, 0, NULL)) {
		MessageBox(NULL, (LPCTSTR) lpMsgBuf,
@


1.10
log
@Eliminate tkpMenubuttonClass
make tkpButtonProcs CONST
fix gcc warnings: missing initializer
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.9 2009/08/10 23:16:28 nijtmans Exp $
d15 6
@


1.9
log
@Eliminate more gcc warnings
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.8 2009/04/30 13:44:19 dkf Exp $
a15 1

@


1.8
log
@Fix [Bug 2080533] by falling back to creating a DIB.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.7 2007/01/11 15:35:41 dkf Exp $
d79 1
a79 1
	unsigned char *bits = NULL;
d93 1
a93 1
		DIB_RGB_COLORS, (void **) &bits, 0, 0);
@


1.7
log
@Many minute fixes to reduce number of minor warnings from GCC.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.6 2005/12/02 13:42:29 dkf Exp $
d48 1
a48 1
    newTwdPtr = (TkWinDrawable*) ckalloc(sizeof(TkWinDrawable));
d51 1
a51 1
    twdPtr = (TkWinDrawable *)d;
d71 48
d124 1
a124 1
    return (Pixmap)newTwdPtr;
d153 1
a153 1
	ckfree((char *)twdPtr);
@


1.7.4.1
log
@Backported fix for [Bug 2080533].
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.7 2007/01/11 15:35:41 dkf Exp $
d16 1
d51 1
a51 1
    twdPtr = (TkWinDrawable *) d;
a70 48
    /*
     * CreateBitmap tries to use memory on the graphics card. If it fails,
     * call CreateDIBSection which uses real memory; slower, but at least
     * still works. [Bug 2080533]
     */

    if (newTwdPtr->bitmap.handle == NULL) {
	static int repeatError = 0;
	unsigned char *bits = NULL;
	BITMAPINFO bitmapInfo;
	HDC dc;

	memset(&bitmapInfo, 0, sizeof(bitmapInfo));
	bitmapInfo.bmiHeader.biSize = sizeof(bitmapInfo.bmiHeader);
	bitmapInfo.bmiHeader.biWidth = width;
	bitmapInfo.bmiHeader.biHeight = height;
	bitmapInfo.bmiHeader.biPlanes = planes;
	bitmapInfo.bmiHeader.biBitCount = depth;
	bitmapInfo.bmiHeader.biCompression = BI_RGB;
	bitmapInfo.bmiHeader.biSizeImage = 0;
	dc = GetDC(NULL);
	newTwdPtr->bitmap.handle = CreateDIBSection(dc, &bitmapInfo,
		DIB_RGB_COLORS, (void **) &bits, 0, 0);
	ReleaseDC(NULL, dc);

	/*
	 * Oh no! Things are still going wrong. Pop up a warning message here
	 * (because things will probably crash soon) which will encourage
	 * people to report this as a bug...
	 */

	if (newTwdPtr->bitmap.handle == NULL && !repeatError) {
	    LPVOID lpMsgBuf;

	    repeatError = 1;
	    if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
		    FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
		    NULL, GetLastError(),
		    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		    (LPTSTR) &lpMsgBuf, 0, NULL)) {
		MessageBox(NULL, (LPCTSTR) lpMsgBuf,
			"Tk_GetPixmap: Error from CreateDIBSection",
			MB_OK | MB_ICONINFORMATION);
		LocalFree(lpMsgBuf);
	    }
	}
    }

d76 1
a76 1
    return (Pixmap) newTwdPtr;
d105 1
a105 1
	ckfree((char *) twdPtr);
@


1.7.4.2
log
@[Bug 2956548] TkpButtonSetDefaults only initializes one button type
Fix various gcc warnings, all backported from Tk 8.6
VC6++ does not have SPI_SETKEYBOARDCUES
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.7.4.1 2009/04/30 13:48:00 dkf Exp $
d78 1
a78 1
	void *bits = NULL;
d92 1
a92 1
		DIB_RGB_COLORS, &bits, 0, 0);
@


1.6
log
@More fixes (mostly getting rid of excess spaces)
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.5 2005/12/02 00:19:04 dkf Exp $
d69 1
a69 1
	    CreateBitmap(width, height, planes, depth, NULL);
@


1.5
log
@ANSIfication
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.4 2004/01/13 02:06:02 davygrvy Exp $
d172 10
a181 10
            Tcl_Panic("XGetGeometry: invalid pixmap");
        }
        dc = GetDC(NULL);
        info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
        info.bmiHeader.biBitCount = 0;
        if (!GetDIBits(dc, twdPtr->bitmap.handle, 0, 0, NULL, &info,
                DIB_RGB_COLORS)) {
            Tcl_Panic("XGetGeometry: unable to get bitmap size");
        }
        ReleaseDC(NULL, dc);
d183 2
a184 2
        *width_return = info.bmiHeader.biWidth;
        *height_return = info.bmiHeader.biHeight;
d188 6
a193 6
        if (twdPtr->window.handle == NULL) {
            Tcl_Panic("XGetGeometry: invalid window");
        }
        GetClientRect(twdPtr->window.handle, &rect);
        *width_return = rect.right - rect.left;
        *height_return = rect.bottom - rect.top;
d195 1
a195 1
        Tcl_Panic("XGetGeometry: invalid window");
@


1.4
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
@d1 1
a1 1
/* 
d4 2
a5 2
 *	This file contains the Xlib emulation functions pertaining to
 *	creating and destroying pixmaps.
d9 2
a10 2
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.3 2000/02/01 11:41:44 hobbs Exp $
d35 6
a40 6
Tk_GetPixmap(display, d, width, height, depth)
    Display* display;
    Drawable d;
    int width;
    int height;
    int depth;
d45 1
a45 1
    
d68 2
a69 1
    newTwdPtr->bitmap.handle = CreateBitmap(width, height, planes, depth, NULL);
d75 1
a75 1
    
d96 3
a98 3
Tk_FreePixmap(display, pixmap)
    Display* display;
    Pixmap pixmap;
d127 3
a129 3
TkSetPixmapColormap(pixmap, colormap)
    Pixmap pixmap;
    Colormap colormap;
d140 3
a142 3
 *	Retrieve the geometry of the given drawable.  Note that
 *	this is a degenerate implementation that only returns the
 *	size of a pixmap or window.
d154 10
a163 11
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;
d199 8
@


1.3
log
@	* win/Makefile.in (install-*): reduced verbosity of install

	* win/tkWinPixmap.c (XGetGeometry): added support for windows in
	XGetGeometry [Bug: 4069]

	* win/tkWinFont.c (GetScreenFont): fixed possible mem overrun with
	long font names [Bug: 4108]

	* win/tkWinDialog.c: added EnableWindow calls to dialogs to
	correct for possible loss of control in parent Tk toplevel
	[Bug: 1212 et al]
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.2 1998/09/14 18:24:01 stanton Exp $
d172 1
a172 1
            panic("XGetGeometry: invalid pixmap");
d179 1
a179 1
            panic("XGetGeometry: unable to get bitmap size");
d189 1
a189 1
            panic("XGetGeometry: invalid window");
d195 1
a195 1
        panic("XGetGeometry: invalid window");
@


1.3.10.1
log
@Backport 2080533 fix.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.3 2000/02/01 11:41:44 hobbs Exp $
d68 1
a68 50
    newTwdPtr->bitmap.handle =
	    CreateBitmap(width, height, (DWORD) planes, (DWORD) depth, NULL);

    /*
     * CreateBitmap tries to use memory on the graphics card. If it fails,
     * call CreateDIBSection which uses real memory; slower, but at least
     * still works. [Bug 2080533]
     */

    if (newTwdPtr->bitmap.handle == NULL) {
	static int repeatError = 0;
	unsigned char *bits = NULL;
	BITMAPINFO bitmapInfo;
	HDC dc;

	memset(&bitmapInfo, 0, sizeof(bitmapInfo));
	bitmapInfo.bmiHeader.biSize = sizeof(bitmapInfo.bmiHeader);
	bitmapInfo.bmiHeader.biWidth = width;
	bitmapInfo.bmiHeader.biHeight = height;
	bitmapInfo.bmiHeader.biPlanes = planes;
	bitmapInfo.bmiHeader.biBitCount = depth;
	bitmapInfo.bmiHeader.biCompression = BI_RGB;
	bitmapInfo.bmiHeader.biSizeImage = 0;
	dc = GetDC(NULL);
	newTwdPtr->bitmap.handle = CreateDIBSection(dc, &bitmapInfo,
		DIB_RGB_COLORS, (void **) &bits, 0, 0);
	ReleaseDC(NULL, dc);

	/*
	 * Oh no! Things are still going wrong. Pop up a warning message here
	 * (because things will probably crash soon) which will encourage
	 * people to report this as a bug...
	 */

	if (newTwdPtr->bitmap.handle == NULL && !repeatError) {
	    LPVOID lpMsgBuf;

	    repeatError = 1;
	    if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
		    FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
		    NULL, GetLastError(),
		    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		    (LPTSTR) &lpMsgBuf, 0, NULL)) {
		MessageBox(NULL, (LPCTSTR) lpMsgBuf,
			"Tk_GetPixmap: Error from CreateDIBSection",
			MB_OK | MB_ICONINFORMATION);
		LocalFree(lpMsgBuf);
	    }
	}
    }
@


1.3.4.1
log
@	* generic/tk.decls:
	* generic/tkInt.decls:
	* generic/tkIntPlatDecls.h:
	* generic/tkPlatDecls.h:
	* generic/tkStubInit.c:
	* win/Makefile.in:
	* win/makefile.vc:
	* win/tkWin3d.c:
	* win/tkWinButton.c:
	* win/tkWinColor.c:
	* win/tkWinDraw.c:
	* win/tkWinFont.c:
	* win/tkWinGdi.c (new):
	* win/tkWinGdi.h (new):
	* win/tkWinImage.c:
	* win/tkWinInt.h:
	* win/tkWinMenu.c:
	* win/tkWinPixmap.c:
	* win/tkWinUtil.c (new):
	* win/tkWinWindow.c:
	* win/tkWinWm.c:
	* win/tkWinX.c:
	* win/winMain.c:
	* xlib/xgc.c:
	* xlib/X11/Xlib.h: first cut at Windows speedup improvements by
	Leo Schubert.  Needs to be streamlined, but the code is correct
	and passes all tests.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.3 2000/02/01 11:41:44 hobbs Exp $
a46 1
    GTRACE(("begin Tk_GetPixmap\n");)
d68 1
a68 5
#ifdef USE_CKGRAPH_IMP
    newTwdPtr->bitmap.handle=CkGraph_GetHashedBitmap(width,height,planes,depth);
#else
    newTwdPtr->bitmap.handle = CkCreateBitmap(width, height, planes, depth, NULL);
#endif
a74 1
    GTRACE(("end Tk_GetPixmap return 0x%x\n",newTwdPtr->bitmap.handle);)
a101 1
    GTRACE(("begin Tk_FreePixmap 0x%x\n",twdPtr->bitmap.handle);)
d103 1
a103 5
#ifdef USE_CKGRAPH_IMP
        CkGraph_ReleaseHashedBitmap(twdPtr->bitmap.handle);
#else
	CkDeleteBitmap(twdPtr->bitmap.handle);
#endif
a105 1
    GTRACE(("end Tk_FreePixmap 0x%x\n",twdPtr->bitmap.handle);)
a130 1
    GTRACE(("TkSetPixmapColormap 0x%x\n",colormap);)
d174 1
a174 1
        dc = TkWinGetNULLDC();
d181 1
a181 1
        TkWinReleaseNULLDC(dc);
a184 1
        GTRACE(("XGetGeometry(..0x%x) returns w:%d,h:%d \n",twdPtr->bitmap.handle,*width_return,*height_return);)
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id$
d141 1
a141 1
 *	size of a pixmap.
a165 2
    HDC dc;
    BITMAPINFO info;
d167 29
a195 9
    if ((twdPtr->type != TWD_BITMAP) || (twdPtr->bitmap.handle == NULL)) {
	panic("XGetGeometry: invalid pixmap");
    }
    dc = GetDC(NULL);
    info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    info.bmiHeader.biBitCount = 0;
    if (!GetDIBits(dc, twdPtr->bitmap.handle, 0, 0, NULL, &info,
	    DIB_RGB_COLORS)) {
	panic("XGetGeometry: unable to get bitmap size");
a196 4
    ReleaseDC(NULL, dc);

    *width_return = info.bmiHeader.biWidth;
    *height_return = info.bmiHeader.biHeight;
@


1.1
log
@Initial revision
@
text
@d12 1
a12 1
 * SCCS: @@(#) tkWinPixmap.c 1.18 97/08/06 15:36:23
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkWinPixmap.c,v 1.2 1998/09/14 18:24:01 stanton Exp $
@


