X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fplat%2FWin32.cc;h=6ba10bf08e64b883db3b35b114805d2af189a6bd;hb=2ecea0c2856332ce907f16b4e2a233ff1428e4d6;hp=851bc4a5a4f218b226a28f7349e8eec4ec3f6033;hpb=8116ab6dab5058c54126cf7a74142d6fdfddc1d5;p=org.ibex.core.git diff --git a/src/org/xwt/plat/Win32.cc b/src/org/xwt/plat/Win32.cc index 851bc4a..6ba10bf 100644 --- a/src/org/xwt/plat/Win32.cc +++ b/src/org/xwt/plat/Win32.cc @@ -1,4 +1,8 @@ // Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL] +#include "GCJ.cc" + +// we have to do this because the jpeg libraries use the symbol 'INT32' +#define INT32 WIN32_INT32 // this has to precede the others so we don't get collisions on min/max #include @@ -431,7 +435,6 @@ static jint scratch_h = 0; void org::xwt::plat::Win32$Win32DoubleBuffer::drawPicture(org::xwt::Picture* source0, jint dx1, jint dy1, jint dx2, jint dy2, jint sx1, jint sy1, jint sx2, jint sy2) { - org::xwt::plat::Win32$Win32Picture* source = (org::xwt::plat::Win32$Win32Picture*)source0; if (source->hasalpha) { @@ -521,6 +524,8 @@ void org::xwt::plat::Win32$Win32DoubleBuffer::fillRect(jint x, jint y, jint x2, } void org::xwt::plat::Win32$Win32Surface::blit(org::xwt::DoubleBuffer* s, jint sx, jint sy, jint dx, jint dy, jint dx2, jint dy2) { + // we create the DC lazily to get around some strange race condition in WinXP + if (hdc == 0) hdc = (jint)GetDC((HWND)hwnd); BitBlt((HDC)hdc, dx, dy, dx2 - dx, dy2 - dy, (HDC)(((org::xwt::plat::Win32$Win32DoubleBuffer*)s)->hdc), sx, sy, SRCCOPY); } @@ -610,10 +615,9 @@ void org::xwt::plat::Win32$Win32Surface::natInit(jboolean framed) { // GC_enable_incremental(); ShowWindow ((HWND)hwnd, SW_SHOWDEFAULT); - hdc = (jint)GetDC((HWND)hwnd); } -void org::xwt::plat::Win32$Win32Surface::finalize() { DeleteObject((void*)hwnd); } +void org::xwt::plat::Win32$Win32Surface::finalize() { /* DeleteObject((void*)hwnd); */ } void org::xwt::plat::Win32$Win32Surface::toFront() { BringWindowToTop((HWND)hwnd); } void org::xwt::plat::Win32$Win32Surface::toBack() { SetWindowPos((HWND)hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } void org::xwt::plat::Win32$Win32Surface::_dispose() { PostMessage((HWND)hwnd, WM_USER_DISPOSE, 0, 0); } @@ -655,6 +659,9 @@ void org::xwt::plat::Win32$Win32Surface::setIcon(org::xwt::Picture* p0) { int icon_width = GetSystemMetrics(SM_CXSMICON); int icon_height = GetSystemMetrics(SM_CYSMICON); + // we create the DC lazily to get around some strange race condition in WinXP + if (hdc == 0) hdc = (jint)GetDC((HWND)hwnd); + // create the bitmap HBITMAP bit = CreateCompatibleBitmap((HDC)hdc, icon_width, icon_height); HDC memdc = CreateCompatibleDC((HDC)hdc);