From 8ebe31bf7180d74d4c6008ed834da5c13f5d0b33 Mon Sep 17 00:00:00 2001 From: caro Date: Sat, 10 Jan 2009 17:57:25 +0000 Subject: [PATCH] * ecore/ecore_pipe.c: fix doc * ecore_file/Makefile.am: add Windows cflags * ecore_file/ecore_file_private.h: move Evil.h so that EAPI is correctly defined * ecore_wince: make window_new windowed by default. other backend that gdi might have problems. add title_set and fullscreen_set functions. do not use aygshell features anymore for fullscreen (it's not free and not always available) include missing config.h * ecore_evas: move Evas.h and Ecore_Getopt.h so that EAPI is correctly defined add title_set and fullscreen_set functions. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@38540 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- configure.ac | 4 +- src/lib/ecore/ecore_pipe.c | 4 +- src/lib/ecore_evas/Ecore_Evas.h | 6 +- src/lib/ecore_evas/ecore_evas_private.h | 3 + src/lib/ecore_evas/ecore_evas_wince.c | 75 ++++++++++++----- src/lib/ecore_file/Makefile.am | 3 +- src/lib/ecore_file/ecore_file_private.h | 6 +- src/lib/ecore_wince/Ecore_WinCE.h | 8 ++ src/lib/ecore_wince/ecore_wince.c | 14 ++-- src/lib/ecore_wince/ecore_wince_event.c | 8 +- src/lib/ecore_wince/ecore_wince_private.h | 3 + src/lib/ecore_wince/ecore_wince_window.c | 130 ++++++++++++++++++++++++++---- 12 files changed, 210 insertions(+), 54 deletions(-) diff --git a/configure.ac b/configure.ac index d7c2894..932bf8b 100644 --- a/configure.ac +++ b/configure.ac @@ -89,12 +89,12 @@ case "$host_os" in AC_DEFINE(EFL_ECORE_WINCE_BUILD, 1, [Define to mention that ecore WinCE is built.]) WIN32_CPPFLAGS="-D_WIN32_WCE=0x0420" WIN32_CFLAGS="-mwin32" - WIN32_LIBS="-lws2 -laygshell" + WIN32_LIBS="-lws2" else if test "$host_os" = "mingw32ce" ; then AC_DEFINE(EFL_ECORE_WINCE_BUILD, 1, [Define to mention that ecore WinCE is built.]) WIN32_CPPFLAGS="-D_WIN32_WCE=0x0420" - WIN32_LIBS="-lws2 -laygshell" + WIN32_LIBS="-lws2" else WIN32_LIBS="-lws2_32" fi diff --git a/src/lib/ecore/ecore_pipe.c b/src/lib/ecore/ecore_pipe.c index cd3d6bc..4f435d2 100644 --- a/src/lib/ecore/ecore_pipe.c +++ b/src/lib/ecore/ecore_pipe.c @@ -148,7 +148,7 @@ static int _ecore_pipe_read(void *data, * pipeline = _buid_pipeline (filename, pipe); * if (!pipeline) { * g_print ("Error during the pipeline building\n"); - * ecore_pipe_free (pipe); + * ecore_pipe_del (pipe); * ecore_shutdown (); * gst_deinit (); * return -1; @@ -158,7 +158,7 @@ static int _ecore_pipe_read(void *data, * * ecore_main_loop_begin(); * - * ecore_pipe_free (pipe); + * ecore_pipe_del (pipe); * ecore_shutdown (); * gst_deinit (); * diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index 12b7b86..6e97a15 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -5,6 +5,9 @@ #ifndef _ECORE_EVAS_H #define _ECORE_EVAS_H +#include +#include + #ifdef EAPI # undef EAPI #endif @@ -48,9 +51,6 @@ * - dfb back-end ??? (dfb's threads make this REALLY HARD) */ -#include -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index 51c85fa..4d32413 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -212,6 +212,9 @@ struct _Ecore_Evas_Engine #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE struct { Ecore_WinCE_Window *window; + struct { + unsigned char fullscreen : 1; + } state; } wince; #endif diff --git a/src/lib/ecore_evas/ecore_evas_wince.c b/src/lib/ecore_evas/ecore_evas_wince.c index e6e306e..812e88f 100644 --- a/src/lib/ecore_evas/ecore_evas_wince.c +++ b/src/lib/ecore_evas/ecore_evas_wince.c @@ -705,14 +705,14 @@ _ecore_evas_wince_hide(Ecore_Evas *ee) /* ecore_wince_window_lower(ee->engine.wince.window); */ /* } */ -/* static void */ -/* _ecore_evas_wince_title_set(Ecore_Evas *ee, const char *title) */ -/* { */ -/* if (ee->prop.title) free(ee->prop.title); */ -/* ee->prop.title = NULL; */ -/* if (title) ee->prop.title = strdup(title); */ -/* ecore_wince_window_title_set(ee->engine.wince.window, ee->prop.title); */ -/* } */ +static void +_ecore_evas_wince_title_set(Ecore_Evas *ee, const char *title) +{ + if (ee->prop.title) free(ee->prop.title); + ee->prop.title = NULL; + if (title) ee->prop.title = strdup(title); + ecore_wince_window_title_set(ee->engine.wince.window, ee->prop.title); +} /* static void */ /* _ecore_evas_wince_size_min_set(Ecore_Evas *ee, int width, int height) */ @@ -821,17 +821,52 @@ _ecore_evas_wince_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ho static void _ecore_evas_wince_fullscreen_set(Ecore_Evas *ee, int on) { -/* if ((ee->prop.fullscreen && on) || */ -/* (!ee->prop.fullscreen && !on)) return; */ - -/* ee->engine.wince.state.fullscreen = on; */ -/* ecore_wince_window_fullscreen_set(ee->engine.wince.window, ee->prop.borderless); */ - /* FIXME: what to do with that code ?? */ -/* if (ee->should_be_visible) */ -/* ecore_x_netwm_state_request_send(ee->engine.x.win, ee->engine.x.win_root, */ -/* ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on); */ -/* else */ -/* _ecore_evas_wince_state_update(ee); */ + Evas_Engine_Info_Software_16_WinCE *einfo; + struct _Ecore_WinCE_Window *window; + + if ((ee->engine.wince.state.fullscreen && on) || + (!ee->engine.wince.state.fullscreen && !on)) + return; + + ee->engine.wince.state.fullscreen = on; + ee->prop.fullscreen = on; + + window = (struct _Ecore_WinCE_Window *)ee->engine.wince.window; + + if (on != 0) + { +/* ecore_win32_window_shape_set(ee->engine.win32.window, 0, 0, NULL); */ + ecore_wince_window_fullscreen_set(ee->engine.wince.window, on); + ee->w = GetSystemMetrics(SM_CXSCREEN); + ee->h = GetSystemMetrics(SM_CYSCREEN); + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + else + { + int w; + int h; + + ecore_wince_window_fullscreen_set(ee->engine.wince.window, on); + ecore_wince_window_size_get(ee->engine.wince.window, &w, &h); + ee->w = w; + ee->h = h; + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); +/* ecore_win32_window_shape_set(window, */ +/* window->shape.width, */ +/* window->shape.height, */ +/* window->shape.mask); */ + } + + einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ecore_evas_get(ee)); + if (einfo != NULL) + { + einfo->info.fullscreen = !!on; +/* einfo->info.layered = window->shape.layered; */ + printf ("_ecore_evas_wince_fullscreen_set : %d\n", einfo->info.fullscreen); + evas_engine_info_set(ecore_evas_get(ee), (Evas_Engine_Info *)einfo); + } } static void * @@ -868,7 +903,7 @@ static const Ecore_Evas_Engine_Func _ecore_wince_engine_func = NULL, //_ecore_evas_wince_raise, NULL, //_ecore_evas_wince_lower, NULL, //_ecore_evas_wince_activate, - NULL, //_ecore_evas_wince_title_set, + _ecore_evas_wince_title_set, NULL, /* _ecore_evas_x_name_class_set */ NULL, //_ecore_evas_wince_size_min_set, NULL, //_ecore_evas_wince_size_max_set, diff --git a/src/lib/ecore_file/Makefile.am b/src/lib/ecore_file/Makefile.am index 811d560..01978f0 100644 --- a/src/lib/ecore_file/Makefile.am +++ b/src/lib/ecore_file/Makefile.am @@ -6,7 +6,8 @@ AM_CPPFLAGS = \ -I$(top_builddir)/src/lib/ecore \ @CURL_CFLAGS@ \ @EVIL_CFLAGS@ \ -@EINA_CFLAGS@ +@EINA_CFLAGS@ \ +@WIN32_CPPFLAGS@ AM_CFLAGS = @WIN32_CFLAGS@ diff --git a/src/lib/ecore_file/ecore_file_private.h b/src/lib/ecore_file/ecore_file_private.h index e2001f7..0c642ae 100644 --- a/src/lib/ecore_file/ecore_file_private.h +++ b/src/lib/ecore_file/ecore_file_private.h @@ -6,13 +6,13 @@ # include #endif -#include "Ecore.h" -#include "ecore_private.h" - #ifdef HAVE_EVIL # include #endif +#include "Ecore.h" +#include "ecore_private.h" + #include "Ecore_File.h" /* ecore_file_monitor */ diff --git a/src/lib/ecore_wince/Ecore_WinCE.h b/src/lib/ecore_wince/Ecore_WinCE.h index 0b6b46a..6920406 100644 --- a/src/lib/ecore_wince/Ecore_WinCE.h +++ b/src/lib/ecore_wince/Ecore_WinCE.h @@ -37,7 +37,9 @@ extern "C" { #endif +#ifndef _ECORE_EVAS_H typedef void Ecore_WinCE_Window; +#endif /* Events */ @@ -213,6 +215,9 @@ EAPI void ecore_wince_window_show(Ecore_WinCE_Window *window); EAPI void ecore_wince_window_hide(Ecore_WinCE_Window *window); +EAPI void ecore_wince_window_title_set(Ecore_WinCE_Window *window, + const char *title); + EAPI void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend); EAPI void ecore_wince_window_suspend_set(Ecore_WinCE_Window *window, int (*suspend)(int)); @@ -231,6 +236,9 @@ EAPI void ecore_wince_window_size_get(Ecore_WinCE_Window *window, EAPI void *ecore_wince_window_window_get(Ecore_WinCE_Window *window); +EAPI void ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, + int on); + #ifdef __cplusplus } diff --git a/src/lib/ecore_wince/ecore_wince.c b/src/lib/ecore_wince/ecore_wince.c index 1eb9806..fe689bf 100644 --- a/src/lib/ecore_wince/ecore_wince.c +++ b/src/lib/ecore_wince/ecore_wince.c @@ -2,6 +2,10 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include /* for printf */ @@ -105,8 +109,6 @@ ecore_wince_init() _ecore_wince_init_count++; - printf ("ecore_wince : instance + class bon\n"); - return _ecore_wince_init_count; } @@ -276,7 +278,7 @@ _ecore_wince_window_procedure(HWND window, _ecore_wince_event_handle_create_notify(data); return 0; case WM_DESTROY: - printf (" * ecore message : destroy\n"); + printf (" *** ecore message : destroy\n"); _ecore_wince_event_handle_destroy_notify(data); return 0; case WM_SHOWWINDOW: @@ -297,7 +299,7 @@ _ecore_wince_window_procedure(HWND window, return 0; case WM_CLOSE: - printf (" * ecore message : close\n"); + printf (" *** ecore message : close\n"); _ecore_wince_event_handle_delete_request(data); return 0; /* GDI notifications */ @@ -306,10 +308,10 @@ _ecore_wince_window_procedure(HWND window, RECT rect; PAINTSTRUCT paint; - printf (" * ecore message : paint\n"); +/* printf (" * ecore message : paint\n"); */ if (BeginPaint(window, &paint)) { - printf (" * ecore message : painting...\n"); +/* printf (" * ecore message : painting...\n"); */ data->update = paint.rcPaint; _ecore_wince_event_handle_expose(data); EndPaint(window, &paint); diff --git a/src/lib/ecore_wince/ecore_wince_event.c b/src/lib/ecore_wince/ecore_wince_event.c index 73fcd56..1904b4b 100644 --- a/src/lib/ecore_wince/ecore_wince_event.c +++ b/src/lib/ecore_wince/ecore_wince_event.c @@ -2,6 +2,10 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include /* for printf */ @@ -263,7 +267,7 @@ _ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg) Ecore_WinCE_Window *window; window = (void *)GetWindowLong(msg->window, GWL_USERDATA); - printf (" * ecore event enter notify 0\n"); +/* printf (" * ecore event enter notify 0\n"); */ { Ecore_WinCE_Event_Mouse_Move *e; @@ -297,7 +301,7 @@ _ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg) ecore_event_add(ECORE_WINCE_EVENT_MOUSE_IN, e, NULL, NULL); } - printf (" * ecore event enter notify 1\n"); +/* printf (" * ecore event enter notify 1\n"); */ } void diff --git a/src/lib/ecore_wince/ecore_wince_private.h b/src/lib/ecore_wince/ecore_wince_private.h index 68aeed2..85ad0f7 100644 --- a/src/lib/ecore_wince/ecore_wince_private.h +++ b/src/lib/ecore_wince/ecore_wince_private.h @@ -36,7 +36,10 @@ struct _Ecore_WinCE_Window ecore_wince_suspend suspend; ecore_wince_resume resume; + RECT rect; /* used to go fullscreen to normal */ + unsigned int pointer_is_in : 1; + unsigned int fullscreen : 1; }; extern double _ecore_wince_double_click_time; diff --git a/src/lib/ecore_wince/ecore_wince_window.c b/src/lib/ecore_wince/ecore_wince_window.c index de97069..8933d1d 100644 --- a/src/lib/ecore_wince/ecore_wince_window.c +++ b/src/lib/ecore_wince/ecore_wince_window.c @@ -2,13 +2,15 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ -#include -#include /* for printf */ +#ifdef HAVE_CONFIG_H +# include +#endif #define WIN32_LEAN_AND_MEAN #include #undef WIN32_LEAN_AND_MEAN -#include + +#include #include "Ecore_WinCE.h" #include "ecore_wince_private.h" @@ -38,18 +40,23 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent, if (!w) return NULL; - SetRect(&rect, 0, 0, - GetSystemMetrics(SM_CXSCREEN), - GetSystemMetrics(SM_CYSCREEN)); + rect.left = 0; + rect.top = 0; + rect.right = width; + rect.bottom = height; + if (!AdjustWindowRectEx(&rect, WS_CAPTION | WS_SYSMENU | WS_VISIBLE, FALSE, WS_EX_TOPMOST)) + { + free(w); + return NULL; + } window = CreateWindowEx(WS_EX_TOPMOST, ECORE_WINCE_WINDOW_CLASS, L"", - WS_VISIBLE | WS_POPUP, - rect.left, rect.top, - rect.right - rect.left, - rect.bottom - rect.top, - parent ? ((struct _Ecore_WinCE_Window *)parent)->window : NULL, + WS_CAPTION | WS_SYSMENU | WS_VISIBLE, + x, y, + rect.right - rect.left, rect.bottom - rect.top, + parent ? ((struct _Ecore_WinCE_Window *)parent)->window : NULL, NULL, _ecore_wince_instance, NULL); if (!window) { @@ -57,9 +64,6 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent, return NULL; } - SHFullScreen(window, - SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON); - if (!_ecore_wince_hardware_keys_register(window)) { DestroyWindow(window); @@ -116,6 +120,23 @@ ecore_wince_window_hide(Ecore_WinCE_Window *window) } void +ecore_wince_window_title_set(Ecore_WinCE_Window *window, + const char *title) +{ + wchar_t *wtitle; + + if (!window) return; + + if (!title || !title[0]) return; + + wtitle = evil_char_to_wchar(title); + if (!wtitle) return; + + SetWindowText(((struct _Ecore_WinCE_Window *)window)->window, wtitle); + free(wtitle); +} + +void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend) { struct _Ecore_WinCE_Window *w; @@ -211,7 +232,6 @@ ecore_wince_window_size_get(Ecore_WinCE_Window *window, { RECT rect; - printf ("ecore_wince_window_size_get %p\n", window); if (!window) { if (width) *width = GetSystemMetrics(SM_CXSCREEN); @@ -242,6 +262,86 @@ ecore_wince_window_window_get(Ecore_WinCE_Window *window) return ((struct _Ecore_WinCE_Window *)window)->window; } +void +ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, + int on) +{ + struct _Ecore_WinCE_Window *ew; + HWND w; + HWND task_bar; + int width; + int height; + + if (!window) return; + + ew = (struct _Ecore_WinCE_Window *)window; + if (((ew->fullscreen) && (on)) || + ((!ew->fullscreen) && (!on))) + return; + + ew->fullscreen = !!on; + w = ew->window; + + if (on) + { + /* save the position and size of the window */ + if (!GetWindowRect(w, &ew->rect)) return; + + /* hide task bar */ + task_bar = FindWindow(L"HHTaskBar", NULL); + if (!task_bar) return; + ShowWindow(task_bar, SW_HIDE); + EnableWindow(task_bar, FALSE); + + /* style: visible + popup */ + if (!SetWindowLong(w, GWL_STYLE, WS_POPUP | WS_VISIBLE)) return; + + /* resize window to fit the entire screen */ + SetWindowPos(w, HWND_TOPMOST, + 0, 0, + GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + /* + * It seems that SetWindowPos is not sufficient. + * Call MoveWindow with the correct size and force painting. + * Note that UpdateWindow (forcing repainting) is not sufficient + */ + MoveWindow(w, + 0, 0, + GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), + TRUE); + } + else + { + /* show task bar */ + task_bar = FindWindow(L"HHTaskBar", NULL); + if (!task_bar) return; + ShowWindow(task_bar, SW_SHOW); + EnableWindow(task_bar, TRUE); + + /* style: visible + caption + sysmenu */ + if (!SetWindowLong(w, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE)) return; + /* restaure the position and size of the window */ + SetWindowPos(w, HWND_TOPMOST, + ew->rect.left, + ew->rect.top, + ew->rect.right - ew->rect.left, + ew->rect.bottom - ew->rect.top, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + /* + * It seems that SetWindowPos is not sufficient. + * Call MoveWindow with the correct size and force painting. + * Note that UpdateWindow (forcing repainting) is not sufficient + */ + MoveWindow(w, + ew->rect.left, + ew->rect.top, + ew->rect.right - ew->rect.left, + ew->rect.bottom - ew->rect.top, + TRUE); + } +} + /***** Private functions definitions *****/ -- 2.7.4