ui/win32/window.c

changeset 113
dde28a806552
parent 112
c3f2f16fa4b8
--- a/ui/win32/window.c	Sun Oct 19 21:20:08 2025 +0200
+++ b/ui/win32/window.c	Mon Nov 10 21:52:51 2025 +0100
@@ -52,41 +52,12 @@
 
 static const char *mainWindowClass = "UiMainWindow";
 
-LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
-	W32Widget *widget = (W32Widget*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-	if (widget && widget->wclass->eventproc) {
-		widget->wclass->eventproc(widget, hwnd, uMsg, wParam, lParam);
-	}
-    switch(uMsg) {
-        case WM_DESTROY: {
-	        PostQuitMessage(0);
-        	break;
-        }
-		case WM_COMMAND: {
-        	HWND hwndCtrl = (HWND)lParam;
-        	W32Widget *cmdWidget = (W32Widget*)GetWindowLongPtr(hwndCtrl, GWLP_USERDATA);
-        	if (cmdWidget && cmdWidget->wclass->eventproc) {
-        		cmdWidget->wclass->eventproc(cmdWidget, hwnd, uMsg, wParam, lParam);
-        	}
-        }
-		case WM_SIZE: {
-        	int width  = LOWORD(lParam);
-        	int height = HIWORD(lParam);
-        	if (widget->layout) {
-        		widget->layout(widget->layoutmanager, width, height);
-        	}
-        	break;
-		}
-        default: return DefWindowProc(hwnd, uMsg, wParam, lParam);
-    }
-    return 0;
-}
 
 void ui_window_init(void) {
 	hInstance = GetModuleHandle(NULL);
 	
 	WNDCLASSEX wc = { sizeof(WNDCLASSEX) };
-    wc.lpfnWndProc = WindowProc;
+    wc.lpfnWndProc = ui_default_eventproc;
     wc.hInstance = hInstance;
     wc.lpszClassName = mainWindowClass;
     wc.hCursor = LoadCursor(NULL, IDC_ARROW);

mercurial