Added a framework for handling WM_WININICHANGE to child windows; this will be used by the date-time picker.
This commit is contained in:
parent
fd6cfa54b3
commit
3ecd94e9b4
|
@ -84,3 +84,41 @@ RUNFN(WM_NOTIFY, notify,
|
|||
RUNFN(WM_HSCROLL, hscroll,
|
||||
(HWND) lParam,
|
||||
LOWORD(wParam))
|
||||
|
||||
struct wininichange {
|
||||
HWND hwnd;
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
||||
static struct wininichange *wininichanges = NULL;
|
||||
|
||||
void uiWindowsRegisterReceiveWM_WININICHANGE(HWND hwnd)
|
||||
{
|
||||
struct wininchange *ch;
|
||||
|
||||
HASH_FIND_PTR(wininichanges, &hwnd, ch);
|
||||
if (ch != NULL)
|
||||
complain("window handle %p already subscribed to receive WM_WINICHANGEs in uiWindowsRegisterReceiveWM_WININICHANGE()", hwnd);
|
||||
ch = uiNew(struct wininichange);
|
||||
ch->hwnd = hwnd;
|
||||
HASH_ADD_PTR(wininichanges, hwnd, ch);
|
||||
}
|
||||
|
||||
void uiWindowsUnregisterReceiveWM_WINICHANGE(HWND hwnd)
|
||||
{
|
||||
struct wininichange *ch;
|
||||
|
||||
HASH_FIND_PTR(wininichanges, &hwnd, ch);
|
||||
if (ch == NULL)
|
||||
complain("window handle %p not registered to receive WM_WININICHANGEs in uiWindowsUnregisterReceiveWM_WINICHANGE()", hwnd);
|
||||
HASH_DEL(wininichanges, ch);
|
||||
uiFree(ch);
|
||||
}
|
||||
|
||||
void issueWM_WININICHANGE(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
struct wininichange *ch;
|
||||
|
||||
for (ch = wininichanges; ch != NULL; ch = ch->hh.next)
|
||||
SendMessageW(ch->hwnd, WM_WININICHANGE, wParam, lParam);
|
||||
}
|
||||
|
|
|
@ -103,6 +103,9 @@ extern void uiWindowsUnregisterWM_HSCROLLHandler(HWND);
|
|||
extern BOOL runWM_COMMAND(WPARAM, LPARAM, LRESULT *);
|
||||
extern BOOL runWM_NOTIFY(WPARAM, LPARAM, LRESULT *);
|
||||
extern BOOL runWM_HSCROLL(WPARAM, LPARAM, LRESULT *);
|
||||
extern void uiWindowsRegisterReceiveWM_WININICHANGE(HWND);
|
||||
extern void uiWindowsUnregisterReceiveWM_WINICHANGE(HWND);
|
||||
extern void issueWM_WININICHANGE(WPARAM, LPARAM);
|
||||
|
||||
// dialoghelper.c
|
||||
extern void dialogHelperRegisterWindow(HWND);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// - It is the initial parent of all controls. When a control loses its parent, it also becomes that control's parent.
|
||||
// - It handles WM_QUERYENDSESSION and console end session requests.
|
||||
// - It has a timer to run resizes.
|
||||
// - It handles WM_WININICHANGE and forwards the message to any child windows that request it.
|
||||
|
||||
#define utilWindowClass L"libui_utilWindowClass"
|
||||
|
||||
|
@ -37,6 +38,9 @@ static LRESULT CALLBACK utilWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, L
|
|||
logLastError("error resetting resize timer in utilWindowWndProc()");
|
||||
doResizes();
|
||||
return 0;
|
||||
case WM_WININICHANGE:
|
||||
issueWM_WININICHANGE(wParam, lParam);
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue