long _ecore_wince_event_last_time = 0;
Ecore_WinCE_Window *_ecore_wince_event_last_window = NULL;
HINSTANCE _ecore_wince_instance = NULL;
-int _ecore_wince_log_dom = -1;
+int _ecore_wince_log_dom_global = -1;
int ECORE_WINCE_EVENT_MOUSE_IN = 0;
int ECORE_WINCE_EVENT_MOUSE_OUT = 0;
{
WNDCLASS wc;
- eina_log_print_cb_set(_ecore_wince_error_print_cb, NULL);
+ if (++_ecore_win32_init_count != 1)
+ return _ecore_win32_init_count;
- if(_ecore_wince_log_dom < 0)
- _ecore_wince_log_dom = eina_log_domain_register("ecore_wince", EINA_COLOR_LIGHTBLUE);
- if(_ecore_wince_log_dom < 0)
- {
- EINA_LOG_ERR("Could not register log domain: ecore_wince");
- return 0;
- }
+ if (!eina_init())
+ return --_ecore_win32_init_count;
- ECORE_WINCE_MSG_INFO("initializing ecore_wince (current count: %d)", _ecore_wince_init_count);
+ eina_log_print_cb_set(_ecore_wince_error_print_cb, NULL);
+ _ecore_wince_log_dom_global = eina_log_domain_register("ecore_wince", EINA_COLOR_LIGHTBLUE);
+ if (_ecore_wince_log_dom_global < 0)
+ {
+ EINA_LOG_ERR("Ecore_WinCE: Could not register log domain");
+ goto shutdown_eina;
+ }
- if (_ecore_wince_init_count > 0)
+ if (!ecore_event_init())
{
- _ecore_wince_init_count++;
- return _ecore_wince_init_count;
+ ERR("Ecore_WinCE: Could not init ecore_event");
+ goto unregister_log_domain;
}
_ecore_wince_instance = GetModuleHandle(NULL);
if (!_ecore_wince_instance)
{
- ECORE_WINCE_MSG_ERR("GetModuleHandle() failed");
- return 0;
+ ERR("GetModuleHandle() failed");
+ goto shutdown_ecore_event;
}
memset (&wc, 0, sizeof (wc));
if(!RegisterClass(&wc))
{
- ECORE_WINCE_MSG_ERR("RegisterClass() failed");
- FreeLibrary(_ecore_wince_instance);
- return 0;
+ ERR("RegisterClass() failed");
+ goto free_library;
}
if (!ECORE_WINCE_EVENT_MOUSE_IN)
ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
}
- ecore_event_init();
+ return _ecore_wince_init_count;
- _ecore_wince_init_count++;
+ free_library:
+ FreeLibrary(_ecore_win32_instance);
+ shutdown_ecore_event:
+ ecore_event_shutdown();
+ unregister_log_domain:
+ eina_log_domain_unregister(_ecore_win32_log_dom_global);
+ shutdown_eina:
+ eina_shutdown();
- return _ecore_wince_init_count;
+ return --_ecore_win32_init_count;
}
int
{
HWND task_bar;
- ECORE_WINCE_MSG_INFO("shutting down ecore_wince (current count: %d)", _ecore_wince_init_count);
-
- _ecore_wince_init_count--;
- if (_ecore_wince_init_count > 0) return _ecore_wince_init_count;
-
- ecore_event_shutdown();
+ if (--_ecore_wince_init_count != 0)
+ return _ecore_wince_init_count;
/* force task bar to be shown (in case the application exits */
/* while being fullscreen) */
}
if (!UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance))
- {
- ECORE_WINCE_MSG_ERR("UnregisterClass() failed");
- }
+ ERR("UnregisterClass() failed");
+
if (!FreeLibrary(_ecore_wince_instance))
- {
- ECORE_WINCE_MSG_ERR("FreeLibrary() failed");
- }
- _ecore_wince_instance = NULL;
+ ERR("FreeLibrary() failed");
- eina_log_domain_unregister(_ecore_wince_log_dom);
+ _ecore_wince_instance = NULL;
- if (_ecore_wince_init_count < 0) _ecore_wince_init_count = 0;
+ ecore_event_shutdown();
+ eina_log_domain_unregister(_ecore_wince_log_dom_global);
+ eina_shutdown();
return _ecore_wince_init_count;
}
{
POINT pt;
- ECORE_WINCE_MSG_INFO("mouse in window");
+ INF("mouse in window");
pt.x = LOWORD(data_param);
pt.y = HIWORD(data_param);
}
else
{
- ECORE_WINCE_MSG_ERR("GetClientRect() failed");
+ ERR("GetClientRect() failed");
}
_ecore_wince_event_handle_motion_notify(data);
{
Ecore_Event_Key *e;
- ECORE_WINCE_MSG_INFO("key pressed");
+ INF("key pressed");
e = (Ecore_Event_Key *)malloc(sizeof(Ecore_Event_Key));
if (!e) return;
{
Ecore_Event_Key *e;
- ECORE_WINCE_MSG_INFO("key released");
+ INF("key released");
e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key));
if (!e) return;
{
Ecore_WinCE_Window *window;
- ECORE_WINCE_MSG_INFO("mouse button pressed");
+ INF("mouse button pressed");
window = (Ecore_WinCE_Window *)GetWindowLong(msg->window, GWL_USERDATA);
{
Ecore_WinCE_Window *window;
- ECORE_WINCE_MSG_INFO("mouse button released");
+ INF("mouse button released");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
{
Ecore_Event_Mouse_Move *e;
- ECORE_WINCE_MSG_INFO("mouse moved");
+ INF("mouse moved");
e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
if (!e) return;
{
Ecore_WinCE_Window *window;
- ECORE_WINCE_MSG_INFO("mouse in");
+ INF("mouse in");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
{
Ecore_WinCE_Window *window;
- ECORE_WINCE_MSG_INFO("mouse out");
+ INF("mouse out");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
Ecore_WinCE_Event_Window_Focus_In *e;
struct _Ecore_WinCE_Window *window;
- ECORE_WINCE_MSG_INFO("focus in");
+ INF("focus in");
e = (Ecore_WinCE_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_In));
if (!e) return;
Ecore_WinCE_Event_Window_Focus_Out *e;
struct _Ecore_WinCE_Window *window;
- ECORE_WINCE_MSG_INFO("focus out");
+ INF("focus out");
e = (Ecore_WinCE_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_Out));
if (!e) return;
{
Ecore_WinCE_Event_Window_Damage *e;
- ECORE_WINCE_MSG_INFO("window expose");
+ INF("window expose");
e = (Ecore_WinCE_Event_Window_Damage *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Damage));
if (!e) return;
e->y = msg->update.top;
e->width = msg->update.right - msg->update.left;
e->height = msg->update.bottom - msg->update.top;
- ECORE_WINCE_MSG_INFO("window expose size: %dx%d", e->width, e->height);
+ INF("window expose size: %dx%d", e->width, e->height);
e->time = _ecore_wince_event_last_time;
{
Ecore_WinCE_Event_Window_Create *e;
- ECORE_WINCE_MSG_INFO("window create notify");
+ INF("window create notify");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Create));
if (!e) return;
{
Ecore_WinCE_Event_Window_Destroy *e;
- ECORE_WINCE_MSG_INFO("window destroy notify");
+ INF("window destroy notify");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Destroy));
if (!e) return;
{
Ecore_WinCE_Event_Window_Show *e;
- ECORE_WINCE_MSG_INFO("window map notify");
+ INF("window map notify");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Show));
if (!e) return;
{
Ecore_WinCE_Event_Window_Hide *e;
- ECORE_WINCE_MSG_INFO("window unmap notify");
+ INF("window unmap notify");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Hide));
if (!e) return;
{
Ecore_WinCE_Event_Window_Delete_Request *e;
- ECORE_WINCE_MSG_INFO("window delete request");
+ INF("window delete request");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Delete_Request));
if (!e) return;
HWND window;
RECT rect;
- ECORE_WINCE_MSG_INFO("creating window");
+ INF("creating window");
w = (struct _Ecore_WinCE_Window *)calloc(1, sizeof(struct _Ecore_WinCE_Window));
if (!w)
{
- ECORE_WINCE_MSG_ERR("malloc() failed");
+ ERR("malloc() failed");
return NULL;
}
rect.bottom = height;
if (!AdjustWindowRectEx(&rect, WS_CAPTION | WS_SYSMENU | WS_VISIBLE, FALSE, WS_EX_TOPMOST))
{
- ECORE_WINCE_MSG_ERR("AdjustWindowRectEx() failed");
+ ERR("AdjustWindowRectEx() failed");
free(w);
return NULL;
}
NULL, _ecore_wince_instance, NULL);
if (!window)
{
- ECORE_WINCE_MSG_ERR("CreateWindowEx() failed");
+ ERR("CreateWindowEx() failed");
free(w);
return NULL;
}
if (!_ecore_wince_hardware_keys_register(window))
{
- ECORE_WINCE_MSG_ERR("_ecore_wince_hardware_keys_register() failed");
+ ERR("_ecore_wince_hardware_keys_register() failed");
DestroyWindow(window);
free(w);
return NULL;
SetLastError(0);
if (!SetWindowLong(window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0))
{
- ECORE_WINCE_MSG_ERR("SetWindowLong() failed");
+ ERR("SetWindowLong() failed");
DestroyWindow(window);
free(w);
return NULL;
{
if (!window) return;
- ECORE_WINCE_MSG_INFO("destroying window");
+ INF("destroying window");
DestroyWindow(((struct _Ecore_WinCE_Window *)window)->window);
free(window);
if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen)
return;
- ECORE_WINCE_MSG_INFO("moving window (%dx%d)", x, y);
+ INF("moving window (%dx%d)", x, y);
w = ((struct _Ecore_WinCE_Window *)window)->window;
if (!GetWindowRect(w, &rect))
{
- ECORE_WINCE_MSG_ERR("GetWindowRect() failed");
+ ERR("GetWindowRect() failed");
return;
}
rect.bottom - rect.top,
TRUE))
{
- ECORE_WINCE_MSG_ERR("MoveWindow() failed");
+ ERR("MoveWindow() failed");
}
}
if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen)
return;
- ECORE_WINCE_MSG_INFO("resizing window (%dx%d)", width, height);
+ INF("resizing window (%dx%d)", width, height);
w = (struct _Ecore_WinCE_Window *)window;
if (!GetWindowRect(w->window, &rect))
{
- ECORE_WINCE_MSG_ERR("GetWindowRect() failed");
+ ERR("GetWindowRect() failed");
return;
}
rect.bottom = height;
if (!(style = GetWindowLong(w->window, GWL_STYLE)))
{
- ECORE_WINCE_MSG_ERR("GetWindowLong() failed");
+ ERR("GetWindowLong() failed");
return;
}
if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE)))
{
- ECORE_WINCE_MSG_ERR("GetWindowLong() failed");
+ ERR("GetWindowLong() failed");
return;
}
if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
{
- ECORE_WINCE_MSG_ERR("AdjustWindowRectEx() failed");
+ ERR("AdjustWindowRectEx() failed");
return;
}
rect.bottom - rect.top,
FALSE))
{
- ECORE_WINCE_MSG_ERR("MoveWindow() failed");
+ ERR("MoveWindow() failed");
}
}
if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen)
return;
- ECORE_WINCE_MSG_INFO("moving and resizing window (%dx%d %dx%d)", x, y, width, height);
+ INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height);
w = ((struct _Ecore_WinCE_Window *)window);
rect.left = 0;
rect.bottom = height;
if (!(style = GetWindowLong(w->window, GWL_STYLE)))
{
- ECORE_WINCE_MSG_ERR("GetWindowLong() failed");
+ ERR("GetWindowLong() failed");
return;
}
if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE)))
{
- ECORE_WINCE_MSG_ERR("GetWindowLong() failed");
+ ERR("GetWindowLong() failed");
return;
}
if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
{
- ECORE_WINCE_MSG_ERR("AdjustWindowRectEx() failed");
+ ERR("AdjustWindowRectEx() failed");
return;
}
rect.bottom - rect.top,
TRUE))
{
- ECORE_WINCE_MSG_ERR("MoveWindow() failed");
+ ERR("MoveWindow() failed");
}
}
{
if (!window) return;
- ECORE_WINCE_MSG_INFO("showing window");
+ INF("showing window");
if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_SHOWNORMAL))
{
- ECORE_WINCE_MSG_ERR("ShowWindow() failed");
+ ERR("ShowWindow() failed");
return;
}
if (!UpdateWindow(((struct _Ecore_WinCE_Window *)window)->window))
{
- ECORE_WINCE_MSG_ERR("UpdateWindow() failed");
+ ERR("UpdateWindow() failed");
}
if (!SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 1, 0))
{
- ECORE_WINCE_MSG_ERR("SendMessage() failed");
+ ERR("SendMessage() failed");
}
}
{
if (!window) return;
- ECORE_WINCE_MSG_INFO("hiding window");
+ INF("hiding window");
if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_HIDE))
{
- ECORE_WINCE_MSG_ERR("ShowWindow() failed");
+ ERR("ShowWindow() failed");
return;
}
if (!SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 0, 0))
{
- ECORE_WINCE_MSG_ERR("SendMessage() failed");
+ ERR("SendMessage() failed");
}
}
if (!title || !title[0]) return;
- ECORE_WINCE_MSG_INFO("setting window title");
+ INF("setting window title");
wtitle = evil_char_to_wchar(title);
if (!wtitle) return;
if (!SetWindowText(((struct _Ecore_WinCE_Window *)window)->window, wtitle))
{
- ECORE_WINCE_MSG_ERR("SetWindowText() failed");
+ ERR("SetWindowText() failed");
}
free(wtitle);
}
if (!window)
return;
- ECORE_WINCE_MSG_INFO("setting backend");
+ INF("setting backend");
w = (struct _Ecore_WinCE_Window *)window;
w->backend = backend;
if (!window)
return;
- ECORE_WINCE_MSG_INFO("setting suspend callback");
+ INF("setting suspend callback");
w = (struct _Ecore_WinCE_Window *)window;
w->suspend = suspend;
if (!window)
return;
- ECORE_WINCE_MSG_INFO("setting resume callback");
+ INF("setting resume callback");
w = (struct _Ecore_WinCE_Window *)window;
w->resume = resume;
int w;
int h;
- ECORE_WINCE_MSG_INFO("getting window geometry");
+ INF("getting window geometry");
if (!window)
{
if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window,
&rect))
{
- ECORE_WINCE_MSG_ERR("GetClientRect() failed");
+ ERR("GetClientRect() failed");
if (x) *x = 0;
if (y) *y = 0;
if (!GetWindowRect(((struct _Ecore_WinCE_Window *)window)->window,
&rect))
{
- ECORE_WINCE_MSG_ERR("GetWindowRect() failed");
+ ERR("GetWindowRect() failed");
if (x) *x = 0;
if (y) *y = 0;
{
RECT rect;
- ECORE_WINCE_MSG_INFO("getting window size");
+ INF("getting window size");
if (!window)
{
if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window,
&rect))
{
- ECORE_WINCE_MSG_ERR("GetClientRect() failed");
+ ERR("GetClientRect() failed");
if (width) *width = 0;
if (height) *height = 0;
((!ew->fullscreen) && (!on)))
return;
- ECORE_WINCE_MSG_INFO("setting fullscreen: %s", on ? "yes" : "no");
+ INF("setting fullscreen: %s", on ? "yes" : "no");
ew->fullscreen = !!on;
w = ew->window;
/* save the position and size of the window */
if (!GetWindowRect(w, &ew->rect))
{
- ECORE_WINCE_MSG_ERR("GetWindowRect() failed");
+ ERR("GetWindowRect() failed");
return;
}
task_bar = FindWindow(L"HHTaskBar", NULL);
if (!task_bar)
{
- ECORE_WINCE_MSG_INFO("FindWindow(): can not find task bar");
+ INF("FindWindow(): can not find task bar");
}
if (!ShowWindow(task_bar, SW_HIDE))
{
- ECORE_WINCE_MSG_INFO("ShowWindow(): task bar already hidden");
+ INF("ShowWindow(): task bar already hidden");
}
if (!EnableWindow(task_bar, FALSE))
{
- ECORE_WINCE_MSG_INFO("EnableWindow(): input already disabled");
+ INF("EnableWindow(): input already disabled");
}
/* style: visible + popup */
if (!SetWindowLong(w, GWL_STYLE, WS_POPUP | WS_VISIBLE))
{
- ECORE_WINCE_MSG_INFO("SetWindowLong() failed");
+ INF("SetWindowLong() failed");
}
/* resize window to fit the entire screen */
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
{
- ECORE_WINCE_MSG_INFO("SetWindowPos() failed");
+ INF("SetWindowPos() failed");
}
/*
* It seems that SetWindowPos is not sufficient.
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
TRUE))
{
- ECORE_WINCE_MSG_INFO("MoveWindow() failed");
+ INF("MoveWindow() failed");
}
}
else
task_bar = FindWindow(L"HHTaskBar", NULL);
if (!task_bar)
{
- ECORE_WINCE_MSG_INFO("FindWindow(): can not find task bar");
+ INF("FindWindow(): can not find task bar");
}
if (!ShowWindow(task_bar, SW_SHOW))
{
- ECORE_WINCE_MSG_INFO("ShowWindow(): task bar already visible");
+ INF("ShowWindow(): task bar already visible");
}
if (!EnableWindow(task_bar, TRUE))
{
- ECORE_WINCE_MSG_INFO("EnableWindow(): input already enabled");
+ INF("EnableWindow(): input already enabled");
}
/* style: visible + caption + sysmenu */
if (!SetWindowLong(w, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE))
{
- ECORE_WINCE_MSG_INFO("SetWindowLong() failed");
+ INF("SetWindowLong() failed");
}
/* restaure the position and size of the window */
if (!SetWindowPos(w, HWND_TOPMOST,
ew->rect.bottom - ew->rect.top,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
{
- ECORE_WINCE_MSG_INFO("SetWindowLong() failed");
+ INF("SetWindowLong() failed");
}
/*
* It seems that SetWindowPos is not sufficient.
ew->rect.bottom - ew->rect.top,
TRUE))
{
- ECORE_WINCE_MSG_INFO("MoveWindow() failed");
+ INF("MoveWindow() failed");
}
}
}
core_dll = LoadLibrary(L"coredll.dll");
if (!core_dll)
{
- ECORE_WINCE_MSG_ERR("LoadLibrary() failed");
+ ERR("LoadLibrary() failed");
return 0;
}
unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1");
if (!unregister_fct)
{
- ECORE_WINCE_MSG_ERR("GetProcAddress() failed");
+ ERR("GetProcAddress() failed");
FreeLibrary(core_dll);
return 0;
}