From 1dd8436cd415b4783a98124513b000e38b875893 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Sat, 5 Sep 2009 08:39:34 +0000 Subject: [PATCH] add Mathieu Taillefumier's patch for eina logging, with small modifications and fixing ecore_evas_win32 does not build, though. I think that if we add log support in evas, all the macro must have different names, because of all the _private.h headers that are included in all source files (that's the problem with win32). I'll fix ecore_evas_win32 build later. Or someone can do it if he wants :-) SVN revision: 42274 --- .../src/lib/ecore_evas/ecore_evas_win32.c | 40 ++--- .../ecore/src/lib/ecore_win32/ecore_win32.c | 59 ++++--- .../src/lib/ecore_win32/ecore_win32_cursor.c | 8 +- .../src/lib/ecore_win32/ecore_win32_event.c | 34 ++-- .../src/lib/ecore_win32/ecore_win32_private.h | 6 + .../src/lib/ecore_win32/ecore_win32_window.c | 156 +++++++++--------- .../ecore/src/lib/ecore_wince/ecore_wince.c | 49 ++++-- .../src/lib/ecore_wince/ecore_wince_private.h | 4 + .../src/lib/ecore_wince/ecore_wince_window.c | 108 ++++++------ 9 files changed, 251 insertions(+), 213 deletions(-) diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c index a749f2b3fc..532d6f3b79 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c @@ -167,7 +167,7 @@ _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, voi Ecore_Evas *ee; Ecore_Win32_Event_Mouse_In *e; - EINA_ERROR_PINFO("mouse in\n"); + MESSAGE_INFO("mouse in\n"); e = event; ee = ecore_event_window_match((Ecore_Window)e->window); @@ -189,7 +189,7 @@ _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, vo Ecore_Evas *ee; Ecore_Win32_Event_Mouse_Out *e; - EINA_ERROR_PINFO("mouse out\n"); + MESSAGE_INFO("mouse out\n"); e = event; ee = ecore_event_window_match((Ecore_Window)e->window); @@ -213,7 +213,7 @@ _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__ Ecore_Evas *ee; Ecore_Win32_Event_Window_Damage *e; - EINA_ERROR_PINFO("window damage\n"); + MESSAGE_INFO("window damage\n"); e = event; ee = ecore_event_window_match((Ecore_Window)e->window); @@ -265,7 +265,7 @@ _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED_ Ecore_Evas *ee; Ecore_Win32_Event_Window_Destroy *e; - EINA_ERROR_PINFO("window destroy\n"); + MESSAGE_INFO("window destroy\n"); e = event; ee = ecore_event_window_match((Ecore_Window)e->window); @@ -283,7 +283,7 @@ _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, Ecore_Evas *ee; Ecore_Win32_Event_Window_Show *e; - EINA_ERROR_PINFO("window show\n"); + MESSAGE_INFO("window show\n"); e = event; ee = ecore_event_window_match((Ecore_Window)e->window); @@ -302,7 +302,7 @@ _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, Ecore_Evas *ee; Ecore_Win32_Event_Window_Hide *e; - EINA_ERROR_PINFO("window hide\n"); + MESSAGE_INFO("window hide\n"); e = event; ee = ecore_event_window_match((Ecore_Window)e->window); @@ -321,7 +321,7 @@ _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSE Ecore_Evas *ee; Ecore_Win32_Event_Window_Configure *e; - EINA_ERROR_PINFO("window configure\n"); + MESSAGE_INFO("window configure\n"); e = event; ee = ecore_event_window_match((Ecore_Window)e->window); @@ -379,7 +379,7 @@ _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __ Ecore_Evas *ee; Ecore_Win32_Event_Window_Delete_Request *e; - EINA_ERROR_PINFO("window delete request\n"); + MESSAGE_INFO("window delete request\n"); e = event; ee = ecore_event_window_match((Ecore_Window)e->window); @@ -397,7 +397,7 @@ _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __ static void _ecore_evas_win32_free(Ecore_Evas *ee) { - EINA_ERROR_PINFO("ecore evas free\n"); + MESSAGE_INFO("ecore evas free\n"); ecore_win32_window_free((struct _Ecore_Win32_Window *)ee->prop.window); ecore_event_window_unregister(ee->prop.window); @@ -416,7 +416,7 @@ _ecore_evas_win32_callback_delete_request_set(Ecore_Evas *ee, static void _ecore_evas_win32_move(Ecore_Evas *ee, int x, int y) { - EINA_ERROR_PINFO("ecore evas move (%dx%d)\n", x, y); + MESSAGE_INFO("ecore evas move (%dx%d)\n", x, y); if ((x != ee->x) || (y != ee->y)) { @@ -431,7 +431,7 @@ _ecore_evas_win32_move(Ecore_Evas *ee, int x, int y) static void _ecore_evas_win32_resize(Ecore_Evas *ee, int width, int height) { - EINA_ERROR_PINFO("ecore evas resize (%dx%d)\n", width, height); + MESSAGE_INFO("ecore evas resize (%dx%d)\n", width, height); if ((ee->w != width) || (ee->h != height)) { @@ -458,7 +458,7 @@ _ecore_evas_win32_resize(Ecore_Evas *ee, int width, int height) static void _ecore_evas_win32_move_resize(Ecore_Evas *ee, int x, int y, int width, int height) { - EINA_ERROR_PINFO("ecore evas resize (%dx%d %dx%d)\n", x, y, width, height); + MESSAGE_INFO("ecore evas resize (%dx%d %dx%d)\n", x, y, width, height); if ((ee->w != width) || (ee->h != height) || (x != ee->x) || (y != ee->y)) { @@ -564,7 +564,7 @@ _ecore_evas_win32_rotation_set_internal(Ecore_Evas *ee, int rotation) static void _ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation) { - EINA_ERROR_PINFO("ecore evas rotation: %s\n", rotation ? "yes" : "no"); + MESSAGE_INFO("ecore evas rotation: %s\n", rotation ? "yes" : "no"); if (ee->rotation == rotation) return; @@ -598,7 +598,7 @@ _ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation) static void _ecore_evas_win32_show(Ecore_Evas *ee) { - EINA_ERROR_PINFO("ecore evas show\n"); + MESSAGE_INFO("ecore evas show\n"); ee->should_be_visible = 1; if (ee->prop.avoid_damage) @@ -611,7 +611,7 @@ _ecore_evas_win32_show(Ecore_Evas *ee) static void _ecore_evas_win32_hide(Ecore_Evas *ee) { - EINA_ERROR_PINFO("ecore evas hide\n"); + MESSAGE_INFO("ecore evas hide\n"); ecore_win32_window_hide((struct _Ecore_Win32_Window *)ee->prop.window); ee->should_be_visible = 0; @@ -620,7 +620,7 @@ _ecore_evas_win32_hide(Ecore_Evas *ee) static void _ecore_evas_win32_raise(Ecore_Evas *ee) { - EINA_ERROR_PINFO("ecore evas raise\n"); + MESSAGE_INFO("ecore evas raise\n"); if (!ee->prop.fullscreen) ecore_win32_window_raise((struct _Ecore_Win32_Window *)ee->prop.window); @@ -631,7 +631,7 @@ _ecore_evas_win32_raise(Ecore_Evas *ee) static void _ecore_evas_win32_lower(Ecore_Evas *ee) { - EINA_ERROR_PINFO("ecore evas lower\n"); + MESSAGE_INFO("ecore evas lower\n"); if (!ee->prop.fullscreen) ecore_win32_window_lower((struct _Ecore_Win32_Window *)ee->prop.window); @@ -642,7 +642,7 @@ _ecore_evas_win32_lower(Ecore_Evas *ee) static void _ecore_evas_win32_activate(Ecore_Evas *ee) { - EINA_ERROR_PINFO("ecore evas activate\n"); + MESSAGE_INFO("ecore evas activate\n"); ecore_win32_window_focus_set((struct _Ecore_Win32_Window *)ee->prop.window); } @@ -650,7 +650,7 @@ _ecore_evas_win32_activate(Ecore_Evas *ee) static void _ecore_evas_win32_title_set(Ecore_Evas *ee, const char *title) { - EINA_ERROR_PINFO("ecore evas title set\n"); + MESSAGE_INFO("ecore evas title set\n"); if (ee->prop.title) free(ee->prop.title); ee->prop.title = NULL; @@ -774,7 +774,7 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) { struct _Ecore_Win32_Window *window; - EINA_ERROR_PINFO("ecore evas fullscreen set\n"); + MESSAGE_INFO("ecore evas fullscreen set\n"); if ((ee->engine.win32.state.fullscreen && on) || (!ee->engine.win32.state.fullscreen && !on)) diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32.c index cc3ce6c0d8..4fb545da06 100644 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32.c +++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32.c @@ -39,6 +39,7 @@ HINSTANCE _ecore_win32_instance = NULL; double _ecore_win32_double_click_time = 0.25; double _ecore_win32_event_last_time = 0.0; Ecore_Win32_Window *_ecore_win32_event_last_window = NULL; +int _ecore_win32_log_dom = -1; int ECORE_WIN32_EVENT_MOUSE_IN = 0; int ECORE_WIN32_EVENT_MOUSE_OUT = 0; @@ -63,7 +64,8 @@ LRESULT CALLBACK _ecore_win32_window_procedure(HWND window, WPARAM window_param, LPARAM data_param); -static void _ecore_wince_error_print_cb(Eina_Error_Level level, +static void _ecore_win32_error_print_cb(const Eina_Log_Domain *d, + Eina_Log_Level level, const char *file, const char *fnc, int line, @@ -80,9 +82,19 @@ ecore_win32_init() { WNDCLASS wc; - eina_error_print_cb_set(_ecore_wince_error_print_cb, NULL); + eina_log_print_cb_set(_ecore_win32_error_print_cb, NULL); - EINA_ERROR_PINFO("initializing ecore_win32 (current count: %d)\n", _ecore_win32_init_count); + /* in case of double initialization of the module */ + if(_ecore_win32_log_dom < 0) + _ecore_win32_log_dom = eina_log_domain_register("ecore_win32", EINA_COLOR_LIGHTBLUE); + + if (_ecore_win32_log_dom < 0) + { + EINA_LOG_ERR("Could not register log domain: ecore_win32"); + return 0; + } + + MESSAGE_INFO("initializing ecore_win32 (current count: %d)\n", _ecore_win32_init_count); if (_ecore_win32_init_count > 0) { @@ -93,7 +105,7 @@ ecore_win32_init() _ecore_win32_instance = GetModuleHandle(NULL); if (!_ecore_win32_instance) { - EINA_ERROR_PERR("GetModuleHandle() failed\n"); + MESSAGE_ERR("GetModuleHandle() failed\n"); return 0; } @@ -111,14 +123,14 @@ ecore_win32_init() if(!RegisterClass(&wc)) { - EINA_ERROR_PERR("RegisterClass() failed\n"); + MESSAGE_ERR("RegisterClass() failed\n"); FreeLibrary(_ecore_win32_instance); return 0; } if (!ecore_win32_dnd_init()) { - EINA_ERROR_PERR("ecore_win32_dnd_init() failed\n"); + MESSAGE_ERR("ecore_win32_dnd_init() failed\n"); FreeLibrary(_ecore_win32_instance); return 0; } @@ -149,24 +161,26 @@ ecore_win32_init() int ecore_win32_shutdown() { - EINA_ERROR_PINFO("shutting down ecore_win32 (current count: %d)\n", _ecore_win32_init_count); + MESSAGE_INFO("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; - ecore_event_shutdown(); + ecore_event_shutdown(); ecore_win32_dnd_shutdown(); if (!UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance)) { - EINA_ERROR_PERR("UnregisterClass() failed\n"); + MESSAGE_INFO("UnregisterClass() failed\n"); } if (!FreeLibrary(_ecore_win32_instance)) { - EINA_ERROR_PERR("FreeLibrary() failed\n"); + MESSAGE_INFO("FreeLibrary() failed\n"); } _ecore_win32_instance = NULL; + eina_log_domain_unregister(_ecore_win32_log_dom); + if (_ecore_win32_init_count < 0) _ecore_win32_init_count = 0; return _ecore_win32_init_count; @@ -178,19 +192,19 @@ ecore_win32_screen_depth_get() HDC dc; int depth; - EINA_ERROR_PINFO("getting screen depth\n"); + MESSAGE_INFO("getting screen depth\n"); dc = GetDC(NULL); if (!dc) { - EINA_ERROR_PERR("GetDC() failed\n"); + MESSAGE_ERR("GetDC() failed\n"); return 0; } depth = GetDeviceCaps(dc, BITSPIXEL); if (!ReleaseDC(NULL, dc)) { - EINA_ERROR_PERR("ReleaseDC() failed (device context not released)\n"); + MESSAGE_ERR("ReleaseDC() failed (device context not released)\n"); } return depth; @@ -309,7 +323,7 @@ _ecore_win32_window_procedure(HWND window, { POINT pt; - EINA_ERROR_PINFO("mouse in window\n"); + MESSAGE_INFO("mouse in window\n"); pt.x = GET_X_LPARAM(data_param); pt.y = GET_Y_LPARAM(data_param); @@ -332,7 +346,7 @@ _ecore_win32_window_procedure(HWND window, } else { - EINA_ERROR_PERR("GetClientRect() failed\n"); + MESSAGE_ERR("GetClientRect() failed\n"); } _ecore_win32_event_handle_motion_notify(data); @@ -423,13 +437,14 @@ _ecore_win32_window_procedure(HWND window, } 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) +_ecore_win32_error_print_cb(const Eina_Log_Domain *d __UNUSED__, + Eina_Log_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); diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32_cursor.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32_cursor.c index bbfd5d68ea..2590d00508 100644 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32_cursor.c +++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32_cursor.c @@ -30,7 +30,7 @@ ecore_win32_cursor_new(const void *pixels_and, int cursor_width; int cursor_height; - EINA_ERROR_PINFO("creating cursor\n"); + MESSAGE_INFO("creating cursor\n"); cursor_width = GetSystemMetrics(SM_CXCURSOR); cursor_height = GetSystemMetrics(SM_CYCURSOR); @@ -52,7 +52,7 @@ ecore_win32_cursor_new(const void *pixels_and, void ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor) { - EINA_ERROR_PINFO("destroying cursor\n"); + MESSAGE_INFO("destroying cursor\n"); DestroyCursor(cursor); } @@ -63,7 +63,7 @@ ecore_win32_cursor_shape_get(Ecore_Win32_Cursor_Shape shape) Ecore_Win32_Cursor *cursor = NULL; const char *cursor_name; - EINA_ERROR_PINFO("geting shape cursor\n"); + MESSAGE_INFO("geting shape cursor\n"); switch (shape) { @@ -125,7 +125,7 @@ ecore_win32_cursor_size_get(void) int width; int height; - EINA_ERROR_PINFO("geting size cursor\n"); + MESSAGE_INFO("geting size cursor\n"); width = GetSystemMetrics(SM_CXCURSOR); height = GetSystemMetrics(SM_CYCURSOR); diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32_event.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32_event.c index 1d3e80788d..4406d9aad8 100644 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32_event.c +++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32_event.c @@ -58,7 +58,7 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, { Ecore_Event_Key *e; - EINA_ERROR_PINFO("key pressed\n"); + MESSAGE_INFO("key pressed\n"); e = (Ecore_Event_Key *)malloc(sizeof(Ecore_Event_Key)); if (!e) return; @@ -108,7 +108,7 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg, { Ecore_Event_Key *e; - EINA_ERROR_PINFO("key released\n"); + MESSAGE_INFO("key released\n"); e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); if (!e) return; @@ -158,7 +158,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, { Ecore_Win32_Window *window; - EINA_ERROR_PINFO("mouse button pressed\n"); + MESSAGE_INFO("mouse button pressed\n"); window = (Ecore_Win32_Window *)GetWindowLong(msg->window, GWL_USERDATA); @@ -260,7 +260,7 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, { Ecore_Win32_Window *window; - EINA_ERROR_PINFO("mouse button released\n"); + MESSAGE_INFO("mouse button released\n"); window = (void *)GetWindowLong(msg->window, GWL_USERDATA); @@ -318,7 +318,7 @@ _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Event_Mouse_Move *e; - EINA_ERROR_PINFO("mouse moved\n"); + MESSAGE_INFO("mouse moved\n"); e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; @@ -337,7 +337,7 @@ _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Event_Mouse_Move *e; - EINA_ERROR_PINFO("mouse in\n"); + MESSAGE_INFO("mouse in\n"); e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; @@ -376,7 +376,7 @@ _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Event_Mouse_Move *e; - EINA_ERROR_PINFO("mouse out\n"); + MESSAGE_INFO("mouse out\n"); e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; @@ -414,7 +414,7 @@ _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Focus_In *e; - EINA_ERROR_PINFO("focus in\n"); + MESSAGE_INFO("focus in\n"); e = (Ecore_Win32_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_In)); if (!e) return; @@ -432,7 +432,7 @@ _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Focus_Out *e; - EINA_ERROR_PINFO("focus out\n"); + MESSAGE_INFO("focus out\n"); e = (Ecore_Win32_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_Out)); if (!e) return; @@ -450,7 +450,7 @@ _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Damage *e; - EINA_ERROR_PINFO("window expose\n"); + MESSAGE_INFO("window expose\n"); e = (Ecore_Win32_Event_Window_Damage *)calloc(1, sizeof(Ecore_Win32_Event_Window_Damage)); if (!e) return; @@ -472,7 +472,7 @@ _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Create *e; - EINA_ERROR_PINFO("window create notify\n"); + MESSAGE_INFO("window create notify\n"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Create)); if (!e) return; @@ -489,7 +489,7 @@ _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Destroy *e; - EINA_ERROR_PINFO("window destroy notify\n"); + MESSAGE_INFO("window destroy notify\n"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Destroy)); if (!e) return; @@ -507,7 +507,7 @@ _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Show *e; - EINA_ERROR_PINFO("window map notify\n"); + MESSAGE_INFO("window map notify\n"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Show)); if (!e) return; @@ -524,7 +524,7 @@ _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Hide *e; - EINA_ERROR_PINFO("window unmap notify\n"); + MESSAGE_INFO("window unmap notify\n"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Hide)); if (!e) return; @@ -543,7 +543,7 @@ _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg) Ecore_Win32_Event_Window_Configure *e; WINDOWPOS *window_pos; - EINA_ERROR_PINFO("window configure notify\n"); + MESSAGE_INFO("window configure notify\n"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Configure)); if (!e) return; @@ -573,7 +573,7 @@ _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg) RECT rect; Ecore_Win32_Event_Window_Resize *e; - EINA_ERROR_PINFO("window resize\n"); + MESSAGE_INFO("window resize\n"); if (!GetClientRect(msg->window, &rect)) return; @@ -594,7 +594,7 @@ _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Delete_Request *e; - EINA_ERROR_PINFO("window delete request\n"); + MESSAGE_INFO("window delete request\n"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete_Request)); if (!e) return; diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32_private.h b/legacy/ecore/src/lib/ecore_win32/ecore_win32_private.h index 7a55f4e8ba..7194313f24 100644 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32_private.h +++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32_private.h @@ -13,6 +13,12 @@ extern "C" { #define ECORE_WIN32_WINDOW_CLASS "Ecore_Win32_Window_Class" +/* logging messages macros */ +extern int _ecore_win32_log_dom; + +#define MESSAGE_ERR(...) EINA_LOG_DOM_ERR(_ecore_win32_log_dom , __VA_ARGS__) +#define MESSAGE_DBG(...) EINA_LOG_DOM_DBG(_ecore_win32_log_dom , __VA_ARGS__) +#define MESSAGE_INFO(...) EINA_LOG_DOM_INFO(_ecore_win32_log_dom , __VA_ARGS__) typedef struct _Ecore_Win32_Callback_Data Ecore_Win32_Callback_Data; diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c index 6ce4fe3dd5..96153e6d32 100644 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c +++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c @@ -50,7 +50,7 @@ ecore_win32_window_new(Ecore_Win32_Window *parent, int width, int height) { - EINA_ERROR_PINFO("creating window with border\n"); + MESSAGE_INFO("creating window with border\n"); return ecore_win32_window_internal_new(parent, x, y, @@ -66,7 +66,7 @@ ecore_win32_window_override_new(Ecore_Win32_Window *parent, int width, int height) { - EINA_ERROR_PINFO("creating window without border\n"); + MESSAGE_INFO("creating window without border\n"); return ecore_win32_window_internal_new(parent, x, y, @@ -81,7 +81,7 @@ ecore_win32_window_free(Ecore_Win32_Window *window) if (!window) return; - EINA_ERROR_PINFO("destroying window\n"); + MESSAGE_INFO("destroying window\n"); if (wnd->shape.mask != NULL) free(wnd->shape.mask); @@ -140,12 +140,12 @@ ecore_win32_window_move(Ecore_Win32_Window *window, if (!window) return; - EINA_ERROR_PINFO("moving window (%dx%d)\n", x, y); + MESSAGE_INFO("moving window (%dx%d)\n", x, y); w = ((struct _Ecore_Win32_Window *)window)->window; if (!GetWindowRect(w, &rect)) { - EINA_ERROR_PERR("GetWindowRect() failed\n"); + MESSAGE_ERR("GetWindowRect() failed\n"); return; } @@ -154,7 +154,7 @@ ecore_win32_window_move(Ecore_Win32_Window *window, rect.bottom - rect.top, TRUE)) { - EINA_ERROR_PERR("MoveWindow() failed\n"); + MESSAGE_ERR("MoveWindow() failed\n"); } } @@ -171,12 +171,12 @@ ecore_win32_window_resize(Ecore_Win32_Window *window, if (!window) return; - EINA_ERROR_PINFO("resizing window (%dx%d)\n", width, height); + MESSAGE_INFO("resizing window (%dx%d)\n", width, height); w = (struct _Ecore_Win32_Window *)window; if (!GetWindowRect(w->window, &rect)) { - EINA_ERROR_PERR("GetWindowRect() failed\n"); + MESSAGE_ERR("GetWindowRect() failed\n"); return; } @@ -195,12 +195,12 @@ ecore_win32_window_resize(Ecore_Win32_Window *window, rect.bottom = height; if (!(style = GetWindowLong(w->window, GWL_STYLE))) { - EINA_ERROR_PERR("GetWindowLong() failed\n"); + MESSAGE_ERR("GetWindowLong() failed\n"); return; } if (!AdjustWindowRect(&rect, style, FALSE)) { - EINA_ERROR_PERR("AdjustWindowRect() failed\n"); + MESSAGE_ERR("AdjustWindowRect() failed\n"); return; } @@ -209,7 +209,7 @@ ecore_win32_window_resize(Ecore_Win32_Window *window, rect.bottom - rect.top, TRUE)) { - EINA_ERROR_PERR("MoveWindow() failed\n"); + MESSAGE_ERR("MoveWindow() failed\n"); } } @@ -226,7 +226,7 @@ ecore_win32_window_move_resize(Ecore_Win32_Window *window, if (!window) return; - EINA_ERROR_PINFO("moving and resizing window (%dx%d %dx%d)\n", x, y, width, height); + MESSAGE_INFO("moving and resizing window (%dx%d %dx%d)\n", x, y, width, height); w = ((struct _Ecore_Win32_Window *)window); rect.left = 0; @@ -239,12 +239,12 @@ ecore_win32_window_move_resize(Ecore_Win32_Window *window, rect.bottom = height; if (!(style = GetWindowLong(w->window, GWL_STYLE))) { - EINA_ERROR_PERR("GetWindowLong() failed\n"); + MESSAGE_ERR("GetWindowLong() failed\n"); return; } if (!AdjustWindowRect(&rect, style, FALSE)) { - EINA_ERROR_PERR("AdjustWindowRect() failed\n"); + MESSAGE_ERR("AdjustWindowRect() failed\n"); return; } @@ -253,7 +253,7 @@ ecore_win32_window_move_resize(Ecore_Win32_Window *window, rect.bottom - rect.top, TRUE)) { - EINA_ERROR_PERR("MoveWindow() failed\n"); + MESSAGE_ERR("MoveWindow() failed\n"); } } @@ -268,7 +268,7 @@ ecore_win32_window_geometry_get(Ecore_Win32_Window *window, int w; int h; - EINA_ERROR_PINFO("getting window geometry\n"); + MESSAGE_INFO("getting window geometry\n"); if (!window) { @@ -283,7 +283,7 @@ ecore_win32_window_geometry_get(Ecore_Win32_Window *window, if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window, &rect)) { - EINA_ERROR_PERR("GetClientRect() failed\n"); + MESSAGE_ERR("GetClientRect() failed\n"); if (x) *x = 0; if (y) *y = 0; @@ -299,7 +299,7 @@ ecore_win32_window_geometry_get(Ecore_Win32_Window *window, if (!GetWindowRect(((struct _Ecore_Win32_Window *)window)->window, &rect)) { - EINA_ERROR_PERR("GetWindowRect() failed\n"); + MESSAGE_ERR("GetWindowRect() failed\n"); if (x) *x = 0; if (y) *y = 0; @@ -322,7 +322,7 @@ ecore_win32_window_size_get(Ecore_Win32_Window *window, { RECT rect; - EINA_ERROR_PINFO("getting window size\n"); + MESSAGE_INFO("getting window size\n"); if (!window) { @@ -335,7 +335,7 @@ ecore_win32_window_size_get(Ecore_Win32_Window *window, if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window, &rect)) { - EINA_ERROR_PERR("GetClientRect() failed\n"); + MESSAGE_ERR("GetClientRect() failed\n"); if (width) *width = 0; if (height) *height = 0; @@ -494,13 +494,13 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, GetWindowLong(wnd->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + MESSAGE_ERR("SetWindowLongPtr() failed\n"); return; } if (!RedrawWindow(wnd->window, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN)) { - EINA_ERROR_PERR("RedrawWindow() failed\n"); + MESSAGE_ERR("RedrawWindow() failed\n"); return; } #endif @@ -508,7 +508,7 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, else if (!SetWindowRgn(wnd->window, NULL, TRUE)) { - EINA_ERROR_PERR("SetWindowRgn() failed\n"); + MESSAGE_ERR("SetWindowRgn() failed\n"); } return; } @@ -542,7 +542,7 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, GetWindowLong(wnd->window, GWL_EXSTYLE) | WS_EX_LAYERED) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + MESSAGE_ERR("SetWindowLongPtr() failed\n"); return; } wnd->shape.layered = 1; @@ -552,7 +552,7 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, if (!(rgn = CreateRectRgn(0, 0, 0, 0))) { - EINA_ERROR_PERR("CreateRectRgn() failed\n"); + MESSAGE_ERR("CreateRectRgn() failed\n"); return; } for (y = 0; y < height; y++) @@ -561,7 +561,7 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, if (!(rgnLine = CreateRectRgn(0, 0, 0, 0))) { - EINA_ERROR_PERR("CreateRectRgn() failed\n"); + MESSAGE_ERR("CreateRectRgn() failed\n"); return; } for (x = 0; x < width; x++) @@ -572,33 +572,33 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, if (!(rgnDot = CreateRectRgn(x, y, x + 1, y + 1))) { - EINA_ERROR_PERR("CreateRectRgn() failed\n"); + MESSAGE_ERR("CreateRectRgn() failed\n"); return; } if (CombineRgn(rgnLine, rgnLine, rgnDot, RGN_OR) == ERROR) { - EINA_ERROR_PERR("CombineRgn() has not created a new region\n"); + MESSAGE_ERR("CombineRgn() has not created a new region\n"); } if (!DeleteObject(rgnDot)) { - EINA_ERROR_PERR("DeleteObject() failed\n"); + MESSAGE_ERR("DeleteObject() failed\n"); return; } } } if (CombineRgn(rgn, rgn, rgnLine, RGN_OR) == ERROR) { - EINA_ERROR_PERR("CombineRgn() has not created a new region\n"); + MESSAGE_ERR("CombineRgn() has not created a new region\n"); } if (!DeleteObject(rgnLine)) { - EINA_ERROR_PERR("DeleteObject() failed\n"); + MESSAGE_ERR("DeleteObject() failed\n"); return; } } if (!SetWindowRgn(wnd->window, rgn, TRUE)) { - EINA_ERROR_PERR("SetWindowRgn() failed\n"); + MESSAGE_ERR("SetWindowRgn() failed\n"); } } @@ -607,12 +607,12 @@ ecore_win32_window_show(Ecore_Win32_Window *window) { if (!window) return; - EINA_ERROR_PINFO("showing window\n"); + MESSAGE_INFO("showing window\n"); ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_SHOWNORMAL); if (!UpdateWindow(((struct _Ecore_Win32_Window *)window)->window)) { - EINA_ERROR_PERR("UpdateWindow() failed\n"); + MESSAGE_ERR("UpdateWindow() failed\n"); } } @@ -622,7 +622,7 @@ ecore_win32_window_hide(Ecore_Win32_Window *window) { if (!window) return; - EINA_ERROR_PINFO("hiding window\n"); + MESSAGE_INFO("hiding window\n"); ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_HIDE); } @@ -632,13 +632,13 @@ ecore_win32_window_raise(Ecore_Win32_Window *window) { if (!window) return; - EINA_ERROR_PINFO("raising window\n"); + MESSAGE_INFO("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"); + MESSAGE_ERR("SetWindowPos() failed\n"); } } @@ -647,13 +647,13 @@ ecore_win32_window_lower(Ecore_Win32_Window *window) { if (!window) return; - EINA_ERROR_PINFO("lowering window\n"); + MESSAGE_INFO("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"); + MESSAGE_ERR("SetWindowPos() failed\n"); } } @@ -665,11 +665,11 @@ ecore_win32_window_title_set(Ecore_Win32_Window *window, if (!title || !title[0]) return; - EINA_ERROR_PINFO("setting window title\n"); + MESSAGE_INFO("setting window title\n"); if (!SetWindowText(((struct _Ecore_Win32_Window *)window)->window, title)) { - EINA_ERROR_PERR("SetWindowText() failed\n"); + MESSAGE_ERR("SetWindowText() failed\n"); } } @@ -678,11 +678,11 @@ ecore_win32_window_focus_set(Ecore_Win32_Window *window) { if (!window) return; - EINA_ERROR_PINFO("focusing window\n"); + MESSAGE_INFO("focusing window\n"); if (!SetFocus(((struct _Ecore_Win32_Window *)window)->window)) { - EINA_ERROR_PERR("SetFocus() failed\n"); + MESSAGE_ERR("SetFocus() failed\n"); } } @@ -699,7 +699,7 @@ ecore_win32_window_iconified_set(Ecore_Win32_Window *window, ((!ew->iconified) && (!on))) return; - EINA_ERROR_PINFO("iconifying window: %s\n", on ? "yes" : "no"); + MESSAGE_INFO("iconifying window: %s\n", on ? "yes" : "no"); ShowWindow(ew->window, on ? SW_MINIMIZE : SW_RESTORE); ew->iconified = on; @@ -721,7 +721,7 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, ((!ew->borderless) && (!on))) return; - EINA_ERROR_PINFO("setting window without border: %s\n", on ? "yes" : "no"); + MESSAGE_INFO("setting window without border: %s\n", on ? "yes" : "no"); w = ew->window; @@ -730,13 +730,13 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, { if (!GetClientRect(w, &rect)) { - EINA_ERROR_PERR("GetClientRect() failed\n"); + MESSAGE_ERR("GetClientRect() failed\n"); return; } SetLastError(0); if (!SetWindowLongPtr(w, GWL_STYLE, style & ~(WS_CAPTION | WS_THICKFRAME)) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + MESSAGE_ERR("SetWindowLongPtr() failed\n"); return; } } @@ -744,19 +744,19 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, { if (!GetWindowRect(w, &rect)) { - EINA_ERROR_PERR("GetWindowRect() failed\n"); + MESSAGE_ERR("GetWindowRect() failed\n"); return; } style |= WS_CAPTION | WS_THICKFRAME; if (!AdjustWindowRect (&rect, style, FALSE)) { - EINA_ERROR_PERR("AdjustWindowRect() failed\n"); + MESSAGE_ERR("AdjustWindowRect() failed\n"); return; } SetLastError(0); if (!SetWindowLongPtr(w, GWL_STYLE, style) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + MESSAGE_ERR("SetWindowLongPtr() failed\n"); return; } } @@ -765,7 +765,7 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_FRAMECHANGED)) { - EINA_ERROR_PERR("SetWindowPos() failed\n"); + MESSAGE_ERR("SetWindowPos() failed\n"); return; } ew->borderless = on; @@ -785,7 +785,7 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, ((!ew->fullscreen) && (!on))) return; - EINA_ERROR_PINFO("setting fullscreen: %s\n", on ? "yes" : "no"); + MESSAGE_INFO("setting fullscreen: %s\n", on ? "yes" : "no"); ew->fullscreen = !!on; w = ew->window; @@ -796,12 +796,12 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, if (!GetWindowRect(w, &ew->rect)) { - EINA_ERROR_PERR("GetWindowRect() failed\n"); + MESSAGE_ERR("GetWindowRect() failed\n"); return; } if (!(ew->style = GetWindowLong(w, GWL_STYLE))) { - EINA_ERROR_PERR("GetWindowLong() failed\n"); + MESSAGE_ERR("GetWindowLong() failed\n"); return; } style = ew->style & ~WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX; @@ -809,20 +809,20 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, SetLastError(0); if (!SetWindowLongPtr(w, GWL_STYLE, style) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + MESSAGE_ERR("SetWindowLongPtr() failed\n"); return; } SetLastError(0); if (!SetWindowLongPtr(w, GWL_EXSTYLE, WS_EX_TOPMOST) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + MESSAGE_ERR("SetWindowLongPtr() 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"); + MESSAGE_ERR("SetWindowPos() failed\n"); return; } } @@ -831,13 +831,13 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, SetLastError(0); if (!SetWindowLongPtr(w, GWL_STYLE, ew->style) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + MESSAGE_ERR("SetWindowLongPtr() failed\n"); return; } SetLastError(0); if (!SetWindowLongPtr(w, GWL_EXSTYLE, 0) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + MESSAGE_ERR("SetWindowLongPtr() failed\n"); return; } if (!SetWindowPos(w, HWND_NOTOPMOST, @@ -847,7 +847,7 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, ew->rect.bottom - ew->rect.top, SWP_NOCOPYBITS | SWP_SHOWWINDOW)) { - EINA_ERROR_PERR("SetWindowPos() failed\n"); + MESSAGE_ERR("SetWindowPos() failed\n"); return; } } @@ -857,12 +857,12 @@ void ecore_win32_window_cursor_set(Ecore_Win32_Window *window, Ecore_Win32_Cursor *cursor) { - EINA_ERROR_PINFO("setting cursor\n"); + MESSAGE_INFO("setting cursor\n"); if (!SetClassLong(((struct _Ecore_Win32_Window *)window)->window, GCL_HCURSOR, (LONG)cursor)) { - EINA_ERROR_PERR("SetClassLong() failed\n"); + MESSAGE_ERR("SetClassLong() failed\n"); } } @@ -876,7 +876,7 @@ ecore_win32_window_state_set(Ecore_Win32_Window *window, if (!window || !state || !num) return; - EINA_ERROR_PINFO("setting cursor state\n"); + MESSAGE_INFO("setting cursor state\n"); for (i = 0; i < num; i++) { @@ -939,7 +939,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, ew = (struct _Ecore_Win32_Window *)window; w = ew->window; - EINA_ERROR_PINFO("sending cursor state\n"); + MESSAGE_INFO("sending cursor state\n"); switch (state) { @@ -963,7 +963,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, if (!SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0)) { - EINA_ERROR_PERR("SystemParametersInfo() failed\n"); + MESSAGE_ERR("SystemParametersInfo() failed\n"); break; } y = rect.top; @@ -971,7 +971,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, if (!GetClientRect(w, &rect)) { - EINA_ERROR_PERR("GetClientRect() failed\n"); + MESSAGE_ERR("GetClientRect() failed\n"); break; } @@ -980,7 +980,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, height, TRUE)) { - EINA_ERROR_PERR("MoveWindow() failed\n"); + MESSAGE_ERR("MoveWindow() failed\n"); } } break; @@ -991,7 +991,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, if (!GetClientRect(w, &rect)) { - EINA_ERROR_PERR("GetClientRect() failed\n"); + MESSAGE_ERR("GetClientRect() failed\n"); break; } @@ -1000,7 +1000,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, rect.bottom - rect.top, TRUE)) { - EINA_ERROR_PERR("MoveWindow() failed\n"); + MESSAGE_ERR("MoveWindow() failed\n"); } } break; @@ -1012,7 +1012,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, if (!SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0)) { - EINA_ERROR_PERR("SystemParametersInfo() failed\n"); + MESSAGE_ERR("SystemParametersInfo() failed\n"); break; } @@ -1021,7 +1021,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, rect.bottom - rect.top, TRUE)) { - EINA_ERROR_PERR("MoveWindow() failed\n"); + MESSAGE_ERR("MoveWindow() failed\n"); } } break; @@ -1042,7 +1042,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) { - EINA_ERROR_PERR("SetWindowPos() failed\n"); + MESSAGE_ERR("SetWindowPos() failed\n"); } break; case ECORE_WIN32_WINDOW_STATE_BELOW: @@ -1052,7 +1052,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) { - EINA_ERROR_PERR("SetWindowPos() failed\n"); + MESSAGE_ERR("SetWindowPos() failed\n"); } break; case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION: @@ -1071,7 +1071,7 @@ ecore_win32_window_type_set(Ecore_Win32_Window *window, if (!window) return; - EINA_ERROR_PINFO("setting window type\n"); + MESSAGE_INFO("setting window type\n"); switch (type) { @@ -1124,7 +1124,7 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent, w = (struct _Ecore_Win32_Window *)calloc(1, sizeof(struct _Ecore_Win32_Window)); if (!w) { - EINA_ERROR_PERR("malloc() failed\n"); + MESSAGE_ERR("malloc() failed\n"); return NULL; } @@ -1134,7 +1134,7 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent, rect.bottom = height; if (!AdjustWindowRect(&rect, style, FALSE)) { - EINA_ERROR_PERR("AdjustWindowRect() failed\n"); + MESSAGE_ERR("AdjustWindowRect() failed\n"); free(w); return NULL; } @@ -1164,7 +1164,7 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent, NULL, _ecore_win32_instance, NULL); if (!w->window) { - EINA_ERROR_PERR("CreateWindowEx() failed\n"); + MESSAGE_ERR("CreateWindowEx() failed\n"); free(w); return NULL; } @@ -1172,7 +1172,7 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent, SetLastError(0); if (!SetWindowLongPtr(w->window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + MESSAGE_ERR("SetWindowLongPtr() failed\n"); DestroyWindow(w->window); free(w); return NULL; diff --git a/legacy/ecore/src/lib/ecore_wince/ecore_wince.c b/legacy/ecore/src/lib/ecore_wince/ecore_wince.c index 5403b251d9..53c7685985 100644 --- a/legacy/ecore/src/lib/ecore_wince/ecore_wince.c +++ b/legacy/ecore/src/lib/ecore_wince/ecore_wince.c @@ -27,6 +27,7 @@ double _ecore_wince_double_click_time = 0.25; double _ecore_wince_event_last_time = 0.0; Ecore_WinCE_Window *_ecore_wince_event_last_window = NULL; HINSTANCE _ecore_wince_instance = NULL; +int _ecore_wince_log_dom = -1; int ECORE_WINCE_EVENT_MOUSE_IN = 0; int ECORE_WINCE_EVENT_MOUSE_OUT = 0; @@ -43,14 +44,15 @@ int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = 0; /***** Private declarations *****/ static int _ecore_wince_init_count = 0; - +static int _ecore_wince_log_dom = -1; LRESULT CALLBACK _ecore_wince_window_procedure(HWND window, UINT message, WPARAM window_param, LPARAM data_param); -static void _ecore_wince_error_print_cb(Eina_Error_Level level, +static void _ecore_wince_error_print_cb(const Eina_Log_Domain *d, + Eina_Log_Level level, const char *file, const char *fnc, int line, @@ -66,9 +68,17 @@ ecore_wince_init() { WNDCLASS wc; - eina_error_print_cb_set(_ecore_wince_error_print_cb, NULL); + _ecore_wince_error_print_cb_set(_ecore_wince_error_print_cb, NULL); - EINA_ERROR_PINFO("initializing ecore_wince (current count: %d)\n", _ecore_wince_init_count); + if(_ecore_wince_log_dom < 0) + _ecore_wince_log_dom = eina_log_domain_register("ecore_wince", EINA_LOG_COLOR_LIGHTBLUE); + if(_ecore_wince_log_dom < 0) + { + EINA_LOG_ERR("Could not register log domain: ecore_wince"); + return 0; + } + + MESSAGE_INFO("initializing ecore_wince (current count: %d)\n", _ecore_wince_init_count); if (_ecore_wince_init_count > 0) { @@ -79,7 +89,7 @@ ecore_wince_init() _ecore_wince_instance = GetModuleHandle(NULL); if (!_ecore_wince_instance) { - EINA_ERROR_PERR("GetModuleHandle() failed\n"); + MESSAGE_ERR("GetModuleHandle() failed\n"); return 0; } @@ -97,7 +107,7 @@ ecore_wince_init() if(!RegisterClass(&wc)) { - EINA_ERROR_PERR("RegisterClass() failed\n"); + MESSAGE_ERR("RegisterClass() failed\n"); FreeLibrary(_ecore_wince_instance); return 0; } @@ -128,7 +138,7 @@ ecore_wince_shutdown() { HWND task_bar; - EINA_ERROR_PINFO("shutting down ecore_wince (current count: %d)\n", _ecore_wince_init_count); + MESSAGE_INFO("shutting down ecore_wince (current count: %d)\n", _ecore_wince_init_count); _ecore_wince_init_count--; if (_ecore_wince_init_count > 0) return _ecore_wince_init_count; @@ -146,14 +156,16 @@ ecore_wince_shutdown() if (!UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance)) { - EINA_ERROR_PERR("UnregisterClass() failed\n"); + MESSAGE_ERR("UnregisterClass() failed\n"); } if (!FreeLibrary(_ecore_wince_instance)) { - EINA_ERROR_PERR("FreeLibrary() failed\n"); + MESSAGE_ERR("FreeLibrary() failed\n"); } _ecore_wince_instance = NULL; + eina_log_domain_unregister(_ecore_wince_log_dom); + if (_ecore_wince_init_count < 0) _ecore_wince_init_count = 0; return _ecore_wince_init_count; @@ -264,7 +276,7 @@ _ecore_wince_window_procedure(HWND window, { POINT pt; - EINA_ERROR_PINFO("mouse in window\n"); + MESSAGE_INFO("mouse in window\n"); pt.x = LOWORD(data_param); pt.y = HIWORD(data_param); @@ -287,7 +299,7 @@ _ecore_wince_window_procedure(HWND window, } else { - EINA_ERROR_PERR("GetClientRect() failed\n"); + MESSAGE_ERR("GetClientRect() failed\n"); } _ecore_wince_event_handle_motion_notify(data); @@ -335,13 +347,14 @@ _ecore_wince_window_procedure(HWND window, } 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) +_ecore_wince_error_print_cb(const Eina_Log_Domain *d __UNUSED__, + Eina_Log_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); diff --git a/legacy/ecore/src/lib/ecore_wince/ecore_wince_private.h b/legacy/ecore/src/lib/ecore_wince/ecore_wince_private.h index eedab27e8d..a9b13af9da 100644 --- a/legacy/ecore/src/lib/ecore_wince/ecore_wince_private.h +++ b/legacy/ecore/src/lib/ecore_wince/ecore_wince_private.h @@ -48,6 +48,10 @@ extern Ecore_WinCE_Window *_ecore_wince_event_last_window; extern HINSTANCE _ecore_wince_instance; +extern int _ecore_wince_log_dom; +#define MESSAGE_ERR(...) EINA_LOG_DOM_ERR(_ecore_wince_log_dom , __VA_ARGS__) +#define MESSAGE_DBG(...) EINA_LOG_DOM_DBG(_ecore_wince_log_dom , __VA_ARGS__) +#define MESSAGE_INFO(...) EINA_LOG_DOM_INFO(_ecore_wince_log_dom , __VA_ARGS__) void _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg, int is_keystroke); void _ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg, int is_keystroke); diff --git a/legacy/ecore/src/lib/ecore_wince/ecore_wince_window.c b/legacy/ecore/src/lib/ecore_wince/ecore_wince_window.c index e024f6e2ce..8cb22890a4 100644 --- a/legacy/ecore/src/lib/ecore_wince/ecore_wince_window.c +++ b/legacy/ecore/src/lib/ecore_wince/ecore_wince_window.c @@ -37,12 +37,12 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent, HWND window; RECT rect; - EINA_ERROR_PINFO("creating window\n"); + MESSAGE_INFO("creating window\n"); w = (struct _Ecore_WinCE_Window *)calloc(1, sizeof(struct _Ecore_WinCE_Window)); if (!w) { - EINA_ERROR_PERR("malloc() failed\n"); + MESSAGE_ERR("malloc() failed\n"); return NULL; } @@ -52,7 +52,7 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent, rect.bottom = height; if (!AdjustWindowRectEx(&rect, WS_CAPTION | WS_SYSMENU | WS_VISIBLE, FALSE, WS_EX_TOPMOST)) { - EINA_ERROR_PERR("AdjustWindowRectEx() failed\n"); + MESSAGE_ERR("AdjustWindowRectEx() failed\n"); free(w); return NULL; } @@ -67,14 +67,14 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent, NULL, _ecore_wince_instance, NULL); if (!window) { - EINA_ERROR_PERR("CreateWindowEx() failed\n"); + MESSAGE_ERR("CreateWindowEx() failed\n"); free(w); return NULL; } if (!_ecore_wince_hardware_keys_register(window)) { - EINA_ERROR_PERR("_ecore_wince_hardware_keys_register() failed\n"); + MESSAGE_ERR("_ecore_wince_hardware_keys_register() failed\n"); DestroyWindow(window); free(w); return NULL; @@ -85,7 +85,7 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent, SetLastError(0); if (!SetWindowLong(window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLong() failed\n"); + MESSAGE_ERR("SetWindowLong() failed\n"); DestroyWindow(window); free(w); return NULL; @@ -101,7 +101,7 @@ ecore_wince_window_free(Ecore_WinCE_Window *window) { if (!window) return; - EINA_ERROR_PINFO("destroying window\n"); + MESSAGE_INFO("destroying window\n"); DestroyWindow(((struct _Ecore_WinCE_Window *)window)->window); free(window); @@ -127,12 +127,12 @@ ecore_wince_window_move(Ecore_WinCE_Window *window, if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen) return; - EINA_ERROR_PINFO("moving window (%dx%d)\n", x, y); + MESSAGE_INFO("moving window (%dx%d)\n", x, y); w = ((struct _Ecore_WinCE_Window *)window)->window; if (!GetWindowRect(w, &rect)) { - EINA_ERROR_PERR("GetWindowRect() failed\n"); + MESSAGE_ERR("GetWindowRect() failed\n"); return; } @@ -141,7 +141,7 @@ ecore_wince_window_move(Ecore_WinCE_Window *window, rect.bottom - rect.top, TRUE)) { - EINA_ERROR_PERR("MoveWindow() failed\n"); + MESSAGE_ERR("MoveWindow() failed\n"); } } @@ -160,12 +160,12 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window, if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen) return; - EINA_ERROR_PINFO("resizing window (%dx%d)\n", width, height); + MESSAGE_INFO("resizing window (%dx%d)\n", width, height); w = (struct _Ecore_WinCE_Window *)window; if (!GetWindowRect(w->window, &rect)) { - EINA_ERROR_PERR("GetWindowRect() failed\n"); + MESSAGE_ERR("GetWindowRect() failed\n"); return; } @@ -177,17 +177,17 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window, rect.bottom = height; if (!(style = GetWindowLong(w->window, GWL_STYLE))) { - EINA_ERROR_PERR("GetWindowLong() failed\n"); + MESSAGE_ERR("GetWindowLong() failed\n"); return; } if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE))) { - EINA_ERROR_PERR("GetWindowLong() failed\n"); + MESSAGE_ERR("GetWindowLong() failed\n"); return; } if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle)) { - EINA_ERROR_PERR("AdjustWindowRectEx() failed\n"); + MESSAGE_ERR("AdjustWindowRectEx() failed\n"); return; } @@ -196,7 +196,7 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window, rect.bottom - rect.top, FALSE)) { - EINA_ERROR_PERR("MoveWindow() failed\n"); + MESSAGE_ERR("MoveWindow() failed\n"); } } @@ -215,7 +215,7 @@ ecore_wince_window_move_resize(Ecore_WinCE_Window *window, if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen) return; - EINA_ERROR_PINFO("moving and resizing window (%dx%d %dx%d)\n", x, y, width, height); + MESSAGE_INFO("moving and resizing window (%dx%d %dx%d)\n", x, y, width, height); w = ((struct _Ecore_WinCE_Window *)window); rect.left = 0; @@ -224,17 +224,17 @@ ecore_wince_window_move_resize(Ecore_WinCE_Window *window, rect.bottom = height; if (!(style = GetWindowLong(w->window, GWL_STYLE))) { - EINA_ERROR_PERR("GetWindowLong() failed\n"); + MESSAGE_ERR("GetWindowLong() failed\n"); return; } if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE))) { - EINA_ERROR_PERR("GetWindowLong() failed\n"); + MESSAGE_ERR("GetWindowLong() failed\n"); return; } if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle)) { - EINA_ERROR_PERR("AdjustWindowRectEx() failed\n"); + MESSAGE_ERR("AdjustWindowRectEx() failed\n"); return; } @@ -243,7 +243,7 @@ ecore_wince_window_move_resize(Ecore_WinCE_Window *window, rect.bottom - rect.top, TRUE)) { - EINA_ERROR_PERR("MoveWindow() failed\n"); + MESSAGE_ERR("MoveWindow() failed\n"); } } @@ -252,20 +252,20 @@ ecore_wince_window_show(Ecore_WinCE_Window *window) { if (!window) return; - EINA_ERROR_PINFO("showing window\n"); + MESSAGE_INFO("showing window\n"); if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_SHOWNORMAL)) { - EINA_ERROR_PERR("ShowWindow() failed\n"); + MESSAGE_ERR("ShowWindow() failed\n"); return; } if (!UpdateWindow(((struct _Ecore_WinCE_Window *)window)->window)) { - EINA_ERROR_PERR("UpdateWindow() failed\n"); + MESSAGE_ERR("UpdateWindow() failed\n"); } if (!SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 1, 0)) { - EINA_ERROR_PERR("SendMessage() failed\n"); + MESSAGE_ERR("SendMessage() failed\n"); } } @@ -274,16 +274,16 @@ ecore_wince_window_hide(Ecore_WinCE_Window *window) { if (!window) return; - EINA_ERROR_PINFO("hiding window\n"); + MESSAGE_INFO("hiding window\n"); if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_HIDE)) { - EINA_ERROR_PERR("ShowWindow() failed\n"); + MESSAGE_ERR("ShowWindow() failed\n"); return; } if (!SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 0, 0)) { - EINA_ERROR_PERR("SendMessage() failed\n"); + MESSAGE_ERR("SendMessage() failed\n"); } } @@ -297,14 +297,14 @@ ecore_wince_window_title_set(Ecore_WinCE_Window *window, if (!title || !title[0]) return; - EINA_ERROR_PINFO("setting window title\n"); + MESSAGE_INFO("setting window title\n"); wtitle = evil_char_to_wchar(title); if (!wtitle) return; if (!SetWindowText(((struct _Ecore_WinCE_Window *)window)->window, wtitle)) { - EINA_ERROR_PERR("SetWindowText() failed\n"); + MESSAGE_ERR("SetWindowText() failed\n"); } free(wtitle); } @@ -317,7 +317,7 @@ ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend) if (!window) return; - EINA_ERROR_PINFO("setting backend\n"); + MESSAGE_INFO("setting backend\n"); w = (struct _Ecore_WinCE_Window *)window; w->backend = backend; @@ -331,7 +331,7 @@ ecore_wince_window_suspend_set(Ecore_WinCE_Window *window, int (*suspend)(int)) if (!window) return; - EINA_ERROR_PINFO("setting suspend callback\n"); + MESSAGE_INFO("setting suspend callback\n"); w = (struct _Ecore_WinCE_Window *)window; w->suspend = suspend; @@ -345,7 +345,7 @@ ecore_wince_window_resume_set(Ecore_WinCE_Window *window, int (*resume)(int)) if (!window) return; - EINA_ERROR_PINFO("setting resume callback\n"); + MESSAGE_INFO("setting resume callback\n"); w = (struct _Ecore_WinCE_Window *)window; w->resume = resume; @@ -362,7 +362,7 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window, int w; int h; - EINA_ERROR_PINFO("getting window geometry\n"); + MESSAGE_INFO("getting window geometry\n"); if (!window) { @@ -377,7 +377,7 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window, if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window, &rect)) { - EINA_ERROR_PERR("GetClientRect() failed\n"); + MESSAGE_ERR("GetClientRect() failed\n"); if (x) *x = 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, &rect)) { - EINA_ERROR_PERR("GetWindowRect() failed\n"); + MESSAGE_ERR("GetWindowRect() failed\n"); if (x) *x = 0; if (y) *y = 0; @@ -416,7 +416,7 @@ ecore_wince_window_size_get(Ecore_WinCE_Window *window, { RECT rect; - EINA_ERROR_PINFO("getting window size\n"); + MESSAGE_INFO("getting window size\n"); if (!window) { @@ -429,7 +429,7 @@ ecore_wince_window_size_get(Ecore_WinCE_Window *window, if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window, &rect)) { - EINA_ERROR_PERR("GetClientRect() failed\n"); + MESSAGE_ERR("GetClientRect() failed\n"); if (width) *width = 0; if (height) *height = 0; @@ -454,7 +454,7 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, ((!ew->fullscreen) && (!on))) return; - EINA_ERROR_PINFO("setting fullscreen: %s\n", on ? "yes" : "no"); + MESSAGE_INFO("setting fullscreen: %s\n", on ? "yes" : "no"); ew->fullscreen = !!on; w = ew->window; @@ -464,7 +464,7 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, /* save the position and size of the window */ if (!GetWindowRect(w, &ew->rect)) { - EINA_ERROR_PERR("GetWindowRect() failed\n"); + MESSAGE_ERR("GetWindowRect() failed\n"); return; } @@ -472,21 +472,21 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, task_bar = FindWindow(L"HHTaskBar", NULL); if (!task_bar) { - EINA_ERROR_PINFO("FindWindow(): can not find task bar\n"); + MESSAGE_INFO("FindWindow(): can not find task bar\n"); } if (!ShowWindow(task_bar, SW_HIDE)) { - EINA_ERROR_PINFO("ShowWindow(): task bar already hidden\n"); + MESSAGE_INFO("ShowWindow(): task bar already hidden\n"); } if (!EnableWindow(task_bar, FALSE)) { - EINA_ERROR_PINFO("EnableWindow(): input already disabled\n"); + MESSAGE_INFO("EnableWindow(): input already disabled\n"); } /* style: visible + popup */ if (!SetWindowLong(w, GWL_STYLE, WS_POPUP | WS_VISIBLE)) { - EINA_ERROR_PINFO("SetWindowLong() failed\n"); + MESSAGE_INFO("SetWindowLong() failed\n"); } /* 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), SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED)) { - EINA_ERROR_PINFO("SetWindowPos() failed\n"); + MESSAGE_INFO("SetWindowPos() failed\n"); } /* * 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), TRUE)) { - EINA_ERROR_PINFO("MoveWindow() failed\n"); + MESSAGE_INFO("MoveWindow() failed\n"); } } else @@ -516,21 +516,21 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, task_bar = FindWindow(L"HHTaskBar", NULL); if (!task_bar) { - EINA_ERROR_PINFO("FindWindow(): can not find task bar\n"); + MESSAGE_INFO("FindWindow(): can not find task bar\n"); } if (!ShowWindow(task_bar, SW_SHOW)) { - EINA_ERROR_PINFO("ShowWindow(): task bar already visible\n"); + MESSAGE_INFO("ShowWindow(): task bar already visible\n"); } if (!EnableWindow(task_bar, TRUE)) { - EINA_ERROR_PINFO("EnableWindow(): input already enabled\n"); + MESSAGE_INFO("EnableWindow(): input already enabled\n"); } /* style: visible + caption + sysmenu */ if (!SetWindowLong(w, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE)) { - EINA_ERROR_PINFO("SetWindowLong() failed\n"); + MESSAGE_INFO("SetWindowLong() failed\n"); } /* restaure the position and size of the window */ if (!SetWindowPos(w, HWND_TOPMOST, @@ -540,7 +540,7 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, ew->rect.bottom - ew->rect.top, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED)) { - EINA_ERROR_PINFO("SetWindowLong() failed\n"); + MESSAGE_INFO("SetWindowLong() failed\n"); } /* * 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, TRUE)) { - EINA_ERROR_PINFO("MoveWindow() failed\n"); + MESSAGE_INFO("MoveWindow() failed\n"); } } } @@ -572,14 +572,14 @@ _ecore_wince_hardware_keys_register(HWND window) core_dll = LoadLibrary(L"coredll.dll"); if (!core_dll) { - EINA_ERROR_PERR("LoadLibrary() failed\n"); + MESSAGE_ERR("LoadLibrary() failed\n"); return 0; } unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1"); if (!unregister_fct) { - EINA_ERROR_PERR("GetProcAddress() failed\n"); + MESSAGE_ERR("GetProcAddress() failed\n"); FreeLibrary(core_dll); return 0; }