diff options
author | hobbs <hobbs> | 2000-02-01 11:41:43 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2000-02-01 11:41:43 (GMT) |
commit | d029a3f0572fd461b639eadd8d469ff99d01c4b5 (patch) | |
tree | 5aa30a90261ad40eb818a867dfa52d7455a6f388 /win/tkWinPixmap.c | |
parent | d9ef6f977a3ef1459bb388a5eb9d6ccdc1f8006b (diff) | |
download | tk-d029a3f0572fd461b639eadd8d469ff99d01c4b5.zip tk-d029a3f0572fd461b639eadd8d469ff99d01c4b5.tar.gz tk-d029a3f0572fd461b639eadd8d469ff99d01c4b5.tar.bz2 |
* 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]
Diffstat (limited to 'win/tkWinPixmap.c')
-rw-r--r-- | win/tkWinPixmap.c | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c index ec09d89..75f820c 100644 --- a/win/tkWinPixmap.c +++ b/win/tkWinPixmap.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: tkWinPixmap.c,v 1.2 1998/09/14 18:24:01 stanton Exp $ + * RCS: @(#) $Id: tkWinPixmap.c,v 1.3 2000/02/01 11:41:44 hobbs Exp $ */ #include "tkWinInt.h" @@ -138,7 +138,7 @@ TkSetPixmapColormap(pixmap, colormap) * * Retrieve the geometry of the given drawable. Note that * this is a degenerate implementation that only returns the - * size of a pixmap. + * size of a pixmap or window. * * Results: * Returns 0. @@ -163,22 +163,36 @@ XGetGeometry(display, d, root_return, x_return, y_return, width_return, unsigned int* depth_return; { TkWinDrawable *twdPtr = (TkWinDrawable *)d; - HDC dc; - BITMAPINFO info; - 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"); - } - ReleaseDC(NULL, dc); + if (twdPtr->type == TWD_BITMAP) { + HDC dc; + BITMAPINFO info; + + if (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"); + } + ReleaseDC(NULL, dc); - *width_return = info.bmiHeader.biWidth; - *height_return = info.bmiHeader.biHeight; + *width_return = info.bmiHeader.biWidth; + *height_return = info.bmiHeader.biHeight; + } else if (twdPtr->type == TWD_WINDOW) { + RECT rect; + + if (twdPtr->window.handle == NULL) { + panic("XGetGeometry: invalid window"); + } + GetClientRect(twdPtr->window.handle, &rect); + *width_return = rect.right - rect.left; + *height_return = rect.bottom - rect.top; + } else { + panic("XGetGeometry: invalid window"); + } return 1; } |