summaryrefslogtreecommitdiff
path: root/redo/window_windows.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-14 16:12:43 -0400
committerPietro Gagliardi <[email protected]>2014-08-14 16:12:43 -0400
commit868161b7f0f5de708f242aaf82a3165edbaa22e8 (patch)
tree6284f0ded45f49ec14f746de49c9999802b79557 /redo/window_windows.c
parentd944af860934fdf8a3a38fc48a0b158428d90a0f (diff)
Moved code to handle window user data in the Windows backend to a single function.
Diffstat (limited to 'redo/window_windows.c')
-rw-r--r--redo/window_windows.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/redo/window_windows.c b/redo/window_windows.c
index 5ea83f1..e4ea875 100644
--- a/redo/window_windows.c
+++ b/redo/window_windows.c
@@ -9,21 +9,13 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
{
void *data;
RECT r;
- LRESULT shared;
+ LRESULT lResult;
- data = (void *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
- if (data == NULL) {
- // the lpParam is available during WM_NCCREATE and WM_CREATE
- if (uMsg == WM_NCCREATE) {
- storelpParam(hwnd, lParam);
- data = (void *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
- storeWindowHWND(data, hwnd);
- }
- // act as if we're not ready yet, even during WM_NCCREATE (nothing important to the switch statement below happens here anyway)
- return DefWindowProcW(hwnd, uMsg, wParam, lParam);
- }
- if (sharedWndProc(hwnd, uMsg, wParam, lParam, &shared))
- return shared;
+ data = getWindowData(hwnd, uMsg, wParam, lParam, &lResult, storeWindowHWND);
+ if (data == NULL)
+ return lResult;
+ if (sharedWndProc(hwnd, uMsg, wParam, lParam, &lResult))
+ return lResult;
switch (uMsg) {
case WM_SIZE:
if (GetClientRect(hwnd, &r) == 0)