Merge pull request #67 from MrSmith33/master

Fix 64-bit build.
This commit is contained in:
Vadim Lopatin 2015-02-24 07:04:49 +03:00
commit bde4b0d44e
1 changed files with 73 additions and 73 deletions

View File

@ -172,10 +172,10 @@ class Win32Window : Window {
HWND parenthwnd = w32parent ? w32parent._hwnd : null;
_dx = width;
_dy = height;
if (!_dx)
_dx = 600;
if (!_dy)
_dy = 400;
if (!_dx)
_dx = 600;
if (!_dy)
_dy = 400;
_platform = platform;
version (USE_OPENGL) {
_gl = new GLSupport();
@ -317,46 +317,46 @@ class Win32Window : Window {
_hwnd = null;
}
/// post event to handle in UI thread (this method can be used from background thread)
override void postEvent(CustomEvent event) {
super.postEvent(event);
PostMessageW(_hwnd, CUSTOM_MESSAGE_ID, 0, event.uniqueId);
}
/// post event to handle in UI thread (this method can be used from background thread)
override void postEvent(CustomEvent event) {
super.postEvent(event);
PostMessageW(_hwnd, CUSTOM_MESSAGE_ID, 0, event.uniqueId);
}
/// set handler for files dropped to app window
override @property Window onFilesDropped(void delegate(string[]) handler) {
super.onFilesDropped(handler);
/// set handler for files dropped to app window
override @property Window onFilesDropped(void delegate(string[]) handler) {
super.onFilesDropped(handler);
DragAcceptFiles(_hwnd, handler ? TRUE : FALSE);
return this;
}
return this;
}
private long _nextExpectedTimerTs;
private UINT_PTR _timerId = 1;
/// schedule timer for interval in milliseconds - call window.onTimer when finished
override protected void scheduleSystemTimer(long intervalMillis) {
if (intervalMillis < 10)
intervalMillis = 10;
long nextts = currentTimeMillis + intervalMillis;
if (_timerId && _nextExpectedTimerTs && _nextExpectedTimerTs < nextts + 10)
return; // don't reschedule timer, timer event will be received soon
if (_hwnd) {
//_timerId =
SetTimer(_hwnd, _timerId, cast(uint)intervalMillis, null);
_nextExpectedTimerTs = nextts;
}
}
void handleTimer(UINT_PTR timerId) {
//Log.d("handleTimer id=", timerId);
if (timerId == _timerId) {
KillTimer(_hwnd, timerId);
//_timerId = 0;
_nextExpectedTimerTs = 0;
onTimer();
}
}
/// schedule timer for interval in milliseconds - call window.onTimer when finished
override protected void scheduleSystemTimer(long intervalMillis) {
if (intervalMillis < 10)
intervalMillis = 10;
long nextts = currentTimeMillis + intervalMillis;
if (_timerId && _nextExpectedTimerTs && _nextExpectedTimerTs < nextts + 10)
return; // don't reschedule timer, timer event will be received soon
if (_hwnd) {
//_timerId =
SetTimer(_hwnd, _timerId, cast(uint)intervalMillis, null);
_nextExpectedTimerTs = nextts;
}
}
void handleTimer(UINT_PTR timerId) {
//Log.d("handleTimer id=", timerId);
if (timerId == _timerId) {
KillTimer(_hwnd, timerId);
//_timerId = 0;
_nextExpectedTimerTs = 0;
onTimer();
}
}
Win32ColorDrawBuf getDrawBuf() {
//RECT rect;
@ -738,9 +738,9 @@ class Win32Platform : Platform {
{
return false;
}
HDC dc = CreateCompatibleDC(NULL);
SCREEN_DPI = GetDeviceCaps(dc, LOGPIXELSY);
DeleteObject(dc);
HDC dc = CreateCompatibleDC(NULL);
SCREEN_DPI = GetDeviceCaps(dc, LOGPIXELSY);
DeleteObject(dc);
return true;
}
@ -751,7 +751,7 @@ class Win32Platform : Platform {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
return cast(int)msg.wParam;
}
private Win32Window[ulong] _windowMap;
/// add window to window map
@ -836,7 +836,7 @@ class Win32Platform : Platform {
EmptyClipboard();
wstring w = toUTF16(text);
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE,
(w.length + 1) * TCHAR.sizeof);
cast(uint)((w.length + 1) * TCHAR.sizeof));
if (hglbCopy == NULL) {
CloseClipboard();
return;
@ -1023,33 +1023,33 @@ int myWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int iCmdSho
int result = UIAppMain(args);
Log.i("UIAppMain returned ", result);
debug {
if (DrawBuf.instanceCount > 0) {
Log.e("Non-zero DrawBuf instance count when exiting: ", DrawBuf.instanceCount);
}
if (Style.instanceCount > 0) {
Log.e("Non-zero Style instance count when exiting: ", Style.instanceCount);
}
if (Widget.instanceCount() > 0) {
Log.e("Non-zero Widget instance count when exiting: ", Widget.instanceCount);
}
if (ImageDrawable.instanceCount > 0) {
Log.e("Non-zero ImageDrawable instance count when exiting: ", ImageDrawable.instanceCount);
}
if (Drawable.instanceCount > 0) {
Log.e("Non-zero Drawable instance count when exiting: ", Drawable.instanceCount);
}
version (USE_FREETYPE) {
import dlangui.graphics.ftfonts;
if (FreeTypeFontFile.instanceCount > 0) {
Log.e("Non-zero FreeTypeFontFile instance count when exiting: ", FreeTypeFontFile.instanceCount);
}
if (FreeTypeFont.instanceCount > 0) {
Log.e("Non-zero FreeTypeFont instance count when exiting: ", FreeTypeFont.instanceCount);
}
}
}
Log.d("Exiting main");
debug {
if (DrawBuf.instanceCount > 0) {
Log.e("Non-zero DrawBuf instance count when exiting: ", DrawBuf.instanceCount);
}
if (Style.instanceCount > 0) {
Log.e("Non-zero Style instance count when exiting: ", Style.instanceCount);
}
if (Widget.instanceCount() > 0) {
Log.e("Non-zero Widget instance count when exiting: ", Widget.instanceCount);
}
if (ImageDrawable.instanceCount > 0) {
Log.e("Non-zero ImageDrawable instance count when exiting: ", ImageDrawable.instanceCount);
}
if (Drawable.instanceCount > 0) {
Log.e("Non-zero Drawable instance count when exiting: ", Drawable.instanceCount);
}
version (USE_FREETYPE) {
import dlangui.graphics.ftfonts;
if (FreeTypeFontFile.instanceCount > 0) {
Log.e("Non-zero FreeTypeFontFile instance count when exiting: ", FreeTypeFontFile.instanceCount);
}
if (FreeTypeFont.instanceCount > 0) {
Log.e("Non-zero FreeTypeFont instance count when exiting: ", FreeTypeFont.instanceCount);
}
}
}
Log.d("Exiting main");
return result;
}
@ -1151,14 +1151,14 @@ LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYUP:
if (window !is null) {
int repeatCount = lParam & 0xFFFF;
if (window.onKey(message == WM_KEYDOWN || message == WM_SYSKEYDOWN ? KeyAction.KeyDown : KeyAction.KeyUp, wParam, repeatCount, 0, message == WM_SYSKEYUP || message == WM_SYSKEYDOWN))
if (window.onKey(message == WM_KEYDOWN || message == WM_SYSKEYDOWN ? KeyAction.KeyDown : KeyAction.KeyUp, cast(uint)wParam, repeatCount, 0, message == WM_SYSKEYUP || message == WM_SYSKEYDOWN))
return 0; // processed
}
break;
case WM_UNICHAR:
if (window !is null) {
int repeatCount = lParam & 0xFFFF;
if (window.onKey(KeyAction.Text, wParam, repeatCount, wParam == UNICODE_NOCHAR ? 0 : wParam))
if (window.onKey(KeyAction.Text, cast(uint)wParam, repeatCount, wParam == UNICODE_NOCHAR ? 0 : cast(uint)wParam))
return 1; // processed
return 1;
}
@ -1166,7 +1166,7 @@ LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_CHAR:
if (window !is null) {
int repeatCount = lParam & 0xFFFF;
if (window.onKey(KeyAction.Text, wParam, repeatCount, wParam == UNICODE_NOCHAR ? 0 : wParam))
if (window.onKey(KeyAction.Text, cast(uint)wParam, repeatCount, wParam == UNICODE_NOCHAR ? 0 : cast(uint)wParam))
return 1; // processed
return 1;
}