Commit f89d38bc authored by LRN's avatar LRN

W32: RGBA GDK backend (broken)

https://bugzilla.gnome.org/show_bug.cgi?id=727316
parent 3f23f20c
......@@ -363,6 +363,25 @@ fi
AC_SUBST(ENABLE_ON_X11)
if test "$enable_win32_backend" = "yes"; then
AC_MSG_CHECKING([for DWM])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <windows.h>
#include <dwmapi.h>
]],
[[
DWM_BLURBEHIND bb;
memset (&bb, 0, sizeof (bb));
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
]]
)],
[dwm_ok=yes], [dwm_ok=no]
)
AC_MSG_RESULT($dwm_ok)
if test "$dwm_ok" = "yes"; then
AC_DEFINE([HAVE_W32_DWM], [1], [Define if W32 DWM API is available])
fi
cairo_backends="$cairo_backends cairo-win32"
GDK_BACKENDS="$GDK_BACKENDS win32"
backend_immodules="$backend_immodules,ime"
......
......@@ -211,7 +211,7 @@ gdk_win32_screen_class_init (GdkWin32ScreenClass *klass)
screen_class->get_monitor_geometry = gdk_win32_screen_get_monitor_geometry;
screen_class->get_monitor_workarea = gdk_win32_screen_get_monitor_geometry;
screen_class->get_system_visual = _gdk_win32_screen_get_system_visual;
screen_class->get_rgba_visual = gdk_win32_screen_get_rgba_visual;
screen_class->get_rgba_visual = _gdk_win32_screen_get_system_visual;
screen_class->is_composited = gdk_win32_screen_is_composited;
screen_class->make_display_name = gdk_win32_screen_make_display_name;
screen_class->get_active_window = gdk_win32_screen_get_active_window;
......
......@@ -194,7 +194,6 @@ _gdk_visual_init (GdkScreen *screen)
}
else if (bitspixel == 24 || bitspixel == 32)
{
bitspixel = 24;
system_visual->type = GDK_VISUAL_TRUE_COLOR;
system_visual->red_mask = 0x00FF0000;
system_visual->green_mask = 0x0000FF00;
......
......@@ -38,6 +38,9 @@
#include "gdkdisplayprivate.h"
#include "gdkvisualprivate.h"
#include "gdkwin32window.h"
#ifdef HAVE_W32_DWM
#include <dwmapi.h>
#endif
#include <cairo-win32.h>
......@@ -684,6 +687,45 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display,
if (attributes_mask & GDK_WA_CURSOR)
gdk_window_set_cursor (window, attributes->cursor);
/* HAVE_W32_DWM means that we have necessary declarations at compile-time,
* but we'd still like to be able to run on XP, so we'll load the only non-XP
* function we need here at runtime.
*/
#ifdef HAVE_W32_DWM
{
typedef HRESULT (WINAPI *PFN_DwmEnableBlurBehindWindow)(HWND,
const DWM_BLURBEHIND *);
HMODULE dwmdll;
PFN_DwmEnableBlurBehindWindow dwmEnableBlurBehindWindow = NULL;
dwmdll = GetModuleHandle ("dwmapi.dll");
dwmEnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow)
GetProcAddress (dwmdll, "DwmEnableBlurBehindWindow");
if (dwmEnableBlurBehindWindow)
{
/* Enable blurbehind, but give it an empty region, leaving us
with all the transparency with none of the blur */
DWM_BLURBEHIND bb;
HRGN hRgn;
hRgn = CreateRectRgn (0, 0, -1, -1);
if (hRgn != NULL)
{
HRESULT hr;
memset (&bb, 0, sizeof (bb));
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
bb.hRgnBlur = hRgn;
bb.fEnable = TRUE;
hr = dwmEnableBlurBehindWindow (GDK_WINDOW_HWND (window), &bb);
if (S_OK != hr)
g_warning ("%s: %s failed: %" G_GINT64_MODIFIER "x", G_STRLOC,
"DwmEnableBlurBehindWindow", (guint64) hr);
DeleteObject (hRgn);
}
}
}
#endif
}
GdkWindow *
......@@ -3387,7 +3429,7 @@ gdk_win32_ref_cairo_surface (GdkWindow *window)
if (!hdc)
return NULL;
impl->cairo_surface = cairo_win32_surface_create (hdc);
impl->cairo_surface = cairo_win32_surface_create_with_alpha (hdc);
cairo_surface_set_user_data (impl->cairo_surface, &gdk_win32_cairo_key,
impl, gdk_win32_cairo_surface_destroy);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment