Implemented WM_PRINTCLIENT on Window and cleaned up the WM_CTLCOLOR*** message handler; both are on the Windows backend.
This commit is contained in:
parent
4d8911fe7e
commit
555b6ebcbd
|
@ -79,8 +79,6 @@ static LRESULT forwardNotify(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
BOOL sharedWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
BOOL sharedWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
||||||
{
|
{
|
||||||
DWORD exstyle;
|
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
*lResult = forwardCommand(hwnd, uMsg, wParam, lParam);
|
*lResult = forwardCommand(hwnd, uMsg, wParam, lParam);
|
||||||
|
@ -90,16 +88,11 @@ BOOL sharedWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_CTLCOLORSTATIC:
|
case WM_CTLCOLORSTATIC:
|
||||||
case WM_CTLCOLORBTN:
|
case WM_CTLCOLORBTN:
|
||||||
exstyle = (DWORD) GetWindowLongPtrW((HWND) lParam, GWL_EXSTYLE);
|
if (SetBkMode((HDC) wParam, TRANSPARENT) == 0)
|
||||||
// TODO clean this up
|
xpanic("error setting transparent background mode to Labels", GetLastError());
|
||||||
{// if ((exstyle & WS_EX_TRANSPARENT) != 0) {
|
paintControlBackground((HWND) lParam, (HDC) wParam);
|
||||||
if (SetBkMode((HDC) wParam, TRANSPARENT) == 0)
|
*lResult = (LRESULT) hollowBrush;
|
||||||
xpanic("error setting transparent background mode to Labels", GetLastError());
|
return TRUE;
|
||||||
paintControlBackground((HWND) lParam, (HDC) wParam);
|
|
||||||
*lResult = (LRESULT) hollowBrush;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +105,6 @@ void paintControlBackground(HWND hwnd, HDC dc)
|
||||||
int saved;
|
int saved;
|
||||||
WCHAR classname[128] = L""; // more than enough to avoid collisions
|
WCHAR classname[128] = L""; // more than enough to avoid collisions
|
||||||
|
|
||||||
// TODO implement WM_PRINTCLIENT in window_windows.c
|
|
||||||
parent = hwnd;
|
parent = hwnd;
|
||||||
do {
|
do {
|
||||||
parent = GetParent(parent);
|
parent = GetParent(parent);
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#define windowclass L"gouiwindow"
|
#define windowclass L"gouiwindow"
|
||||||
|
|
||||||
|
#define windowBackground ((HBRUSH) (COLOR_BTNFACE + 1))
|
||||||
|
|
||||||
static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
void *data;
|
void *data;
|
||||||
|
@ -17,6 +19,15 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
if (sharedWndProc(hwnd, uMsg, wParam, lParam, &lResult))
|
if (sharedWndProc(hwnd, uMsg, wParam, lParam, &lResult))
|
||||||
return lResult;
|
return lResult;
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
|
case WM_PRINTCLIENT:
|
||||||
|
// the return value of this message is not documented
|
||||||
|
// just to be safe, do this first, returning its value later
|
||||||
|
lResult = DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||||
|
if (GetClientRect(hwnd, &r) == 0)
|
||||||
|
xpanic("error getting client rect for Window in WM_PRINTCLIENT", GetLastError());
|
||||||
|
if (FillRect((HDC) wParam, &r, windowBackground) == 0)
|
||||||
|
xpanic("error filling WM_PRINTCLIENT DC with window background color", GetLastError());
|
||||||
|
return lResult;
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if (GetClientRect(hwnd, &r) == 0)
|
if (GetClientRect(hwnd, &r) == 0)
|
||||||
xpanic("error getting client rect for Window in WM_SIZE", GetLastError());
|
xpanic("error getting client rect for Window in WM_SIZE", GetLastError());
|
||||||
|
@ -41,7 +52,7 @@ DWORD makeWindowWindowClass(char **errmsg)
|
||||||
wc.hInstance = hInstance;
|
wc.hInstance = hInstance;
|
||||||
wc.hIcon = hDefaultIcon;
|
wc.hIcon = hDefaultIcon;
|
||||||
wc.hCursor = hArrowCursor;
|
wc.hCursor = hArrowCursor;
|
||||||
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
|
wc.hbrBackground = windowBackground;
|
||||||
wc.lpszClassName = windowclass;
|
wc.lpszClassName = windowclass;
|
||||||
if (RegisterClassW(&wc) == 0) {
|
if (RegisterClassW(&wc) == 0) {
|
||||||
*errmsg = "error registering Window window class";
|
*errmsg = "error registering Window window class";
|
||||||
|
|
Loading…
Reference in New Issue