summaryrefslogtreecommitdiff
path: root/src/lib/ecore_win32/ecore_win32_window.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2014-07-08 23:21:35 +0200
committerCedric BAIL <c.bail@partner.samsung.com>2014-07-09 14:26:26 +0200
commitd1cbf6d080424263a906d43b1bf35f3fb1815cb6 (patch)
tree136d19e610622e49d038e840c4de44097449c2a9 /src/lib/ecore_win32/ecore_win32_window.c
parent925c258e6b58c8f5a95c2f8fc6ca85ca7856c455 (diff)
Ecore_Win32: fix resize of windows when step and base sizes are set
Diffstat (limited to 'src/lib/ecore_win32/ecore_win32_window.c')
-rw-r--r--src/lib/ecore_win32/ecore_win32_window.c510
1 files changed, 405 insertions, 105 deletions
diff --git a/src/lib/ecore_win32/ecore_win32_window.c b/src/lib/ecore_win32/ecore_win32_window.c
index 239fe9d..792fcb3 100644
--- a/src/lib/ecore_win32/ecore_win32_window.c
+++ b/src/lib/ecore_win32/ecore_win32_window.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>
@@ -33,7 +32,7 @@ enum _Ecore_Win32_Window_Z_Order
33}; 32};
34 33
35static Ecore_Win32_Window * 34static Ecore_Win32_Window *
36ecore_win32_window_internal_new(Ecore_Win32_Window *parent, 35_ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
37 int x, 36 int x,
38 int y, 37 int y,
39 int width, 38 int width,
@@ -42,9 +41,6 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
42{ 41{
43 RECT rect; 42 RECT rect;
44 Ecore_Win32_Window *w; 43 Ecore_Win32_Window *w;
45 int minimal_width;
46#warning "We need to handle minimal_height for window like we do with width."
47 /* int minimal_height; */
48 44
49 w = (Ecore_Win32_Window *)calloc(1, sizeof(Ecore_Win32_Window)); 45 w = (Ecore_Win32_Window *)calloc(1, sizeof(Ecore_Win32_Window));
50 if (!w) 46 if (!w)
@@ -55,6 +51,19 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
55 51
56 rect.left = 0; 52 rect.left = 0;
57 rect.top = 0; 53 rect.top = 0;
54 rect.right = 0;
55 rect.bottom = 0;
56 if (!AdjustWindowRectEx(&rect, style, FALSE, 0))
57 {
58 ERR("AdjustWindowRect() failed");
59 free(w);
60 return NULL;
61 }
62
63 w->mininal_window_width = GetSystemMetrics(SM_CXMIN) - (rect.right - rect.left);
64
65 rect.left = 0;
66 rect.top = 0;
58 rect.right = width; 67 rect.right = width;
59 rect.bottom = height; 68 rect.bottom = height;
60 if (!AdjustWindowRectEx(&rect, style, FALSE, 0)) 69 if (!AdjustWindowRectEx(&rect, style, FALSE, 0))
@@ -64,19 +73,18 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
64 return NULL; 73 return NULL;
65 } 74 }
66 75
67 minimal_width = GetSystemMetrics(SM_CXMIN); 76 if (width < w->mininal_window_width)
68 /* minimal_height = GetSystemMetrics(SM_CYMIN); */ 77 width = w->mininal_window_width;
69/* if (((rect.right - rect.left) < minimal_width) || */ 78
70/* ((rect.bottom - rect.top) < minimal_height)) */ 79 rect.left = 0;
71/* { */ 80 rect.top = 0;
72/* fprintf (stderr, "[Ecore] [Win32] ERROR !!\n"); */ 81 rect.right = width;
73/* fprintf (stderr, " Wrong size %ld\n", rect.right - rect.left); */ 82 rect.bottom = height;
74/* free(w); */ 83 if (!AdjustWindowRectEx(&rect, style, FALSE, 0))
75/* return NULL; */
76/* } */
77 if ((rect.right - rect.left) < minimal_width)
78 { 84 {
79 rect.right = rect.left + minimal_width; 85 ERR("AdjustWindowRect() failed");
86 free(w);
87 return NULL;
80 } 88 }
81 89
82 w->window = CreateWindowEx(0, 90 w->window = CreateWindowEx(0,
@@ -104,14 +112,15 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
104 return NULL; 112 return NULL;
105 } 113 }
106 114
107 w->min_width = 0; 115 w->pos_hints.flags = 0;
108 w->min_height = 0; 116 w->pos_hints.min_width = w->mininal_window_width;
109 w->max_width = 32767; 117 w->pos_hints.min_height = 0;
110 w->max_height = 32767; 118 w->pos_hints.max_width = 32767;
111 w->base_width = -1; 119 w->pos_hints.max_height = 32767;
112 w->base_height = -1; 120 w->pos_hints.base_width = w->mininal_window_width;
113 w->step_width = 1; 121 w->pos_hints.base_height = 0;
114 w->step_height = 1; 122 w->pos_hints.step_width = 0;
123 w->pos_hints.step_height = 0;
115 124
116 w->state.iconified = 0; 125 w->state.iconified = 0;
117 w->state.modal = 0; 126 w->state.modal = 0;
@@ -158,6 +167,255 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
158 * Global * 167 * Global *
159 *============================================================================*/ 168 *============================================================================*/
160 169
170Eina_Bool
171ecore_win32_window_drag(Ecore_Win32_Window *w, int ptx, int pty)
172{
173 if (w->drag.type == HTCAPTION)
174 {
175 int dx;
176 int dy;
177
178 dx = ptx - w->drag.px;
179 dy = pty - w->drag.py;
180 if ((dx == 0) && (dy == 0))
181 return EINA_TRUE;
182
183 ecore_win32_window_move(w, w->drag.x + dx, w->drag.y + dy);
184 return EINA_TRUE;
185 }
186 if (w->drag.type == HTLEFT)
187 {
188 int dw;
189
190 dw = ptx - w->drag.px;
191
192 if (w->pos_hints.flags & ECORE_WIN32_POS_HINTS_STEP_SIZE)
193 {
194 int new_width;
195
196 new_width = w->pos_hints.base_width + ((w->drag.w - w->pos_hints.base_width - dw) / w->pos_hints.step_width) * w->pos_hints.step_width;
197 if ((new_width != w->drag.w) &&
198 (new_width >= w->pos_hints.base_width) &&
199 (new_width <= w->pos_hints.max_width))
200 ecore_win32_window_move_resize(w, w->drag.x - (new_width - w->drag.w), w->drag.y, new_width, w->drag.h);
201 }
202 else
203 {
204 if (((w->drag.w - dw) >= w->pos_hints.min_width) &&
205 ((w->drag.w - dw) <= w->pos_hints.max_width))
206 ecore_win32_window_move_resize(w, w->drag.x + dw, w->drag.y, w->drag.w - dw, w->drag.h);
207 }
208 return EINA_TRUE;
209 }
210 if (w->drag.type == HTRIGHT)
211 {
212 int dw;
213
214 dw = ptx - w->drag.px;
215
216 if (w->pos_hints.flags & ECORE_WIN32_POS_HINTS_STEP_SIZE)
217 {
218 int new_width;
219
220 new_width = w->pos_hints.base_width + ((w->drag.w - w->pos_hints.base_width + dw) / w->pos_hints.step_width) * w->pos_hints.step_width;
221 if ((new_width != w->drag.w) &&
222 (new_width >= w->pos_hints.base_width) &&
223 (new_width <= w->pos_hints.max_width))
224 ecore_win32_window_resize(w, new_width, w->drag.h);
225 }
226 else
227 {
228 if (((w->drag.w + dw) >= w->pos_hints.min_width) &&
229 ((w->drag.w + dw) <= w->pos_hints.max_width))
230 ecore_win32_window_resize(w, w->drag.w + dw, w->drag.h);
231 }
232 return EINA_TRUE;
233 }
234 if (w->drag.type == HTTOP)
235 {
236 int dh;
237
238 dh = pty - w->drag.py;
239
240 if (w->pos_hints.flags & ECORE_WIN32_POS_HINTS_STEP_SIZE)
241 {
242 int new_height;
243
244 new_height = w->pos_hints.base_height + ((w->drag.h - w->pos_hints.base_height - dh) / w->pos_hints.step_height) * w->pos_hints.step_height;
245 if ((new_height != w->drag.h) &&
246 (new_height >= w->pos_hints.base_height) &&
247 (new_height <= w->pos_hints.max_height))
248 ecore_win32_window_move_resize(w, w->drag.x, w->drag.y - (new_height - w->drag.h), w->drag.w, new_height);
249 }
250 else
251 {
252 if ((dh != 0) &&
253 ((w->drag.h - dh) >= w->pos_hints.min_height) &&
254 ((w->drag.h - dh) <= w->pos_hints.max_height))
255 ecore_win32_window_move_resize(w, w->drag.x, w->drag.y + dh, w->drag.w, w->drag.h - dh);
256 }
257 return EINA_TRUE;
258 }
259 if (w->drag.type == HTBOTTOM)
260 {
261 int dh;
262
263 dh = pty - w->drag.py;
264
265 if (w->pos_hints.flags & ECORE_WIN32_POS_HINTS_STEP_SIZE)
266 {
267 int new_height;
268
269 new_height = w->pos_hints.base_height + ((w->drag.h - w->pos_hints.base_height + dh) / w->pos_hints.step_height) * w->pos_hints.step_height;
270 if ((new_height != w->drag.h) &&
271 (new_height >= w->pos_hints.base_height) &&
272 (new_height <= w->pos_hints.max_height))
273 ecore_win32_window_resize(w, w->drag.w, new_height);
274 }
275 else
276 {
277 if (((w->drag.h + dh) >= w->pos_hints.min_height) &&
278 ((w->drag.h + dh) <= w->pos_hints.max_height))
279 ecore_win32_window_resize(w, w->drag.w, w->drag.h + dh);
280 }
281 return EINA_TRUE;
282 }
283 if (w->drag.type == HTTOPLEFT)
284 {
285 int dh;
286 int dw;
287
288 dw = ptx - w->drag.px;
289 dh = pty - w->drag.py;
290
291 if (w->pos_hints.flags & ECORE_WIN32_POS_HINTS_STEP_SIZE)
292 {
293 int new_width;
294 int new_height;
295
296 new_width = w->pos_hints.base_width + ((w->drag.w - w->pos_hints.base_width - dw) / w->pos_hints.step_width) * w->pos_hints.step_width;
297 new_height = w->pos_hints.base_height + ((w->drag.h - w->pos_hints.base_height - dh) / w->pos_hints.step_height) * w->pos_hints.step_height;
298 if ((new_width != w->drag.w) &&
299 (new_width >= w->pos_hints.base_width) &&
300 (new_width <= w->pos_hints.max_width) &&
301 (new_height != w->drag.h) &&
302 (new_height >= w->pos_hints.base_height) &&
303 (new_height <= w->pos_hints.max_height))
304 ecore_win32_window_move_resize(w, w->drag.x - (new_width - w->drag.w), w->drag.y - (new_height - w->drag.h), new_width, new_height);
305 }
306 else
307 {
308 if (((w->drag.w - dw) >= w->pos_hints.min_width) &&
309 ((w->drag.w - dw) <= w->pos_hints.max_width) &&
310 ((w->drag.h - dh) >= w->pos_hints.min_height) &&
311 ((w->drag.h - dh) <= w->pos_hints.max_height))
312 ecore_win32_window_move_resize(w, w->drag.x + dw, w->drag.y + dh, w->drag.w - dw, w->drag.h - dh);
313 }
314 return EINA_TRUE;
315 }
316 if (w->drag.type == HTTOPRIGHT)
317 {
318 int dh;
319 int dw;
320
321 dw = ptx - w->drag.px;
322 dh = pty - w->drag.py;
323
324 if (w->pos_hints.flags & ECORE_WIN32_POS_HINTS_STEP_SIZE)
325 {
326 int new_width;
327 int new_height;
328
329 new_width = w->pos_hints.base_width + ((w->drag.w - w->pos_hints.base_width + dw) / w->pos_hints.step_width) * w->pos_hints.step_width;
330 new_height = w->pos_hints.base_height + ((w->drag.h - w->pos_hints.base_height - dh) / w->pos_hints.step_height) * w->pos_hints.step_height;
331 if ((new_width != w->drag.w) &&
332 (new_width >= w->pos_hints.base_width) &&
333 (new_width <= w->pos_hints.max_width) &&
334 (new_height != w->drag.h) &&
335 (new_height >= w->pos_hints.base_height) &&
336 (new_height <= w->pos_hints.max_height))
337 ecore_win32_window_move_resize(w, w->drag.x, w->drag.y - (new_height - w->drag.h), new_width, new_height);
338 }
339 else
340 {
341 if (((w->drag.w + dw) >= w->pos_hints.min_width) &&
342 ((w->drag.w + dw) <= w->pos_hints.max_width) &&
343 ((w->drag.h - dh) >= w->pos_hints.min_height) &&
344 ((w->drag.h - dh) <= w->pos_hints.max_height))
345 ecore_win32_window_move_resize(w, w->drag.x, w->drag.y + dh, w->drag.w + dw, w->drag.h - dh);
346 }
347 return EINA_TRUE;
348 }
349 if (w->drag.type == HTBOTTOMLEFT)
350 {
351 int dh;
352 int dw;
353
354 dw = ptx - w->drag.px;
355 dh = pty - w->drag.py;
356
357 if (w->pos_hints.flags & ECORE_WIN32_POS_HINTS_STEP_SIZE)
358 {
359 int new_width;
360 int new_height;
361
362 new_width = w->pos_hints.base_width + ((w->drag.w - w->pos_hints.base_width - dw) / w->pos_hints.step_width) * w->pos_hints.step_width;
363 new_height = w->pos_hints.base_height + ((w->drag.h - w->pos_hints.base_height + dh) / w->pos_hints.step_height) * w->pos_hints.step_height;
364 if ((new_width != w->drag.w) &&
365 (new_width >= w->pos_hints.base_width) &&
366 (new_width <= w->pos_hints.max_width) &&
367 (new_height != w->drag.h) &&
368 (new_height >= w->pos_hints.base_height) &&
369 (new_height <= w->pos_hints.max_height))
370 ecore_win32_window_move_resize(w, w->drag.x - (new_width - w->drag.w), w->drag.y, new_width, new_height);
371 }
372 else
373 {
374 if (((w->drag.w - dw) >= w->pos_hints.min_width) &&
375 ((w->drag.w - dw) <= w->pos_hints.max_width) &&
376 ((w->drag.h + dh) >= w->pos_hints.min_height) &&
377 ((w->drag.h + dh) <= w->pos_hints.max_height))
378 ecore_win32_window_move_resize(w, w->drag.x + dw, w->drag.y, w->drag.w - dw, w->drag.h + dh);
379 }
380 return EINA_TRUE;
381 }
382 if (w->drag.type == HTBOTTOMRIGHT)
383 {
384 int dh;
385 int dw;
386
387 dw = ptx - w->drag.px;
388 dh = pty - w->drag.py;
389
390 if (w->pos_hints.flags & ECORE_WIN32_POS_HINTS_STEP_SIZE)
391 {
392 int new_width;
393 int new_height;
394
395 new_width = w->pos_hints.base_width + ((w->drag.w - w->pos_hints.base_width + dw) / w->pos_hints.step_width) * w->pos_hints.step_width;
396 new_height = w->pos_hints.base_height + ((w->drag.h - w->pos_hints.base_height + dh) / w->pos_hints.step_height) * w->pos_hints.step_height;
397 if ((new_width != w->drag.w) &&
398 (new_width >= w->pos_hints.base_width) &&
399 (new_width <= w->pos_hints.max_width) &&
400 (new_height != w->drag.h) &&
401 (new_height >= w->pos_hints.base_height) &&
402 (new_height <= w->pos_hints.max_height))
403 ecore_win32_window_resize(w, new_width, new_height);
404 }
405 else
406 {
407 if (((w->drag.w + dw) >= w->pos_hints.min_width) &&
408 ((w->drag.w + dw) <= w->pos_hints.max_width) &&
409 ((w->drag.h + dh) >= w->pos_hints.min_height) &&
410 ((w->drag.h + dh) <= w->pos_hints.max_height))
411 ecore_win32_window_resize(w, w->drag.w + dw, w->drag.h + dh);
412 }
413 return EINA_TRUE;
414 }
415
416 return EINA_FALSE;
417}
418
161/*============================================================================* 419/*============================================================================*
162 * API * 420 * API *
163 *============================================================================*/ 421 *============================================================================*/
@@ -194,10 +452,10 @@ ecore_win32_window_new(Ecore_Win32_Window *parent,
194{ 452{
195 INF("creating window with border"); 453 INF("creating window with border");
196 454
197 return ecore_win32_window_internal_new(parent, 455 return _ecore_win32_window_internal_new(parent,
198 x, y, 456 x, y,
199 width, height, 457 width, height,
200 WS_OVERLAPPEDWINDOW | WS_SIZEBOX); 458 WS_OVERLAPPEDWINDOW | WS_SIZEBOX);
201} 459}
202 460
203/** 461/**
@@ -222,10 +480,10 @@ ecore_win32_window_override_new(Ecore_Win32_Window *parent,
222{ 480{
223 INF("creating window without border"); 481 INF("creating window without border");
224 482
225 return ecore_win32_window_internal_new(parent, 483 return _ecore_win32_window_internal_new(parent,
226 x, y, 484 x, y,
227 width, height, 485 width, height,
228 WS_POPUP & ~(WS_CAPTION | WS_THICKFRAME)); 486 WS_POPUP & ~(WS_CAPTION | WS_THICKFRAME));
229} 487}
230 488
231/** 489/**
@@ -354,21 +612,16 @@ ecore_win32_window_resize(Ecore_Win32_Window *window,
354 int width, 612 int width,
355 int height) 613 int height)
356{ 614{
357 RECT rect; 615 RECT rect;
358 DWORD style; 616 DWORD style;
359 int x; 617 int x;
360 int y; 618 int y;
361 int minimal_width;
362 int minimal_height;
363 619
364 /* FIXME: on fullscreen, should not resize it */ 620 /* FIXME: on fullscreen, should not resize it */
365 if (!window) return; 621 if (!window) return;
366 622
367 INF("resizing window (%dx%d)", width, height); 623 INF("resizing window (%dx%d)", width, height);
368 624
369 minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width);
370 minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height);
371
372 if (!GetWindowRect(window->window, &rect)) 625 if (!GetWindowRect(window->window, &rect))
373 { 626 {
374 ERR("GetWindowRect() failed"); 627 ERR("GetWindowRect() failed");
@@ -379,10 +632,10 @@ ecore_win32_window_resize(Ecore_Win32_Window *window,
379 y = rect.top; 632 y = rect.top;
380 rect.left = 0; 633 rect.left = 0;
381 rect.top = 0; 634 rect.top = 0;
382 if (width < minimal_width) width = minimal_width; 635 if (width < window->pos_hints.min_width) width = window->pos_hints.min_width;
383 if (width > (int)window->max_width) width = window->max_width; 636 if (width > window->pos_hints.max_width) width = window->pos_hints.max_width;
384 if (height < minimal_height) height = minimal_height; 637 if (height < window->pos_hints.min_height) height = window->pos_hints.min_height;
385 if (height > (int)window->max_height) height = window->max_height; 638 if (height > window->pos_hints.max_height) height = window->pos_hints.max_height;
386 rect.right = width; 639 rect.right = width;
387 rect.bottom = height; 640 rect.bottom = height;
388 if (!(style = GetWindowLong(window->window, GWL_STYLE))) 641 if (!(style = GetWindowLong(window->window, GWL_STYLE)))
@@ -425,25 +678,20 @@ ecore_win32_window_move_resize(Ecore_Win32_Window *window,
425 int width, 678 int width,
426 int height) 679 int height)
427{ 680{
428 RECT rect; 681 RECT rect;
429 DWORD style; 682 DWORD style;
430 int minimal_width;
431 int minimal_height;
432 683
433 /* FIXME: on fullscreen, should not move/resize it */ 684 /* FIXME: on fullscreen, should not move/resize it */
434 if (!window) return; 685 if (!window) return;
435 686
436 INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height); 687 INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height);
437 688
438 minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width);
439 minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height);
440
441 rect.left = 0; 689 rect.left = 0;
442 rect.top = 0; 690 rect.top = 0;
443 if (width < minimal_width) width = minimal_width; 691 if (width < window->pos_hints.min_width) width = window->pos_hints.min_width;
444 if (width > (int)window->max_width) width = window->max_width; 692 if (width > window->pos_hints.max_width) width = window->pos_hints.max_width;
445 if (height < minimal_height) height = minimal_height; 693 if (height < window->pos_hints.min_height) height = window->pos_hints.min_height;
446 if (height > (int)window->max_height) height = window->max_height; 694 if (height > window->pos_hints.max_height) height = window->pos_hints.max_height;
447 rect.right = width; 695 rect.right = width;
448 rect.bottom = height; 696 rect.bottom = height;
449 if (!(style = GetWindowLong(window->window, GWL_STYLE))) 697 if (!(style = GetWindowLong(window->window, GWL_STYLE)))
@@ -499,8 +747,8 @@ ecore_win32_window_geometry_get(Ecore_Win32_Window *window,
499 { 747 {
500 if (x) *x = 0; 748 if (x) *x = 0;
501 if (y) *y = 0; 749 if (y) *y = 0;
502 if (width) *width = GetSystemMetrics(SM_CXSCREEN); 750 if (width) *width = 0;
503 if (height) *height = GetSystemMetrics(SM_CYSCREEN); 751 if (height) *height = 0;
504 752
505 return; 753 return;
506 } 754 }
@@ -563,8 +811,8 @@ ecore_win32_window_size_get(Ecore_Win32_Window *window,
563 811
564 if (!window) 812 if (!window)
565 { 813 {
566 if (width) *width = GetSystemMetrics(SM_CXSCREEN); 814 if (width) *width = 0;
567 if (height) *height = GetSystemMetrics(SM_CYSCREEN); 815 if (height) *height = 0;
568 816
569 return; 817 return;
570 } 818 }
@@ -594,14 +842,27 @@ ecore_win32_window_size_get(Ecore_Win32_Window *window,
594 */ 842 */
595EAPI void 843EAPI void
596ecore_win32_window_size_min_set(Ecore_Win32_Window *window, 844ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
597 unsigned int min_width, 845 int min_width,
598 unsigned int min_height) 846 int min_height)
599{ 847{
600 if (!window) return; 848 if (!window) return;
601 849
602 printf ("ecore_win32_window_size_min_set : %p %d %d\n", window, min_width, min_height); 850 INF("setting minimum window size to %dx%d", min_width, min_height);
603 window->min_width = min_width; 851
604 window->min_height = min_height; 852 if ((min_width > 0) && (min_height > 0))
853 {
854 if (min_width < window->mininal_window_width)
855 min_width = window->mininal_window_width;
856
857 window->pos_hints.flags |= ECORE_WIN32_POS_HINTS_MIN_SIZE;
858 window->pos_hints.min_width = min_width;
859 window->pos_hints.min_height = min_height;
860 if (!(window->pos_hints.flags & ECORE_WIN32_POS_HINTS_BASE_SIZE))
861 {
862 window->pos_hints.base_width = min_width;
863 window->pos_hints.base_height = min_height;
864 }
865 }
605} 866}
606 867
607/** 868/**
@@ -617,14 +878,20 @@ ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
617 */ 878 */
618EAPI void 879EAPI void
619ecore_win32_window_size_min_get(Ecore_Win32_Window *window, 880ecore_win32_window_size_min_get(Ecore_Win32_Window *window,
620 unsigned int *min_width, 881 int *min_width,
621 unsigned int *min_height) 882 int *min_height)
622{ 883{
623 if (!window) return; 884 if (!window || !(window->pos_hints.flags & ECORE_WIN32_POS_HINTS_MIN_SIZE))
885 {
886 if (min_width) *min_width = 0;
887 if (min_height) *min_height = 0;
888 return;
889 }
890
891 INF("getting minimum window size: %dx%d", window->pos_hints.min_width, window->pos_hints.min_height);
624 892
625 printf ("ecore_win32_window_size_min_get : %p %d %d\n", window, window->min_width, window->min_height); 893 if (min_width) *min_width = window->pos_hints.min_width;
626 if (min_width) *min_width = window->min_width; 894 if (min_height) *min_height = window->pos_hints.min_height;
627 if (min_height) *min_height = window->min_height;
628} 895}
629 896
630/** 897/**
@@ -640,14 +907,19 @@ ecore_win32_window_size_min_get(Ecore_Win32_Window *window,
640 */ 907 */
641EAPI void 908EAPI void
642ecore_win32_window_size_max_set(Ecore_Win32_Window *window, 909ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
643 unsigned int max_width, 910 int max_width,
644 unsigned int max_height) 911 int max_height)
645{ 912{
646 if (!window) return; 913 if (!window) return;
647 914
648 printf ("ecore_win32_window_size_max_set : %p %d %d\n", window, max_width, max_height); 915 INF("setting maximum window size to %dx%d", max_width, max_height);
649 window->max_width = max_width; 916
650 window->max_height = max_height; 917 if ((max_width > 0) && (max_height > 0))
918 {
919 window->pos_hints.flags |= ECORE_WIN32_POS_HINTS_MAX_SIZE;
920 window->pos_hints.max_width = max_width;
921 window->pos_hints.max_height = max_height;
922 }
651} 923}
652 924
653/** 925/**
@@ -663,14 +935,20 @@ ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
663 */ 935 */
664EAPI void 936EAPI void
665ecore_win32_window_size_max_get(Ecore_Win32_Window *window, 937ecore_win32_window_size_max_get(Ecore_Win32_Window *window,
666 unsigned int *max_width, 938 int *max_width,
667 unsigned int *max_height) 939 int *max_height)
668{ 940{
669 if (!window) return; 941 if (!window || !(window->pos_hints.flags & ECORE_WIN32_POS_HINTS_MAX_SIZE))
942 {
943 if (max_width) *max_width = 0;
944 if (max_height) *max_height = 0;
945 return;
946 }
670 947
671 printf ("ecore_win32_window_size_max_get : %p %d %d\n", window, window->max_width, window->max_height); 948 INF("getting maximum window size: %dx%d", window->pos_hints.max_width, window->pos_hints.max_height);
672 if (max_width) *max_width = window->max_width; 949
673 if (max_height) *max_height = window->max_height; 950 if (max_width) *max_width = window->pos_hints.max_width;
951 if (max_height) *max_height = window->pos_hints.max_height;
674} 952}
675 953
676/** 954/**
@@ -686,14 +964,19 @@ ecore_win32_window_size_max_get(Ecore_Win32_Window *window,
686 */ 964 */
687EAPI void 965EAPI void
688ecore_win32_window_size_base_set(Ecore_Win32_Window *window, 966ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
689 unsigned int base_width, 967 int base_width,
690 unsigned int base_height) 968 int base_height)
691{ 969{
692 printf ("ecore_win32_window_size_base_set : %p %d %d\n", window, base_width, base_height);
693 if (!window) return; 970 if (!window) return;
694 971
695 window->base_width = base_width; 972 INF("setting base window size to %dx%d", base_width, base_height);
696 window->base_height = base_height; 973
974 if ((base_width > 0) && (base_height > 0))
975 {
976 window->pos_hints.flags |= ECORE_WIN32_POS_HINTS_BASE_SIZE;
977 window->pos_hints.base_width = base_width;
978 window->pos_hints.base_height = base_height;
979 }
697} 980}
698 981
699/** 982/**
@@ -709,14 +992,20 @@ ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
709 */ 992 */
710EAPI void 993EAPI void
711ecore_win32_window_size_base_get(Ecore_Win32_Window *window, 994ecore_win32_window_size_base_get(Ecore_Win32_Window *window,
712 unsigned int *base_width, 995 int *base_width,
713 unsigned int *base_height) 996 int *base_height)
714{ 997{
715 if (!window) return; 998 if (!window || !(window->pos_hints.flags & ECORE_WIN32_POS_HINTS_BASE_SIZE))
999 {
1000 if (base_width) *base_width = 0;
1001 if (base_height) *base_height = 0;
1002 return;
1003 }
1004
1005 INF("getting base window size: %dx%d", window->pos_hints.base_width, window->pos_hints.base_height);
716 1006
717 printf ("ecore_win32_window_size_base_get : %p %d %d\n", window, window->base_width, window->base_height); 1007 if (base_width) *base_width = window->pos_hints.base_width;
718 if (base_width) *base_width = window->base_width; 1008 if (base_height) *base_height = window->pos_hints.base_height;
719 if (base_height) *base_height = window->base_height;
720} 1009}
721 1010
722/** 1011/**
@@ -732,14 +1021,19 @@ ecore_win32_window_size_base_get(Ecore_Win32_Window *window,
732 */ 1021 */
733EAPI void 1022EAPI void
734ecore_win32_window_size_step_set(Ecore_Win32_Window *window, 1023ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
735 unsigned int step_width, 1024 int step_width,
736 unsigned int step_height) 1025 int step_height)
737{ 1026{
738 printf ("ecore_win32_window_size_step_set : %p %d %d\n", window, step_width, step_height);
739 if (!window) return; 1027 if (!window) return;
740 1028
741 window->step_width = step_width; 1029 INF("setting step window size to %dx%d", step_width, step_height);
742 window->step_height = step_height; 1030
1031 if ((step_width > 0) && (step_height > 0))
1032 {
1033 window->pos_hints.flags |= ECORE_WIN32_POS_HINTS_STEP_SIZE;
1034 window->pos_hints.step_width = step_width;
1035 window->pos_hints.step_height = step_height;
1036 }
743} 1037}
744 1038
745/** 1039/**
@@ -755,14 +1049,20 @@ ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
755 */ 1049 */
756EAPI void 1050EAPI void
757ecore_win32_window_size_step_get(Ecore_Win32_Window *window, 1051ecore_win32_window_size_step_get(Ecore_Win32_Window *window,
758 unsigned int *step_width, 1052 int *step_width,
759 unsigned int *step_height) 1053 int *step_height)
760{ 1054{
761 if (!window) return; 1055 if (!window || !(window->pos_hints.flags & ECORE_WIN32_POS_HINTS_STEP_SIZE))
1056 {
1057 if (step_width) *step_width = 0;
1058 if (step_height) *step_height = 0;
1059 return;
1060 }
1061
1062 INF("getting step window size: %dx%d", window->pos_hints.step_width, window->pos_hints.step_height);
762 1063
763 printf ("ecore_win32_window_size_step_get : %p %d %d\n", window, window->step_width, window->step_height); 1064 if (step_width) *step_width = window->pos_hints.step_width;
764 if (step_width) *step_width = window->step_width; 1065 if (step_height) *step_height = window->pos_hints.step_height;
765 if (step_height) *step_height = window->step_height;
766} 1066}
767 1067
768/** 1068/**