#if defined(__WIN32__)
+#undef WINVER
#define WINVER 0x0500
-#define _WIN32_WINNT 0x0500
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
#undef JOY_BUTTON1
#undef JOY_BUTTON2
#define Method _Method
#define byte _byte
#define int64 _int64
+#define String _String
+#define Mutex _Mutex
+#define Platform _Platform
#include <windows.h>
+#include <wincon.h>
#include <shellapi.h>
#undef Method
#undef byte
#undef int64
+#undef String
+#undef Mutex
+#undef Platform
import "Window"
'D','F','G','H','J','K','L',VK_SEMI,VK_QUOTE,VK_TILDE,VK_SHIFT,VK_BACK_SLASH,'Z','X','C','V',
'B','N','M',VK_COMMA,VK_PERIOD,VK_DIVIDE,VK_SHIFT,VK_MULTIPLY,VK_LMENU,VK_SPACE,VK_CAPITAL,VK_F1,VK_F2,VK_F3,VK_F4,VK_F5,
VK_F6,VK_F7,VK_F8,VK_F9,VK_F10,VK_NUMLOCK,VK_SCROLL,VK_NUMPAD7,VK_NUMPAD8,VK_NUMPAD9,VK_SUBTRACT,VK_NUMPAD4,VK_NUMPAD5,VK_NUMPAD6,VK_ADD,VK_NUMPAD1,
- VK_NUMPAD2,VK_NUMPAD3,VK_NUMPAD0,VK_DELETE,0,0,0,0,0,0,0,0,0,0,0,0,
+ VK_NUMPAD2,VK_NUMPAD3,VK_NUMPAD0,VK_DELETE,0,0,0,VK_F11,VK_F12,0,0,0,0,0,0,0,
0,0,0,0,0,0,VK_HOME,VK_UP,VK_PRIOR,VK_LEFT,VK_RIGHT,VK_END,VK_DOWN,VK_NEXT,VK_INSERT,VK_DELETE,
0,0,0,VK_SHIFT,VK_MENU,VK_CONTROL
};
static bool fullScreenMode;
static int desktopX = 0, desktopY = 0, desktopW = 0, desktopH = 0;
static DWORD hiResTimer;
-static HWND topWindow;
+// static HWND topWindow;
static HWND startBar;
return monitor < 32;
}
+static bool externalDisplayChange;
+
static int taskBarState;
static WINDOWPLACEMENT taskBarPlacement;
static bool activateApp;
static SystemCursor lastCursor = (SystemCursor)-1;
+void AeroSnapPosition(Window window, int x, int y, int w, int h)
+{
+ int oldX = window.absPosition.x;
+
+ // To prevent having a window < minClientSize with Aero Snap, because we don't receive a WM_SIZING!
+ // The sensible implementation of this is in WM_SIZING
+ {
+ int gw = w, gh = h;
+ MinMaxValue ew, eh;
+ window.GetDecorationsSize(&ew, &eh);
+
+ gw -= ew;
+ gh -= eh;
+
+ gw = Max(gw, 1);
+ gh = Max(gh, 1);
+
+ gw = Max(gw, window.minSize.w);
+ gh = Max(gh, window.minSize.h);
+ gw = Min(gw, window.maxSize.w);
+ gh = Min(gh, window.maxSize.h);
+
+ if(!window.OnResizing(&gw, &gh))
+ {
+ gw = window.clientSize.w;
+ gh = window.clientSize.h;
+ }
+
+ gw = Max(gw, window.skinMinSize.w);
+ gh = Max(gh, window.skinMinSize.h);
+
+ gw += ew;
+ gh += eh;
+
+ if(w != gw || h != gh)
+ {
+ bool move = false;
+ // Adjust x position if we resized from top or bottom left corner
+ if(x != oldX)
+ {
+ x += w - gw;
+ move = true;
+ }
+ w = gw;
+ h = gh;
+ guiApp.interfaceDriver.PositionRootWindow(window, x, y, w, h, move, true);
+ }
+ }
+ window.ExternalPosition(x, y, w, h);
+}
+
class Win32Interface : Interface
{
class_property(name) = "Win32";
if(time - lastAutoHideCheck > 1)
{
APPBARDATA appBarData = { 0 };
- newTaskBarState = SHAppBarMessage(ABM_GETSTATE, &appBarData);
+ newTaskBarState = (int)SHAppBarMessage(ABM_GETSTATE, &appBarData);
lastAutoHideCheck = time;
}
code = key;
}
- if(key != leftShift && key != rightShift && ::GetKeyState(VK_SHIFT) & 0x80000)
- code.shift = true;
- if(key != leftControl && key != rightControl && ::GetKeyState(VK_CONTROL) & 0x80000 && !frenchShift)
- code.ctrl = true;
- if(key != leftAlt && key != rightAlt && ::GetKeyState(VK_MENU) & 0x80000 && !frenchShift)
- code.alt = true;
-
if(msg == WM_MOUSEWHEEL)
{
+ if(::GetAsyncKeyState(VK_SHIFT) & 0x80000)
+ code.ctrl = true;
+ if(::GetAsyncKeyState(VK_CONTROL) & 0x80000)
+ code.ctrl = true;
+ if(::GetAsyncKeyState(VK_MENU) & 0x80000)
+ code.alt = true;
+
result = window.KeyMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyHit, code, 0);
}
else
{
+ if(key != leftShift && key != rightShift && ::GetKeyState(VK_SHIFT) & 0x80000)
+ code.shift = true;
+ if(key != leftControl && key != rightControl && ::GetKeyState(VK_CONTROL) & 0x80000 && !frenchShift)
+ code.ctrl = true;
+ if(key != leftAlt && key != rightAlt && ::GetKeyState(VK_MENU) & 0x80000 && !frenchShift)
+ code.alt = true;
/*
byte ch = Interface::TranslateKeykey, code.shift);
if(::GetKeyState(VK_CAPITAL))
// --- Window procedure ---
DWORD CALLBACK ::ApplicationWindow(HWND windowHandle, UINT msg, WPARAM wParam, LPARAM lParam)
{
+#ifdef _WIN64
+ Window window = (Window)GetWindowLongPtr(windowHandle, GWLP_USERDATA);
+#else
Window window = (Window)GetWindowLong(windowHandle, GWL_USERDATA);
+#endif
static Point lastPos;
if(window)
{
{
HWND foreground;
DWORD id;
-
- uint returnValue = (uint)DefWindowProc(windowHandle, msg, wParam, lParam);
- uint windowLong;
+ void * windowLong;
foreground = GetForegroundWindow();
if(foreground == windowHandle && lParam)
foreground = (HWND)lParam;
GetWindowThreadProcessId(foreground, &id);
- windowLong = GetWindowLong(foreground, GWL_WNDPROC);
+#ifdef _WIN64
+ windowLong = (void*)GetWindowLongPtr(foreground, GWLP_WNDPROC);
+#else
+ windowLong = (void*)GetWindowLong(foreground, GWL_WNDPROC);
+#endif
#if !defined(ECERE_VANILLA) && !defined(ECERE_NO3D)
// The != ApplicationWindow check is for not recognizing the Console window as an Ecere Window
// That check causes a problem with the OpenGL driver which seems to popup a window of a different class
if(window.displaySystem && window.displaySystem.driver == class(OpenGLDisplayDriver))
- windowLong = (uint)ApplicationWindow;
+ windowLong = (void *)ApplicationWindow;
#endif
- if(id != GetCurrentProcessId() || windowLong != (LPARAM)ApplicationWindow)
+ if(id != GetCurrentProcessId() || windowLong != (void *)ApplicationWindow)
window.ExternalActivate(false, true, window, null);
- return returnValue;
+ // DefWindowProc for WM_NCACTIVATE draws the decorations, make sure it's drawn in the right state
+ return (uint)DefWindowProc(windowHandle, msg, window.active, lParam);
}
}
if(activateApp)
SetWindowPos(window.windowHandle, window.style.stayOnTop ? HWND_TOPMOST : HWND_TOP, 0,0,0,0,
SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOSIZE); //|SWP_NOREDRAW);
activateApp = false;
- }
+ }
- return (uint)DefWindowProc(windowHandle, msg, wParam, lParam);
+ return (uint)DefWindowProc(windowHandle, msg, window ? window.active : wParam, lParam);
}
case WM_ACTIVATEAPP:
if(!guiApp.IsModeSwitching())
SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOSIZE); //|SWP_NOREDRAW);
*/
}
- guiApp.SetAppFocus(wParam);
+ guiApp.SetAppFocus((bool)wParam);
}
}
else
- guiApp.SetAppFocus(wParam);
+ guiApp.SetAppFocus((bool)wParam);
break;
case WM_PAINT:
{
static int lastRes = 0;
if(lastBits != wParam || lastRes != lParam)
{
- lastBits = wParam;
- lastRes = lParam;
+ lastBits = (int)wParam;
+ lastRes = (int)lParam;
+ externalDisplayChange = true;
if(guiApp.desktop.DisplayModeChanged())
{
char caption[2048];
window.FigureCaption(caption);
SetRootWindowCaption(window, caption);
}
+ externalDisplayChange = false;
}
break;
}
incref window;
if(msg == WM_CHAR || msg == WM_DEADCHAR || PeekMessage(&charMsg, windowHandle, min, max, PM_REMOVE))
{
- ch = (msg == WM_CHAR || msg == WM_DEADCHAR) ? wParam : (unichar)charMsg.wParam;
+ ch = (msg == WM_CHAR || msg == WM_DEADCHAR) ? (unichar)wParam : (unichar)charMsg.wParam;
+ // TOCHECK: What is this for again? Fixing some obscure activation status?
+ // -- I believe this was somehow allowing 'unmaximizing', but was causing problems
+ // as there was no way to prevent AltEnter from doing so (e.g. when it is used for a node property)
+ // Worked around by fixing ProcessHotKeys to properly check for sysButtons in parent.parent when sys buttons
+ // are placed inside a menu bar for a document
+ /*
if(msg == WM_SYSKEYDOWN && ch == 13)
{
- ShowWindow(window.windowHandle, SW_SHOWNORMAL);
+ ShowWindow(window.windowHandle, window.state == maximized ? SW_MAXIMIZE : SW_SHOWNORMAL);
+ // This last line been commented out for a long time:
// window.ExternalActivate(true, true, window, null);
}
+ */
if(msg == WM_SYSKEYUP || msg == WM_KEYUP)
{
if(!ProcessKeyMessage(window, WM_KEYDOWN, 0x40000000, 0, ch))
font.lfOutPrecision = OUT_DEFAULT_PRECIS;
font.lfClipPrecision = CLIP_DEFAULT_PRECIS;
font.lfQuality = DEFAULT_QUALITY;
- font.lfPitchAndFamily = (byte)DEFAULT_PITCH|FF_DONTCARE; // TODO: Fix compiler 0 | 0 to produce byte, not int
+ font.lfPitchAndFamily = (byte)(DEFAULT_PITCH|FF_DONTCARE); // TODO: Fix compiler 0 | 0 to produce byte, not int
UTF8toUTF16Buffer(res.faceName, font.lfFaceName, LF_FACESIZE);
ImmSetCompositionFont(ctx, &font);
case WM_NCRBUTTONDOWN:
case WM_NCRBUTTONDBLCLK:
case WM_NCMBUTTONDOWN:
- case WM_NCMBUTTONDBLCLK:
- case WM_NCMOUSEMOVE:*/
+ case WM_NCMBUTTONDBLCLK:*/
+ case WM_NCMOUSEMOVE:
{
Modifiers code = 0;
bool consequential = false;
x += (short)LOWORD(lParam);
y += (short)HIWORD(lParam);
+ if(window.nativeDecorations && msg != WM_NCMOUSEMOVE)
+ {
+ x += window.clientStart.x;
+ y += window.clientStart.y - (window.hasMenuBar ? skinMenuHeight : 0);
+ }
+
if(::GetKeyState(VK_SHIFT) & 0x80000) code.shift = true;
if(::GetKeyState(VK_CONTROL) & 0x80000) code.ctrl = true;
if(::GetKeyState(VK_MENU) & 0x80000) code.alt = true;
incref window;
switch(msg)
{
- //case WM_NCMOUSEMOVE:
+ case WM_NCMOUSEMOVE:
case WM_MOUSEMOVE:
window.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMouseMove, x,y,&code, consequential, false);
break;
//case WM_NCLBUTTONDOWN:
case WM_LBUTTONDOWN:
window.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonDown,x,y,&code, false,
- (msg == WM_LBUTTONDBLCLK) ? false: true);
+ /*(msg == WM_LBUTTONDBLCLK) ? false: */true);
break;
//case WM_NCLBUTTONUP:
case WM_LBUTTONUP: window.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonUp, x,y,&code, false, false);break;
break;
}
delete window;
+ if(msg == WM_NCMOUSEMOVE)
+ return (uint)DefWindowProc(windowHandle, msg, wParam, lParam);
break;
}
case WM_SETCURSOR:
SetCursor((lastCursor == (SystemCursor)-1) ? null : systemCursors[lastCursor]);
return 0;
}
+ case WM_EXITMENULOOP:
+ case WM_EXITSIZEMOVE:
+ // We had some DirectInput stuff in here
+ break;
+ case WM_ENTERMENULOOP:
+ case WM_ENTERSIZEMOVE:
+ // We had some DirectInput stuff in here
+ break;
case WM_CLOSE:
{
window.Destroy(0);
return 0;
}
- case WM_SIZE:
+ case WM_MOVE:
{
- if(window.nativeDecorations)
+ int x, y, w, h;
+ WINDOWPLACEMENT placement = { 0 };
+ RECT rcWindow;
+ placement.length = sizeof(WINDOWPLACEMENT);
+ GetWindowRect(windowHandle, &rcWindow);
+ GetWindowPlacement(windowHandle, &placement);
+
+ x = rcWindow.left - desktopX;
+ y = rcWindow.top - desktopY;
+ w = rcWindow.right - rcWindow.left;
+ h = rcWindow.bottom - rcWindow.top;
+
+ AeroSnapPosition(window, x, y, w, h);
+ break;
+ }
+ /*case WM_MOVING:
+ break;*/
+ case WM_SIZING:
+ {
+ RECT * rect = (RECT *)lParam;
+ MinMaxValue ew, eh;
+ int x, y, w, h;
+
+ window.GetDecorationsSize(&ew, &eh);
+
+ w = rect->right - rect->left;
+ h = rect->bottom - rect->top;
+
+ w -= ew;
+ h -= eh;
+
+ w = Max(w, 1);
+ h = Max(h, 1);
+
+ w = Max(w, window.minSize.w);
+ h = Max(h, window.minSize.h);
+ w = Min(w, window.maxSize.w);
+ h = Min(h, window.maxSize.h);
+
+ if(!window.OnResizing(&w, &h))
{
- int w = LOWORD(lParam);
- int h = HIWORD(lParam);
- int x, y;
- WINDOWPLACEMENT placement = { 0 };
- placement.length = sizeof(WINDOWPLACEMENT);
+ w = window.clientSize.w;
+ h = window.clientSize.h;
+ }
+
+ w = Max(w, window.skinMinSize.w);
+ h = Max(h, window.skinMinSize.h);
- GetWindowPlacement(windowHandle, &placement);
- x = placement.rcNormalPosition.left;
- y = placement.rcNormalPosition.top;
+ w += ew;
+ h += eh;
- window.ExternalPosition(x, y, w, h);
+ if(wParam == WMSZ_BOTTOMLEFT || wParam == WMSZ_LEFT || wParam == WMSZ_TOPLEFT)
+ rect->left = rect->right - w;
+ else
+ rect->right = rect->left + w;
+
+ if(wParam == WMSZ_TOPLEFT || wParam == WMSZ_TOP || wParam == WMSZ_TOPRIGHT)
+ rect->top = rect->bottom - h;
+ else
+ rect->bottom = rect->top + h;
+
+ return 1;
+ }
+ case WM_SIZE:
+ {
+ if(window.nativeDecorations)
+ {
+ int x, y, w, h;
+ RECT rcWindow;
+ GetWindowRect(windowHandle, &rcWindow);
+
+ if(wParam == SIZE_MAXIMIZED && window.state != maximized)
+ window.state = maximized;
+ else if(wParam == SIZE_MINIMIZED && window.state != minimized)
+ window.state = minimized;
+ else if(wParam == SIZE_RESTORED && window.state != normal && window.visible)
+ window.state = normal;
+
+ x = rcWindow.left - desktopX;
+ y = rcWindow.top - desktopY;
+ w = rcWindow.right - rcWindow.left;
+ h = rcWindow.bottom - rcWindow.top;
+
+ AeroSnapPosition(window, x, y, w, h);
+ if(!guiApp.modeSwitching)
+ window.UpdateVisual(null);
}
else
return (uint)DefWindowProc(windowHandle, msg, wParam, lParam);
/// DRIVER IMPLEMENTATION /////////////
****************************************************************************/
+#ifdef _WIN64
+ void CALLBACK ::TimerProc(UINT uTimerID, UINT uMsg, uint64 dwUser, uint64 dw1, uint64 dw2)
+#else
void CALLBACK ::TimerProc(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
+#endif
{
guiApp.SignalEvent();
}
null,
className
};
+ AttachConsole(-1);
wcl.hInstance = hInstance = GetModuleHandle(null);
RegisterClass(&wcl);
DWORD style = 0;
DWORD exStyle = 0;
HWND parentWindow = null; //HWND_DESKTOP; // we get different behaviors with desktop...
+ Window master = window.master, rootWindow = (master && master != guiApp.desktop) ? master.rootWindow : null;
if(window.style.stayOnTop)
exStyle |= WS_EX_TOPMOST;
- // exStyle |= WS_EX_TOOLWINDOW;
-
- if(window.master.rootWindow && window.master.rootWindow != guiApp.desktop && (window.style.modal || window.style.interim))
- {
- Window master = window.master;
- Window rootWindow = window.master.rootWindow;
-
+ if(rootWindow && (window._isModal || window.style.interim))
parentWindow = rootWindow.is3D ? rootWindow.parent.windowHandle : rootWindow.windowHandle;
-
- // parentWindow = window.master.rootWindow.is3D ? window.master.rootWindow.parent.windowHandle : window.master.rootWindow.windowHandle;
- }
if(window.alphaBlend)
// if(window.background.a < 255) //&& window.style & ES_REDRAW) Not needed anymore?
exStyle |= WS_EX_LAYERED; // | WS_EX_TRANSPARENT;
- if(window.style.showInTaskBar)
+ // Toolwindow will disappear if they don't have AppWindow set
+ if(window.style.showInTaskBar || (!parentWindow && window.style.thin))
{
exStyle |= WS_EX_APPWINDOW;
parentWindow = null;
- style |= WS_SYSMENU;
}
- else if(window.master.rootWindow && window.master.rootWindow != guiApp.desktop)
- {
+
+ if(window.style.thin)
exStyle |= WS_EX_TOOLWINDOW;
- //exStyle |= WS_EX_APPWINDOW;
- style |= WS_SYSMENU;
- }
- else
- {
- // exStyle |= WS_EX_APPWINDOW;
- style |= WS_SYSMENU;
- }
- /*else if(parentWindow)
- exStyle |= WS_EX_TOOLWINDOW;*/
if(window.windowHandle)
windowHandle = window.windowHandle;
else
{
if(window.nativeDecorations)
- style |= WS_OVERLAPPEDWINDOW;
+ {
+ BorderBits borderStyle = window.borderStyle; // FIXME!
+ style = WS_OVERLAPPED;
+ if(borderStyle.fixed)
+ style |= WS_CAPTION;
+ if(window.hasClose)
+ style |= WS_SYSMENU;
+ if(borderStyle.sizable)
+ style |= WS_THICKFRAME;
+ if(window.hasMinimize)
+ style |= WS_MINIMIZEBOX;
+ if(window.hasMaximize)
+ style |= WS_MAXIMIZEBOX;
+ }
windowHandle = CreateWindowEx(
exStyle,
className, text,
style | (window.systemParent ? WS_CHILD :
(WS_POPUP | (window.style.hasMinimize ? WS_MINIMIZEBOX : 0))),
0,0,1,1, parentWindow, null, hInstance, null);
-
#if 0
if(exStyle & WS_EX_LAYERED)
SetLayeredWindowAttributes(windowHandle, 0, 255 /*A(window.background)*/, LWA_ALPHA);
}
}
delete text;
+#ifdef _WIN64
+ SetWindowLongPtr(windowHandle, GWLP_USERDATA, (int64)window);
+#else
SetWindowLong(windowHandle, GWL_USERDATA, (DWORD)window);
+#endif
return windowHandle;
}
void DestroyRootWindow(Window window)
{
- HICON oldIcon = (HICON)SendMessage(window.windowHandle, WM_GETICON, ICON_BIG, 0);
+ HICON oldIcon;
+ int c, lockCount = guiApp.lockMutex.lockCount;
+ for(c = 0; c < lockCount; c++)
+ guiApp.lockMutex.Release();
+
+ oldIcon = (HICON)SendMessage(window.windowHandle, WM_GETICON, ICON_BIG, 0);
+#ifdef _WIN64
+ if(oldIcon && oldIcon != (HICON)GetClassLongPtr(window.windowHandle, GCLP_HICON))
+#else
if(oldIcon && oldIcon != (HICON)GetClassLong(window.windowHandle, GCL_HICON))
- {
+#endif
DestroyIcon(oldIcon);
- }
- // TO FIX LOCK UP PROBLEMS... WOULD NEED TO UNLOCK ALL RECURSIONS ((GuiApplication)__thisModule.application).Unlock();
ShowWindow(window.windowHandle, SW_HIDE);
- // TO FIX LOCK UP PROBLEMS... WOULD NEED TO LOCK ALL RECURSIONS((GuiApplication)__thisModule.application).Lock();
+#ifdef _WIN64
+ SetWindowLongPtr(window.windowHandle, GWLP_USERDATA, (int64)null);
+#else
SetWindowLong(window.windowHandle, GWL_USERDATA, 0);
+#endif
DestroyWindow(window.windowHandle);
+
+ for(c = 0; c < lockCount; c++)
+ guiApp.lockMutex.Wait();
+
window.windowHandle = null;
}
void SetRootWindowCaption(Window window, char * name)
{
uint16 * text = UTF8toUTF16(name, null);
+ guiApp.Unlock();
SetWindowText(window.windowHandle, text);
+ guiApp.Lock();
delete text;
}
flags &=~SWP_NOMOVE;
flags |= SWP_NOSIZE;
}*/
- SetWindowPos(window.windowHandle, null, x, y, w, h, flags);
+ if(!window.nativeDecorations || window.state != maximized || !window.visible || guiApp.modeSwitching)
+ SetWindowPos(window.windowHandle, null, x, y, w, h, flags);
}
void OrderRootWindow(Window window, bool topMost)
{
case maximized:
case normal:
- /*SetWindowPos(window.windowHandle, null, 0,0,0,0,
- SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER);*/
- // ShowWindow(window.windowHandle, SW_SHOWNA);
- ShowWindow(window.windowHandle, (window.creationActivation == activate && !guiApp.modeSwitching) ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE);
-
- if(window.nativeDecorations)
- {
- int w, h;
- int x, y;
- RECT rect;
- WINDOWPLACEMENT placement = { 0 };
- placement.length = sizeof(WINDOWPLACEMENT);
-
- GetClientRect(window.windowHandle, &rect);
- GetWindowPlacement(window.windowHandle, &placement);
- x = placement.rcNormalPosition.left;
- y = placement.rcNormalPosition.top;
- w = rect.right+1;
- h = rect.bottom+1;
-
- window.ExternalPosition(x, y, w, h);
- }
+ ShowWindow(window.windowHandle, ((window.active || window.creationActivation == activate) && !externalDisplayChange) ?
+ ((window.nativeDecorations && state == maximized) ? SW_MAXIMIZE : SW_SHOWNORMAL) : SW_SHOWNOACTIVATE);
break;
case minimized:
ShowWindow(window.windowHandle, SW_MINIMIZE);
}
else
{
- /*
- SetWindowPos(window.windowHandle, null, 0,0,0,0,
- SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_HIDEWINDOW|SWP_NOZORDER);
- */
ShowWindow(window.windowHandle, SW_HIDE);
}
}
void ActivateRootWindow(Window window)
{
- //MSG msg;
- //HWND windowHandle = window.windowHandle;
- //SetActiveWindow(topWindow);
- //while(windowHandle != HWND_DESKTOP)
- // {
- // SetActiveWindow(windowHandle);
- /*
- SetWindowPos(window.windowHandle, window.style.stayOnTop ? HWND_TOPMOST : HWND_TOP,
- 0,0,0,0,
- SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOSIZE|SWP_NOREDRAW);
- */
- //SetFocus(windowHandle);
-
- // windowHandle = GetParent(windowHandle);
- /*
- SetWindowPos(window.windowHandle, window.style.stayOnTop ? HWND_TOPMOST : HWND_TOP,
- 0,0,0,0, SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOSIZE|SWP_NOREDRAW);*/
- // }
- // if(!window.isForegroundWindow)
- //SetActiveWindow(window.windowHandle);
-/*
- HWND windowHandle = window.windowHandle;
- while(windowHandle != HWND_DESKTOP)
- {
- SetActiveWindow(windowHandle);
- windowHandle = GetParent(windowHandle);
- }
-*/
- //SetActiveWindow(window.windowHandle);
- if(!guiApp.modeSwitching)
+ if(!externalDisplayChange)
SetForegroundWindow(window.windowHandle);
- // UpdateWindow(window.windowHandle);
- /*
- SetWindowPos(window.windowHandle, window.style.stayOnTop ? HWND_TOPMOST : HWND_TOP,
- 0,0,0,0, SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOSIZE|SWP_NOREDRAW|SWP_NOACTIVATE);
- */
- /*
- while(PeekMessage(&msg,window.windowHandle,WM_NCACTIVATE,WM_NCACTIVATE,PM_REMOVE))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }*/
-
}
void FlashRootWindow(Window window)
flashInfo.hwnd = window.windowHandle;
flashInfo.uCount = 1;
flashInfo.dwFlags = FLASHW_TRAY; // FLASHW_ALL;
+ guiApp.Unlock();
FlashWindowEx((void *)&flashInfo);
+ guiApp.Lock();
}
// --- Mouse-based window movement ---
bool result = false;
if(OpenClipboard(null))
{
- if(clipBoard.handle = GetClipboardData(CF_UNICODETEXT))
+ if((clipBoard.handle = GetClipboardData(CF_UNICODETEXT)))
{
uint16 * u16text = GlobalLock(clipBoard.handle);
if(u16text)
HICON icon = null;
HICON oldIcon = (HICON)SendMessage(window.windowHandle, WM_GETICON, ICON_BIG, 0);
+ // Dialogs Inherit master's icon if none set
+ if(!window.style.showInTaskBar && window.hasClose)
+ {
+ Window master = window.master;
+ while(master && !resource)
+ {
+ Window rootWindow = (master && master != guiApp.desktop) ? master.rootWindow : null;
+ if(rootWindow && rootWindow.icon)
+ resource = rootWindow.icon;
+ else
+ master = master.master;
+ }
+ }
+
// WARNING -- putting this here as it is right after CreateRootWindow
// Take out Layered flag if we're not in 24 bit
{
}
}
+#ifdef _WIN64
+ if(oldIcon && oldIcon != (HICON)GetClassLongPtr(window.windowHandle, GCLP_HICON))
+#else
if(oldIcon && oldIcon != (HICON)GetClassLong(window.windowHandle, GCL_HICON))
+#endif
{
DestroyIcon(oldIcon);
}
if(bitmap.Load(resource.fileName, null, null))
{
Bitmap and { };
- int y, x;
PixelFormat format = window.display.pixelFormat;
- //int bits = 8<<GetColorDepthShifts(format);
- int bits;
+ int bits = GetDepthBits(format);
bool blend;
- bits = GetDepthBits(format);
-
bitmap.Convert(null, pixelFormat888, null);
and.Allocate(null, (bitmap.width+7/8), bitmap.height, 0, pixelFormat8, false);
c++;
m++;
}
- and.picture[b++] = mask;
+ picture[b++] = mask;
}
c = 0;
while(c < size)