From 3dfd5f38f58450053a5460806507bb81605d032d Mon Sep 17 00:00:00 2001 From: caro Date: Fri, 24 Apr 2009 19:37:09 +0000 Subject: [PATCH] * formatting in ecore_evas_win32.c * fix fullscreen_set() and borderless_set() functions in ecore_win32 * change SetWindowLong() to SetWindowLongPtr() as it is deprecated * better error management when dealing with SetWindowLongPtr() * remove useless SendMessage() calls * other minor fixes git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@40354 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_evas/ecore_evas_win32.c | 26 +++++----- src/lib/ecore_win32/ecore_win32_window.c | 83 ++++++++++++++++---------------- 2 files changed, 56 insertions(+), 53 deletions(-) diff --git a/src/lib/ecore_evas/ecore_evas_win32.c b/src/lib/ecore_evas/ecore_evas_win32.c index f16a6ff..edf3115 100644 --- a/src/lib/ecore_evas/ecore_evas_win32.c +++ b/src/lib/ecore_evas/ecore_evas_win32.c @@ -772,35 +772,37 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) window->shape.mask); } - if (strcmp(ee->driver, "direct3d") == 0) + /* Nothing to be done for the GDI backend at the evas level */ + +#ifdef BUILD_ECORE_EVAS_SOFTWRE_DDRAW + if (strcmp(ee->driver, "software_ddraw") == 0) { -#ifdef BUILD_ECORE_EVAS_DIRECT3D - Evas_Engine_Info_Direct3D *einfo; + Evas_Engine_Info_Software_DDraw *einfo; - einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ecore_evas_get(ee)); + einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee)); if (einfo != NULL) { einfo->info.fullscreen = !!on; - einfo->info.layered = window->shape.layered; +/* einfo->info.layered = window->shape.layered; */ evas_engine_info_set(ecore_evas_get(ee), (Evas_Engine_Info *)einfo); } -#endif /* BUILD_ECORE_EVAS_DIRECT3D */ } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ - if (strcmp(ee->driver, "software_ddraw") == 0) +#ifdef BUILD_ECORE_EVAS_DIRECT3D + if (strcmp(ee->driver, "direct3d") == 0) { -#ifdef BUILD_ECORE_EVAS_SOFTWRE_DDRAW - Evas_Engine_Info_Software_DDraw *einfo; + Evas_Engine_Info_Direct3D *einfo; - einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee)); + einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ecore_evas_get(ee)); if (einfo != NULL) { einfo->info.fullscreen = !!on; -/* einfo->info.layered = window->shape.layered; */ + einfo->info.layered = window->shape.layered; evas_engine_info_set(ecore_evas_get(ee), (Evas_Engine_Info *)einfo); } -#endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ } +#endif /* BUILD_ECORE_EVAS_DIRECT3D */ } diff --git a/src/lib/ecore_win32/ecore_win32_window.c b/src/lib/ecore_win32/ecore_win32_window.c index caf4714..53138f5 100644 --- a/src/lib/ecore_win32/ecore_win32_window.c +++ b/src/lib/ecore_win32/ecore_win32_window.c @@ -489,10 +489,12 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, { wnd->shape.layered = 0; #if defined(WS_EX_LAYERED) - if (!SetWindowLong(wnd->window, GWL_EXSTYLE, - GetWindowLong(wnd->window, GWL_EXSTYLE) & (~WS_EX_LAYERED))) + SetLastError(0); + if (!SetWindowLongPtr(wnd->window, GWL_EXSTYLE, + GetWindowLong(wnd->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) && + (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLong() failed\n"); + EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); return; } if (!RedrawWindow(wnd->window, NULL, NULL, @@ -535,10 +537,12 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, version_info.dwOSVersionInfoSize = sizeof(version_info); if (GetVersionEx(&version_info) == TRUE && version_info.dwMajorVersion == 5) { - if (!SetWindowLong(wnd->window, GWL_EXSTYLE, - GetWindowLong(wnd->window, GWL_EXSTYLE) | WS_EX_LAYERED)) + SetLastError(0); + if (!SetWindowLongPtr(wnd->window, GWL_EXSTYLE, + GetWindowLong(wnd->window, GWL_EXSTYLE) | WS_EX_LAYERED) && + (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLong() failed\n"); + EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); return; } wnd->shape.layered = 1; @@ -605,19 +609,11 @@ ecore_win32_window_show(Ecore_Win32_Window *window) EINA_ERROR_PINFO("showing window\n"); - if (!ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_SHOWNORMAL)) - { - EINA_ERROR_PERR("ShowWindow() failed\n"); - return; - } + ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_SHOWNORMAL); if (!UpdateWindow(((struct _Ecore_Win32_Window *)window)->window)) { EINA_ERROR_PERR("UpdateWindow() failed\n"); } - if (!SendMessage(((struct _Ecore_Win32_Window *)window)->window, WM_SHOWWINDOW, 1, 0)) - { - EINA_ERROR_PERR("SendMessage() failed\n"); - } } /* FIXME: seems to block the taskbar */ @@ -628,14 +624,7 @@ ecore_win32_window_hide(Ecore_Win32_Window *window) EINA_ERROR_PINFO("hiding window\n"); - if (!ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_HIDE)) - { - EINA_ERROR_PERR("ShowWindow() failed\n"); - } - if (!SendMessage(((struct _Ecore_Win32_Window *)window)->window, WM_SHOWWINDOW, 0, 0)) - { - EINA_ERROR_PERR("SendMessage() failed\n"); - } + ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_HIDE); } void @@ -712,10 +701,7 @@ ecore_win32_window_iconified_set(Ecore_Win32_Window *window, EINA_ERROR_PINFO("iconifying window: %s\n", on ? "yes" : "no"); - if (!ShowWindow(ew->window, on ? SW_MINIMIZE : SW_RESTORE)) - { - EINA_ERROR_PERR("ShowWindow() failed\n"); - } + ShowWindow(ew->window, on ? SW_MINIMIZE : SW_RESTORE); ew->iconified = on; } @@ -735,14 +721,24 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, ((!ew->borderless) && (!on))) return; - EINA_ERROR_PINFO("setting window border: %s\n", on ? "yes" : "no"); + EINA_ERROR_PINFO("setting window without border: %s\n", on ? "yes" : "no"); w = ew->window; style = GetWindowLong(w, GWL_STYLE); if (on) { - SetWindowLong(w, GWL_STYLE, style & ~WS_CAPTION); + if (!GetClientRect(w, &rect)) + { + EINA_ERROR_PERR("GetClientRect() failed\n"); + return; + } + SetLastError(0); + if (!SetWindowLongPtr(w, GWL_STYLE, style & ~WS_CAPTION) && (GetLastError() != 0)) + { + EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); + return; + } } else { @@ -757,9 +753,10 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, EINA_ERROR_PERR("AdjustWindowRect() failed\n"); return; } - if (!SetWindowLong(w, GWL_STYLE, style)) + SetLastError(0); + if (!SetWindowLongPtr(w, GWL_STYLE, style) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLong() failed\n"); + EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); return; } } @@ -809,14 +806,16 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, } style = ew->style & ~WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX; style |= WS_VISIBLE | WS_POPUP; - if (!SetWindowLong(w, GWL_STYLE, style)) + SetLastError(0); + if (!SetWindowLongPtr(w, GWL_STYLE, style) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLong() failed\n"); + EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); return; } - if (!SetWindowLong(w, GWL_EXSTYLE, WS_EX_TOPMOST)) + SetLastError(0); + if (!SetWindowLongPtr(w, GWL_EXSTYLE, WS_EX_TOPMOST) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLong() failed\n"); + EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); return; } if (!SetWindowPos(w, HWND_TOPMOST, 0, 0, @@ -829,14 +828,16 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, } else { - if (!SetWindowLong(w, GWL_STYLE, ew->style)) + SetLastError(0); + if (!SetWindowLongPtr(w, GWL_STYLE, ew->style) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLong() failed\n"); + EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); return; } - if (!SetWindowLong(w, GWL_EXSTYLE, 0)) + SetLastError(0); + if (!SetWindowLongPtr(w, GWL_EXSTYLE, 0) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLong() failed\n"); + EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); return; } if (!SetWindowPos(w, HWND_NOTOPMOST, @@ -1169,9 +1170,9 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent, } SetLastError(0); - if (!SetWindowLong(w->window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0)) + if (!SetWindowLongPtr(w->window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0)) { - EINA_ERROR_PERR("SetWindowLong() failed\n"); + EINA_ERROR_PERR("SetWindowLongPtr() failed\n"); DestroyWindow(w->window); free(w); return NULL; -- 2.7.4