* simplify a bit and fix init/shutdown functions

* rename logging macros



SVN revision: 42993
This commit is contained in:
Vincent Torri 2009-10-10 03:45:35 +00:00
parent d6c7cc65d9
commit 7680ac9922
4 changed files with 115 additions and 113 deletions

View File

@ -27,7 +27,7 @@ double _ecore_wince_double_click_time = 0.25;
long _ecore_wince_event_last_time = 0; long _ecore_wince_event_last_time = 0;
Ecore_WinCE_Window *_ecore_wince_event_last_window = NULL; Ecore_WinCE_Window *_ecore_wince_event_last_window = NULL;
HINSTANCE _ecore_wince_instance = 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_IN = 0;
int ECORE_WINCE_EVENT_MOUSE_OUT = 0; int ECORE_WINCE_EVENT_MOUSE_OUT = 0;
@ -67,29 +67,31 @@ ecore_wince_init()
{ {
WNDCLASS wc; WNDCLASS wc;
if (++_ecore_win32_init_count != 1)
return _ecore_win32_init_count;
if (!eina_init())
return --_ecore_win32_init_count;
eina_log_print_cb_set(_ecore_wince_error_print_cb, NULL); 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 < 0) if (_ecore_wince_log_dom_global < 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"); EINA_LOG_ERR("Ecore_WinCE: Could not register log domain");
return 0; goto shutdown_eina;
} }
ECORE_WINCE_MSG_INFO("initializing ecore_wince (current count: %d)", _ecore_wince_init_count); if (!ecore_event_init())
if (_ecore_wince_init_count > 0)
{ {
_ecore_wince_init_count++; ERR("Ecore_WinCE: Could not init ecore_event");
return _ecore_wince_init_count; goto unregister_log_domain;
} }
_ecore_wince_instance = GetModuleHandle(NULL); _ecore_wince_instance = GetModuleHandle(NULL);
if (!_ecore_wince_instance) if (!_ecore_wince_instance)
{ {
ECORE_WINCE_MSG_ERR("GetModuleHandle() failed"); ERR("GetModuleHandle() failed");
return 0; goto shutdown_ecore_event;
} }
memset (&wc, 0, sizeof (wc)); memset (&wc, 0, sizeof (wc));
@ -106,9 +108,8 @@ ecore_wince_init()
if(!RegisterClass(&wc)) if(!RegisterClass(&wc))
{ {
ECORE_WINCE_MSG_ERR("RegisterClass() failed"); ERR("RegisterClass() failed");
FreeLibrary(_ecore_wince_instance); goto free_library;
return 0;
} }
if (!ECORE_WINCE_EVENT_MOUSE_IN) if (!ECORE_WINCE_EVENT_MOUSE_IN)
@ -125,11 +126,18 @@ ecore_wince_init()
ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
} }
ecore_event_init();
_ecore_wince_init_count++;
return _ecore_wince_init_count; return _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_win32_init_count;
} }
int int
@ -137,12 +145,8 @@ ecore_wince_shutdown()
{ {
HWND task_bar; HWND task_bar;
ECORE_WINCE_MSG_INFO("shutting down ecore_wince (current count: %d)", _ecore_wince_init_count); if (--_ecore_wince_init_count != 0)
return _ecore_wince_init_count;
_ecore_wince_init_count--;
if (_ecore_wince_init_count > 0) return _ecore_wince_init_count;
ecore_event_shutdown();
/* force task bar to be shown (in case the application exits */ /* force task bar to be shown (in case the application exits */
/* while being fullscreen) */ /* while being fullscreen) */
@ -154,18 +158,16 @@ ecore_wince_shutdown()
} }
if (!UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance)) if (!UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance))
{ ERR("UnregisterClass() failed");
ECORE_WINCE_MSG_ERR("UnregisterClass() failed");
}
if (!FreeLibrary(_ecore_wince_instance)) if (!FreeLibrary(_ecore_wince_instance))
{ ERR("FreeLibrary() failed");
ECORE_WINCE_MSG_ERR("FreeLibrary() failed");
}
_ecore_wince_instance = NULL; _ecore_wince_instance = NULL;
eina_log_domain_unregister(_ecore_wince_log_dom); ecore_event_shutdown();
eina_log_domain_unregister(_ecore_wince_log_dom_global);
if (_ecore_wince_init_count < 0) _ecore_wince_init_count = 0; eina_shutdown();
return _ecore_wince_init_count; return _ecore_wince_init_count;
} }
@ -275,7 +277,7 @@ _ecore_wince_window_procedure(HWND window,
{ {
POINT pt; POINT pt;
ECORE_WINCE_MSG_INFO("mouse in window"); INF("mouse in window");
pt.x = LOWORD(data_param); pt.x = LOWORD(data_param);
pt.y = HIWORD(data_param); pt.y = HIWORD(data_param);
@ -298,7 +300,7 @@ _ecore_wince_window_procedure(HWND window,
} }
else else
{ {
ECORE_WINCE_MSG_ERR("GetClientRect() failed"); ERR("GetClientRect() failed");
} }
_ecore_wince_event_handle_motion_notify(data); _ecore_wince_event_handle_motion_notify(data);

View File

@ -55,7 +55,7 @@ _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg,
{ {
Ecore_Event_Key *e; Ecore_Event_Key *e;
ECORE_WINCE_MSG_INFO("key pressed"); INF("key pressed");
e = (Ecore_Event_Key *)malloc(sizeof(Ecore_Event_Key)); e = (Ecore_Event_Key *)malloc(sizeof(Ecore_Event_Key));
if (!e) return; if (!e) return;
@ -102,7 +102,7 @@ _ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg,
{ {
Ecore_Event_Key *e; Ecore_Event_Key *e;
ECORE_WINCE_MSG_INFO("key released"); INF("key released");
e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key));
if (!e) return; if (!e) return;
@ -149,7 +149,7 @@ _ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg,
{ {
Ecore_WinCE_Window *window; Ecore_WinCE_Window *window;
ECORE_WINCE_MSG_INFO("mouse button pressed"); INF("mouse button pressed");
window = (Ecore_WinCE_Window *)GetWindowLong(msg->window, GWL_USERDATA); window = (Ecore_WinCE_Window *)GetWindowLong(msg->window, GWL_USERDATA);
@ -228,7 +228,7 @@ _ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg,
{ {
Ecore_WinCE_Window *window; Ecore_WinCE_Window *window;
ECORE_WINCE_MSG_INFO("mouse button released"); INF("mouse button released");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA); window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
@ -286,7 +286,7 @@ _ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg)
{ {
Ecore_Event_Mouse_Move *e; 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)); e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move));
if (!e) return; if (!e) return;
@ -304,7 +304,7 @@ _ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg)
{ {
Ecore_WinCE_Window *window; Ecore_WinCE_Window *window;
ECORE_WINCE_MSG_INFO("mouse in"); INF("mouse in");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA); window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
@ -347,7 +347,7 @@ _ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg)
{ {
Ecore_WinCE_Window *window; Ecore_WinCE_Window *window;
ECORE_WINCE_MSG_INFO("mouse out"); INF("mouse out");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA); window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
@ -391,7 +391,7 @@ _ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg)
Ecore_WinCE_Event_Window_Focus_In *e; Ecore_WinCE_Event_Window_Focus_In *e;
struct _Ecore_WinCE_Window *window; 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)); e = (Ecore_WinCE_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_In));
if (!e) return; if (!e) return;
@ -420,7 +420,7 @@ _ecore_wince_event_handle_focus_out(Ecore_WinCE_Callback_Data *msg)
Ecore_WinCE_Event_Window_Focus_Out *e; Ecore_WinCE_Event_Window_Focus_Out *e;
struct _Ecore_WinCE_Window *window; 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)); e = (Ecore_WinCE_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_Out));
if (!e) return; if (!e) return;
@ -447,7 +447,7 @@ _ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg)
{ {
Ecore_WinCE_Event_Window_Damage *e; 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)); e = (Ecore_WinCE_Event_Window_Damage *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Damage));
if (!e) return; if (!e) return;
@ -463,7 +463,7 @@ _ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg)
e->y = msg->update.top; e->y = msg->update.top;
e->width = msg->update.right - msg->update.left; e->width = msg->update.right - msg->update.left;
e->height = msg->update.bottom - msg->update.top; 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; e->time = _ecore_wince_event_last_time;
@ -475,7 +475,7 @@ _ecore_wince_event_handle_create_notify(Ecore_WinCE_Callback_Data *msg)
{ {
Ecore_WinCE_Event_Window_Create *e; 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)); e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Create));
if (!e) return; if (!e) return;
@ -497,7 +497,7 @@ _ecore_wince_event_handle_destroy_notify(Ecore_WinCE_Callback_Data *msg)
{ {
Ecore_WinCE_Event_Window_Destroy *e; 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)); e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Destroy));
if (!e) return; if (!e) return;
@ -520,7 +520,7 @@ _ecore_wince_event_handle_map_notify(Ecore_WinCE_Callback_Data *msg)
{ {
Ecore_WinCE_Event_Window_Show *e; 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)); e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Show));
if (!e) return; if (!e) return;
@ -542,7 +542,7 @@ _ecore_wince_event_handle_unmap_notify(Ecore_WinCE_Callback_Data *msg)
{ {
Ecore_WinCE_Event_Window_Hide *e; 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)); e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Hide));
if (!e) return; if (!e) return;
@ -564,7 +564,7 @@ _ecore_wince_event_handle_delete_request(Ecore_WinCE_Callback_Data *msg)
{ {
Ecore_WinCE_Event_Window_Delete_Request *e; 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)); e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Delete_Request));
if (!e) return; if (!e) return;

