summaryrefslogtreecommitdiff
path: root/redo/area_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/area_windows.c
parentd944af860934fdf8a3a38fc48a0b158428d90a0f (diff)
Moved code to handle window user data in the Windows backend to a single function.
Diffstat (limited to 'redo/area_windows.c')
-rw-r--r--redo/area_windows.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/redo/area_windows.c b/redo/area_windows.c
index e6347bd..e9ded14 100644
--- a/redo/area_windows.c
+++ b/redo/area_windows.c
@@ -314,19 +314,11 @@ static LRESULT CALLBACK areaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
void *data;
DWORD which;
uintptr_t heldButtons = (uintptr_t) wParam;
+ 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);
- storeAreaHWND(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);
- }
-
+ data = getWindowData(hwnd, uMsg, wParam, lParam, &lResult, storeAreaHWND);
+ if (data == NULL)
+ return lResult;
switch (uMsg) {
case WM_PAINT:
paintArea(hwnd, data);