summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2010-12-10 21:15:05 +0000
committerVincent Torri <vincent.torri@gmail.com>2010-12-10 21:15:05 +0000
commit62ed31828206e203fbd7c095fea2f4e416c7bd8b (patch)
treeb51c0225799396b8de1802a7bc6f6921f7f28838 /legacy
parent2f44146d6064fdfdfb3952564b981f5707fbd233 (diff)
[ecore_win32] Better move and resize of windows. Needs a lot of love though
SVN revision: 55470
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ecore/src/lib/ecore_win32/ecore_win32.c193
-rw-r--r--legacy/ecore/src/lib/ecore_win32/ecore_win32_private.h10
2 files changed, 193 insertions, 10 deletions
diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32.c
index 7734f484ab..95f2c697dc 100644
--- a/legacy/ecore/src/lib/ecore_win32/ecore_win32.c
+++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32.c
@@ -3,7 +3,6 @@
3#endif 3#endif
4 4
5#include <stdlib.h> 5#include <stdlib.h>
6#include <stdio.h> /* for printf */
7 6
8#define WIN32_LEAN_AND_MEAN 7#define WIN32_LEAN_AND_MEAN
9#include <windows.h> 8#include <windows.h>
@@ -66,37 +65,48 @@ _ecore_win32_window_procedure(HWND window,
66 { 65 {
67 /* Keyboard input notifications */ 66 /* Keyboard input notifications */
68 case WM_KEYDOWN: 67 case WM_KEYDOWN:
68 INF("keydown message");
69 _ecore_win32_event_handle_key_press(data, 1); 69 _ecore_win32_event_handle_key_press(data, 1);
70 return 0; 70 return 0;
71 case WM_CHAR: 71 case WM_CHAR:
72 INF("char message");
72 _ecore_win32_event_handle_key_press(data, 0); 73 _ecore_win32_event_handle_key_press(data, 0);
73 return 0; 74 return 0;
74 case WM_KEYUP: 75 case WM_KEYUP:
76 INF("keyup message");
75 _ecore_win32_event_handle_key_release(data, 1); 77 _ecore_win32_event_handle_key_release(data, 1);
76 return 0; 78 return 0;
77 case WM_SETFOCUS: 79 case WM_SETFOCUS:
80 INF("setfocus message");
78 _ecore_win32_event_handle_focus_in(data); 81 _ecore_win32_event_handle_focus_in(data);
79 return 0; 82 return 0;
80 case WM_KILLFOCUS: 83 case WM_KILLFOCUS:
84 INF("kill focus message");
81 _ecore_win32_event_handle_focus_out(data); 85 _ecore_win32_event_handle_focus_out(data);
82 return 0; 86 return 0;
83 /* Mouse input notifications */ 87 /* Mouse input notifications */
84 case WM_LBUTTONDOWN: 88 case WM_LBUTTONDOWN:
89 INF("left button down message");
85 _ecore_win32_event_handle_button_press(data, 1); 90 _ecore_win32_event_handle_button_press(data, 1);
86 return 0; 91 return 0;
87 case WM_MBUTTONDOWN: 92 case WM_MBUTTONDOWN:
93 INF("middle button down message");
88 _ecore_win32_event_handle_button_press(data, 2); 94 _ecore_win32_event_handle_button_press(data, 2);
89 return 0; 95 return 0;
90 case WM_RBUTTONDOWN: 96 case WM_RBUTTONDOWN:
97 INF("right button down message");
91 _ecore_win32_event_handle_button_press(data, 3); 98 _ecore_win32_event_handle_button_press(data, 3);
92 return 0; 99 return 0;
93 case WM_LBUTTONUP: 100 case WM_LBUTTONUP:
101 INF("left button up message");
94 _ecore_win32_event_handle_button_release(data, 1); 102 _ecore_win32_event_handle_button_release(data, 1);
95 return 0; 103 return 0;
96 case WM_MBUTTONUP: 104 case WM_MBUTTONUP:
105 INF("middle button up message");
97 _ecore_win32_event_handle_button_release(data, 2); 106 _ecore_win32_event_handle_button_release(data, 2);
98 return 0; 107 return 0;
99 case WM_RBUTTONUP: 108 case WM_RBUTTONUP:
109 INF("right button up message");
100 _ecore_win32_event_handle_button_release(data, 3); 110 _ecore_win32_event_handle_button_release(data, 3);
101 return 0; 111 return 0;
102 case WM_MOUSEMOVE: 112 case WM_MOUSEMOVE:
@@ -104,6 +114,8 @@ _ecore_win32_window_procedure(HWND window,
104 RECT rect; 114 RECT rect;
105 struct _Ecore_Win32_Window *w = NULL; 115 struct _Ecore_Win32_Window *w = NULL;
106 116
117 INF("moue move message");
118
107 w = (struct _Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA); 119 w = (struct _Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
108 120
109 if (GetClientRect(window, &rect)) 121 if (GetClientRect(window, &rect))
@@ -140,16 +152,20 @@ _ecore_win32_window_procedure(HWND window,
140 return 0; 152 return 0;
141 } 153 }
142 case WM_MOUSEWHEEL: 154 case WM_MOUSEWHEEL:
155 INF("mouse wheel message");
143 _ecore_win32_event_handle_button_press(data, 4); 156 _ecore_win32_event_handle_button_press(data, 4);
144 return 0; 157 return 0;
145 /* Window notifications */ 158 /* Window notifications */
146 case WM_CREATE: 159 case WM_CREATE:
160 INF("create window message");
147 _ecore_win32_event_handle_create_notify(data); 161 _ecore_win32_event_handle_create_notify(data);
148 return 0; 162 return 0;
149 case WM_DESTROY: 163 case WM_DESTROY:
164 INF("destroy window message");
150 _ecore_win32_event_handle_destroy_notify(data); 165 _ecore_win32_event_handle_destroy_notify(data);
151 return 0; 166 return 0;
152 case WM_SHOWWINDOW: 167 case WM_SHOWWINDOW:
168 INF("show window message");
153 if ((data->data_param == SW_OTHERUNZOOM) || 169 if ((data->data_param == SW_OTHERUNZOOM) ||
154 (data->data_param == SW_OTHERZOOM)) 170 (data->data_param == SW_OTHERZOOM))
155 return 0; 171 return 0;
@@ -161,21 +177,26 @@ _ecore_win32_window_procedure(HWND window,
161 177
162 return 0; 178 return 0;
163 case WM_CLOSE: 179 case WM_CLOSE:
180 INF("close window message");
164 _ecore_win32_event_handle_delete_request(data); 181 _ecore_win32_event_handle_delete_request(data);
165 return 0; 182 return 0;
183 case WM_GETMINMAXINFO:
184 INF("get min max info window message");
185 return TRUE;
166 case WM_MOVING: 186 case WM_MOVING:
167 printf (" * ecore message : moving\n"); 187 INF("moving window message");
188 _ecore_win32_event_handle_configure_notify(data);
168 return TRUE; 189 return TRUE;
169 case WM_MOVE: 190 case WM_MOVE:
170 printf (" * ecore message : moved\n"); 191 INF("move window message");
171 return 0; 192 return 0;
172 case WM_SIZING: 193 case WM_SIZING:
173 printf (" * ecore message : sizing\n"); 194 INF("sizing window message");
174 _ecore_win32_event_handle_resize(data); 195 _ecore_win32_event_handle_resize(data);
175 _ecore_win32_event_handle_configure_notify(data); 196 _ecore_win32_event_handle_configure_notify(data);
176 return TRUE; 197 return TRUE;
177 case WM_SIZE: 198 case WM_SIZE:
178 printf (" * ecore message : sized\n"); 199 INF("size window message");
179 return 0; 200 return 0;
180/* case WM_WINDOWPOSCHANGING: */ 201/* case WM_WINDOWPOSCHANGING: */
181/* { */ 202/* { */
@@ -187,19 +208,171 @@ _ecore_win32_window_procedure(HWND window,
187/* _ecore_win32_event_handle_configure_notify(data); */ 208/* _ecore_win32_event_handle_configure_notify(data); */
188/* return 0; */ 209/* return 0; */
189 case WM_WINDOWPOSCHANGED: 210 case WM_WINDOWPOSCHANGED:
211 INF("position changed window message");
190 _ecore_win32_event_handle_configure_notify(data); 212 _ecore_win32_event_handle_configure_notify(data);
191 return 0; 213 return 0;
192 case WM_ENTERSIZEMOVE : 214 case WM_ENTERSIZEMOVE:
193 printf (" * ecore message : WM_ENTERSIZEMOVE \n"); 215 INF("enter size move window message");
194 return 0; 216 return 0;
195 case WM_EXITSIZEMOVE: 217 case WM_EXITSIZEMOVE:
196 printf (" * ecore message : WM_EXITSIZEMOVE\n"); 218 INF("exit size move window message");
197 return 0; 219 return 0;
220 case WM_NCLBUTTONDOWN:
221 INF("non client left button down window message");
222 if (((DWORD)window_param == HTCAPTION) ||
223 ((DWORD)window_param == HTBOTTOM) ||
224 ((DWORD)window_param == HTBOTTOMLEFT) ||
225 ((DWORD)window_param == HTBOTTOMRIGHT) ||
226 ((DWORD)window_param == HTLEFT) ||
227 ((DWORD)window_param == HTRIGHT) ||
228 ((DWORD)window_param == HTTOP) ||
229 ((DWORD)window_param == HTTOPLEFT) ||
230 ((DWORD)window_param == HTTOPRIGHT))
231 {
232 Ecore_Win32_Window *w;
233
234 w = (Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
235 ecore_win32_window_geometry_get(w,
236 &w->drag.x, &w->drag.y,
237 &w->drag.w, &w->drag.h);
238 w->drag.px = GET_X_LPARAM(data_param);
239 w->drag.py = GET_Y_LPARAM(data_param);
240 w->drag.dragging = 1;
241 return 0;
242 }
243 return DefWindowProc(window, message, window_param, data_param);
244 case WM_SYSCOMMAND:
245 INF("sys command window message", (int)window_param);
246 if ((((DWORD)window_param & 0xfff0) == SC_MOVE) ||
247 (((DWORD)window_param & 0xfff0) == SC_SIZE))
248 {
249 Ecore_Win32_Window *w;
250
251 INF("sys command MOVE or SIZE window message : %dx%d", GET_X_LPARAM(data_param), GET_Y_LPARAM(data_param));
252
253 w = (Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
254 w->drag.dragging = 1;
255 return 0;
256 }
257 return DefWindowProc(window, message, window_param, data_param);
258 case WM_NCMOUSEMOVE:
259 INF("non client mouse move window message");
260 if ((DWORD)window_param == HTCAPTION)
261 {
262 Ecore_Win32_Window *w;
263
264 w = (Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
265 if (w->drag.dragging)
266 {
267 int dx;
268 int dy;
269
270 dx = GET_X_LPARAM(data_param) - w->drag.px;
271 dy = GET_Y_LPARAM(data_param) - w->drag.py;
272 ecore_win32_window_move(w, w->drag.x + dx, w->drag.y + dy);
273 w->drag.x += dx;
274 w->drag.y += dy;
275 w->drag.px = GET_X_LPARAM(data_param);
276 w->drag.py = GET_Y_LPARAM(data_param);
277 return 0;
278 }
279 }
280 if ((DWORD)window_param == HTLEFT)
281 {
282 Ecore_Win32_Window *w;
283
284 w = (Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
285 if (w->drag.dragging)
286 {
287 int dw;
288 dw = GET_X_LPARAM(data_param) - w->drag.px;
289 ecore_win32_window_move_resize(w, w->drag.x + dw, w->drag.y, w->drag.w - dw, w->drag.h);
290 w->drag.x += dw;
291 w->drag.w -= dw;
292 w->drag.px = GET_X_LPARAM(data_param);
293 w->drag.py = GET_Y_LPARAM(data_param);
294 return 0;
295 }
296 }
297 if ((DWORD)window_param == HTRIGHT)
298 {
299 Ecore_Win32_Window *w;
300
301 w = (Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
302 if (w->drag.dragging)
303 {
304 int dw;
305 dw = GET_X_LPARAM(data_param) - w->drag.px;
306 ecore_win32_window_resize(w, w->drag.w + dw, w->drag.h);
307 w->drag.w += dw;
308 w->drag.px = GET_X_LPARAM(data_param);
309 w->drag.py = GET_Y_LPARAM(data_param);
310 return 0;
311 }
312 }
313 if ((DWORD)window_param == HTTOP)
314 {
315 Ecore_Win32_Window *w;
316
317 w = (Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
318 if (w->drag.dragging)
319 {
320 int dh;
321 dh = GET_Y_LPARAM(data_param) - w->drag.py;
322 ecore_win32_window_move_resize(w, w->drag.x, w->drag.y + dh, w->drag.w, w->drag.h - dh);
323 w->drag.y += dh;
324 w->drag.h -= dh;
325 w->drag.px = GET_X_LPARAM(data_param);
326 w->drag.py = GET_Y_LPARAM(data_param);
327 return 0;
328 }
329 }
330 if ((DWORD)window_param == HTBOTTOM)
331 {
332 Ecore_Win32_Window *w;
333
334 w = (Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
335 if (w->drag.dragging)
336 {
337 int dh;
338 dh = GET_Y_LPARAM(data_param) - w->drag.py;
339 ecore_win32_window_resize(w, w->drag.w, w->drag.h + dh);
340 w->drag.h += dh;
341 w->drag.px = GET_X_LPARAM(data_param);
342 w->drag.py = GET_Y_LPARAM(data_param);
343 return 0;
344 }
345 }
346 return DefWindowProc(window, message, window_param, data_param);
347 case WM_NCLBUTTONUP:
348 INF("non client left button up window message");
349 if (((DWORD)window_param == HTCAPTION) ||
350 ((DWORD)window_param == HTBOTTOM) ||
351 ((DWORD)window_param == HTBOTTOMLEFT) ||
352 ((DWORD)window_param == HTBOTTOMRIGHT) ||
353 ((DWORD)window_param == HTLEFT) ||
354 ((DWORD)window_param == HTRIGHT) ||
355 ((DWORD)window_param == HTTOP) ||
356 ((DWORD)window_param == HTTOPLEFT) ||
357 ((DWORD)window_param == HTTOPRIGHT))
358 {
359 Ecore_Win32_Window *w;
360
361 w = (Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
362 if (w->drag.dragging)
363 {
364 w->drag.dragging = 0;
365 return 0;
366 }
367 }
368 return DefWindowProc(window, message, window_param, data_param);
198 /* GDI notifications */ 369 /* GDI notifications */
199 case WM_PAINT: 370 case WM_PAINT:
200 { 371 {
201 RECT rect; 372 RECT rect;
202 373
374 INF("paint message");
375
203 if (GetUpdateRect(window, &rect, FALSE)) 376 if (GetUpdateRect(window, &rect, FALSE))
204 { 377 {
205 PAINTSTRUCT ps; 378 PAINTSTRUCT ps;
@@ -213,10 +386,10 @@ _ecore_win32_window_procedure(HWND window,
213 return 0; 386 return 0;
214 } 387 }
215 case WM_SETREDRAW: 388 case WM_SETREDRAW:
216 printf (" * ecore message : WM_SETREDRAW\n"); 389 INF("set redraw message");
217 return 0; 390 return 0;
218 case WM_SYNCPAINT: 391 case WM_SYNCPAINT:
219 printf (" * ecore message : WM_SYNCPAINT\n"); 392 INF("sync paint message");
220 return 0; 393 return 0;
221 default: 394 default:
222 return DefWindowProc(window, message, window_param, data_param); 395 return DefWindowProc(window, message, window_param, data_param);
diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32_private.h b/legacy/ecore/src/lib/ecore_win32/ecore_win32_private.h
index 4154c1259f..41b07caad1 100644
--- a/legacy/ecore/src/lib/ecore_win32/ecore_win32_private.h
+++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32_private.h
@@ -99,6 +99,16 @@ struct _Ecore_Win32_Window
99 unsigned int layered : 1; 99 unsigned int layered : 1;
100 } shape; 100 } shape;
101 101
102 struct {
103 unsigned int x;
104 unsigned int y;
105 unsigned int w;
106 unsigned int h;
107 unsigned int px;
108 unsigned int py;
109 unsigned int dragging : 1;
110 } drag;
111
102 void *dnd_drop_target; 112 void *dnd_drop_target;
103}; 113};
104 114