MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Window_Procedure

Function Window_Procedure

src/Window_WinCE.c:143–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPARAM lParam) {
144 float wheelDelta;
145 cc_bool sized;
146 HWND hwnd;
147
148 switch (message) {
149 case WM_ACTIVATE:
150 Window_Main.Focused = LOWORD(wParam) != 0;
151 Event_RaiseVoid(&WindowEvents.FocusChanged);
152 break;
153
154 case WM_ERASEBKGND:
155 return 1; /* Avoid flickering */
156
157 case WM_PAINT:
158 {
159 hwnd = Window_Main.Handle.ptr;
160 //ValidateRect(hwnd, NULL);
161 PAINTSTRUCT ps;
162 HWND hwnd = Window_Main.Handle.ptr;
163 HDC hdc = BeginPaint(handle, &ps);
164 EndPaint(handle, &ps);
165 Event_RaiseVoid(&WindowEvents.RedrawNeeded);
166 return 0;
167 }
168
169 case WM_SIZE:
170 sized = RefreshWindowDimensions();
171
172 if (sized && !suppress_resize) Event_RaiseVoid(&WindowEvents.Resized);
173 Event_RaiseVoid(&WindowEvents.StateChanged);
174 break;
175
176 case WM_MOVE:
177 RefreshWindowPosition();
178 break;
179
180 case WM_CHAR:
181 /* TODO: Use WM_UNICHAR instead, as WM_CHAR is just utf16 */
182 Event_RaiseInt(&InputEvents.Press, (cc_unichar)wParam);
183 break;
184
185#ifndef CC_BUILD_TOUCH
186 case WM_MOUSEMOVE:
187 /* Set before position change, in case mouse buttons changed when outside window */
188 if (!(wParam & 0x01)) Input_SetReleased(CCMOUSE_L);
189 //Input_SetNonRepeatable(CCMOUSE_L, wParam & 0x01);
190 Input_SetNonRepeatable(CCMOUSE_R, wParam & 0x02);
191 Input_SetNonRepeatable(CCMOUSE_M, wParam & 0x10);
192 /* TODO: do we need to set XBUTTON1/XBUTTON2 here */
193 Pointer_SetPosition(0, LOWORD(lParam), HIWORD(lParam));
194 break;
195#else
196 case WM_MOUSEMOVE:
197 if (wParam & MK_LBUTTON)
198 Input_UpdateTouch(0, LOWORD(lParam), HIWORD(lParam));
199 break;
200#endif

Callers

nothing calls this directly

Calls 15

Event_RaiseVoidFunction · 0.85
Event_RaiseIntFunction · 0.85
Input_SetReleasedFunction · 0.85
Input_SetNonRepeatableFunction · 0.85
Pointer_SetPositionFunction · 0.85
Input_UpdateTouchFunction · 0.85
Mouse_ScrollVWheelFunction · 0.85
Input_SetPressedFunction · 0.85
Input_AddTouchFunction · 0.85
Input_RemoveTouchFunction · 0.85
Input_SetFunction · 0.85
Input_ClearFunction · 0.85

Tested by

no test coverage detected