summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2015-04-15 17:44:55 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2015-04-17 11:23:53 +0800
commitb85f0ccc672455d4b7c895cb00d3804b44310659 (patch)
tree34c55cf69c9f7ca2eb2ee5e20a960077e9f060ac
parent24d3f3fcb2894df110a17317260b8705d68d22ec (diff)
downloadgtk+-b85f0ccc672455d4b7c895cb00d3804b44310659.tar.gz
gdk-win32: Really Implement GdkScreen->is_composited()
The current GdkScreen->is_composited() is a stub as we were having Windows XP being supported, which does not support Desktop Window Manager (DWM), which is used by Windows for composition. Windows Vista and later support DWM, and it is always enabled on Windows 8/ Server 2012 and later. Please note that as we are dropping XP support in this cycle, this is the commit that would say goodbye to Windows XP support for GTK+-3.x, by linking directly to dwmapi.dll. This means, we only check whether we are on Windows 8 or Server 2012 (or later) to see whether we unconditionally have composition enabled. https://bugzilla.gnome.org/show_bug.cgi?id=741849
-rw-r--r--build/win32/vs10/gdk.vcxprojin8
-rw-r--r--build/win32/vs9/gdk.vcprojin8
-rw-r--r--configure.ac2
-rw-r--r--gdk/win32/gdkglobals-win32.c2
-rw-r--r--gdk/win32/gdkmain-win32.c1
-rw-r--r--gdk/win32/gdkprivate-win32.h2
-rw-r--r--gdk/win32/gdkscreen-win32.c13
7 files changed, 26 insertions, 10 deletions
diff --git a/build/win32/vs10/gdk.vcxprojin b/build/win32/vs10/gdk.vcxprojin
index 35e14a2d1a..fff2f6da67 100644
--- a/build/win32/vs10/gdk.vcxprojin
+++ b/build/win32/vs10/gdk.vcxprojin
@@ -167,7 +167,7 @@
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
- <AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
@@ -209,7 +209,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
- <AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
@@ -257,7 +257,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
- <AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
@@ -299,7 +299,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
- <AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
diff --git a/build/win32/vs9/gdk.vcprojin b/build/win32/vs9/gdk.vcprojin
index ad33f6ef96..59d17362a3 100644
--- a/build/win32/vs9/gdk.vcprojin
+++ b/build/win32/vs9/gdk.vcprojin
@@ -74,7 +74,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="imm32.lib winmm.lib ws2_32.lib"
+ AdditionalDependencies="imm32.lib winmm.lib ws2_32.lib dwmapi.lib"
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
LinkIncremental="1"
GenerateDebugInformation="true"
@@ -136,7 +136,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="imm32.lib winmm.lib ws2_32.lib"
+ AdditionalDependencies="imm32.lib winmm.lib ws2_32.lib dwmapi.lib"
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
LinkIncremental="1"
GenerateDebugInformation="true"
@@ -202,7 +202,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="imm32.lib winmm.lib ws2_32.lib"
+ AdditionalDependencies="imm32.lib winmm.lib ws2_32.lib dwmapi.lib"
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
LinkIncremental="1"
GenerateDebugInformation="true"
@@ -264,7 +264,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="imm32.lib winmm.lib ws2_32.lib"
+ AdditionalDependencies="imm32.lib winmm.lib ws2_32.lib dwmapi.lib"
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
LinkIncremental="1"
GenerateDebugInformation="true"
diff --git a/configure.ac b/configure.ac
index 7dc9c265cb..ba8954c3c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -375,7 +375,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"
+ GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi"
AM_CONDITIONAL(USE_WIN32, true)
PANGO_PACKAGES="pangowin32 pangocairo"
else
diff --git a/gdk/win32/gdkglobals-win32.c b/gdk/win32/gdkglobals-win32.c
index 5248a009cf..3d1c17f5d6 100644
--- a/gdk/win32/gdkglobals-win32.c
+++ b/gdk/win32/gdkglobals-win32.c
@@ -82,3 +82,5 @@ gboolean _ignore_destroy_clipboard = FALSE;
HGLOBAL _delayed_rendering_data = NULL;
GHashTable *_format_atom_table = NULL;
+
+gboolean _is_win8_or_later = FALSE;
diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c
index 905c729fab..f12c16673b 100644
--- a/gdk/win32/gdkmain-win32.c
+++ b/gdk/win32/gdkmain-win32.c
@@ -130,6 +130,7 @@ _gdk_win32_windowing_init (void)
_cf_url = RegisterClipboardFormat ("UniformResourceLocatorW");
_cf_html_format = RegisterClipboardFormat ("HTML Format");
_cf_text_html = RegisterClipboardFormat ("text/html");
+ _is_win8_or_later = g_win32_check_windows_version (6, 2, 0, G_WIN32_OS_ANY);
_gdk_win32_selection_init ();
}
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index acc3fcac05..dbb9a7900b 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -508,4 +508,6 @@ void _gdk_events_init (void);
void _gdk_input_init (GdkDisplay *display);
void _gdk_input_wintab_init_check (GdkDeviceManager *device_manager);
+extern gboolean _is_win8_or_later;
+
#endif /* __GDK_PRIVATE_WIN32_H__ */
diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c
index 8c6fb03400..4e9cc992b1 100644
--- a/gdk/win32/gdkscreen-win32.c
+++ b/gdk/win32/gdkscreen-win32.c
@@ -21,6 +21,8 @@
#include "gdkscreenprivate.h"
#include "gdkwin32screen.h"
+#include <dwmapi.h>
+
struct _GdkWin32Screen
{
GdkScreen parent_instance;
@@ -195,9 +197,18 @@ gdk_win32_screen_get_window_stack (GdkScreen *screen)
static gboolean
gdk_win32_screen_is_composited (GdkScreen *screen)
{
+ gboolean is_composited;
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
- return FALSE;
+ /* On Windows 8 and later, DWM (composition) is always enabled */
+ if (_is_win8_or_later)
+ return TRUE;
+ else
+ {
+ if (DwmIsCompositionEnabled (&is_composited) != S_OK)
+ return FALSE;
+ return is_composited;
+ }
}
static void