Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:rhabacker:branches:windows:mingw:win32
mingw32-gtk3
0001-Save-Windows-XP-compatibility.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Save-Windows-XP-compatibility.patch of Package mingw32-gtk3
From f9e841af3fb0c33043adf4fcf3f026c883585af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch> Date: Tue, 20 Oct 2015 10:35:06 +0200 Subject: [PATCH] Save Windows XP compatibility --- configure.ac | 2 +- gdk/Makefile.am | 2 +- gdk/win32/gdkscreen-win32.c | 26 +++++++++++++++++++++++++- gdk/win32/gdkwindow-win32.c | 23 ++++++++++++++++++++++- 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 09b464d..4c3829f 100644 --- a/configure.ac +++ b/configure.ac @@ -384,7 +384,7 @@ if test "$enable_win32_backend" = "yes"; then backend_immodules="$backend_immodules,ime" GDK_WINDOWING="$GDK_WINDOWING #define GDK_WINDOWING_WIN32" - GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi" + GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm" AM_CONDITIONAL(USE_WIN32, true) PANGO_PACKAGES="pangowin32 pangocairo" else diff --git a/gdk/Makefile.am b/gdk/Makefile.am index dea10d1..5841585 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -195,7 +195,7 @@ libgdk_3_la_LIBADD += quartz/libgdk-quartz.la endif # USE_QUARTZ if USE_WIN32 -libgdk_3_la_LIBADD += win32/libgdk-win32.la +libgdk_3_la_LIBADD += win32/libgdk-win32.la $(GLIB_LIBS) libgdk_3_la_DEPENDENCIES = win32/libgdk-win32.la win32/rc/gdk-win32-res.o libgdk_3_la_LDFLAGS += -Wl,win32/rc/gdk-win32-res.o endif # USE_WIN32 diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c index c637b95..497f570 100644 --- a/gdk/win32/gdkscreen-win32.c +++ b/gdk/win32/gdkscreen-win32.c @@ -22,6 +22,7 @@ #include "gdkwin32screen.h" #include <dwmapi.h> +#include <gmodule.h> struct _GdkWin32Screen { @@ -189,6 +190,9 @@ gdk_win32_screen_get_window_stack (GdkScreen *screen) static gboolean gdk_win32_screen_is_composited (GdkScreen *screen) { + GModule *dwmapi_module = NULL; + typedef HRESULT (*tDwmIsCompositionEnabled)(BOOL*); + static tDwmIsCompositionEnabled pDwmIsCompositionEnabled = NULL; gboolean is_composited; g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); @@ -197,8 +201,28 @@ gdk_win32_screen_is_composited (GdkScreen *screen) return TRUE; else { - if (DwmIsCompositionEnabled (&is_composited) != S_OK) + dwmapi_module = g_module_open ("dwmapi.dll", G_MODULE_BIND_LAZY); + if (dwmapi_module == NULL) return FALSE; + + if (! g_module_symbol (dwmapi_module, "DwmIsCompositionEnabled", (gpointer)pDwmIsCompositionEnabled)) + { + g_module_close(dwmapi_module); + return FALSE; + } + + if (pDwmIsCompositionEnabled == NULL) + { + g_module_close(dwmapi_module); + return FALSE; + } + + if (pDwmIsCompositionEnabled (&is_composited) != S_OK) + { + g_module_close(dwmapi_module); + return FALSE; + } + g_module_close(dwmapi_module); return is_composited; } } diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 67519aa..e0926ac 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -42,6 +42,7 @@ #include <cairo-win32.h> #include <dwmapi.h> +#include <gmodule.h> static void gdk_window_impl_win32_init (GdkWindowImplWin32 *window); static void gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass); @@ -242,6 +243,9 @@ _gdk_windowing_window_init (GdkScreen *screen) gboolean _gdk_win32_window_enable_transparency (GdkWindow *window) { + GModule *dwmapi_module = NULL; + typedef HRESULT (*tDwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*); + static tDwmEnableBlurBehindWindow pDwmEnableBlurBehindWindow = NULL; DWM_BLURBEHIND blur_behind; HRGN empty_region; HRESULT call_result; @@ -256,6 +260,22 @@ _gdk_win32_window_enable_transparency (GdkWindow *window) if (window == _gdk_root) return FALSE; + dwmapi_module = g_module_open ("dwmapi.dll", G_MODULE_BIND_LAZY); + if (dwmapi_module == NULL) + return FALSE; + + if (! g_module_symbol (dwmapi_module, "DwmEnableBlurBehindWindow", (gpointer)pDwmEnableBlurBehindWindow)) + { + g_module_close(dwmapi_module); + return FALSE; + } + + if (pDwmEnableBlurBehindWindow == NULL) + { + g_module_close(dwmapi_module); + return FALSE; + } + thiswindow = GDK_WINDOW_HWND (window); /* Blurbehind only works on toplevel windows */ @@ -273,7 +293,7 @@ _gdk_win32_window_enable_transparency (GdkWindow *window) blur_behind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; blur_behind.hRgnBlur = empty_region; blur_behind.fEnable = TRUE; - call_result = DwmEnableBlurBehindWindow (thiswindow, &blur_behind); + call_result = pDwmEnableBlurBehindWindow (thiswindow, &blur_behind); if (!SUCCEEDED (call_result)) g_warning ("%s: %s (%p) failed: %" G_GINT32_MODIFIER "x", @@ -281,6 +301,7 @@ _gdk_win32_window_enable_transparency (GdkWindow *window) DeleteObject (empty_region); + g_module_close(dwmapi_module); return SUCCEEDED (call_result); } -- 2.6.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor