#undef WIN32_LEAN_AND_MEAN
#include <windowsx.h>
+#include <Eina.h>
+
#include "Ecore.h"
#include "Ecore_Win32.h"
#include "ecore_win32_private.h"
WPARAM window_param,
LPARAM data_param);
+static void _ecore_wince_error_print_cb(Eina_Error_Level level,
+ const char *file,
+ const char *fnc,
+ int line,
+ const char *fmt,
+ void *data,
+ va_list args);
+
/***** API *****/
{
WNDCLASS wc;
+ eina_error_print_cb_set(_ecore_wince_error_print_cb, NULL);
+
+ EINA_ERROR_PINFO("initializing ecore_win32 (current count: %d)\n", _ecore_win32_init_count);
+
if (_ecore_win32_init_count > 0)
{
_ecore_win32_init_count++;
return _ecore_win32_init_count;
}
- printf (" *** ecore_win32_init\n");
_ecore_win32_instance = GetModuleHandle(NULL);
if (!_ecore_win32_instance)
- return 0;
+ {
+ EINA_ERROR_PERR("GetModuleHandle() failed\n");
+ return 0;
+ }
memset (&wc, 0, sizeof (WNDCLASS));
wc.style = CS_HREDRAW | CS_VREDRAW;
if(!RegisterClass(&wc))
{
+ EINA_ERROR_PERR("RegisterClass() failed\n");
FreeLibrary(_ecore_win32_instance);
return 0;
}
if (!ecore_win32_dnd_init())
{
+ EINA_ERROR_PERR("ecore_win32_dnd_init() failed\n");
FreeLibrary(_ecore_win32_instance);
return 0;
}
int
ecore_win32_shutdown()
{
+ EINA_ERROR_PINFO("shutting down ecore_win32 (current count: %d)\n", _ecore_win32_init_count);
+
_ecore_win32_init_count--;
if (_ecore_win32_init_count > 0) return _ecore_win32_init_count;
if (!_ecore_win32_instance) return _ecore_win32_init_count;
ecore_win32_dnd_shutdown();
- UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance);
- FreeLibrary(_ecore_win32_instance);
+ if (!UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance))
+ {
+ EINA_ERROR_PERR("UnregisterClass() failed\n");
+ }
+ if (!FreeLibrary(_ecore_win32_instance))
+ {
+ EINA_ERROR_PERR("FreeLibrary() failed\n");
+ }
_ecore_win32_instance = NULL;
if (_ecore_win32_init_count < 0) _ecore_win32_init_count = 0;
HDC dc;
int depth;
+ EINA_ERROR_PINFO("getting screen depth\n");
+
dc = GetDC(NULL);
if (!dc)
- return 0;
+ {
+ EINA_ERROR_PERR("GetDC() failed\n");
+ return 0;
+ }
depth = GetDeviceCaps(dc, BITSPIXEL);
- ReleaseDC(NULL, dc);
+ if (!ReleaseDC(NULL, dc))
+ {
+ EINA_ERROR_PERR("ReleaseDC() failed (device context not released)\n");
+ }
return depth;
}
{
/* Keyboard input notifications */
case WM_KEYDOWN:
- printf (" * ecore message : keystroke down\n");
_ecore_win32_event_handle_key_press(data, 1);
return 0;
case WM_CHAR:
_ecore_win32_event_handle_key_press(data, 0);
return 0;
case WM_KEYUP:
- printf (" * ecore message : keystroke up\n");
_ecore_win32_event_handle_key_release(data, 1);
return 0;
case WM_SETFOCUS:
- printf (" * ecore message : focus in\n");
_ecore_win32_event_handle_focus_in(data);
return 0;
case WM_KILLFOCUS:
- printf (" * ecore message : focus out\n");
_ecore_win32_event_handle_focus_out(data);
return 0;
/* Mouse input notifications */
case WM_LBUTTONDOWN:
- printf (" * ecore message : lbuttondown\n");
_ecore_win32_event_handle_button_press(data, 1);
return 0;
case WM_MBUTTONDOWN:
- printf (" * ecore message : mbuttondown\n");
_ecore_win32_event_handle_button_press(data, 2);
return 0;
case WM_RBUTTONDOWN:
- printf (" * ecore message : rbuttondown\n");
_ecore_win32_event_handle_button_press(data, 3);
return 0;
case WM_LBUTTONUP:
- printf (" * ecore message : lbuttonup\n");
_ecore_win32_event_handle_button_release(data, 1);
return 0;
case WM_MBUTTONUP:
- printf (" * ecore message : mbuttonup\n");
_ecore_win32_event_handle_button_release(data, 2);
return 0;
case WM_RBUTTONUP:
- printf (" * ecore message : rbuttonup\n");
_ecore_win32_event_handle_button_release(data, 3);
return 0;
case WM_MOUSEMOVE:
w = (struct _Ecore_Win32_Window *)GetWindowLong(window, GWL_USERDATA);
if (GetClientRect(window, &rect))
- {
- POINT pt;
-
- pt.x = GET_X_LPARAM(data_param);
- pt.y = GET_Y_LPARAM(data_param);
- if (!PtInRect(&rect, pt))
- {
- if (w->pointer_is_in)
- {
- w->pointer_is_in = 0;
- _ecore_win32_event_handle_leave_notify(data);
- }
- }
- else
- {
- if (!w->pointer_is_in)
- {
- w->pointer_is_in = 1;
- _ecore_win32_event_handle_enter_notify(data);
- }
-
- }
- }
+ {
+ POINT pt;
+
+ EINA_ERROR_PINFO("mouse in window\n");
+
+ pt.x = GET_X_LPARAM(data_param);
+ pt.y = GET_Y_LPARAM(data_param);
+ if (!PtInRect(&rect, pt))
+ {
+ if (w->pointer_is_in)
+ {
+ w->pointer_is_in = 0;
+ _ecore_win32_event_handle_leave_notify(data);
+ }
+ }
+ else
+ {
+ if (!w->pointer_is_in)
+ {
+ w->pointer_is_in = 1;
+ _ecore_win32_event_handle_enter_notify(data);
+ }
+ }
+ }
+ else
+ {
+ EINA_ERROR_PERR("GetClientRect() failed\n");
+ }
_ecore_win32_event_handle_motion_notify(data);
return 0;
}
case WM_MOUSEWHEEL:
- printf (" * ecore message : mouse wheel\n");
_ecore_win32_event_handle_button_press(data, 4);
return 0;
/* Window notifications */
case WM_CREATE:
- {
- RECT rect;
- GetClientRect(window, &rect);
- printf (" *** ecore message : create %ld %ld\n",
- rect.right - rect.left, rect.bottom - rect.top);
- }
_ecore_win32_event_handle_create_notify(data);
return 0;
case WM_DESTROY:
- printf (" * ecore message : destroy\n");
_ecore_win32_event_handle_destroy_notify(data);
return 0;
case WM_SHOWWINDOW:
- {
- RECT rect;
- GetClientRect(window, &rect);
- printf (" *** ecore message : show %ld %ld\n",
- rect.right - rect.left, rect.bottom - rect.top);
- }
if ((data->data_param == SW_OTHERUNZOOM) ||
(data->data_param == SW_OTHERUNZOOM))
return 0;
return 0;
case WM_CLOSE:
- printf (" * ecore message : close\n");
_ecore_win32_event_handle_delete_request(data);
return 0;
case WM_MOVING:
/* _ecore_win32_event_handle_configure_notify(data); */
/* return 0; */
case WM_WINDOWPOSCHANGED:
- {
- RECT rect;
- GetClientRect(window, &rect);
- printf (" *** ecore message : WINDOWPOSCHANGED %ld %ld\n",
- rect.right - rect.left, rect.bottom - rect.top);
- }
_ecore_win32_event_handle_configure_notify(data);
return 0;
case WM_ENTERSIZEMOVE :
{
RECT rect;
- printf (" * ecore message : paint\n");
if (GetUpdateRect(window, &rect, FALSE))
{
PAINTSTRUCT ps;
data->update = rect;
_ecore_win32_event_handle_expose(data);
EndPaint(window, &ps);
- printf (" * %ld %ld %ld %ld\n",
- rect.left,
- rect.top,
- rect.right - rect.left,
- rect.bottom - rect.top);
}
return 0;
}
default:
return DefWindowProc(window, message, window_param, data_param);
}
+}
+static void
+_ecore_wince_error_print_cb(Eina_Error_Level level __UNUSED__,
+ const char *file __UNUSED__,
+ const char *fnc,
+ int line,
+ const char *fmt,
+ void *data __UNUSED__,
+ va_list args)
+{
+ fprintf(stderr, "[%s:%d] ", fnc, line);
+ vfprintf(stderr, fmt, args);
}
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
+#include <Eina.h>
+
#include "Ecore_Win32.h"
#include "ecore_win32_private.h"
int width,
int height)
{
+ EINA_ERROR_PINFO("creating window with border\n");
+
return ecore_win32_window_internal_new(parent,
x, y,
width, height,
int width,
int height)
{
+ EINA_ERROR_PINFO("creating window without border\n");
+
return ecore_win32_window_internal_new(parent,
x, y,
width, height,
if (!window) return;
+ EINA_ERROR_PINFO("destroying window\n");
+
if (wnd->shape.mask != NULL)
free(wnd->shape.mask);
DestroyWindow(((struct _Ecore_Win32_Window *)window)->window);
free(window);
- printf ("ecore_win32_window_del\n");
}
void *
if (!window) return;
- printf ("ecore_win32_window_move %p : %d %d\n", window, x, y);
+ EINA_ERROR_PINFO("moving window (%dx%d)\n", x, y);
+
w = ((struct _Ecore_Win32_Window *)window)->window;
if (!GetWindowRect(w, &rect))
- return;
+ {
+ EINA_ERROR_PERR("GetWindowRect() failed\n");
+ return;
+ }
- MoveWindow(w, x, y,
- rect.right - rect.left,
- rect.bottom - rect.top,
- TRUE);
+ if (!MoveWindow(w, x, y,
+ rect.right - rect.left,
+ rect.bottom - rect.top,
+ TRUE))
+ {
+ EINA_ERROR_PERR("MoveWindow() failed\n");
+ }
}
void
if (!window) return;
- w = (struct _Ecore_Win32_Window *)window;
- if (!GetWindowRect(w->window, &rect)) return;
+ EINA_ERROR_PINFO("resizing window (%dx%d)\n", width, height);
- printf ("ecore_win32_window_resize 0 : %p (%d %d) (%d %d) (%d %d)\n",
- w,
- w->min_width,
- w->min_height,
- w->max_width,
- w->max_height,
- width,
- height);
+ w = (struct _Ecore_Win32_Window *)window;
+ if (!GetWindowRect(w->window, &rect))
+ {
+ EINA_ERROR_PERR("GetWindowRect() failed\n");
+ return;
+ }
x = rect.left;
y = rect.top;
/* printf ("ecore_win32_window_resize 3 : %d %d\n", w->max_height, height); */
rect.right = width;
rect.bottom = height;
- style = GetWindowLong(w->window, GWL_STYLE);
+ if (!(style = GetWindowLong(w->window, GWL_STYLE)))
+ {
+ EINA_ERROR_PERR("GetWindowLong() failed\n");
+ return;
+ }
if (!AdjustWindowRect(&rect, style, FALSE))
- return;
+ {
+ EINA_ERROR_PERR("AdjustWindowRect() failed\n");
+ return;
+ }
if (!MoveWindow(w->window, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
FALSE))
{
- printf (" MEEERDE !!!\n");
+ EINA_ERROR_PERR("MoveWindow() failed\n");
}
- printf ("ecore_win32_window_resize 4 : %d %d\n", width, height);
}
void
if (!window) return;
- printf ("ecore_win32_window_move_resize 0 : %p %d %d\n", window, width, height);
+ EINA_ERROR_PINFO("moving and resizing window (%dx%d %dx%d)\n", x, y, width, height);
+
w = ((struct _Ecore_Win32_Window *)window);
rect.left = 0;
rect.top = 0;
if ((unsigned int)width > w->max_width) width = w->max_width;
if ((unsigned int)height < w->min_height) height = w->min_height;
if ((unsigned int)height > w->max_height) height = w->max_height;
- printf ("ecore_win32_window_move_resize 1 : %d %d\n", width, height);
rect.right = width;
rect.bottom = height;
- style = GetWindowLong(w->window, GWL_STYLE);
+ if (!(style = GetWindowLong(w->window, GWL_STYLE)))
+ {
+ EINA_ERROR_PERR("GetWindowLong() failed\n");
+ return;
+ }
if (!AdjustWindowRect(&rect, style, FALSE))
- return;
+ {
+ EINA_ERROR_PERR("AdjustWindowRect() failed\n");
+ return;
+ }
- MoveWindow(w->window, x, y,
- rect.right - rect.left,
- rect.bottom - rect.top,
- TRUE);
+ if (!MoveWindow(w->window, x, y,
+ rect.right - rect.left,
+ rect.bottom - rect.top,
+ TRUE))
+ {
+ EINA_ERROR_PERR("MoveWindow() failed\n");
+ }
}
void
int w;
int h;
- printf ("ecore_win32_window_geometry_get %p\n", window);
+ EINA_ERROR_PINFO("getting window geometry\n");
+
if (!window)
{
if (x) *x = 0;
if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
&rect))
{
+ EINA_ERROR_PERR("GetClientRect() failed\n");
+
if (x) *x = 0;
if (y) *y = 0;
if (width) *width = 0;
if (!GetWindowRect(((struct _Ecore_Win32_Window *)window)->window,
&rect))
{
+ EINA_ERROR_PERR("GetWindowRect() failed\n");
+
if (x) *x = 0;
if (y) *y = 0;
if (width) *width = 0;
{
RECT rect;
- printf ("ecore_win32_window_size_get %p\n", window);
+ EINA_ERROR_PINFO("getting window size\n");
+
if (!window)
{
if (width) *width = GetSystemMetrics(SM_CXSCREEN);
if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
&rect))
{
+ EINA_ERROR_PERR("GetClientRect() failed\n");
+
if (width) *width = 0;
if (height) *height = 0;
}
if (mask == NULL)
{
- wnd->shape.enabled = 0;
- if (wnd->shape.layered != 0)
- {
- wnd->shape.layered = 0;
+ wnd->shape.enabled = 0;
+ if (wnd->shape.layered != 0)
+ {
+ wnd->shape.layered = 0;
#if defined(WS_EX_LAYERED)
- SetWindowLong(wnd->window, GWL_EXSTYLE,
- GetWindowLong(wnd->window, GWL_EXSTYLE) & (~WS_EX_LAYERED));
- RedrawWindow(wnd->window, NULL, NULL,
- RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
+ if (!SetWindowLong(wnd->window, GWL_EXSTYLE,
+ GetWindowLong(wnd->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)))
+ {
+ EINA_ERROR_PERR("SetWindowLong() failed\n");
+ return;
+ }
+ if (!RedrawWindow(wnd->window, NULL, NULL,
+ RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN))
+ {
+ EINA_ERROR_PERR("RedrawWindow() failed\n");
+ return;
+ }
#endif
- }
- else
- SetWindowRgn(wnd->window, NULL, TRUE);
- return;
+ }
+ else
+ if (!SetWindowRgn(wnd->window, NULL, TRUE))
+ {
+ EINA_ERROR_PERR("SetWindowRgn() failed\n");
+ }
+ return;
}
if (width == 0 || height == 0)
version_info.dwOSVersionInfoSize = sizeof(version_info);
if (GetVersionEx(&version_info) == TRUE && version_info.dwMajorVersion == 5)
{
- SetWindowLong(wnd->window, GWL_EXSTYLE,
- GetWindowLong(wnd->window, GWL_EXSTYLE) | WS_EX_LAYERED);
+ if (!SetWindowLong(wnd->window, GWL_EXSTYLE,
+ GetWindowLong(wnd->window, GWL_EXSTYLE) | WS_EX_LAYERED))
+ {
+ EINA_ERROR_PERR("SetWindowLong() failed\n");
+ return;
+ }
wnd->shape.layered = 1;
return;
}
#endif
- rgn = CreateRectRgn(0, 0, 0, 0);
+ if (!(rgn = CreateRectRgn(0, 0, 0, 0)))
+ {
+ EINA_ERROR_PERR("CreateRectRgn() failed\n");
+ return;
+ }
for (y = 0; y < height; y++)
{
- HRGN rgnLine = CreateRectRgn(0, 0, 0, 0);
- for (x = 0; x < width; x++)
- {
- if (mask[y * width + x] > 0)
- {
- HRGN rgnDot = CreateRectRgn(x, y, x + 1, y + 1);
- CombineRgn(rgnLine, rgnLine, rgnDot, RGN_OR);
- DeleteObject(rgnDot);
- }
- }
- CombineRgn(rgn, rgn, rgnLine, RGN_OR);
- DeleteObject(rgnLine);
+ HRGN rgnLine;
+
+ if (!(rgnLine = CreateRectRgn(0, 0, 0, 0)))
+ {
+ EINA_ERROR_PERR("CreateRectRgn() failed\n");
+ return;
+ }
+ for (x = 0; x < width; x++)
+ {
+ if (mask[y * width + x] > 0)
+ {
+ HRGN rgnDot;
+
+ if (!(rgnDot = CreateRectRgn(x, y, x + 1, y + 1)))
+ {
+ EINA_ERROR_PERR("CreateRectRgn() failed\n");
+ return;
+ }
+ if (CombineRgn(rgnLine, rgnLine, rgnDot, RGN_OR) == ERROR)
+ {
+ EINA_ERROR_PERR("CombineRgn() has not created a new region\n");
+ }
+ if (!DeleteObject(rgnDot))
+ {
+ EINA_ERROR_PERR("DeleteObject() failed\n");
+ return;
+ }
+ }
+ }
+ if (CombineRgn(rgn, rgn, rgnLine, RGN_OR) == ERROR)
+ {
+ EINA_ERROR_PERR("CombineRgn() has not created a new region\n");
+ }
+ if (!DeleteObject(rgnLine))
+ {
+ EINA_ERROR_PERR("DeleteObject() failed\n");
+ return;
+ }
+ }
+ if (!SetWindowRgn(wnd->window, rgn, TRUE))
+ {
+ EINA_ERROR_PERR("SetWindowRgn() failed\n");
}
- SetWindowRgn(wnd->window, rgn, TRUE);
}
void
{
if (!window) return;
- printf (" ** ecore_win32_window_show %p\n", window);
- ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_SHOWNORMAL);
- UpdateWindow(((struct _Ecore_Win32_Window *)window)->window);
+ EINA_ERROR_PINFO("showing window\n");
+
+ if (!ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_SHOWNORMAL))
+ {
+ EINA_ERROR_PERR("ShowWindow() failed\n");
+ return;
+ }
+ if (!UpdateWindow(((struct _Ecore_Win32_Window *)window)->window))
+ {
+ EINA_ERROR_PERR("UpdateWindow() failed\n");
+ }
+ if (!SendMessage(((struct _Ecore_Win32_Window *)window)->window, WM_SHOWWINDOW, 1, 0))
+ {
+ EINA_ERROR_PERR("SendMessage() failed\n");
+ }
}
/* FIXME: seems to block the taskbar */
{
if (!window) return;
- printf (" ** ecore_win32_window_hide %p\n", window);
- ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_HIDE);
+ EINA_ERROR_PINFO("hiding window\n");
+
+ if (!ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_HIDE))
+ {
+ EINA_ERROR_PERR("ShowWindow() failed\n");
+ }
+ if (!SendMessage(((struct _Ecore_Win32_Window *)window)->window, WM_SHOWWINDOW, 0, 0))
+ {
+ EINA_ERROR_PERR("SendMessage() failed\n");
+ }
}
void
{
if (!window) return;
- printf (" ** ecore_win32_window_raise %p\n", window);
- SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
- HWND_TOP, 0, 0, 0, 0,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
+ EINA_ERROR_PINFO("raising window\n");
+
+ if (!SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
+ HWND_TOP, 0, 0, 0, 0,
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
+ {
+ EINA_ERROR_PERR("SetWindowPos() failed\n");
+ }
}
void
{
if (!window) return;
- printf (" ** ecore_win32_window_lower %p\n", window);
- SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
- HWND_BOTTOM, 0, 0, 0, 0,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
+ EINA_ERROR_PINFO("lowering window\n");
+
+ if (!SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
+ HWND_BOTTOM, 0, 0, 0, 0,
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
+ {
+ EINA_ERROR_PERR("SetWindowPos() failed\n");
+ }
}
void
if (!title || !title[0]) return;
- SetWindowText(((struct _Ecore_Win32_Window *)window)->window, title);
+ EINA_ERROR_PINFO("setting window title\n");
+
+ if (!SetWindowText(((struct _Ecore_Win32_Window *)window)->window, title))
+ {
+ EINA_ERROR_PERR("SetWindowText() failed\n");
+ }
}
void
{
if (!window) return;
- SetFocus(((struct _Ecore_Win32_Window *)window)->window);
+ EINA_ERROR_PINFO("focusing window\n");
+
+ if (!SetFocus(((struct _Ecore_Win32_Window *)window)->window))
+ {
+ EINA_ERROR_PERR("SetFocus() failed\n");
+ }
}
void
((!ew->iconified) && (!on)))
return;
- if (on)
- {
- ShowWindow(ew->window,
- SW_MINIMIZE);
- }
- else
+ EINA_ERROR_PINFO("iconifying window: %s\n", on ? "yes" : "no");
+
+ if (!ShowWindow(ew->window, on ? SW_MINIMIZE : SW_RESTORE))
{
- ShowWindow(ew->window,
- SW_RESTORE);
+ EINA_ERROR_PERR("ShowWindow() failed\n");
}
ew->iconified = on;
}
if (!window) return;
- printf (" ** ecore_win32_window_borderless_set %p %d\n", window, on);
ew = (struct _Ecore_Win32_Window *)window;
if (((ew->borderless) && (on)) ||
((!ew->borderless) && (!on)))
return;
+ EINA_ERROR_PINFO("setting window border: %s\n", on ? "yes" : "no");
+
w = ew->window;
style = GetWindowLong(w, GWL_STYLE);
if (on)
{
- if (!GetClientRect(w, &rect)) return;
SetWindowLong(w, GWL_STYLE, style & ~WS_CAPTION);
}
else
{
- if (!GetWindowRect(w, &rect)) return;
+ if (!GetWindowRect(w, &rect))
+ {
+ EINA_ERROR_PERR("GetWindowRect() failed\n");
+ return;
+ }
style |= WS_CAPTION;
- AdjustWindowRect (&rect, style, FALSE);
- SetWindowLong(w, GWL_STYLE, style);
+ if (!AdjustWindowRect (&rect, style, FALSE))
+ {
+ EINA_ERROR_PERR("AdjustWindowRect() failed\n");
+ return;
+ }
+ if (!SetWindowLong(w, GWL_STYLE, style))
+ {
+ EINA_ERROR_PERR("SetWindowLong() failed\n");
+ return;
+ }
+ }
+ if (!SetWindowPos(w, HWND_TOPMOST,
+ rect.left, rect.top,
+ rect.right - rect.left, rect.bottom - rect.top,
+ SWP_NOMOVE | SWP_FRAMECHANGED))
+ {
+ EINA_ERROR_PERR("SetWindowPos() failed\n");
+ return;
}
- SetWindowPos(w, HWND_TOPMOST,
- rect.left, rect.top,
- rect.right - rect.left, rect.bottom - rect.top,
- SWP_NOMOVE | SWP_FRAMECHANGED);
ew->borderless = on;
}
((!ew->fullscreen) && (!on)))
return;
+ EINA_ERROR_PINFO("setting fullscreen: %s\n", on ? "yes" : "no");
+
ew->fullscreen = !!on;
w = ew->window;
{
DWORD style;
- if (!GetWindowRect(w, &ew->rect)) return;
- if (!(ew->style = GetWindowLong(w, GWL_STYLE))) return;
+ if (!GetWindowRect(w, &ew->rect))
+ {
+ EINA_ERROR_PERR("GetWindowRect() failed\n");
+ return;
+ }
+ if (!(ew->style = GetWindowLong(w, GWL_STYLE)))
+ {
+ EINA_ERROR_PERR("GetWindowLong() failed\n");
+ return;
+ }
style = ew->style & ~WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX;
style |= WS_VISIBLE | WS_POPUP;
- if (!SetWindowLong(w, GWL_STYLE, style)) return;
- if (!SetWindowLong(w, GWL_EXSTYLE, WS_EX_TOPMOST)) return;
- SetWindowPos(w, HWND_TOPMOST, 0, 0,
- GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN),
- SWP_NOCOPYBITS | SWP_SHOWWINDOW);
+ if (!SetWindowLong(w, GWL_STYLE, style))
+ {
+ EINA_ERROR_PERR("SetWindowLong() failed\n");
+ return;
+ }
+ if (!SetWindowLong(w, GWL_EXSTYLE, WS_EX_TOPMOST))
+ {
+ EINA_ERROR_PERR("SetWindowLong() failed\n");
+ return;
+ }
+ if (!SetWindowPos(w, HWND_TOPMOST, 0, 0,
+ GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN),
+ SWP_NOCOPYBITS | SWP_SHOWWINDOW))
+ {
+ EINA_ERROR_PERR("SetWindowPos() failed\n");
+ return;
+ }
}
else
{
- if (!SetWindowLong(w, GWL_STYLE, ew->style)) return;
- if (!SetWindowLong(w, GWL_EXSTYLE, 0)) return;
- SetWindowPos(w, HWND_NOTOPMOST,
- ew->rect.left,
- ew->rect.top,
- ew->rect.right - ew->rect.left,
- ew->rect.bottom - ew->rect.top,
- SWP_NOCOPYBITS | SWP_SHOWWINDOW);
+ if (!SetWindowLong(w, GWL_STYLE, ew->style))
+ {
+ EINA_ERROR_PERR("SetWindowLong() failed\n");
+ return;
+ }
+ if (!SetWindowLong(w, GWL_EXSTYLE, 0))
+ {
+ EINA_ERROR_PERR("SetWindowLong() failed\n");
+ return;
+ }
+ if (!SetWindowPos(w, HWND_NOTOPMOST,
+ ew->rect.left,
+ ew->rect.top,
+ ew->rect.right - ew->rect.left,
+ ew->rect.bottom - ew->rect.top,
+ SWP_NOCOPYBITS | SWP_SHOWWINDOW))
+ {
+ EINA_ERROR_PERR("SetWindowPos() failed\n");
+ return;
+ }
}
}
ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
Ecore_Win32_Cursor *cursor)
{
- SetClassLong(((struct _Ecore_Win32_Window *)window)->window,
- GCL_HCURSOR, (LONG)cursor);
+ EINA_ERROR_PINFO("setting cursor\n");
+
+ if (!SetClassLong(((struct _Ecore_Win32_Window *)window)->window,
+ GCL_HCURSOR, (LONG)cursor))
+ {
+ EINA_ERROR_PERR("SetClassLong() failed\n");
+ }
}
void
{
unsigned int i;
- if (!num)
+ if (!window || !state || !num)
return;
+ EINA_ERROR_PINFO("setting cursor state\n");
+
for (i = 0; i < num; i++)
{
switch (state[i])
Ecore_Win32_Window_State state,
unsigned int set)
{
- if (!window)
- return;
+ if (!window)
+ return;
+
+ EINA_ERROR_PINFO("sending cursor state\n");
switch (state)
{
- case ECORE_WIN32_WINDOW_STATE_ICONIFIED:
- if (((struct _Ecore_Win32_Window *)window)->state.iconified)
- ecore_win32_window_iconified_set(window, set);
- break;
- case ECORE_WIN32_WINDOW_STATE_MODAL:
- ((struct _Ecore_Win32_Window *)window)->state.modal = 1;
- break;
- case ECORE_WIN32_WINDOW_STATE_STICKY:
- ((struct _Ecore_Win32_Window *)window)->state.sticky = 1;
- break;
- case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT:
- if (((struct _Ecore_Win32_Window *)window)->state.maximized_vert)
- {
- RECT rect;
- int y;
- int height;
-
- if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
- &rect, 0))
- break;
- y = rect.top;
- height = rect.bottom - rect.top;
-
- if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
- &rect))
- break;
-
- MoveWindow(window, rect.left, y,
- rect.right - rect.left,
- height,
- TRUE);
- }
- break;
- case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ:
- if (((struct _Ecore_Win32_Window *)window)->state.maximized_horz)
- {
- RECT rect;
-
- if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
- &rect))
- break;
-
- MoveWindow(window, 0, rect.top,
- GetSystemMetrics(SM_CXSCREEN),
- rect.bottom - rect.top,
- TRUE);
- }
- break;
- case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
- if (((struct _Ecore_Win32_Window *)window)->state.maximized_vert &&
- ((struct _Ecore_Win32_Window *)window)->state.maximized_horz)
- {
- RECT rect;
-
- if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
- &rect, 0))
- break;
-
- MoveWindow(window, 0, 0,
- GetSystemMetrics(SM_CXSCREEN),
- rect.bottom - rect.top,
- TRUE);
- }
- break;
- case ECORE_WIN32_WINDOW_STATE_SHADED:
- ((struct _Ecore_Win32_Window *)window)->state.shaded = 1;
- break;
- case ECORE_WIN32_WINDOW_STATE_HIDDEN:
- ((struct _Ecore_Win32_Window *)window)->state.hidden = 1;
- break;
- case ECORE_WIN32_WINDOW_STATE_FULLSCREEN:
- if (((struct _Ecore_Win32_Window *)window)->state.fullscreen)
- ecore_win32_window_fullscreen_set(window, set);
- break;
- case ECORE_WIN32_WINDOW_STATE_ABOVE:
- if (((struct _Ecore_Win32_Window *)window)->state.above)
- SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
- HWND_TOP,
- 0, 0,
- 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
- break;
- case ECORE_WIN32_WINDOW_STATE_BELOW:
- if (((struct _Ecore_Win32_Window *)window)->state.below)
- SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
- HWND_BOTTOM,
- 0, 0,
- 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
- break;
- case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION:
- ((struct _Ecore_Win32_Window *)window)->state.demands_attention = 1;
- break;
- case ECORE_WIN32_WINDOW_STATE_UNKNOWN:
- /* nothing to be done */
- break;
+ case ECORE_WIN32_WINDOW_STATE_ICONIFIED:
+ if (((struct _Ecore_Win32_Window *)window)->state.iconified)
+ ecore_win32_window_iconified_set(window, set);
+ break;
+ case ECORE_WIN32_WINDOW_STATE_MODAL:
+ ((struct _Ecore_Win32_Window *)window)->state.modal = 1;
+ break;
+ case ECORE_WIN32_WINDOW_STATE_STICKY:
+ ((struct _Ecore_Win32_Window *)window)->state.sticky = 1;
+ break;
+ case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT:
+ if (((struct _Ecore_Win32_Window *)window)->state.maximized_vert)
+ {
+ RECT rect;
+ int y;
+ int height;
+
+ if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
+ &rect, 0))
+ {
+ EINA_ERROR_PERR("SystemParametersInfo() failed\n");
+ break;
+ }
+ y = rect.top;
+ height = rect.bottom - rect.top;
+
+ if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
+ &rect))
+ {
+ EINA_ERROR_PERR("GetClientRect() failed\n");
+ break;
+ }
+
+ if (!MoveWindow(window, rect.left, y,
+ rect.right - rect.left,
+ height,
+ TRUE))
+ {
+ EINA_ERROR_PERR("MoveWindow() failed\n");
+ }
+ }
+ break;
+ case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ:
+ if (((struct _Ecore_Win32_Window *)window)->state.maximized_horz)
+ {
+ RECT rect;
+
+ if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
+ &rect))
+ {
+ EINA_ERROR_PERR("GetClientRect() failed\n");
+ break;
+ }
+
+ if (!MoveWindow(window, 0, rect.top,
+ GetSystemMetrics(SM_CXSCREEN),
+ rect.bottom - rect.top,
+ TRUE))
+ {
+ EINA_ERROR_PERR("MoveWindow() failed\n");
+ }
+ }
+ break;
+ case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
+ if (((struct _Ecore_Win32_Window *)window)->state.maximized_vert &&
+ ((struct _Ecore_Win32_Window *)window)->state.maximized_horz)
+ {
+ RECT rect;
+
+ if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
+ &rect, 0))
+ {
+ EINA_ERROR_PERR("SystemParametersInfo() failed\n");
+ break;
+ }
+
+ if (!MoveWindow(window, 0, 0,
+ GetSystemMetrics(SM_CXSCREEN),
+ rect.bottom - rect.top,
+ TRUE))
+ {
+ EINA_ERROR_PERR("MoveWindow() failed\n");
+ }
+ }
+ break;
+ case ECORE_WIN32_WINDOW_STATE_SHADED:
+ ((struct _Ecore_Win32_Window *)window)->state.shaded = 1;
+ break;
+ case ECORE_WIN32_WINDOW_STATE_HIDDEN:
+ ((struct _Ecore_Win32_Window *)window)->state.hidden = 1;
+ break;
+ case ECORE_WIN32_WINDOW_STATE_FULLSCREEN:
+ if (((struct _Ecore_Win32_Window *)window)->state.fullscreen)
+ ecore_win32_window_fullscreen_set(window, set);
+ break;
+ case ECORE_WIN32_WINDOW_STATE_ABOVE:
+ if (((struct _Ecore_Win32_Window *)window)->state.above)
+ if (!SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
+ HWND_TOP,
+ 0, 0,
+ 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW))
+ {
+ EINA_ERROR_PERR("SetWindowPos() failed\n");
+ }
+ break;
+ case ECORE_WIN32_WINDOW_STATE_BELOW:
+ if (((struct _Ecore_Win32_Window *)window)->state.below)
+ if (!SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
+ HWND_BOTTOM,
+ 0, 0,
+ 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW))
+ {
+ EINA_ERROR_PERR("SetWindowPos() failed\n");
+ }
+ break;
+ case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION:
+ ((struct _Ecore_Win32_Window *)window)->state.demands_attention = 1;
+ break;
+ case ECORE_WIN32_WINDOW_STATE_UNKNOWN:
+ /* nothing to be done */
+ break;
}
}
ecore_win32_window_type_set(Ecore_Win32_Window *window,
Ecore_Win32_Window_Type type)
{
+ if (!window)
+ return;
+
+ EINA_ERROR_PINFO("setting window type\n");
+
switch (type)
{
case ECORE_WIN32_WINDOW_TYPE_DESKTOP:
w = (struct _Ecore_Win32_Window *)calloc(1, sizeof(struct _Ecore_Win32_Window));
if (!w)
+ {
+ EINA_ERROR_PERR("malloc() failed\n");
+ return NULL;
+ }
return NULL;
- printf (" *** ecore_win32_window_new : %p %d %d %d\n",
- w,
- width, height, GetSystemMetrics(SM_CXMIN));
rect.left = 0;
rect.top = 0;
rect.right = width;
rect.bottom = height;
if (!AdjustWindowRect(&rect, style, FALSE))
{
+ EINA_ERROR_PERR("AdjustWindowRect() failed\n");
free(w);
return NULL;
}
- printf (" * ecore : new debut : %ld %d %d\n",
- rect.right - rect.left, GetSystemMetrics(SM_CXMIN), GetSystemMetrics(SM_CYMIN));
minimal_width = GetSystemMetrics(SM_CXMIN);
minimal_height = GetSystemMetrics(SM_CYMIN);
NULL, _ecore_win32_instance, NULL);
if (!w->window)
{
+ EINA_ERROR_PERR("CreateWindowEx() failed\n");
free(w);
return NULL;
}
SetLastError(0);
if (!SetWindowLong(w->window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0))
{
+ EINA_ERROR_PERR("SetWindowLong() failed\n");
DestroyWindow(w->window);
free(w);
return NULL;
w->iconified = 0;
w->fullscreen = 0;
- printf (" *** ecore_win32_window_new fin : (%d %d) (%d %d)\n",
- w->min_width,
- w->min_height,
- w->max_width,
- w->max_height);
-
return w;
}