6 #include <stdio.h> /* for printf */
8 #define _WIN32_WINNT 0x0500 // For WS_EX_LAYERED
10 #define WIN32_LEAN_AND_MEAN
12 #undef WIN32_LEAN_AND_MEAN
16 #include "Ecore_Win32.h"
17 #include "ecore_win32_private.h"
20 /***** Private declarations *****/
23 typedef enum _Ecore_Win32_Window_Z_Order Ecore_Win32_Window_Z_Order;
24 enum _Ecore_Win32_Window_Z_Order
26 ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM,
27 ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST,
28 ECORE_WIN32_WINDOW_Z_ORDER_TOP,
29 ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST
32 static Ecore_Win32_Window *ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
43 ecore_win32_window_new(Ecore_Win32_Window *parent,
49 INF("creating window with border");
51 return ecore_win32_window_internal_new(parent,
54 WS_OVERLAPPEDWINDOW | WS_SIZEBOX);
57 /* simulate X11 override windows */
59 ecore_win32_window_override_new(Ecore_Win32_Window *parent,
65 INF("creating window without border");
67 return ecore_win32_window_internal_new(parent,
74 ecore_win32_window_free(Ecore_Win32_Window *window)
76 struct _Ecore_Win32_Window *wnd = window;
80 INF("destroying window");
83 free(wnd->shape.mask);
85 DestroyWindow(((struct _Ecore_Win32_Window *)window)->window);
90 ecore_win32_window_hwnd_get(Ecore_Win32_Window *window)
92 if (!window) return NULL;
94 return ((struct _Ecore_Win32_Window *)window)->window;
99 ecore_win32_window_configure(Ecore_Win32_Window *window,
100 Ecore_Win32_Window_Z_Order order,
110 case ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM:
113 case ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST:
116 case ECORE_WIN32_WINDOW_Z_ORDER_TOP:
119 case ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST:
125 SetWindowPos((struct _Ecore_Win32_Window *)window->window, w, x, y, width, height, ???);
130 ecore_win32_window_move(Ecore_Win32_Window *window,
139 INF("moving window (%dx%d)", x, y);
141 w = ((struct _Ecore_Win32_Window *)window)->window;
142 if (!GetWindowRect(w, &rect))
144 ERR("GetWindowRect() failed");
148 if (!MoveWindow(w, x, y,
149 rect.right - rect.left,
150 rect.bottom - rect.top,
153 ERR("MoveWindow() failed");
158 ecore_win32_window_resize(Ecore_Win32_Window *window,
163 struct _Ecore_Win32_Window *w;
170 INF("resizing window (%dx%d)", width, height);
172 w = (struct _Ecore_Win32_Window *)window;
173 if (!GetWindowRect(w->window, &rect))
175 ERR("GetWindowRect() failed");
183 /* if (width < w->min_width) width = w->min_width; */
184 /* if (width > w->max_width) width = w->max_width; */
185 /* printf ("ecore_win32_window_resize 1 : %d %d %d\n", w->min_height, w->max_height, height); */
186 /* if (height < w->min_height) height = w->min_height; */
187 /* printf ("ecore_win32_window_resize 2 : %d %d\n", w->max_height, height); */
188 /* if (height > w->max_height) height = w->max_height; */
189 /* printf ("ecore_win32_window_resize 3 : %d %d\n", w->max_height, height); */
191 rect.bottom = height;
192 if (!(style = GetWindowLong(w->window, GWL_STYLE)))
194 ERR("GetWindowLong() failed");
197 if (!AdjustWindowRect(&rect, style, FALSE))
199 ERR("AdjustWindowRect() failed");
203 if (!MoveWindow(w->window, x, y,
204 rect.right - rect.left,
205 rect.bottom - rect.top,
208 ERR("MoveWindow() failed");
213 ecore_win32_window_move_resize(Ecore_Win32_Window *window,
220 struct _Ecore_Win32_Window *w;
225 INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height);
227 w = ((struct _Ecore_Win32_Window *)window);
230 if ((unsigned int)width < w->min_width) width = w->min_width;
231 if ((unsigned int)width > w->max_width) width = w->max_width;
232 if ((unsigned int)height < w->min_height) height = w->min_height;
233 if ((unsigned int)height > w->max_height) height = w->max_height;
235 rect.bottom = height;
236 if (!(style = GetWindowLong(w->window, GWL_STYLE)))
238 ERR("GetWindowLong() failed");
241 if (!AdjustWindowRect(&rect, style, FALSE))
243 ERR("AdjustWindowRect() failed");
247 if (!MoveWindow(w->window, x, y,
248 rect.right - rect.left,
249 rect.bottom - rect.top,
252 ERR("MoveWindow() failed");
257 ecore_win32_window_geometry_get(Ecore_Win32_Window *window,
267 INF("getting window geometry");
273 if (width) *width = GetSystemMetrics(SM_CXSCREEN);
274 if (height) *height = GetSystemMetrics(SM_CYSCREEN);
279 if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
282 ERR("GetClientRect() failed");
286 if (width) *width = 0;
287 if (height) *height = 0;
292 w = rect.right - rect.left;
293 h = rect.bottom - rect.top;
295 if (!GetWindowRect(((struct _Ecore_Win32_Window *)window)->window,
298 ERR("GetWindowRect() failed");
302 if (width) *width = 0;
303 if (height) *height = 0;
308 if (x) *x = rect.left;
309 if (y) *y = rect.top;
310 if (width) *width = w;
311 if (height) *height = h;
315 ecore_win32_window_size_get(Ecore_Win32_Window *window,
321 INF("getting window size");
325 if (width) *width = GetSystemMetrics(SM_CXSCREEN);
326 if (height) *height = GetSystemMetrics(SM_CYSCREEN);
331 if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
334 ERR("GetClientRect() failed");
336 if (width) *width = 0;
337 if (height) *height = 0;
340 if (width) *width = rect.right - rect.left;
341 if (height) *height = rect.bottom - rect.top;
345 ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
346 unsigned int min_width,
347 unsigned int min_height)
349 struct _Ecore_Win32_Window *w;
353 printf ("ecore_win32_window_size_min_set : %p %d %d\n", window, min_width, min_height);
354 w = (struct _Ecore_Win32_Window *)window;
355 w->min_width = min_width;
356 w->min_height = min_height;
360 ecore_win32_window_size_min_get(Ecore_Win32_Window *window,
361 unsigned int *min_width,
362 unsigned int *min_height)
364 struct _Ecore_Win32_Window *w;
368 w = (struct _Ecore_Win32_Window *)window;
369 printf ("ecore_win32_window_size_min_get : %p %d %d\n", window, w->min_width, w->min_height);
370 if (min_width) *min_width = w->min_width;
371 if (min_height) *min_height = w->min_height;
375 ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
376 unsigned int max_width,
377 unsigned int max_height)
379 struct _Ecore_Win32_Window *w;
383 printf ("ecore_win32_window_size_max_set : %p %d %d\n", window, max_width, max_height);
384 w = (struct _Ecore_Win32_Window *)window;
385 w->max_width = max_width;
386 w->max_height = max_height;
390 ecore_win32_window_size_max_get(Ecore_Win32_Window *window,
391 unsigned int *max_width,
392 unsigned int *max_height)
394 struct _Ecore_Win32_Window *w;
398 w = (struct _Ecore_Win32_Window *)window;
399 printf ("ecore_win32_window_size_max_get : %p %d %d\n", window, w->max_width, w->max_height);
400 if (max_width) *max_width = w->max_width;
401 if (max_height) *max_height = w->max_height;
405 ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
406 unsigned int base_width,
407 unsigned int base_height)
409 struct _Ecore_Win32_Window *w;
411 printf ("ecore_win32_window_size_base_set : %p %d %d\n", window, base_width, base_height);
414 w = (struct _Ecore_Win32_Window *)window;
415 w->base_width = base_width;
416 w->base_height = base_height;
420 ecore_win32_window_size_base_get(Ecore_Win32_Window *window,
421 unsigned int *base_width,
422 unsigned int *base_height)
424 struct _Ecore_Win32_Window *w;
428 w = (struct _Ecore_Win32_Window *)window;
429 printf ("ecore_win32_window_size_base_get : %p %d %d\n", window, w->base_width, w->base_height);
430 if (base_width) *base_width = w->base_width;
431 if (base_height) *base_height = w->base_height;
435 ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
436 unsigned int step_width,
437 unsigned int step_height)
439 struct _Ecore_Win32_Window *w;
441 printf ("ecore_win32_window_size_step_set : %p %d %d\n", window, step_width, step_height);
444 w = (struct _Ecore_Win32_Window *)window;
445 w->step_width = step_width;
446 w->step_height = step_height;
450 ecore_win32_window_size_step_get(Ecore_Win32_Window *window,
451 unsigned int *step_width,
452 unsigned int *step_height)
454 struct _Ecore_Win32_Window *w;
458 w = (struct _Ecore_Win32_Window *)window;
459 printf ("ecore_win32_window_size_step_get : %p %d %d\n", window, w->step_width, w->step_height);
460 if (step_width) *step_width = w->step_width;
461 if (step_height) *step_height = w->step_height;
465 ecore_win32_window_shape_set(Ecore_Win32_Window *window,
466 unsigned short width,
467 unsigned short height,
470 struct _Ecore_Win32_Window *wnd;
474 OSVERSIONINFO version_info;
479 wnd = (struct _Ecore_Win32_Window *)window;
483 wnd->shape.enabled = 0;
484 if (wnd->shape.layered != 0)
486 wnd->shape.layered = 0;
487 #if defined(WS_EX_LAYERED)
489 if (!SetWindowLongPtr(wnd->window, GWL_EXSTYLE,
490 GetWindowLong(wnd->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) &&
491 (GetLastError() != 0))
493 ERR("SetWindowLongPtr() failed");
496 if (!RedrawWindow(wnd->window, NULL, NULL,
497 RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN))
499 ERR("RedrawWindow() failed");
505 if (!SetWindowRgn(wnd->window, NULL, TRUE))
507 ERR("SetWindowRgn() failed");
512 if (width == 0 || height == 0)
515 wnd->shape.enabled = 1;
517 if (width != wnd->shape.width || height != wnd->shape.height)
519 wnd->shape.width = width;
520 wnd->shape.height = height;
523 free(wnd->shape.mask);
524 wnd->shape.mask = NULL;
526 wnd->shape.mask = malloc(width * height);
528 memcpy(wnd->shape.mask, mask, width * height);
530 wnd->shape.layered = 0;
532 #if defined(WS_EX_LAYERED)
533 version_info.dwOSVersionInfoSize = sizeof(version_info);
534 if (GetVersionEx(&version_info) == TRUE && version_info.dwMajorVersion == 5)
537 if (!SetWindowLongPtr(wnd->window, GWL_EXSTYLE,
538 GetWindowLong(wnd->window, GWL_EXSTYLE) | WS_EX_LAYERED) &&
539 (GetLastError() != 0))
541 ERR("SetWindowLongPtr() failed");
544 wnd->shape.layered = 1;
549 if (!(rgn = CreateRectRgn(0, 0, 0, 0)))
551 ERR("CreateRectRgn() failed");
554 for (y = 0; y < height; y++)
558 if (!(rgnLine = CreateRectRgn(0, 0, 0, 0)))
560 ERR("CreateRectRgn() failed");
563 for (x = 0; x < width; x++)
565 if (mask[y * width + x] > 0)
569 if (!(rgnDot = CreateRectRgn(x, y, x + 1, y + 1)))
571 ERR("CreateRectRgn() failed");
574 if (CombineRgn(rgnLine, rgnLine, rgnDot, RGN_OR) == ERROR)
576 ERR("CombineRgn() has not created a new region");
578 if (!DeleteObject(rgnDot))
580 ERR("DeleteObject() failed");
585 if (CombineRgn(rgn, rgn, rgnLine, RGN_OR) == ERROR)
587 ERR("CombineRgn() has not created a new region");
589 if (!DeleteObject(rgnLine))
591 ERR("DeleteObject() failed");
595 if (!SetWindowRgn(wnd->window, rgn, TRUE))
597 ERR("SetWindowRgn() failed");
602 ecore_win32_window_show(Ecore_Win32_Window *window)
606 INF("showing window");
608 ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_SHOWNORMAL);
609 if (!UpdateWindow(((struct _Ecore_Win32_Window *)window)->window))
611 ERR("UpdateWindow() failed");
615 /* FIXME: seems to block the taskbar */
617 ecore_win32_window_hide(Ecore_Win32_Window *window)
621 INF("hiding window");
623 ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_HIDE);
627 ecore_win32_window_raise(Ecore_Win32_Window *window)
631 INF("raising window");
633 if (!SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
634 HWND_TOP, 0, 0, 0, 0,
635 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
637 ERR("SetWindowPos() failed");
642 ecore_win32_window_lower(Ecore_Win32_Window *window)
646 INF("lowering window");
648 if (!SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
649 HWND_BOTTOM, 0, 0, 0, 0,
650 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
652 ERR("SetWindowPos() failed");
657 ecore_win32_window_title_set(Ecore_Win32_Window *window,
662 if (!title || !title[0]) return;
664 INF("setting window title");
666 if (!SetWindowText(((struct _Ecore_Win32_Window *)window)->window, title))
668 ERR("SetWindowText() failed");
673 ecore_win32_window_focus_set(Ecore_Win32_Window *window)
677 INF("focusing window");
679 if (!SetFocus(((struct _Ecore_Win32_Window *)window)->window))
681 ERR("SetFocus() failed");
686 ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
689 struct _Ecore_Win32_Window *ew;
693 ew = (struct _Ecore_Win32_Window *)window;
694 if (((ew->iconified) && (on)) ||
695 ((!ew->iconified) && (!on)))
698 INF("iconifying window: %s", on ? "yes" : "no");
700 ShowWindow(ew->window, on ? SW_MINIMIZE : SW_RESTORE);
705 ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
710 struct _Ecore_Win32_Window *ew;
715 ew = (struct _Ecore_Win32_Window *)window;
716 if (((ew->borderless) && (on)) ||
717 ((!ew->borderless) && (!on)))
720 INF("setting window without border: %s", on ? "yes" : "no");
724 style = GetWindowLong(w, GWL_STYLE);
727 if (!GetClientRect(w, &rect))
729 ERR("GetClientRect() failed");
733 if (!SetWindowLongPtr(w, GWL_STYLE, style & ~(WS_CAPTION | WS_THICKFRAME)) && (GetLastError() != 0))
735 ERR("SetWindowLongPtr() failed");
741 if (!GetWindowRect(w, &rect))
743 ERR("GetWindowRect() failed");
746 style |= WS_CAPTION | WS_THICKFRAME;
747 if (!AdjustWindowRect (&rect, style, FALSE))
749 ERR("AdjustWindowRect() failed");
753 if (!SetWindowLongPtr(w, GWL_STYLE, style) && (GetLastError() != 0))
755 ERR("SetWindowLongPtr() failed");
759 if (!SetWindowPos(w, HWND_TOPMOST,
761 rect.right - rect.left, rect.bottom - rect.top,
762 SWP_NOMOVE | SWP_FRAMECHANGED))
764 ERR("SetWindowPos() failed");
771 ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
774 struct _Ecore_Win32_Window *ew;
779 ew = (struct _Ecore_Win32_Window *)window;
780 if (((ew->fullscreen) && (on)) ||
781 ((!ew->fullscreen) && (!on)))
784 INF("setting fullscreen: %s", on ? "yes" : "no");
786 ew->fullscreen = !!on;
793 if (!GetWindowRect(w, &ew->rect))
795 ERR("GetWindowRect() failed");
798 if (!(ew->style = GetWindowLong(w, GWL_STYLE)))
800 ERR("GetWindowLong() failed");
803 style = ew->style & ~WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX;
804 style |= WS_VISIBLE | WS_POPUP;
806 if (!SetWindowLongPtr(w, GWL_STYLE, style) && (GetLastError() != 0))
808 ERR("SetWindowLongPtr() failed");
812 if (!SetWindowLongPtr(w, GWL_EXSTYLE, WS_EX_TOPMOST) && (GetLastError() != 0))
814 ERR("SetWindowLongPtr() failed");
817 if (!SetWindowPos(w, HWND_TOPMOST, 0, 0,
818 GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN),
819 SWP_NOCOPYBITS | SWP_SHOWWINDOW))
821 ERR("SetWindowPos() failed");
828 if (!SetWindowLongPtr(w, GWL_STYLE, ew->style) && (GetLastError() != 0))
830 ERR("SetWindowLongPtr() failed");
834 if (!SetWindowLongPtr(w, GWL_EXSTYLE, 0) && (GetLastError() != 0))
836 ERR("SetWindowLongPtr() failed");
839 if (!SetWindowPos(w, HWND_NOTOPMOST,
842 ew->rect.right - ew->rect.left,
843 ew->rect.bottom - ew->rect.top,
844 SWP_NOCOPYBITS | SWP_SHOWWINDOW))
846 ERR("SetWindowPos() failed");
853 ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
854 Ecore_Win32_Cursor *cursor)
856 INF("setting cursor");
858 if (!SetClassLong(((struct _Ecore_Win32_Window *)window)->window,
859 GCL_HCURSOR, (LONG)cursor))
861 ERR("SetClassLong() failed");
866 ecore_win32_window_state_set(Ecore_Win32_Window *window,
867 Ecore_Win32_Window_State *state,
872 if (!window || !state || !num)
875 INF("setting cursor state");
877 for (i = 0; i < num; i++)
881 case ECORE_WIN32_WINDOW_STATE_ICONIFIED:
882 ((struct _Ecore_Win32_Window *)window)->state.iconified = 1;
884 case ECORE_WIN32_WINDOW_STATE_MODAL:
885 ((struct _Ecore_Win32_Window *)window)->state.modal = 1;
887 case ECORE_WIN32_WINDOW_STATE_STICKY:
888 ((struct _Ecore_Win32_Window *)window)->state.sticky = 1;
890 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT:
891 ((struct _Ecore_Win32_Window *)window)->state.maximized_vert = 1;
893 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ:
894 ((struct _Ecore_Win32_Window *)window)->state.maximized_horz = 1;
896 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
897 ((struct _Ecore_Win32_Window *)window)->state.maximized_horz = 1;
898 ((struct _Ecore_Win32_Window *)window)->state.maximized_vert = 1;
900 case ECORE_WIN32_WINDOW_STATE_SHADED:
901 ((struct _Ecore_Win32_Window *)window)->state.shaded = 1;
903 case ECORE_WIN32_WINDOW_STATE_HIDDEN:
904 ((struct _Ecore_Win32_Window *)window)->state.hidden = 1;
906 case ECORE_WIN32_WINDOW_STATE_FULLSCREEN:
907 ((struct _Ecore_Win32_Window *)window)->state.fullscreen = 1;
909 case ECORE_WIN32_WINDOW_STATE_ABOVE:
910 ((struct _Ecore_Win32_Window *)window)->state.above = 1;
912 case ECORE_WIN32_WINDOW_STATE_BELOW:
913 ((struct _Ecore_Win32_Window *)window)->state.below = 1;
915 case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION:
916 ((struct _Ecore_Win32_Window *)window)->state.demands_attention = 1;
918 case ECORE_WIN32_WINDOW_STATE_UNKNOWN:
919 /* nothing to be done */
926 ecore_win32_window_state_request_send(Ecore_Win32_Window *window,
927 Ecore_Win32_Window_State state,
930 struct _Ecore_Win32_Window *ew;
935 ew = (struct _Ecore_Win32_Window *)window;
938 INF("sending cursor state");
942 case ECORE_WIN32_WINDOW_STATE_ICONIFIED:
943 if (ew->state.iconified)
944 ecore_win32_window_iconified_set(window, set);
946 case ECORE_WIN32_WINDOW_STATE_MODAL:
949 case ECORE_WIN32_WINDOW_STATE_STICKY:
950 ew->state.sticky = 1;
952 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT:
953 if (ew->state.maximized_vert)
959 if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
962 ERR("SystemParametersInfo() failed");
966 height = rect.bottom - rect.top;
968 if (!GetClientRect(w, &rect))
970 ERR("GetClientRect() failed");
974 if (!MoveWindow(w, rect.left, y,
975 rect.right - rect.left,
979 ERR("MoveWindow() failed");
983 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ:
984 if (ew->state.maximized_horz)
988 if (!GetClientRect(w, &rect))
990 ERR("GetClientRect() failed");
994 if (!MoveWindow(w, 0, rect.top,
995 GetSystemMetrics(SM_CXSCREEN),
996 rect.bottom - rect.top,
999 ERR("MoveWindow() failed");
1003 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
1004 if (ew->state.maximized_vert && ew->state.maximized_horz)
1008 if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
1011 ERR("SystemParametersInfo() failed");
1015 if (!MoveWindow(w, 0, 0,
1016 GetSystemMetrics(SM_CXSCREEN),
1017 rect.bottom - rect.top,
1020 ERR("MoveWindow() failed");
1024 case ECORE_WIN32_WINDOW_STATE_SHADED:
1025 ew->state.shaded = 1;
1027 case ECORE_WIN32_WINDOW_STATE_HIDDEN:
1028 ew->state.hidden = 1;
1030 case ECORE_WIN32_WINDOW_STATE_FULLSCREEN:
1031 if (ew->state.fullscreen)
1032 ecore_win32_window_fullscreen_set(window, set);
1034 case ECORE_WIN32_WINDOW_STATE_ABOVE:
1035 if (ew->state.above)
1036 if (!SetWindowPos(w, HWND_TOP,
1039 SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW))
1041 ERR("SetWindowPos() failed");
1044 case ECORE_WIN32_WINDOW_STATE_BELOW:
1045 if (ew->state.below)
1046 if (!SetWindowPos(w, HWND_BOTTOM,
1049 SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW))
1051 ERR("SetWindowPos() failed");
1054 case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION:
1055 ew->state.demands_attention = 1;
1057 case ECORE_WIN32_WINDOW_STATE_UNKNOWN:
1058 /* nothing to be done */
1064 ecore_win32_window_type_set(Ecore_Win32_Window *window,
1065 Ecore_Win32_Window_Type type)
1070 INF("setting window type");
1074 case ECORE_WIN32_WINDOW_TYPE_DESKTOP:
1075 ((struct _Ecore_Win32_Window *)window)->type.desktop = 1;
1077 case ECORE_WIN32_WINDOW_TYPE_DOCK:
1078 ((struct _Ecore_Win32_Window *)window)->type.dock = 1;
1080 case ECORE_WIN32_WINDOW_TYPE_TOOLBAR:
1081 ((struct _Ecore_Win32_Window *)window)->type.toolbar = 1;
1083 case ECORE_WIN32_WINDOW_TYPE_MENU:
1084 ((struct _Ecore_Win32_Window *)window)->type.menu = 1;
1086 case ECORE_WIN32_WINDOW_TYPE_UTILITY:
1087 ((struct _Ecore_Win32_Window *)window)->type.utility = 1;
1089 case ECORE_WIN32_WINDOW_TYPE_SPLASH:
1090 ((struct _Ecore_Win32_Window *)window)->type.splash = 1;
1092 case ECORE_WIN32_WINDOW_TYPE_DIALOG:
1093 ((struct _Ecore_Win32_Window *)window)->type.dialog = 1;
1095 case ECORE_WIN32_WINDOW_TYPE_NORMAL:
1096 ((struct _Ecore_Win32_Window *)window)->type.normal = 1;
1098 case ECORE_WIN32_WINDOW_TYPE_UNKNOWN:
1099 ((struct _Ecore_Win32_Window *)window)->type.normal = 1;
1105 /***** Private functions definitions *****/
1107 static Ecore_Win32_Window *
1108 ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
1116 struct _Ecore_Win32_Window *w;
1120 w = (struct _Ecore_Win32_Window *)calloc(1, sizeof(struct _Ecore_Win32_Window));
1123 ERR("malloc() failed");
1130 rect.bottom = height;
1131 if (!AdjustWindowRect(&rect, style, FALSE))
1133 ERR("AdjustWindowRect() failed");
1138 minimal_width = GetSystemMetrics(SM_CXMIN);
1139 minimal_height = GetSystemMetrics(SM_CYMIN);
1140 /* if (((rect.right - rect.left) < minimal_width) || */
1141 /* ((rect.bottom - rect.top) < minimal_height)) */
1143 /* fprintf (stderr, "[Ecore] [Win32] ERROR !!\n"); */
1144 /* fprintf (stderr, " Wrong size %ld\n", rect.right - rect.left); */
1148 if ((rect.right - rect.left) < minimal_width)
1150 rect.right = rect.left + minimal_width;
1153 w->window = CreateWindowEx(0,
1154 ECORE_WIN32_WINDOW_CLASS, "",
1157 rect.right - rect.left,
1158 rect.bottom - rect.top,
1159 parent ? ((struct _Ecore_Win32_Window *)parent)->window : NULL,
1160 NULL, _ecore_win32_instance, NULL);
1163 ERR("CreateWindowEx() failed");
1169 if (!SetWindowLongPtr(w->window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0))
1171 ERR("SetWindowLongPtr() failed");
1172 DestroyWindow(w->window);
1179 w->max_width = 32767;
1180 w->max_height = 32767;
1182 w->base_height = -1;
1184 w->step_height = -1;
1186 w->state.iconified = 0;
1188 w->state.sticky = 0;
1189 w->state.maximized_vert = 0;
1190 w->state.maximized_horz = 0;
1191 w->state.shaded = 0;
1192 w->state.hidden = 0;
1193 w->state.fullscreen = 0;
1196 w->state.demands_attention = 0;
1198 w->type.desktop = 0;
1200 w->type.toolbar = 0;
1202 w->type.utility = 0;
1207 w->pointer_is_in = 0;