View File

@ -7,11 +7,11 @@
/* logging messages macros */ /* logging messages macros */
extern int _ecore_wince_log_dom; extern int _ecore_wince_log_dom_global;
#define ECORE_WINCE_MSG_ERR(...) EINA_LOG_DOM_ERR(_ecore_wince_log_dom , __VA_ARGS__) #define ERR(...) EINA_LOG_DOM_ERR(_ecore_wince_log_dom_global , __VA_ARGS__)
#define ECORE_WINCE_MSG_DBG(...) EINA_LOG_DOM_DBG(_ecore_wince_log_dom , __VA_ARGS__) #define DBG(...) EINA_LOG_DOM_DBG(_ecore_wince_log_dom_global , __VA_ARGS__)
#define ECORE_WINCE_MSG_INFO(...) EINA_LOG_DOM_INFO(_ecore_wince_log_dom , __VA_ARGS__) #define INF(...) EINA_LOG_DOM_INFO(_ecore_wince_log_dom_global , __VA_ARGS__)
#define ECORE_WINCE_WINDOW_CLASS L"Ecore_WinCE_Window_Class" #define ECORE_WINCE_WINDOW_CLASS L"Ecore_WinCE_Window_Class"

View File

@ -37,12 +37,12 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
HWND window; HWND window;
RECT rect; RECT rect;
ECORE_WINCE_MSG_INFO("creating window"); INF("creating window");
w = (struct _Ecore_WinCE_Window *)calloc(1, sizeof(struct _Ecore_WinCE_Window)); w = (struct _Ecore_WinCE_Window *)calloc(1, sizeof(struct _Ecore_WinCE_Window));
if (!w) if (!w)
{ {
ECORE_WINCE_MSG_ERR("malloc() failed"); ERR("malloc() failed");
return NULL; return NULL;
} }
@ -52,7 +52,7 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
rect.bottom = height; rect.bottom = height;
if (!AdjustWindowRectEx(&rect, WS_CAPTION | WS_SYSMENU | WS_VISIBLE, FALSE, WS_EX_TOPMOST)) if (!AdjustWindowRectEx(&rect, WS_CAPTION | WS_SYSMENU | WS_VISIBLE, FALSE, WS_EX_TOPMOST))
{ {
ECORE_WINCE_MSG_ERR("AdjustWindowRectEx() failed"); ERR("AdjustWindowRectEx() failed");
free(w); free(w);
return NULL; return NULL;
} }
@ -67,14 +67,14 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
NULL, _ecore_wince_instance, NULL); NULL, _ecore_wince_instance, NULL);
if (!window) if (!window)
{ {
ECORE_WINCE_MSG_ERR("CreateWindowEx() failed"); ERR("CreateWindowEx() failed");
free(w); free(w);
return NULL; return NULL;
} }
if (!_ecore_wince_hardware_keys_register(window)) 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); DestroyWindow(window);
free(w); free(w);
return NULL; return NULL;
@ -85,7 +85,7 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
SetLastError(0); SetLastError(0);
if (!SetWindowLong(window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0)) if (!SetWindowLong(window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0))
{ {
ECORE_WINCE_MSG_ERR("SetWindowLong() failed"); ERR("SetWindowLong() failed");
DestroyWindow(window); DestroyWindow(window);
free(w); free(w);
return NULL; return NULL;
@ -101,7 +101,7 @@ ecore_wince_window_free(Ecore_WinCE_Window *window)
{ {
if (!window) return; if (!window) return;
ECORE_WINCE_MSG_INFO("destroying window"); INF("destroying window");
DestroyWindow(((struct _Ecore_WinCE_Window *)window)->window); DestroyWindow(((struct _Ecore_WinCE_Window *)window)->window);
free(window); free(window);
@ -127,12 +127,12 @@ ecore_wince_window_move(Ecore_WinCE_Window *window,
if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen) if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen)
return; 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; w = ((struct _Ecore_WinCE_Window *)window)->window;
if (!GetWindowRect(w, &rect)) if (!GetWindowRect(w, &rect))
{ {
ECORE_WINCE_MSG_ERR("GetWindowRect() failed"); ERR("GetWindowRect() failed");
return; return;
} }
@ -141,7 +141,7 @@ ecore_wince_window_move(Ecore_WinCE_Window *window,
rect.bottom - rect.top, rect.bottom - rect.top,
TRUE)) TRUE))
{ {
ECORE_WINCE_MSG_ERR("MoveWindow() failed"); ERR("MoveWindow() failed");
} }
} }
@ -160,12 +160,12 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window,
if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen) if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen)
return; return;
ECORE_WINCE_MSG_INFO("resizing window (%dx%d)", width, height); INF("resizing window (%dx%d)", width, height);
w = (struct _Ecore_WinCE_Window *)window; w = (struct _Ecore_WinCE_Window *)window;
if (!GetWindowRect(w->window, &rect)) if (!GetWindowRect(w->window, &rect))
{ {
ECORE_WINCE_MSG_ERR("GetWindowRect() failed"); ERR("GetWindowRect() failed");
return; return;
} }
@ -177,17 +177,17 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window,
rect.bottom = height; rect.bottom = height;
if (!(style = GetWindowLong(w->window, GWL_STYLE))) if (!(style = GetWindowLong(w->window, GWL_STYLE)))
{ {
ECORE_WINCE_MSG_ERR("GetWindowLong() failed"); ERR("GetWindowLong() failed");
return; return;
} }
if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE))) if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE)))
{ {
ECORE_WINCE_MSG_ERR("GetWindowLong() failed"); ERR("GetWindowLong() failed");
return; return;
} }
if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle)) if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
{ {
ECORE_WINCE_MSG_ERR("AdjustWindowRectEx() failed"); ERR("AdjustWindowRectEx() failed");
return; return;
} }
@ -196,7 +196,7 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window,
rect.bottom - rect.top, rect.bottom - rect.top,
FALSE)) FALSE))
{ {
ECORE_WINCE_MSG_ERR("MoveWindow() failed"); ERR("MoveWindow() failed");
} }
} }
@ -215,7 +215,7 @@ ecore_wince_window_move_resize(Ecore_WinCE_Window *window,
if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen) if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen)
return; 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); w = ((struct _Ecore_WinCE_Window *)window);
rect.left = 0; rect.left = 0;
@ -224,17 +224,17 @@ ecore_wince_window_move_resize(Ecore_WinCE_Window *window,
rect.bottom = height; rect.bottom = height;
if (!(style = GetWindowLong(w->window, GWL_STYLE))) if (!(style = GetWindowLong(w->window, GWL_STYLE)))
{ {
ECORE_WINCE_MSG_ERR("GetWindowLong() failed"); ERR("GetWindowLong() failed");
return; return;
} }
if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE))) if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE)))
{ {
ECORE_WINCE_MSG_ERR("GetWindowLong() failed"); ERR("GetWindowLong() failed");
return; return;
} }
if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle)) if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
{ {
ECORE_WINCE_MSG_ERR("AdjustWindowRectEx() failed"); ERR("AdjustWindowRectEx() failed");
return; return;
} }
@ -243,7 +243,7 @@ ecore_wince_window_move_resize(Ecore_WinCE_Window *window,
rect.bottom - rect.top, rect.bottom - rect.top,
TRUE)) TRUE))
{ {
ECORE_WINCE_MSG_ERR("MoveWindow() failed"); ERR("MoveWindow() failed");
} }
} }
@ -252,20 +252,20 @@ ecore_wince_window_show(Ecore_WinCE_Window *window)
{ {
if (!window) return; if (!window) return;
ECORE_WINCE_MSG_INFO("showing window"); INF("showing window");
if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_SHOWNORMAL)) if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_SHOWNORMAL))
{ {
ECORE_WINCE_MSG_ERR("ShowWindow() failed"); ERR("ShowWindow() failed");
return; return;
} }
if (!UpdateWindow(((struct _Ecore_WinCE_Window *)window)->window)) 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)) if (!SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 1, 0))
{ {
ECORE_WINCE_MSG_ERR("SendMessage() failed"); ERR("SendMessage() failed");
} }
} }
@ -274,16 +274,16 @@ ecore_wince_window_hide(Ecore_WinCE_Window *window)
{ {
if (!window) return; if (!window) return;
ECORE_WINCE_MSG_INFO("hiding window"); INF("hiding window");
if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_HIDE)) if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_HIDE))
{ {
ECORE_WINCE_MSG_ERR("ShowWindow() failed"); ERR("ShowWindow() failed");
return; return;
} }
if (!SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 0, 0)) if (!SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 0, 0))
{ {
ECORE_WINCE_MSG_ERR("SendMessage() failed"); ERR("SendMessage() failed");
} }
} }
@ -297,14 +297,14 @@ ecore_wince_window_title_set(Ecore_WinCE_Window *window,
if (!title || !title[0]) return; if (!title || !title[0]) return;
ECORE_WINCE_MSG_INFO("setting window title"); INF("setting window title");
wtitle = evil_char_to_wchar(title); wtitle = evil_char_to_wchar(title);
if (!wtitle) return; if (!wtitle) return;
if (!SetWindowText(((struct _Ecore_WinCE_Window *)window)->window, wtitle)) if (!SetWindowText(((struct _Ecore_WinCE_Window *)window)->window, wtitle))
{ {
ECORE_WINCE_MSG_ERR("SetWindowText() failed"); ERR("SetWindowText() failed");
} }
free(wtitle); free(wtitle);
} }
@ -317,7 +317,7 @@ ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend)
if (!window) if (!window)
return; return;
ECORE_WINCE_MSG_INFO("setting backend"); INF("setting backend");
w = (struct _Ecore_WinCE_Window *)window; w = (struct _Ecore_WinCE_Window *)window;
w->backend = backend; w->backend = backend;
@ -331,7 +331,7 @@ ecore_wince_window_suspend_set(Ecore_WinCE_Window *window, int (*suspend)(int))
if (!window) if (!window)
return; return;
ECORE_WINCE_MSG_INFO("setting suspend callback"); INF("setting suspend callback");
w = (struct _Ecore_WinCE_Window *)window; w = (struct _Ecore_WinCE_Window *)window;
w->suspend = suspend; w->suspend = suspend;
@ -345,7 +345,7 @@ ecore_wince_window_resume_set(Ecore_WinCE_Window *window, int (*resume)(int))
if (!window) if (!window)
return; return;
ECORE_WINCE_MSG_INFO("setting resume callback"); INF("setting resume callback");
w = (struct _Ecore_WinCE_Window *)window; w = (struct _Ecore_WinCE_Window *)window;
w->resume = resume; w->resume = resume;
@ -362,7 +362,7 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
int w; int w;
int h; int h;
ECORE_WINCE_MSG_INFO("getting window geometry"); INF("getting window geometry");
if (!window) if (!window)
{ {
@ -377,7 +377,7 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window, if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window,
&rect)) &rect))
{ {
ECORE_WINCE_MSG_ERR("GetClientRect() failed"); ERR("GetClientRect() failed");
if (x) *x = 0; if (x) *x = 0;
if (y) *y = 0; if (y) *y = 0;
@ -393,7 +393,7 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
if (!GetWindowRect(((struct _Ecore_WinCE_Window *)window)->window, if (!GetWindowRect(((struct _Ecore_WinCE_Window *)window)->window,
&rect)) &rect))
{ {
ECORE_WINCE_MSG_ERR("GetWindowRect() failed"); ERR("GetWindowRect() failed");
if (x) *x = 0; if (x) *x = 0;
if (y) *y = 0; if (y) *y = 0;
@ -416,7 +416,7 @@ ecore_wince_window_size_get(Ecore_WinCE_Window *window,
{ {
RECT rect; RECT rect;
ECORE_WINCE_MSG_INFO("getting window size"); INF("getting window size");
if (!window) if (!window)
{ {
@ -429,7 +429,7 @@ ecore_wince_window_size_get(Ecore_WinCE_Window *window,
if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window, if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window,
&rect)) &rect))
{ {
ECORE_WINCE_MSG_ERR("GetClientRect() failed"); ERR("GetClientRect() failed");
if (width) *width = 0; if (width) *width = 0;
if (height) *height = 0; if (height) *height = 0;
@ -454,7 +454,7 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
((!ew->fullscreen) && (!on))) ((!ew->fullscreen) && (!on)))
return; return;
ECORE_WINCE_MSG_INFO("setting fullscreen: %s", on ? "yes" : "no"); INF("setting fullscreen: %s", on ? "yes" : "no");
ew->fullscreen = !!on; ew->fullscreen = !!on;
w = ew->window; w = ew->window;
@ -464,7 +464,7 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
/* save the position and size of the window */ /* save the position and size of the window */
if (!GetWindowRect(w, &ew->rect)) if (!GetWindowRect(w, &ew->rect))
{ {
ECORE_WINCE_MSG_ERR("GetWindowRect() failed"); ERR("GetWindowRect() failed");
return; return;
} }
@ -472,21 +472,21 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
task_bar = FindWindow(L"HHTaskBar", NULL); task_bar = FindWindow(L"HHTaskBar", NULL);
if (!task_bar) 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)) 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)) if (!EnableWindow(task_bar, FALSE))
{ {
ECORE_WINCE_MSG_INFO("EnableWindow(): input already disabled"); INF("EnableWindow(): input already disabled");
} }
/* style: visible + popup */ /* style: visible + popup */
if (!SetWindowLong(w, GWL_STYLE, WS_POPUP | WS_VISIBLE)) 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 */ /* resize window to fit the entire screen */
@ -495,7 +495,7 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED)) SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
{ {
ECORE_WINCE_MSG_INFO("SetWindowPos() failed"); INF("SetWindowPos() failed");
} }
/* /*
* It seems that SetWindowPos is not sufficient. * It seems that SetWindowPos is not sufficient.
@ -507,7 +507,7 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
TRUE)) TRUE))
{ {
ECORE_WINCE_MSG_INFO("MoveWindow() failed"); INF("MoveWindow() failed");
} }
} }
else else
@ -516,21 +516,21 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
task_bar = FindWindow(L"HHTaskBar", NULL); task_bar = FindWindow(L"HHTaskBar", NULL);
if (!task_bar) 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)) 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)) if (!EnableWindow(task_bar, TRUE))
{ {
ECORE_WINCE_MSG_INFO("EnableWindow(): input already enabled"); INF("EnableWindow(): input already enabled");
} }
/* style: visible + caption + sysmenu */ /* style: visible + caption + sysmenu */
if (!SetWindowLong(w, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE)) 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 */ /* restaure the position and size of the window */
if (!SetWindowPos(w, HWND_TOPMOST, if (!SetWindowPos(w, HWND_TOPMOST,
@ -540,7 +540,7 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
ew->rect.bottom - ew->rect.top, ew->rect.bottom - ew->rect.top,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED)) SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
{ {
ECORE_WINCE_MSG_INFO("SetWindowLong() failed"); INF("SetWindowLong() failed");
} }
/* /*
* It seems that SetWindowPos is not sufficient. * It seems that SetWindowPos is not sufficient.
@ -554,7 +554,7 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
ew->rect.bottom - ew->rect.top, ew->rect.bottom - ew->rect.top,
TRUE)) TRUE))
{ {
ECORE_WINCE_MSG_INFO("MoveWindow() failed"); INF("MoveWindow() failed");
} }
} }
} }
@ -572,14 +572,14 @@ _ecore_wince_hardware_keys_register(HWND window)
core_dll = LoadLibrary(L"coredll.dll"); core_dll = LoadLibrary(L"coredll.dll");
if (!core_dll) if (!core_dll)
{ {
ECORE_WINCE_MSG_ERR("LoadLibrary() failed"); ERR("LoadLibrary() failed");
return 0; return 0;
} }
unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1"); unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1");
if (!unregister_fct) if (!unregister_fct)
{ {
ECORE_WINCE_MSG_ERR("GetProcAddress() failed"); ERR("GetProcAddress() failed");
FreeLibrary(core_dll); FreeLibrary(core_dll);
return 0; return 0;
} }