* 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


SVN revision: 40354
This commit is contained in:
Vincent Torri 2009-04-24 19:37:09 +00:00
parent 619def6ea5
commit e9bacbe619
2 changed files with 60 additions and 57 deletions

View File

@ -772,24 +772,11 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on)
window->shape.mask);
}
if (strcmp(ee->driver, "direct3d") == 0)
{
#ifdef BUILD_ECORE_EVAS_DIRECT3D
Evas_Engine_Info_Direct3D *einfo;
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;
evas_engine_info_set(ecore_evas_get(ee), (Evas_Engine_Info *)einfo);
}
#endif /* BUILD_ECORE_EVAS_DIRECT3D */
}
/* 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_SOFTWRE_DDRAW
Evas_Engine_Info_Software_DDraw *einfo;
einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee));
@ -799,8 +786,23 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on)
/* 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_SOFTWARE_DDRAW */
#ifdef BUILD_ECORE_EVAS_DIRECT3D
if (strcmp(ee->driver, "direct3d") == 0)
{
Evas_Engine_Info_Direct3D *einfo;
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;
evas_engine_info_set(ecore_evas_get(ee), (Evas_Engine_Info *)einfo);
}
}
#endif /* BUILD_ECORE_EVAS_DIRECT3D */
}

View File

@ -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;