// 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 <org/xwt/Box.h>
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) {
}
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);
}
// 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); }
RECT client_rect, window_rect;
GetClientRect((HWND)hwnd, &client_rect);
GetWindowRect((HWND)hwnd, &window_rect);
- int addwidth = (window_rect.right - window_rect.left) - (client_rect.right - client_rect.left);
- int addheight = (window_rect.bottom - window_rect.top) - (client_rect.bottom - client_rect.top);
- SetWindowPos((HWND)hwnd, NULL, 0, 0, w + addwidth, h + addheight, SWP_NOZORDER | SWP_NOMOVE);
+ int width = (window_rect.right - window_rect.left) - (client_rect.right - client_rect.left) + w;
+ int height = (window_rect.bottom - window_rect.top) - (client_rect.bottom - client_rect.top) + h;
+ SetWindowPos((HWND)hwnd, NULL, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE);
}
void org::xwt::plat::Win32$Win32Surface::setTitleBarText(java::lang::String* title) {
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);
POINT point;
HWND hwnd2;
RECT rect, rect2;
+ RECT client_rect, window_rect;
jboolean newinside;
int16_t mouse_x;
int16_t mouse_y;
+ int addwidth, addheight;
switch(iMsg) {
case WM_DEVMODECHANGE: break; // FEATURE: color depth changed
return 0;
case WM_GETMINMAXINFO:
+ GetClientRect((HWND)hwnd, &client_rect);
+ GetWindowRect((HWND)hwnd, &window_rect);
+ addwidth = (window_rect.right - window_rect.left) - (client_rect.right - client_rect.left);
+ addheight = (window_rect.bottom - window_rect.top) - (client_rect.bottom - client_rect.top);
mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = root->dmin(0);
- mmi->ptMinTrackSize.y = root->dmin(1);
- mmi->ptMaxTrackSize.x = root->dmax(0);
- mmi->ptMaxTrackSize.y = root->dmax(1);
+ mmi->ptMinTrackSize.x = ((uint32_t)root->minwidth) + addwidth;
+ mmi->ptMinTrackSize.y = ((uint32_t)root->minheight) + addheight;
+ mmi->ptMaxTrackSize.x = min(org::xwt::plat::Win32::getScreenWidth(), ((uint32_t)root->maxwidth) + addwidth);
+ mmi->ptMaxTrackSize.y = min(org::xwt::plat::Win32::getScreenHeight(), ((uint32_t)root->maxheight) + addheight);
return 0;
case WM_PAINT: