From 3d74da66221bbf9667b2474370be2aab7072082b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 9 Feb 2019 16:00:35 -0600 Subject: [PATCH] uxtheme-GTK_Theming: Rework to avoid "DLL redirects". Instead we have an alternate code path for the appropriate API entry points in uxtheme.dll. This is not the best organizational structure. We should probably have HTHEME handles resolve to an object with its own function table, so then we have an MSSTYLES backend and a GTK backend and what have you. It would also be better to avoid having GTK controlled with its own registry key like this but rather to have it be selectable using EnumThemes()/ApplyTheme() [presumably through a fake theme file, as was used in the original implementation], so that we don't have to have special handling for those functions and everything can just be part of the HTHEME backend. However, time is currently of the essence, and this will have to do for the moment. --- patches/patchinstall.sh | 48 +- ...itial-implementation-of-GTK-backend.patch} | 3040 ++++++++++------- ...gtk-Add-configure-check-and-stub-dll.patch | 467 --- ...ctly-render-buttons-with-GTK-3.14.0.patch} | 16 +- ...ment-enumeration-of-themes-color-and.patch | 308 -- ...-flags-before-calling-GTK3-function.patch} | 83 +- ...theme-Fix-some-incorrect-error-codes.patch | 34 + ...-class-name-before-calling-vtable-fu.patch | 220 -- ...megtk-Add-export-for-OpenThemeDataEx.patch | 59 - ...megtk-Fix-some-incorrect-error-codes.patch | 43 - ...ate-theme-handles-before-accessing-p.patch | 192 -- .../0010-Add-buffering-functions.patch | 355 -- patches/uxtheme-GTK_Theming/definition | 1 - ...ption-to-enable-disable-GTK3-theming.patch | 20 +- 14 files changed, 1990 insertions(+), 2896 deletions(-) rename patches/uxtheme-GTK_Theming/{0002-uxthemegtk-Initial-implementation.patch => 0001-uxtheme-Initial-implementation-of-GTK-backend.patch} (61%) delete mode 100644 patches/uxtheme-GTK_Theming/0001-uxthemegtk-Add-configure-check-and-stub-dll.patch rename patches/uxtheme-GTK_Theming/{0004-uxthemegtk-Correctly-render-buttons-with-GTK-3.14.0.patch => 0003-uxtheme-Correctly-render-buttons-with-GTK-3.14.0.patch} (84%) delete mode 100644 patches/uxtheme-GTK_Theming/0003-uxthemegtk-Implement-enumeration-of-themes-color-and.patch rename patches/uxtheme-GTK_Theming/{0006-uxthemegtk-Reset-FPU-flags-before-calling-GTK3-funct.patch => 0004-uxtheme-Reset-FPU-flags-before-calling-GTK3-function.patch} (56%) create mode 100644 patches/uxtheme-GTK_Theming/0005-uxtheme-Fix-some-incorrect-error-codes.patch delete mode 100644 patches/uxtheme-GTK_Theming/0005-uxthemegtk-Print-class-name-before-calling-vtable-fu.patch delete mode 100644 patches/uxtheme-GTK_Theming/0007-uxthemegtk-Add-export-for-OpenThemeDataEx.patch delete mode 100644 patches/uxtheme-GTK_Theming/0008-uxthemegtk-Fix-some-incorrect-error-codes.patch delete mode 100644 patches/uxtheme-GTK_Theming/0009-uxthemegtk-Validate-theme-handles-before-accessing-p.patch delete mode 100644 patches/uxtheme-GTK_Theming/0010-Add-buffering-functions.patch diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index dde49bfe..e78d1aa7 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -1837,13 +1837,6 @@ if test "$enable_windowscodecs_TIFF_Support" -eq 1; then enable_windowscodecs_GIF_Encoder=1 fi -if test "$enable_uxtheme_GTK_Theming" -eq 1; then - if test "$enable_ntdll_DllRedirects" -gt 1; then - abort "Patchset ntdll-DllRedirects disabled, but uxtheme-GTK_Theming depends on that." - fi - enable_ntdll_DllRedirects=1 -fi - if test "$enable_user32_GetPointerType" -eq 1; then if test "$enable_user32_Mouse_Message_Hwnd" -gt 1; then abort "Patchset user32-Mouse_Message_Hwnd disabled, but user32-GetPointerType depends on that." @@ -6651,38 +6644,23 @@ fi # Patchset uxtheme-GTK_Theming # | -# | This patchset has the following (direct or indirect) dependencies: -# | * wow64cpu-Wow64Transition, ntdll-DllRedirects -# | # | Modified files: -# | * aclocal.m4, configure.ac, dlls/uxtheme-gtk/Makefile.in, dlls/uxtheme-gtk/buffer.c, dlls/uxtheme-gtk/button.c, dlls -# | /uxtheme-gtk/combobox.c, dlls/uxtheme-gtk/edit.c, dlls/uxtheme-gtk/header.c, dlls/uxtheme-gtk/listbox.c, dlls/uxtheme- -# | gtk/listview.c, dlls/uxtheme-gtk/menu.c, dlls/uxtheme-gtk/rebar.c, dlls/uxtheme-gtk/status.c, dlls/uxtheme-gtk/tab.c, -# | dlls/uxtheme-gtk/toolbar.c, dlls/uxtheme-gtk/trackbar.c, dlls/uxtheme-gtk/uxtheme-gtk.spec, dlls/uxtheme-gtk/uxtheme.c, -# | dlls/uxtheme-gtk/uxthemegtk.h, dlls/uxtheme-gtk/version.rc, dlls/uxtheme-gtk/window.c +# | * aclocal.m4, configure.ac, dlls/uxtheme/Makefile.in, dlls/uxtheme/draw.c, dlls/uxtheme/gtk-button.c, dlls/uxtheme/gtk- +# | combobox.c, dlls/uxtheme/gtk-edit.c, dlls/uxtheme/gtk-header.c, dlls/uxtheme/gtk-listbox.c, dlls/uxtheme/gtk-listview.c, +# | dlls/uxtheme/gtk-menu.c, dlls/uxtheme/gtk-rebar.c, dlls/uxtheme/gtk-status.c, dlls/uxtheme/gtk-tab.c, dlls/uxtheme/gtk- +# | toolbar.c, dlls/uxtheme/gtk-trackbar.c, dlls/uxtheme/gtk-window.c, dlls/uxtheme/gtk.c, dlls/uxtheme/metric.c, +# | dlls/uxtheme/property.c, dlls/uxtheme/system.c, dlls/uxtheme/uxthemedll.h, dlls/uxtheme/uxthemegtk.h # | if test "$enable_uxtheme_GTK_Theming" -eq 1; then - patch_apply uxtheme-GTK_Theming/0001-uxthemegtk-Add-configure-check-and-stub-dll.patch - patch_apply uxtheme-GTK_Theming/0002-uxthemegtk-Initial-implementation.patch - patch_apply uxtheme-GTK_Theming/0003-uxthemegtk-Implement-enumeration-of-themes-color-and.patch - patch_apply uxtheme-GTK_Theming/0004-uxthemegtk-Correctly-render-buttons-with-GTK-3.14.0.patch - patch_apply uxtheme-GTK_Theming/0005-uxthemegtk-Print-class-name-before-calling-vtable-fu.patch - patch_apply uxtheme-GTK_Theming/0006-uxthemegtk-Reset-FPU-flags-before-calling-GTK3-funct.patch - patch_apply uxtheme-GTK_Theming/0007-uxthemegtk-Add-export-for-OpenThemeDataEx.patch - patch_apply uxtheme-GTK_Theming/0008-uxthemegtk-Fix-some-incorrect-error-codes.patch - patch_apply uxtheme-GTK_Theming/0009-uxthemegtk-Validate-theme-handles-before-accessing-p.patch - patch_apply uxtheme-GTK_Theming/0010-Add-buffering-functions.patch + patch_apply uxtheme-GTK_Theming/0001-uxtheme-Initial-implementation-of-GTK-backend.patch + patch_apply uxtheme-GTK_Theming/0003-uxtheme-Correctly-render-buttons-with-GTK-3.14.0.patch + patch_apply uxtheme-GTK_Theming/0004-uxtheme-Reset-FPU-flags-before-calling-GTK3-function.patch + patch_apply uxtheme-GTK_Theming/0005-uxtheme-Fix-some-incorrect-error-codes.patch ( - printf '%s\n' '+ { "Michael Müller", "uxthemegtk: Add configure check and stub dll.", 1 },'; - printf '%s\n' '+ { "Ivan Akulinchev", "uxthemegtk: Initial implementation.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "uxthemegtk: Implement enumeration of themes, color and sizes.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "uxthemegtk: Correctly render buttons with GTK >= 3.14.0.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "uxthemegtk: Print class name before calling vtable functions.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "uxthemegtk: Reset FPU flags before calling GTK3 functions.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "uxthemegtk: Add export for OpenThemeDataEx.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "uxthemegtk: Fix some incorrect error codes.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "uxthemegtk: Validate theme handles before accessing private data.", 1 },'; - printf '%s\n' '+ { "Alistair Leslie-Hughes", "Add buffering functions.", 1 },'; + printf '%s\n' '+ { "Ivan Akulinchev", "uxtheme: Initial implementation of GTK backend.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "uxtheme: Correctly render buttons with GTK >= 3.14.0.", 1 },'; + printf '%s\n' '+ { "Michael Müller", "uxtheme: Reset FPU flags before calling GTK3 functions.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "uxtheme: Fix some incorrect error codes.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/uxtheme-GTK_Theming/0002-uxthemegtk-Initial-implementation.patch b/patches/uxtheme-GTK_Theming/0001-uxtheme-Initial-implementation-of-GTK-backend.patch similarity index 61% rename from patches/uxtheme-GTK_Theming/0002-uxthemegtk-Initial-implementation.patch rename to patches/uxtheme-GTK_Theming/0001-uxtheme-Initial-implementation-of-GTK-backend.patch index 226b1b5f..32bde094 100644 --- a/patches/uxtheme-GTK_Theming/0002-uxthemegtk-Initial-implementation.patch +++ b/patches/uxtheme-GTK_Theming/0001-uxtheme-Initial-implementation-of-GTK-backend.patch @@ -1,7 +1,7 @@ -From 33b66bb01ef63fe6a2c140d19961f1e213ac2af1 Mon Sep 17 00:00:00 2001 +From 5e328eb8ce74a65f1cd7e7332c12c7548119e848 Mon Sep 17 00:00:00 2001 From: Ivan Akulinchev -Date: Sun, 9 Aug 2015 03:15:30 +0200 -Subject: uxthemegtk: Initial implementation. +Date: Sat, 9 Feb 2019 15:18:54 -0600 +Subject: [PATCH] uxtheme: Initial implementation of GTK backend. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -19,72 +19,248 @@ Additional changes by Sebastian Lackner : * Fix incorrect class enumaration in OpenThemeData(). * Avoid unnecessary goto in DrawThemeBackgroundEx(). --- - dlls/uxtheme-gtk/Makefile.in | 17 +- - dlls/uxtheme-gtk/button.c | 510 +++++++++++++++++++++++ - dlls/uxtheme-gtk/combobox.c | 236 +++++++++++ - dlls/uxtheme-gtk/edit.c | 205 +++++++++ - dlls/uxtheme-gtk/header.c | 122 ++++++ - dlls/uxtheme-gtk/listbox.c | 113 +++++ - dlls/uxtheme-gtk/listview.c | 32 ++ - dlls/uxtheme-gtk/menu.c | 183 ++++++++ - dlls/uxtheme-gtk/rebar.c | 96 +++++ - dlls/uxtheme-gtk/status.c | 151 +++++++ - dlls/uxtheme-gtk/tab.c | 201 +++++++++ - dlls/uxtheme-gtk/toolbar.c | 165 ++++++++ - dlls/uxtheme-gtk/trackbar.c | 182 ++++++++ - dlls/uxtheme-gtk/uxtheme-gtk.spec | 56 ++- - dlls/uxtheme-gtk/uxtheme.c | 853 +++++++++++++++++++++++++++++++++++++- - dlls/uxtheme-gtk/uxthemegtk.h | 53 +++ - dlls/uxtheme-gtk/window.c | 166 ++++++++ - 17 files changed, 3336 insertions(+), 5 deletions(-) - create mode 100644 dlls/uxtheme-gtk/button.c - create mode 100644 dlls/uxtheme-gtk/combobox.c - create mode 100644 dlls/uxtheme-gtk/edit.c - create mode 100644 dlls/uxtheme-gtk/header.c - create mode 100644 dlls/uxtheme-gtk/listbox.c - create mode 100644 dlls/uxtheme-gtk/listview.c - create mode 100644 dlls/uxtheme-gtk/menu.c - create mode 100644 dlls/uxtheme-gtk/rebar.c - create mode 100644 dlls/uxtheme-gtk/status.c - create mode 100644 dlls/uxtheme-gtk/tab.c - create mode 100644 dlls/uxtheme-gtk/toolbar.c - create mode 100644 dlls/uxtheme-gtk/trackbar.c - create mode 100644 dlls/uxtheme-gtk/window.c + aclocal.m4 | 20 + + configure.ac | 20 + + dlls/uxtheme/Makefile.in | 15 + + dlls/uxtheme/draw.c | 30 ++ + dlls/uxtheme/gtk-button.c | 516 +++++++++++++++++++ + dlls/uxtheme/gtk-combobox.c | 242 +++++++++ + dlls/uxtheme/gtk-edit.c | 211 ++++++++ + dlls/uxtheme/gtk-header.c | 128 +++++ + dlls/uxtheme/gtk-listbox.c | 119 +++++ + dlls/uxtheme/gtk-listview.c | 38 ++ + dlls/uxtheme/gtk-menu.c | 189 +++++++ + dlls/uxtheme/gtk-rebar.c | 102 ++++ + dlls/uxtheme/gtk-status.c | 157 ++++++ + dlls/uxtheme/gtk-tab.c | 207 ++++++++ + dlls/uxtheme/gtk-toolbar.c | 171 +++++++ + dlls/uxtheme/gtk-trackbar.c | 188 +++++++ + dlls/uxtheme/gtk-window.c | 172 +++++++ + dlls/uxtheme/gtk.c | 962 ++++++++++++++++++++++++++++++++++++ + dlls/uxtheme/metric.c | 24 + + dlls/uxtheme/property.c | 40 ++ + dlls/uxtheme/system.c | 34 +- + dlls/uxtheme/uxthemedll.h | 72 +++ + dlls/uxtheme/uxthemegtk.h | 129 +++++ + 23 files changed, 3785 insertions(+), 1 deletion(-) + create mode 100644 dlls/uxtheme/gtk-button.c + create mode 100644 dlls/uxtheme/gtk-combobox.c + create mode 100644 dlls/uxtheme/gtk-edit.c + create mode 100644 dlls/uxtheme/gtk-header.c + create mode 100644 dlls/uxtheme/gtk-listbox.c + create mode 100644 dlls/uxtheme/gtk-listview.c + create mode 100644 dlls/uxtheme/gtk-menu.c + create mode 100644 dlls/uxtheme/gtk-rebar.c + create mode 100644 dlls/uxtheme/gtk-status.c + create mode 100644 dlls/uxtheme/gtk-tab.c + create mode 100644 dlls/uxtheme/gtk-toolbar.c + create mode 100644 dlls/uxtheme/gtk-trackbar.c + create mode 100644 dlls/uxtheme/gtk-window.c + create mode 100644 dlls/uxtheme/gtk.c + create mode 100644 dlls/uxtheme/uxthemegtk.h -diff --git a/dlls/uxtheme-gtk/Makefile.in b/dlls/uxtheme-gtk/Makefile.in -index 07cf3a0f..8cefd51 100644 ---- a/dlls/uxtheme-gtk/Makefile.in -+++ b/dlls/uxtheme-gtk/Makefile.in -@@ -1,7 +1,22 @@ - MODULE = uxtheme-gtk.dll -+IMPORTS = user32 gdi32 advapi32 -+DELAYIMPORTS = msimg32 - EXTRAINCL = $(GTK3_CFLAGS) +diff --git a/aclocal.m4 b/aclocal.m4 +index 25ac678f..04bb6ed7 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -125,6 +125,26 @@ test -z "$ac_libs" || ac_libs=`echo " $ac_libs" | sed 's/ -L\([[^/]]\)/ -L\$(top + AS_VAR_POPDEF([ac_libs])dnl + AS_VAR_POPDEF([ac_cflags])])dnl + ++dnl **** Get include path from pkg-config **** ++dnl ++dnl Usage: WINE_PACKAGE_INCLUDE_FLAGS(var,pkg-name,[cflags-alternate,[checks]]]) ++dnl ++AC_DEFUN([WINE_PACKAGE_INCLUDE_FLAGS], ++[AC_REQUIRE([WINE_PATH_PKG_CONFIG])dnl ++AS_VAR_PUSHDEF([ac_cflags],[[$1]_CFLAGS])dnl ++AC_ARG_VAR(ac_cflags, [C compiler flags for $2, overriding pkg-config])dnl ++AS_VAR_IF([ac_cflags],[], ++ [AS_VAR_SET_IF([PKG_CONFIG], ++ [ac_cflags=`$PKG_CONFIG --cflags-only-I [$2] 2>/dev/null`])]) ++m4_ifval([$3],[test "$cross_compiling" = yes || ac_cflags=[$]{ac_cflags:-[$3]}]) ++AS_ECHO(["$as_me:${as_lineno-$LINENO}: $2 cflags: $ac_cflags"]) >&AS_MESSAGE_LOG_FD ++ac_save_CPPFLAGS=$CPPFLAGS ++CPPFLAGS="$CPPFLAGS $ac_cflags" ++$4 ++CPPFLAGS=$ac_save_CPPFLAGS ++test -z "$ac_cflags" || ac_cflags=`echo " $ac_cflags" | sed 's/ -I\([[^/]]\)/ -I\$(top_builddir)\/\1/g'` ++AS_VAR_POPDEF([ac_cflags])])dnl ++ + dnl **** Link C code with an assembly file **** + dnl + dnl Usage: WINE_TRY_ASM_LINK(asm-code,includes,function,[action-if-found,[action-if-not-found]]) +diff --git a/configure.ac b/configure.ac +index 1b425d22..2f2d2025 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -56,6 +56,7 @@ AC_ARG_WITH(gsm, AS_HELP_STRING([--without-gsm],[do not use libgsm (GSM 06 + [if test "x$withval" = "xno"; then ac_cv_header_gsm_h=no; ac_cv_header_gsm_gsm_h=no; fi]) + AC_ARG_WITH(gssapi, AS_HELP_STRING([--without-gssapi],[do not use GSSAPI (Kerberos SSP support)])) + AC_ARG_WITH(gstreamer, AS_HELP_STRING([--without-gstreamer],[do not use GStreamer (codecs support)])) ++AC_ARG_WITH(gtk3, AS_HELP_STRING([--without-gtk3],[do not use gtk3 (gtk3 theming support)])) + AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic device support)])) + AC_ARG_WITH(jpeg, AS_HELP_STRING([--without-jpeg],[do not use JPEG])) + AC_ARG_WITH(krb5, AS_HELP_STRING([--without-krb5],[do not use krb5 (Kerberos)])) +@@ -1471,6 +1472,25 @@ fi + WINE_NOTICE_WITH(cms,[test "$ac_cv_lib_lcms2_cmsOpenProfileFromFile" != "yes"], + [liblcms2 ${notice_platform}development files not found, Color Management won't be supported.]) + ++dnl **** Check for GTK3 **** ++if test "x$with_gtk3" != "xno"; ++then ++ WINE_PACKAGE_INCLUDE_FLAGS(GTK3, [gtk+-3.0],, ++ [AC_CHECK_HEADERS([gtk/gtk.h]) ++ if test "$ac_cv_header_gtk_gtk_h" = "yes" ++ then ++ WINE_CHECK_SONAME(gobject-2.0,g_object_unref, ++ [WINE_CHECK_SONAME(cairo,cairo_destroy, ++ [WINE_CHECK_SONAME(gtk-3,gtk_style_context_save, ++ [AC_DEFINE(HAVE_GTK3, 1, [Define if GTK 3 is installed])])])]) ++ test "x$ac_cv_lib_soname_gtk_3" != "x" || GTK3_CFLAGS="" ++ else ++ GTK3_CFLAGS="" ++ fi]) ++fi ++WINE_NOTICE_WITH(gtk3,[test "x$ac_cv_lib_soname_gtk_3" = x], ++ [GTK3 ${notice_platform}development files not found, GTK themes won't be supported.]) ++ + dnl **** Check for FreeType 2 **** + if test "x$with_freetype" != "xno" + then +diff --git a/dlls/uxtheme/Makefile.in b/dlls/uxtheme/Makefile.in +index c3fff30b..e09f891e 100644 +--- a/dlls/uxtheme/Makefile.in ++++ b/dlls/uxtheme/Makefile.in +@@ -2,10 +2,25 @@ MODULE = uxtheme.dll + IMPORTLIB = uxtheme + IMPORTS = user32 gdi32 advapi32 + DELAYIMPORTS = msimg32 ++EXTRAINCL = $(GTK3_CFLAGS) C_SRCS = \ -- uxtheme.c -+ button.c \ -+ combobox.c \ -+ edit.c \ -+ header.c \ -+ listbox.c \ -+ listview.c \ -+ menu.c \ -+ rebar.c \ -+ status.c \ -+ tab.c \ -+ toolbar.c \ -+ trackbar.c \ -+ uxtheme.c \ -+ window.c + buffer.c \ + draw.c \ ++ gtk-button.c \ ++ gtk-combobox.c \ ++ gtk-edit.c \ ++ gtk-header.c \ ++ gtk-listbox.c \ ++ gtk-listview.c \ ++ gtk-menu.c \ ++ gtk-rebar.c \ ++ gtk-status.c \ ++ gtk-tab.c \ ++ gtk-toolbar.c \ ++ gtk-trackbar.c \ ++ gtk-window.c \ ++ gtk.c \ + main.c \ + metric.c \ + msstyles.c \ +diff --git a/dlls/uxtheme/draw.c b/dlls/uxtheme/draw.c +index 69c53b9e..dbcbaab7 100644 +--- a/dlls/uxtheme/draw.c ++++ b/dlls/uxtheme/draw.c +@@ -55,6 +55,10 @@ HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags) + BOOL res; - RC_SRCS = version.rc -diff --git a/dlls/uxtheme-gtk/button.c b/dlls/uxtheme-gtk/button.c + TRACE("(%p,0x%08x\n", hwnd, dwFlags); ++ ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_EnableThemeDialogTexture(hwnd, dwFlags); ++ + res = SetPropW (hwnd, (LPCWSTR)MAKEINTATOM(atDialogThemeEnabled), + UlongToHandle(dwFlags|0x80000000)); + /* 0x80000000 serves as a "flags set" flag */ +@@ -74,6 +78,9 @@ BOOL WINAPI IsThemeDialogTextureEnabled(HWND hwnd) + DWORD dwDialogTextureFlags; + TRACE("(%p)\n", hwnd); + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_IsThemeDialogTextureEnabled(hwnd); ++ + dwDialogTextureFlags = HandleToUlong( GetPropW( hwnd, (LPCWSTR)MAKEINTATOM(atDialogThemeEnabled) )); + if (dwDialogTextureFlags == 0) + /* Means EnableThemeDialogTexture wasn't called for this dialog */ +@@ -1027,6 +1034,9 @@ HRESULT WINAPI DrawThemeBackgroundEx(HTHEME hTheme, HDC hdc, int iPartId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_DrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, pOptions); ++ + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype); + if (bgtype == BT_NONE) return S_OK; + +@@ -1670,6 +1680,10 @@ HRESULT WINAPI DrawThemeTextEx(HTHEME hTheme, HDC hdc, int iPartId, int iStateId + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_DrawThemeTextEx(hTheme, hdc, iPartId, iStateId, ++ pszText, iCharCount, flags, rect, options); ++ + if (options->dwFlags & ~DTT_TEXTCOLOR) + FIXME("unsupported flags 0x%08x\n", options->dwFlags); + +@@ -1932,6 +1946,9 @@ HRESULT WINAPI GetThemeBackgroundRegion(HTHEME hTheme, HDC hdc, int iPartId, + if(!pRect || !pRegion) + return E_POINTER; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeBackgroundRegion(hTheme, hdc, iPartId, iStateId, pRect, pRegion); ++ + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype); + if(bgtype == BT_IMAGEFILE) { + hr = create_image_bg_region(hTheme, iPartId, iStateId, pRect, pRegion); +@@ -1983,6 +2000,9 @@ HRESULT WINAPI GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemePartSize(hTheme, hdc, iPartId, iStateId, prc, eSize, psz); ++ + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype); + if (bgtype == BT_NONE) + /* do nothing */; +@@ -2019,6 +2039,10 @@ HRESULT WINAPI GetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeTextExtent(hTheme, hdc, iPartId, iStateId, ++ pszText, iCharCount, dwTextFlags, pBoundingRect, pExtentRect); ++ + if(pBoundingRect) + rt = *pBoundingRect; + +@@ -2056,6 +2080,9 @@ HRESULT WINAPI GetThemeTextMetrics(HTHEME hTheme, HDC hdc, int iPartId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeTextMetrics(hTheme, hdc, iPartId, iStateId, ptm); ++ + hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont); + if(SUCCEEDED(hr)) { + hFont = CreateFontIndirectW(&logfont); +@@ -2094,6 +2121,9 @@ BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, + if(!hTheme) + return FALSE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_IsThemeBackgroundPartiallyTransparent(hTheme, iPartId, iStateId); ++ + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype); + + if (bgtype != BT_IMAGEFILE) return FALSE; +diff --git a/dlls/uxtheme/gtk-button.c b/dlls/uxtheme/gtk-button.c new file mode 100644 -index 0000000..b4b2d02 +index 00000000..f8b3da0d --- /dev/null -+++ b/dlls/uxtheme-gtk/button.c -@@ -0,0 +1,510 @@ ++++ b/dlls/uxtheme/gtk-button.c +@@ -0,0 +1,516 @@ +/* + * GTK uxtheme implementation + * @@ -105,6 +281,10 @@ index 0000000..b4b2d02 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -595,12 +775,14 @@ index 0000000..b4b2d02 + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/combobox.c b/dlls/uxtheme-gtk/combobox.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-combobox.c b/dlls/uxtheme/gtk-combobox.c new file mode 100644 -index 0000000..38abb82 +index 00000000..60bcb0e6 --- /dev/null -+++ b/dlls/uxtheme-gtk/combobox.c -@@ -0,0 +1,236 @@ ++++ b/dlls/uxtheme/gtk-combobox.c +@@ -0,0 +1,242 @@ +/* + * GTK uxtheme implementation + * @@ -621,6 +803,10 @@ index 0000000..38abb82 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -837,12 +1023,14 @@ index 0000000..38abb82 + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/edit.c b/dlls/uxtheme-gtk/edit.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-edit.c b/dlls/uxtheme/gtk-edit.c new file mode 100644 -index 0000000..eb5f108 +index 00000000..dee00d7b --- /dev/null -+++ b/dlls/uxtheme-gtk/edit.c -@@ -0,0 +1,205 @@ ++++ b/dlls/uxtheme/gtk-edit.c +@@ -0,0 +1,211 @@ +/* + * GTK uxtheme implementation + * @@ -863,6 +1051,10 @@ index 0000000..eb5f108 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -1048,12 +1240,14 @@ index 0000000..eb5f108 + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/header.c b/dlls/uxtheme-gtk/header.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-header.c b/dlls/uxtheme/gtk-header.c new file mode 100644 -index 0000000..11c0245 +index 00000000..8a5b235e --- /dev/null -+++ b/dlls/uxtheme-gtk/header.c -@@ -0,0 +1,122 @@ ++++ b/dlls/uxtheme/gtk-header.c +@@ -0,0 +1,128 @@ +/* + * GTK uxtheme implementation + * @@ -1074,6 +1268,10 @@ index 0000000..11c0245 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -1176,12 +1374,14 @@ index 0000000..11c0245 + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/listbox.c b/dlls/uxtheme-gtk/listbox.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-listbox.c b/dlls/uxtheme/gtk-listbox.c new file mode 100644 -index 0000000..53e1391 +index 00000000..6e275925 --- /dev/null -+++ b/dlls/uxtheme-gtk/listbox.c -@@ -0,0 +1,113 @@ ++++ b/dlls/uxtheme/gtk-listbox.c +@@ -0,0 +1,119 @@ +/* + * GTK uxtheme implementation + * @@ -1202,6 +1402,10 @@ index 0000000..53e1391 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -1295,12 +1499,14 @@ index 0000000..53e1391 + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/listview.c b/dlls/uxtheme-gtk/listview.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-listview.c b/dlls/uxtheme/gtk-listview.c new file mode 100644 -index 0000000..673bc4b +index 00000000..9b98983f --- /dev/null -+++ b/dlls/uxtheme-gtk/listview.c -@@ -0,0 +1,32 @@ ++++ b/dlls/uxtheme/gtk-listview.c +@@ -0,0 +1,38 @@ +/* + * GTK uxtheme implementation + * @@ -1321,6 +1527,10 @@ index 0000000..673bc4b + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include "wine/debug.h" @@ -1333,12 +1543,14 @@ index 0000000..673bc4b + + return uxgtk_listbox_theme_create(); +} -diff --git a/dlls/uxtheme-gtk/menu.c b/dlls/uxtheme-gtk/menu.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-menu.c b/dlls/uxtheme/gtk-menu.c new file mode 100644 -index 0000000..b24a085 +index 00000000..5d00afdf --- /dev/null -+++ b/dlls/uxtheme-gtk/menu.c -@@ -0,0 +1,183 @@ ++++ b/dlls/uxtheme/gtk-menu.c +@@ -0,0 +1,189 @@ +/* + * GTK uxtheme implementation + * @@ -1359,6 +1571,10 @@ index 0000000..b24a085 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -1522,12 +1738,14 @@ index 0000000..b24a085 + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/rebar.c b/dlls/uxtheme-gtk/rebar.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-rebar.c b/dlls/uxtheme/gtk-rebar.c new file mode 100644 -index 0000000..03650ae +index 00000000..5d5b5a48 --- /dev/null -+++ b/dlls/uxtheme-gtk/rebar.c -@@ -0,0 +1,96 @@ ++++ b/dlls/uxtheme/gtk-rebar.c +@@ -0,0 +1,102 @@ +/* + * GTK uxtheme implementation + * @@ -1548,6 +1766,10 @@ index 0000000..03650ae + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -1624,12 +1846,14 @@ index 0000000..03650ae + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/status.c b/dlls/uxtheme-gtk/status.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-status.c b/dlls/uxtheme/gtk-status.c new file mode 100644 -index 0000000..e2a937a +index 00000000..38f8646e --- /dev/null -+++ b/dlls/uxtheme-gtk/status.c -@@ -0,0 +1,151 @@ ++++ b/dlls/uxtheme/gtk-status.c +@@ -0,0 +1,157 @@ +/* + * GTK uxtheme implementation + * @@ -1650,6 +1874,10 @@ index 0000000..e2a937a + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -1781,12 +2009,14 @@ index 0000000..e2a937a + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/tab.c b/dlls/uxtheme-gtk/tab.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-tab.c b/dlls/uxtheme/gtk-tab.c new file mode 100644 -index 0000000..31bdc0e +index 00000000..d6417f64 --- /dev/null -+++ b/dlls/uxtheme-gtk/tab.c -@@ -0,0 +1,201 @@ ++++ b/dlls/uxtheme/gtk-tab.c +@@ -0,0 +1,207 @@ +/* + * GTK uxtheme implementation + * @@ -1807,6 +2037,10 @@ index 0000000..31bdc0e + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -1988,12 +2222,14 @@ index 0000000..31bdc0e + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/toolbar.c b/dlls/uxtheme-gtk/toolbar.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-toolbar.c b/dlls/uxtheme/gtk-toolbar.c new file mode 100644 -index 0000000..be8fbae +index 00000000..b23cf0b4 --- /dev/null -+++ b/dlls/uxtheme-gtk/toolbar.c -@@ -0,0 +1,165 @@ ++++ b/dlls/uxtheme/gtk-toolbar.c +@@ -0,0 +1,171 @@ +/* + * GTK uxtheme implementation + * @@ -2014,6 +2250,10 @@ index 0000000..be8fbae + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -2159,12 +2399,14 @@ index 0000000..be8fbae + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/trackbar.c b/dlls/uxtheme-gtk/trackbar.c ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-trackbar.c b/dlls/uxtheme/gtk-trackbar.c new file mode 100644 -index 0000000..58df246 +index 00000000..a58540e3 --- /dev/null -+++ b/dlls/uxtheme-gtk/trackbar.c -@@ -0,0 +1,182 @@ ++++ b/dlls/uxtheme/gtk-trackbar.c +@@ -0,0 +1,188 @@ +/* + * GTK uxtheme implementation + * @@ -2185,6 +2427,10 @@ index 0000000..58df246 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -2347,1056 +2593,14 @@ index 0000000..58df246 + + return &theme->base; +} -diff --git a/dlls/uxtheme-gtk/uxtheme-gtk.spec b/dlls/uxtheme-gtk/uxtheme-gtk.spec -index b7db254..70cd7ff 100644 ---- a/dlls/uxtheme-gtk/uxtheme-gtk.spec -+++ b/dlls/uxtheme-gtk/uxtheme-gtk.spec -@@ -1 +1,55 @@ --# Empty -+# System -+@ stdcall CloseThemeData(ptr) -+@ stdcall EnableThemeDialogTexture(ptr long) -+@ stdcall EnableTheming(long) -+@ stdcall GetCurrentThemeName(wstr long wstr long wstr long) -+@ stdcall GetThemeAppProperties() -+@ stdcall GetWindowTheme(ptr) -+@ stdcall IsAppThemed() -+@ stdcall IsThemeActive() -+@ stdcall IsThemeDialogTextureEnabled(ptr) -+@ stdcall OpenThemeData(ptr wstr) -+@ stdcall SetThemeAppProperties(long) -+@ stdcall SetWindowTheme(ptr wstr wstr) + -+# Properties -+@ stdcall GetThemeBool(ptr long long long ptr) -+@ stdcall GetThemeColor(ptr long long long ptr) -+@ stdcall GetThemeEnumValue(ptr long long long ptr) -+@ stdcall GetThemeFilename(ptr long long long wstr long) -+@ stdcall GetThemeFont(ptr ptr long long long ptr) -+@ stdcall GetThemeInt(ptr long long long ptr) -+@ stdcall GetThemeIntList(ptr long long long ptr) -+@ stdcall GetThemeMargins(ptr ptr long long long ptr ptr) -+@ stdcall GetThemeMetric(ptr ptr long long long ptr) -+@ stdcall GetThemePosition(ptr long long long ptr) -+@ stdcall GetThemePropertyOrigin(ptr long long long ptr) -+@ stdcall GetThemeRect(ptr long long long ptr) -+@ stdcall GetThemeString(ptr long long long wstr long) -+@ stdcall GetThemeTransitionDuration(ptr long long long long ptr) -+ -+# Metrics -+@ stdcall GetThemeSysBool(ptr long) -+@ stdcall GetThemeSysColor(ptr long) -+@ stdcall GetThemeSysColorBrush(ptr long) -+@ stdcall GetThemeSysFont(ptr long ptr) -+@ stdcall GetThemeSysInt(ptr long ptr) -+@ stdcall GetThemeSysSize(ptr long) -+@ stdcall GetThemeSysString(ptr long wstr long) -+ -+# Drawing -+@ stdcall DrawThemeBackground(ptr ptr long long ptr ptr) -+@ stdcall DrawThemeBackgroundEx(ptr ptr long long ptr ptr) -+@ stdcall DrawThemeEdge(ptr ptr long long ptr long long ptr) -+@ stdcall DrawThemeIcon(ptr ptr long long ptr ptr long) -+@ stdcall DrawThemeParentBackground(ptr ptr ptr) -+@ stdcall DrawThemeText(ptr ptr long long wstr long long long ptr) -+@ stdcall GetThemeBackgroundContentRect(ptr ptr long long ptr ptr) -+@ stdcall GetThemeBackgroundExtent(ptr ptr long long ptr ptr) -+@ stdcall GetThemeBackgroundRegion(ptr ptr long long ptr ptr) -+@ stdcall GetThemePartSize(ptr ptr long long ptr long ptr) -+@ stdcall GetThemeTextExtent(ptr ptr long long wstr long long ptr ptr) -+@ stdcall GetThemeTextMetrics(ptr ptr long long ptr) -+@ stdcall HitTestThemeBackground(ptr long long long long ptr long int64 ptr) -+@ stdcall IsThemeBackgroundPartiallyTransparent(ptr long long) -+@ stdcall IsThemePartDefined(ptr long long) -diff --git a/dlls/uxtheme-gtk/uxtheme.c b/dlls/uxtheme-gtk/uxtheme.c -index cd5e3c0..22285df 100644 ---- a/dlls/uxtheme-gtk/uxtheme.c -+++ b/dlls/uxtheme-gtk/uxtheme.c -@@ -1,6 +1,7 @@ - /* - * GTK uxtheme implementation - * -+ * Copyright (C) 2015 Ivan Akulinchev - * Copyright (C) 2015 Michael Müller - * - * This library is free software; you can redistribute it and/or -@@ -22,7 +23,19 @@ - #include "wine/port.h" - #include "wine/library.h" - -+#include -+ -+#include "windef.h" -+#include "winbase.h" -+#include "wingdi.h" -+#include "winuser.h" -+#include "winerror.h" -+#include "uxtheme.h" -+#include "vsstyle.h" -+#include "vssym32.h" -+ - #include "wine/debug.h" -+ - #include "uxthemegtk.h" - - WINE_DEFAULT_DEBUG_CHANNEL(uxthemegtk); -@@ -31,6 +44,28 @@ static void *libgtk3 = NULL; - static void *libcairo = NULL; - static void *libgobject2 = NULL; - -+static const struct -+{ -+ const WCHAR *classname; -+ uxgtk_theme_t *(*create)(void); -+} -+classes[] = -+{ -+ { VSCLASS_BUTTON, uxgtk_button_theme_create }, -+ { VSCLASS_COMBOBOX, uxgtk_combobox_theme_create }, -+ { VSCLASS_EDIT, uxgtk_edit_theme_create }, -+ { VSCLASS_HEADER, uxgtk_header_theme_create }, -+ { VSCLASS_LISTBOX, uxgtk_listbox_theme_create }, -+ { VSCLASS_LISTVIEW, uxgtk_listview_theme_create }, -+ { VSCLASS_MENU, uxgtk_menu_theme_create }, -+ { VSCLASS_REBAR, uxgtk_rebar_theme_create }, -+ { VSCLASS_STATUS, uxgtk_status_theme_create }, -+ { VSCLASS_TAB, uxgtk_tab_theme_create }, -+ { VSCLASS_TOOLBAR, uxgtk_toolbar_theme_create }, -+ { VSCLASS_TRACKBAR, uxgtk_trackbar_theme_create }, -+ { VSCLASS_WINDOW, uxgtk_window_theme_create } -+}; -+ - #define MAKE_FUNCPTR(f) typeof(f) * p##f = NULL - MAKE_FUNCPTR(cairo_create); - MAKE_FUNCPTR(cairo_destroy); -@@ -92,6 +127,12 @@ MAKE_FUNCPTR(gtk_widget_style_get); - MAKE_FUNCPTR(gtk_window_new); - #undef MAKE_FUNCPTR - -+#define NUM_SYS_COLORS (COLOR_MENUBAR + 1) -+#define MENU_HEIGHT 20 -+#define CLASSLIST_MAXLEN 128 -+ -+static const WCHAR THEME_PROPERTY[] = {'u','x','g','t','k','_','t','h','e','m','e',0}; -+ - static void free_gtk3_libs(void) - { - if (libgtk3) wine_dlclose(libgtk3, NULL, 0); -@@ -197,6 +238,812 @@ error: - return FALSE; - } - -+static void process_attach(void) -+{ -+ int i, colors[NUM_SYS_COLORS]; -+ COLORREF refs[NUM_SYS_COLORS]; -+ NONCLIENTMETRICSW metrics; -+ -+ if (!load_gtk3_libs()) -+ return; -+ -+ pgtk_init(0, NULL); /* Otherwise every call to GTK will fail */ -+ -+ /* apply colors */ -+ for (i = 0; i < NUM_SYS_COLORS; i++) -+ { -+ colors[i] = i; -+ refs[i] = GetThemeSysColor(NULL, i); -+ } -+ SetSysColors(NUM_SYS_COLORS, colors, refs); -+ -+ /* fix sys params */ -+ memset(&metrics, 0, sizeof(metrics)); -+ metrics.cbSize = sizeof(metrics); -+ SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0); -+ metrics.iMenuHeight = MENU_HEIGHT; -+ SystemParametersInfoW(SPI_SETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0); -+ -+ SystemParametersInfoW(SPI_SETCLEARTYPE, 0, (LPVOID)TRUE, 0); -+ SystemParametersInfoW(SPI_SETFONTSMOOTHING, 0, (LPVOID)TRUE, 0); -+ SystemParametersInfoW(SPI_SETFLATMENU, 0, (LPVOID)TRUE, 0); -+} -+ -+void uxgtk_theme_init(uxgtk_theme_t *theme, const uxgtk_theme_vtable_t *vtable) -+{ -+ theme->vtable = vtable; -+ theme->window = pgtk_window_new(GTK_WINDOW_TOPLEVEL); -+ theme->layout = pgtk_fixed_new(); -+ pgtk_container_add((GtkContainer *)theme->window, theme->layout); -+} -+ -+static void paint_cairo_surface(cairo_surface_t *surface, HDC target_hdc, -+ int x, int y, int width, int height) -+{ -+ unsigned char *bitmap_data, *surface_data; -+ int i, dib_stride, cairo_stride; -+ HDC bitmap_hdc; -+ HBITMAP bitmap; -+ BITMAPINFO info; -+ BLENDFUNCTION bf; -+ -+ info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); -+ info.bmiHeader.biWidth = width; -+ info.bmiHeader.biHeight = -height; /* top-down, see MSDN */ -+ info.bmiHeader.biPlanes = 1; -+ info.bmiHeader.biBitCount = 32; -+ info.bmiHeader.biCompression = BI_RGB; /* no compression */ -+ info.bmiHeader.biSizeImage = 0; -+ info.bmiHeader.biXPelsPerMeter = 1; -+ info.bmiHeader.biYPelsPerMeter = 1; -+ info.bmiHeader.biClrUsed = 0; -+ info.bmiHeader.biClrImportant = 0; -+ -+ bf.BlendOp = AC_SRC_OVER; -+ bf.BlendFlags = 0; -+ bf.SourceConstantAlpha = 0xff; -+ bf.AlphaFormat = AC_SRC_ALPHA; -+ -+ bitmap_hdc = CreateCompatibleDC(target_hdc); -+ bitmap = CreateDIBSection(bitmap_hdc, &info, DIB_RGB_COLORS, -+ (void **)&bitmap_data, NULL, 0); -+ -+ pcairo_surface_flush(surface); -+ -+ surface_data = pcairo_image_surface_get_data(surface); -+ cairo_stride = pcairo_image_surface_get_stride(surface); -+ dib_stride = width * 4; -+ -+ for (i = 0; i < height; i++) -+ memcpy(bitmap_data + i * dib_stride, surface_data + i * cairo_stride, width * 4); -+ -+ SelectObject(bitmap_hdc, bitmap); -+ -+ GdiAlphaBlend(target_hdc, x, y, width, height, -+ bitmap_hdc, 0, 0, width, height, bf); -+ -+ DeleteObject(bitmap); -+ DeleteDC(bitmap_hdc); -+} -+ -+HRESULT WINAPI CloseThemeData(HTHEME htheme) -+{ -+ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ -+ TRACE("(%p)\n", htheme); -+ -+ if (libgtk3 == NULL) -+ return E_NOTIMPL; -+ -+ if (theme == NULL) -+ return E_HANDLE; -+ -+ /* Destroy the toplevel widget */ -+ pgtk_widget_destroy(theme->window); -+ HeapFree(GetProcessHeap(), 0, theme); -+ return S_OK; -+} -+ -+HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD flags) -+{ -+ HTHEME htheme; -+ -+ TRACE("(%p, %u)\n", hwnd, flags); -+ -+ if (libgtk3 == NULL) -+ return E_NOTIMPL; -+ -+ if (flags & ETDT_USETABTEXTURE) -+ { -+ htheme = GetWindowTheme(hwnd); -+ OpenThemeData(hwnd, VSCLASS_TAB); -+ CloseThemeData(htheme); -+ } -+ -+ return S_OK; /* Always enabled */ -+} -+ -+HRESULT WINAPI EnableTheming(BOOL enable) -+{ -+ TRACE("(%u)\n", enable); -+ -+ return S_OK; /* Always enabled */ -+} -+ -+HRESULT WINAPI GetCurrentThemeName(LPWSTR filename, int filename_maxlen, -+ LPWSTR color, int color_maxlen, -+ LPWSTR size, int size_maxlen) -+{ -+ TRACE("(%p, %d, %p, %d, %p, %d)\n", filename, filename_maxlen, -+ color, color_maxlen, size, size_maxlen); -+ -+ return E_FAIL; /* To prevent calling EnumThemeColors and so on */ -+} -+ -+DWORD WINAPI GetThemeAppProperties(void) -+{ -+ TRACE("()\n"); -+ -+ return STAP_ALLOW_CONTROLS; /* Non-client drawing is not supported */ -+} -+ -+HTHEME WINAPI GetWindowTheme(HWND hwnd) -+{ -+ TRACE("(%p)\n", hwnd); -+ -+ return GetPropW(hwnd, THEME_PROPERTY); -+} -+ -+BOOL WINAPI IsAppThemed(void) -+{ -+ TRACE("()\n"); -+ -+ return IsThemeActive(); -+} -+ -+BOOL WINAPI IsThemeActive(void) -+{ -+ TRACE("()\n"); -+ -+ if (libgtk3 == NULL) -+ return FALSE; -+ -+ return TRUE; -+} -+ -+BOOL WINAPI IsThemeDialogTextureEnabled(HWND hwnd) -+{ -+ TRACE("(%p)\n", hwnd); -+ -+ return TRUE; /* Always enabled */ -+} -+ -+HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist) -+{ -+ WCHAR *start, *tok, buf[CLASSLIST_MAXLEN]; -+ uxgtk_theme_t *theme; -+ int i; -+ -+ TRACE("(%p, %s)\n", hwnd, debugstr_w(classlist)); -+ -+ if (libgtk3 == NULL) -+ { -+ SetLastError(ERROR_NOT_SUPPORTED); -+ return NULL; -+ } -+ -+ /* comctl32.dll likes to send NULL */ -+ if (classlist == NULL) -+ { -+ SetLastError(ERROR_INVALID_PARAMETER); -+ return NULL; -+ } -+ -+ lstrcpynW(buf, classlist, CLASSLIST_MAXLEN - 1); -+ buf[CLASSLIST_MAXLEN - 1] = L'\0'; -+ -+ /* search for the first match */ -+ start = buf; -+ for (tok = buf; *tok; tok++) -+ { -+ if (*tok != ';') continue; -+ *tok = 0; -+ -+ for (i = 0; i < sizeof(classes) / sizeof(classes[0]); i++) -+ if (lstrcmpiW(start, classes[i].classname) == 0) goto found; -+ -+ start = tok + 1; -+ } -+ if (start != tok) -+ { -+ for (i = 0; i < sizeof(classes) / sizeof(classes[0]); i++) -+ if (lstrcmpiW(start, classes[i].classname) == 0) goto found; -+ } -+ -+ FIXME("No matching theme for %s.\n", debugstr_w(classlist)); -+ SetLastError(ERROR_NOT_FOUND); -+ return NULL; -+ -+found: -+ TRACE("Using %s for %s.\n", debugstr_w(classes[i].classname), -+ debugstr_w(classlist)); -+ -+ theme = classes[i].create(); -+ if (theme && IsWindow(hwnd)) -+ SetPropW(hwnd, THEME_PROPERTY, theme); -+ -+ return theme; -+} -+ -+void WINAPI SetThemeAppProperties(DWORD flags) -+{ -+ TRACE("(%u)\n", flags); -+} -+ -+HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR sub_app_name, -+ LPCWSTR sub_id_list) -+{ -+ FIXME("(%p, %s, %s)\n", hwnd, debugstr_w(sub_app_name), -+ debugstr_w(sub_id_list)); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeBool(HTHEME htheme, int part_id, int state_id, -+ int prop_id, BOOL *value) -+{ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, value); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeColor(HTHEME htheme, int part_id, int state_id, -+ int prop_id, COLORREF *color) -+{ -+ HRESULT hr; -+ GdkRGBA rgba = {0, 0, 0, 0}; -+ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, color); -+ -+ if (libgtk3 == NULL) -+ return E_NOTIMPL; -+ -+ if (theme == NULL || theme->vtable == NULL) -+ return E_HANDLE; -+ -+ if (theme->vtable->get_color == NULL) -+ return E_NOTIMPL; -+ -+ if (color == NULL) -+ return E_INVALIDARG; -+ -+ hr = theme->vtable->get_color(theme, part_id, state_id, prop_id, &rgba); -+ -+ if (SUCCEEDED(hr) && rgba.alpha > 0) -+ { -+ *color = RGB((int)(0.5 + CLAMP(rgba.red, 0.0, 1.0) * 255.0), -+ (int)(0.5 + CLAMP(rgba.green, 0.0, 1.0) * 255.0), -+ (int)(0.5 + CLAMP(rgba.blue, 0.0, 1.0) * 255.0)); -+ return S_OK; -+ } -+ -+ return E_FAIL; -+} -+ -+HRESULT WINAPI GetThemeEnumValue(HTHEME htheme, int part_id, int state_id, -+ int prop_id, int *value) -+{ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, value); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeFilename(HTHEME htheme, int part_id, int state_id, -+ int prop_id, LPWSTR filename, int maxlen) -+{ -+ TRACE("(%p, %d, %d, %d, %p, %d)\n", htheme, part_id, state_id, prop_id, -+ filename, maxlen); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeFont(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ int prop_id, LOGFONTW *font) -+{ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, font); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeInt(HTHEME htheme, int part_id, int state_id, -+ int prop_id, int *value) -+{ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, value); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeIntList(HTHEME htheme, int part_id, int state_id, -+ int prop_id, INTLIST *intlist) -+{ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, intlist); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeMargins(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ int prop_id, LPRECT rect, MARGINS *margins) -+{ -+ TRACE("(%p, %d, %d, %d, %p, %p)\n", htheme, part_id, state_id, prop_id, rect, margins); -+ -+ memset(margins, 0, sizeof(MARGINS)); /* Set all margins to 0 */ -+ -+ return S_OK; -+} -+ -+HRESULT WINAPI GetThemeMetric(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ int prop_id, int *value) -+{ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, value); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemePosition(HTHEME htheme, int part_id, int state_id, -+ int prop_id, POINT *point) -+{ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, point); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemePropertyOrigin(HTHEME htheme, int part_id, int state_id, -+ int prop_id, PROPERTYORIGIN *origin) -+{ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, origin); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeRect(HTHEME htheme, int part_id, int state_id, -+ int prop_id, RECT *rect) -+{ -+ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, rect); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeString(HTHEME htheme, int part_id, int state_id, -+ int prop_id, LPWSTR buffer, int maxlen) -+{ -+ TRACE("(%p, %d, %d, %d, %p, %d)\n", htheme, part_id, state_id, prop_id, buffer, -+ maxlen); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeTransitionDuration(HTHEME htheme, int part_id, int state_id_from, -+ int state_id_to, int prop_id, DWORD *duration) -+{ -+ TRACE("(%p, %d, %d, %d, %d, %p)\n", htheme, part_id, state_id_from, state_id_to, prop_id, -+ duration); -+ -+ return E_NOTIMPL; -+} -+ -+BOOL WINAPI GetThemeSysBool(HTHEME htheme, int bool_id) -+{ -+ TRACE("(%p, %d)\n", htheme, bool_id); -+ -+ SetLastError(ERROR_NOT_SUPPORTED); -+ -+ return FALSE; -+} -+ -+COLORREF WINAPI GetThemeSysColor(HTHEME htheme, int color_id) -+{ -+ HRESULT hr = S_OK; -+ COLORREF color = 0; -+ -+ static HTHEME window_htheme = NULL; -+ static HTHEME button_htheme = NULL; -+ static HTHEME edit_htheme = NULL; -+ static HTHEME menu_htheme = NULL; -+ -+ TRACE("(%p, %d)\n", htheme, color_id); -+ -+ if (libgtk3 == NULL) -+ return GetSysColor(color_id); -+ -+ if (window_htheme == NULL) -+ { -+ window_htheme = OpenThemeData(NULL, VSCLASS_WINDOW); -+ button_htheme = OpenThemeData(NULL, VSCLASS_BUTTON); -+ edit_htheme = OpenThemeData(NULL, VSCLASS_EDIT); -+ menu_htheme = OpenThemeData(NULL, VSCLASS_MENU); -+ } -+ -+ switch (color_id) -+ { -+ case COLOR_BTNFACE: -+ case COLOR_SCROLLBAR: -+ case COLOR_WINDOWFRAME: -+ case COLOR_INACTIVECAPTION: -+ case COLOR_GRADIENTINACTIVECAPTION: -+ case COLOR_3DDKSHADOW: -+ case COLOR_BTNHIGHLIGHT: -+ case COLOR_ACTIVEBORDER: -+ case COLOR_INACTIVEBORDER: -+ case COLOR_APPWORKSPACE: -+ case COLOR_BACKGROUND: -+ case COLOR_ACTIVECAPTION: -+ case COLOR_GRADIENTACTIVECAPTION: -+ case COLOR_ALTERNATEBTNFACE: -+ case COLOR_INFOBK: /* FIXME */ -+ hr = GetThemeColor(window_htheme, WP_DIALOG, 0, TMT_FILLCOLOR, &color); -+ break; -+ -+ case COLOR_3DLIGHT: -+ case COLOR_BTNSHADOW: -+ hr = GetThemeColor(button_htheme, BP_PUSHBUTTON, PBS_NORMAL, TMT_BORDERCOLOR, &color); -+ break; -+ -+ case COLOR_BTNTEXT: -+ case COLOR_INFOTEXT: -+ case COLOR_WINDOWTEXT: -+ case COLOR_CAPTIONTEXT: -+ hr = GetThemeColor(window_htheme, WP_DIALOG, 0, TMT_TEXTCOLOR, &color); -+ break; -+ -+ case COLOR_HIGHLIGHTTEXT: -+ hr = GetThemeColor(edit_htheme, EP_EDITTEXT, ETS_SELECTED, TMT_TEXTCOLOR, &color); -+ break; -+ -+ case COLOR_GRAYTEXT: -+ case COLOR_INACTIVECAPTIONTEXT: -+ hr = GetThemeColor(button_htheme, BP_PUSHBUTTON, PBS_DISABLED, TMT_TEXTCOLOR, &color); -+ break; -+ -+ case COLOR_HIGHLIGHT: -+ case COLOR_MENUHILIGHT: -+ case COLOR_HOTLIGHT: -+ hr = GetThemeColor(edit_htheme, EP_EDITTEXT, ETS_SELECTED, TMT_FILLCOLOR, &color); -+ break; -+ -+ case COLOR_MENUBAR: -+ hr = GetThemeColor(menu_htheme, MENU_BARBACKGROUND, MB_ACTIVE, TMT_FILLCOLOR, &color); -+ break; -+ -+ case COLOR_MENU: -+ hr = GetThemeColor(menu_htheme, MENU_POPUPBACKGROUND, 0, TMT_FILLCOLOR, &color); -+ break; -+ -+ case COLOR_MENUTEXT: -+ hr = GetThemeColor(menu_htheme, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR, &color); -+ break; -+ -+ case COLOR_WINDOW: -+ hr = GetThemeColor(edit_htheme, EP_EDITTEXT, ETS_NORMAL, TMT_FILLCOLOR, &color); -+ break; -+ -+ default: -+ FIXME("Unknown color %d.\n", color_id); -+ return GetSysColor(color_id); -+ } -+ -+ if (FAILED(hr)) -+ return GetSysColor(color_id); -+ -+ return color; -+} -+ -+HBRUSH WINAPI GetThemeSysColorBrush(HTHEME htheme, int color_id) -+{ -+ TRACE("(%p, %d)\n", htheme, color_id); -+ -+ return CreateSolidBrush(GetThemeSysColor(htheme, color_id)); -+} -+ -+HRESULT WINAPI GetThemeSysFont(HTHEME htheme, int font_id, LOGFONTW *font) -+{ -+ TRACE("(%p, %d, %p)\n", htheme, font_id, font); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeSysInt(HTHEME htheme, int int_id, int *value) -+{ -+ TRACE("(%p, %d, %p)\n", htheme, int_id, value); -+ -+ return E_NOTIMPL; -+} -+ -+int WINAPI GetThemeSysSize(HTHEME htheme, int size_id) -+{ -+ TRACE("(%p, %d)\n", htheme, size_id); -+ -+ SetLastError(ERROR_NOT_SUPPORTED); -+ -+ return -1; -+} -+ -+HRESULT WINAPI GetThemeSysString(HTHEME htheme, int string_id, -+ LPWSTR buffer, int maxlen) -+{ -+ TRACE("(%p, %d, %p, %d)\n", htheme, string_id, buffer, maxlen); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI DrawThemeBackground(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ LPCRECT rect, LPCRECT clip_rect) -+{ -+ DTBGOPTS opts; -+ -+ TRACE("(%p, %p, %d, %d, %p, %p)\n", htheme, hdc, part_id, state_id, rect, clip_rect); -+ -+ opts.dwSize = sizeof(DTBGOPTS); -+ opts.dwFlags = 0; -+ -+ if (clip_rect != NULL) -+ { -+ opts.dwFlags = DTBG_CLIPRECT; -+ CopyRect(&opts.rcClip, clip_rect); -+ } -+ -+ return DrawThemeBackgroundEx(htheme, hdc, part_id, state_id, rect, &opts); -+} -+ -+HRESULT WINAPI DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ LPCRECT rect, const DTBGOPTS *options) -+{ -+ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ cairo_surface_t *surface; -+ int width, height; -+ cairo_t *cr; -+ HRESULT hr; -+ -+ TRACE("(%p, %p, %d, %d, %p, %p)\n", htheme, hdc, part_id, state_id, rect, options); -+ -+ if (libgtk3 == NULL) -+ return E_NOTIMPL; -+ -+ if (theme == NULL || theme->vtable == NULL) -+ return E_HANDLE; -+ -+ if (theme->vtable->draw_background == NULL) -+ return E_NOTIMPL; -+ -+ width = rect->right - rect->left; -+ height = rect->bottom - rect->top; -+ -+ surface = pcairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); -+ cr = pcairo_create(surface); -+ -+ hr = theme->vtable->draw_background(theme, cr, part_id, state_id, width, height); -+ if (SUCCEEDED(hr)) -+ paint_cairo_surface(surface, hdc, rect->left, rect->top, width, height); -+ -+ pcairo_destroy(cr); -+ pcairo_surface_destroy(surface); -+ return hr; -+} -+ -+HRESULT WINAPI DrawThemeEdge(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ LPCRECT dest_rect, UINT edge, UINT flags, -+ LPRECT content_rect) -+{ -+ TRACE("(%p, %p, %d, %d, %p, %u, %u, %p)\n", htheme, hdc, part_id, state_id, -+ dest_rect, edge, flags, content_rect); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI DrawThemeIcon(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ LPCRECT rect, HIMAGELIST list, int index) -+{ -+ TRACE("(%p, %p, %d, %d, %p, %p, %d)\n", htheme, hdc, part_id, state_id, rect, list, index); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *rect) -+{ -+ HWND parent; -+ -+ TRACE("(%p, %p, %p)\n", hwnd, hdc, rect); -+ -+ parent = GetParent(hwnd); -+ if (!parent) -+ { -+ ERR("Window has no parent.\n"); -+ return E_FAIL; -+ } -+ -+ SendMessageW(parent, WM_ERASEBKGND, (WPARAM)hdc, 0); -+ SendMessageW(parent, WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT); -+ -+ return S_OK; -+} -+ -+HRESULT WINAPI DrawThemeText(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ LPCWSTR text, int length, DWORD flags, DWORD flags2, -+ LPCRECT rect) -+{ -+ RECT rt; -+ HRESULT hr; -+ COLORREF color = RGB(0, 0, 0), oldcolor; -+ -+ TRACE("(%p, %p, %d, %d, %s, %u, %u, %p)\n", htheme, hdc, part_id, state_id, -+ wine_dbgstr_wn(text, length), flags, flags2, rect); -+ -+ hr = GetThemeColor(htheme, part_id, state_id, TMT_TEXTCOLOR, &color); -+ if (FAILED(hr)) -+ { -+ FIXME("No color.\n"); -+ /*return hr;*/ -+ } -+ -+ oldcolor = SetTextColor(hdc, color); -+ -+ CopyRect(&rt, rect); -+ -+ SetBkMode(hdc, TRANSPARENT); -+ DrawTextW(hdc, text, length, &rt, flags); -+ -+ SetTextColor(hdc, oldcolor); -+ -+ return S_OK; -+} -+ -+HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ LPCRECT bounding_rect, LPRECT content_rect) -+{ -+ HRESULT hr; -+ MARGINS margins; -+ -+ TRACE("(%p, %p, %d, %d, %p, %p)\n", htheme, hdc, part_id, state_id, bounding_rect, -+ content_rect); -+ -+ if (bounding_rect == NULL || content_rect == NULL) -+ return E_INVALIDARG; -+ -+ hr = GetThemeMargins(htheme, hdc, part_id, state_id, -+ TMT_CONTENTMARGINS, NULL, &margins); -+ -+ if (FAILED(hr)) -+ return hr; -+ -+ content_rect->left = bounding_rect->left + margins.cxLeftWidth; -+ content_rect->top = bounding_rect->top + margins.cyTopHeight; -+ content_rect->right = bounding_rect->right - margins.cxRightWidth; -+ content_rect->bottom = bounding_rect->bottom - margins.cyBottomHeight; -+ -+ return S_OK; -+} -+ -+HRESULT WINAPI GetThemeBackgroundExtent(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ LPCRECT content_rect, RECT *extent_rect) -+{ -+ HRESULT hr; -+ MARGINS margins; -+ -+ TRACE("(%p, %p, %d, %d, %p, %p)\n", htheme, hdc, part_id, state_id, content_rect, -+ extent_rect); -+ -+ if (content_rect == NULL || extent_rect == NULL) -+ return E_INVALIDARG; -+ -+ hr = GetThemeMargins(htheme, hdc, part_id, state_id, -+ TMT_CONTENTMARGINS, NULL, &margins); -+ -+ if (FAILED(hr)) -+ return hr; -+ -+ extent_rect->left = content_rect->left - margins.cxLeftWidth; -+ extent_rect->top = content_rect->top - margins.cyTopHeight; -+ extent_rect->right = content_rect->right + margins.cxRightWidth; -+ extent_rect->bottom = content_rect->bottom + margins.cyBottomHeight; -+ -+ return S_OK; -+} -+ -+HRESULT WINAPI GetThemeBackgroundRegion(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ LPCRECT rect, HRGN *region) -+{ -+ TRACE("(%p, %p, %d, %d, %p, %p)\n", htheme, hdc, part_id, state_id, rect, region); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ RECT *rect, THEMESIZE type, SIZE *size) -+{ -+ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ -+ TRACE("(%p, %p, %d, %d, %p, %d, %p)\n", htheme, hdc, part_id, state_id, rect, type, size); -+ -+ if (libgtk3 == NULL) -+ return E_NOTIMPL; -+ -+ if (theme == NULL || theme->vtable == NULL) -+ return E_HANDLE; -+ -+ if (theme->vtable->get_part_size == NULL) -+ return E_NOTIMPL; -+ -+ if (rect == NULL || size == NULL) -+ return E_INVALIDARG; -+ -+ return theme->vtable->get_part_size(theme, part_id, state_id, rect, size); -+} -+ -+HRESULT WINAPI GetThemeTextExtent(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ LPCWSTR text, int length, DWORD flags, -+ LPCRECT bounding_rect, LPRECT extent_rect) -+{ -+ TRACE("(%p, %p, %d, %d, %s, %u, %p, %p)\n", htheme, hdc, part_id, state_id, -+ wine_dbgstr_wn(text, length), flags, bounding_rect, extent_rect); -+ -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI GetThemeTextMetrics(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ TEXTMETRICW *metric) -+{ -+ TRACE("(%p, %p, %d, %d, %p)\n", htheme, hdc, part_id, state_id, metric); -+ -+ if (!GetTextMetricsW(hdc, metric)) -+ return HRESULT_FROM_WIN32(GetLastError()); -+ -+ return S_OK; -+} -+ -+HRESULT WINAPI HitTestThemeBackground(HTHEME htheme, HDC hdc, int part_id, int state_id, -+ DWORD options, LPCRECT rect, HRGN hrgn, -+ POINT point, WORD *hit_test_code) -+{ -+ TRACE("(%p, %p, %d, %d, %u, %p, %p, (%d, %d), %p)\n", htheme, hdc, part_id, state_id, options, -+ rect, hrgn, point.x, point.y, hit_test_code); -+ -+ return E_NOTIMPL; -+} -+ -+BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME htheme, int part_id, int state_id) -+{ -+ TRACE("(%p, %d, %d)\n", htheme, part_id, state_id); -+ -+ return TRUE; /* The most widgets are partially transparent */ -+} -+ -+BOOL WINAPI IsThemePartDefined(HTHEME htheme, int part_id, int state_id) -+{ -+ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ -+ TRACE("(%p, %d, %d)\n", htheme, part_id, state_id); -+ -+ if (libgtk3 == NULL) -+ { -+ SetLastError(ERROR_NOT_SUPPORTED); -+ return FALSE; -+ } -+ -+ if (theme == NULL || theme->vtable == NULL) -+ { -+ SetLastError(ERROR_INVALID_HANDLE); -+ return FALSE; -+ } -+ -+ if (theme->vtable->is_part_defined == NULL) -+ { -+ SetLastError(ERROR_NOT_SUPPORTED); -+ return FALSE; -+ } -+ -+ return theme->vtable->is_part_defined(part_id, state_id); -+} -+ - BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) - { - TRACE("(%p, %d, %p)\n", instance, reason, reserved); -@@ -205,13 +1052,13 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) - { - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(instance); -- if (!load_gtk3_libs()) return FALSE; -- break; -+ process_attach(); -+ return TRUE; - - case DLL_PROCESS_DETACH: - if (reserved) break; - free_gtk3_libs(); -- break; -+ return TRUE; - } - - return TRUE; -diff --git a/dlls/uxtheme-gtk/uxthemegtk.h b/dlls/uxtheme-gtk/uxthemegtk.h -index 42e4784..17307f1 100644 ---- a/dlls/uxtheme-gtk/uxthemegtk.h -+++ b/dlls/uxtheme-gtk/uxthemegtk.h -@@ -1,6 +1,7 @@ - /* - * GTK uxtheme implementation - * -+ * Copyright (C) 2015 Ivan Akulinchev - * Copyright (C) 2015 Michael Müller - * - * This library is free software; you can redistribute it and/or -@@ -21,9 +22,45 @@ - #ifndef UXTHEMEGTK_H - #define UXTHEMEGTK_H - -+#include "windef.h" -+ - #define GDK_DISABLE_DEPRECATION_WARNINGS - #include - -+typedef struct _uxgtk_theme uxgtk_theme_t; -+typedef struct _uxgtk_theme_vtable uxgtk_theme_vtable_t; -+ -+struct _uxgtk_theme_vtable -+{ -+ HRESULT (*get_color)(uxgtk_theme_t *theme, int part_id, int state_id, -+ int prop_id, GdkRGBA *rgba); -+ HRESULT (*draw_background)(uxgtk_theme_t *theme, cairo_t *cr, int part_id, int state_id, -+ int width, int height); -+ HRESULT (*get_part_size)(uxgtk_theme_t *theme, int part_id, int state_id, -+ RECT *rect, SIZE *size); -+ BOOL (*is_part_defined)(int part_id, int state_id); -+}; -+ -+struct _uxgtk_theme -+{ -+ const uxgtk_theme_vtable_t *vtable; -+ -+ GtkWidget *window; -+ GtkWidget *layout; -+}; -+ -+typedef HANDLE HTHEMEFILE; -+ -+typedef struct tagTHEMENAMES -+{ -+ WCHAR szName[MAX_PATH+1]; -+ WCHAR szDisplayName[MAX_PATH+1]; -+ WCHAR szTooltip[MAX_PATH+1]; -+} THEMENAMES, *PTHEMENAMES; -+ -+typedef BOOL (CALLBACK *EnumThemeProc)(LPVOID, LPCWSTR, LPCWSTR, LPCWSTR, LPVOID, LPVOID); -+typedef BOOL (CALLBACK *ParseThemeIniFileProc)(DWORD, LPWSTR, LPWSTR, LPWSTR, DWORD, LPVOID); -+ - #define MAKE_FUNCPTR(f) extern typeof(f) * p##f DECLSPEC_HIDDEN - MAKE_FUNCPTR(cairo_create); - MAKE_FUNCPTR(cairo_destroy); -@@ -85,4 +122,20 @@ MAKE_FUNCPTR(gtk_widget_style_get); - MAKE_FUNCPTR(gtk_window_new); - #undef MAKE_FUNCPTR - -+uxgtk_theme_t *uxgtk_button_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_combobox_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_edit_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_header_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_listbox_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_listview_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_menu_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_rebar_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_status_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_tab_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_toolbar_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_trackbar_theme_create(void) DECLSPEC_HIDDEN; -+uxgtk_theme_t *uxgtk_window_theme_create(void) DECLSPEC_HIDDEN; -+ -+void uxgtk_theme_init(uxgtk_theme_t *theme, const uxgtk_theme_vtable_t *vtable) DECLSPEC_HIDDEN; -+ - #endif /* UXTHEMEGTK_H */ -diff --git a/dlls/uxtheme-gtk/window.c b/dlls/uxtheme-gtk/window.c ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk-window.c b/dlls/uxtheme/gtk-window.c new file mode 100644 -index 0000000..cf617ef +index 00000000..657cfb03 --- /dev/null -+++ b/dlls/uxtheme-gtk/window.c -@@ -0,0 +1,166 @@ ++++ b/dlls/uxtheme/gtk-window.c +@@ -0,0 +1,172 @@ +/* + * GTK uxtheme implementation + * @@ -3417,6 +2621,10 @@ index 0000000..cf617ef + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "config.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ +#include "uxthemegtk.h" + +#include @@ -3563,6 +2771,1528 @@ index 0000000..cf617ef + + return &theme->base; +} ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/gtk.c b/dlls/uxtheme/gtk.c +new file mode 100644 +index 00000000..bbee8e87 +--- /dev/null ++++ b/dlls/uxtheme/gtk.c +@@ -0,0 +1,962 @@ ++/* ++ * GTK uxtheme implementation ++ * ++ * Copyright (C) 2015 Ivan Akulinchev ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++ ++#include "config.h" ++#include "wine/port.h" ++ ++#include ++#include ++ ++#include "windef.h" ++#include "winbase.h" ++#include "wingdi.h" ++#include "winuser.h" ++#include "winerror.h" ++#include "winreg.h" ++#include "uxtheme.h" ++#include "vsstyle.h" ++#include "vssym32.h" ++ ++#include "wine/debug.h" ++#include "wine/library.h" ++ ++#include "uxthemedll.h" ++ ++#ifdef HAVE_GTK_GTK_H ++ ++#include "uxthemegtk.h" ++ ++WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); ++ ++#define GDK_DISABLE_DEPRECATION_WARNINGS ++#include ++ ++static void *libgtk3 = NULL; ++static void *libcairo = NULL; ++static void *libgobject2 = NULL; ++ ++#define MAKE_FUNCPTR(f) typeof(f) * p##f DECLSPEC_HIDDEN ++MAKE_FUNCPTR(cairo_create); ++MAKE_FUNCPTR(cairo_destroy); ++MAKE_FUNCPTR(cairo_image_surface_create); ++MAKE_FUNCPTR(cairo_image_surface_get_data); ++MAKE_FUNCPTR(cairo_image_surface_get_stride); ++MAKE_FUNCPTR(cairo_surface_destroy); ++MAKE_FUNCPTR(cairo_surface_flush); ++MAKE_FUNCPTR(g_type_check_instance_is_a); ++MAKE_FUNCPTR(gtk_bin_get_child); ++MAKE_FUNCPTR(gtk_button_new); ++MAKE_FUNCPTR(gtk_check_button_new); ++MAKE_FUNCPTR(gtk_combo_box_new_with_entry); ++MAKE_FUNCPTR(gtk_container_add); ++MAKE_FUNCPTR(gtk_container_forall); ++MAKE_FUNCPTR(gtk_entry_new); ++MAKE_FUNCPTR(gtk_fixed_new); ++MAKE_FUNCPTR(gtk_frame_new); ++MAKE_FUNCPTR(gtk_init); ++MAKE_FUNCPTR(gtk_label_new); ++MAKE_FUNCPTR(gtk_menu_bar_new); ++MAKE_FUNCPTR(gtk_menu_item_new); ++MAKE_FUNCPTR(gtk_menu_item_set_submenu); ++MAKE_FUNCPTR(gtk_menu_new); ++MAKE_FUNCPTR(gtk_menu_shell_append); ++MAKE_FUNCPTR(gtk_notebook_new); ++MAKE_FUNCPTR(gtk_radio_button_new); ++MAKE_FUNCPTR(gtk_render_arrow); ++MAKE_FUNCPTR(gtk_render_background); ++MAKE_FUNCPTR(gtk_render_check); ++MAKE_FUNCPTR(gtk_render_frame); ++MAKE_FUNCPTR(gtk_render_handle); ++MAKE_FUNCPTR(gtk_render_line); ++MAKE_FUNCPTR(gtk_render_option); ++MAKE_FUNCPTR(gtk_render_slider); ++MAKE_FUNCPTR(gtk_scale_new); ++MAKE_FUNCPTR(gtk_scrolled_window_new); ++MAKE_FUNCPTR(gtk_separator_tool_item_new); ++MAKE_FUNCPTR(gtk_style_context_add_class); ++MAKE_FUNCPTR(gtk_style_context_add_region); ++MAKE_FUNCPTR(gtk_style_context_get_background_color); ++MAKE_FUNCPTR(gtk_style_context_get_border_color); ++MAKE_FUNCPTR(gtk_style_context_get_color); ++MAKE_FUNCPTR(gtk_style_context_remove_class); ++MAKE_FUNCPTR(gtk_style_context_restore); ++MAKE_FUNCPTR(gtk_style_context_save); ++MAKE_FUNCPTR(gtk_style_context_set_junction_sides); ++MAKE_FUNCPTR(gtk_style_context_set_state); ++MAKE_FUNCPTR(gtk_toggle_button_get_type); ++MAKE_FUNCPTR(gtk_toolbar_new); ++MAKE_FUNCPTR(gtk_tree_view_append_column); ++MAKE_FUNCPTR(gtk_tree_view_column_get_button); ++MAKE_FUNCPTR(gtk_tree_view_column_new); ++MAKE_FUNCPTR(gtk_tree_view_get_column); ++MAKE_FUNCPTR(gtk_tree_view_new); ++MAKE_FUNCPTR(gtk_widget_destroy); ++MAKE_FUNCPTR(gtk_widget_get_style_context); ++MAKE_FUNCPTR(gtk_widget_style_get); ++MAKE_FUNCPTR(gtk_window_new); ++#undef MAKE_FUNCPTR ++ ++#define NUM_SYS_COLORS (COLOR_MENUBAR + 1) ++#define MENU_HEIGHT 20 ++#define CLASSLIST_MAXLEN 128 ++ ++static void free_gtk3_libs(void) ++{ ++ if (libgtk3) wine_dlclose(libgtk3, NULL, 0); ++ if (libcairo) wine_dlclose(libcairo, NULL, 0); ++ if (libgobject2) wine_dlclose(libgobject2, NULL, 0); ++ libgtk3 = libcairo = libgobject2 = NULL; ++} ++ ++#define LOAD_FUNCPTR(lib, f) \ ++ if(!(p##f = wine_dlsym(lib, #f, NULL, 0))) \ ++ { \ ++ WARN("Can't find symbol %s.\n", #f); \ ++ goto error; \ ++ } ++ ++static BOOL load_gtk3_libs(void) ++{ ++ if (libgtk3 && libcairo && libgobject2) ++ return TRUE; ++ ++ libgtk3 = wine_dlopen(SONAME_LIBGTK_3, RTLD_NOW, NULL, 0); ++ if (!libgtk3) ++ { ++ FIXME("Wine cannot find the %s library.\n", SONAME_LIBGTK_3); ++ goto error; ++ } ++ ++ LOAD_FUNCPTR(libgtk3, gtk_bin_get_child) ++ LOAD_FUNCPTR(libgtk3, gtk_button_new) ++ LOAD_FUNCPTR(libgtk3, gtk_check_button_new) ++ LOAD_FUNCPTR(libgtk3, gtk_combo_box_new_with_entry) ++ LOAD_FUNCPTR(libgtk3, gtk_container_add) ++ LOAD_FUNCPTR(libgtk3, gtk_container_forall) ++ LOAD_FUNCPTR(libgtk3, gtk_entry_new) ++ LOAD_FUNCPTR(libgtk3, gtk_fixed_new) ++ LOAD_FUNCPTR(libgtk3, gtk_frame_new) ++ LOAD_FUNCPTR(libgtk3, gtk_init) ++ LOAD_FUNCPTR(libgtk3, gtk_label_new) ++ LOAD_FUNCPTR(libgtk3, gtk_menu_bar_new) ++ LOAD_FUNCPTR(libgtk3, gtk_menu_item_new) ++ LOAD_FUNCPTR(libgtk3, gtk_menu_item_set_submenu) ++ LOAD_FUNCPTR(libgtk3, gtk_menu_new) ++ LOAD_FUNCPTR(libgtk3, gtk_menu_shell_append) ++ LOAD_FUNCPTR(libgtk3, gtk_notebook_new) ++ LOAD_FUNCPTR(libgtk3, gtk_radio_button_new) ++ LOAD_FUNCPTR(libgtk3, gtk_render_arrow) ++ LOAD_FUNCPTR(libgtk3, gtk_render_background) ++ LOAD_FUNCPTR(libgtk3, gtk_render_check) ++ LOAD_FUNCPTR(libgtk3, gtk_render_frame) ++ LOAD_FUNCPTR(libgtk3, gtk_render_handle) ++ LOAD_FUNCPTR(libgtk3, gtk_render_line) ++ LOAD_FUNCPTR(libgtk3, gtk_render_option) ++ LOAD_FUNCPTR(libgtk3, gtk_render_slider) ++ LOAD_FUNCPTR(libgtk3, gtk_scale_new) ++ LOAD_FUNCPTR(libgtk3, gtk_scrolled_window_new) ++ LOAD_FUNCPTR(libgtk3, gtk_separator_tool_item_new) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_add_class) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_add_region) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_get_background_color) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_get_border_color) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_get_color) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_remove_class) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_restore) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_save) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_set_junction_sides) ++ LOAD_FUNCPTR(libgtk3, gtk_style_context_set_state) ++ LOAD_FUNCPTR(libgtk3, gtk_toggle_button_get_type) ++ LOAD_FUNCPTR(libgtk3, gtk_toolbar_new) ++ LOAD_FUNCPTR(libgtk3, gtk_tree_view_append_column) ++ LOAD_FUNCPTR(libgtk3, gtk_tree_view_column_get_button) ++ LOAD_FUNCPTR(libgtk3, gtk_tree_view_column_new) ++ LOAD_FUNCPTR(libgtk3, gtk_tree_view_get_column) ++ LOAD_FUNCPTR(libgtk3, gtk_tree_view_new) ++ LOAD_FUNCPTR(libgtk3, gtk_widget_destroy) ++ LOAD_FUNCPTR(libgtk3, gtk_widget_get_style_context) ++ LOAD_FUNCPTR(libgtk3, gtk_widget_style_get) ++ LOAD_FUNCPTR(libgtk3, gtk_window_new) ++ ++ libcairo = wine_dlopen(SONAME_LIBCAIRO, RTLD_NOW, NULL, 0); ++ if (!libcairo) ++ { ++ FIXME("Wine cannot find the %s library.\n", SONAME_LIBCAIRO); ++ goto error; ++ } ++ ++ LOAD_FUNCPTR(libcairo, cairo_create) ++ LOAD_FUNCPTR(libcairo, cairo_destroy) ++ LOAD_FUNCPTR(libcairo, cairo_image_surface_create) ++ LOAD_FUNCPTR(libcairo, cairo_image_surface_get_data) ++ LOAD_FUNCPTR(libcairo, cairo_image_surface_get_stride) ++ LOAD_FUNCPTR(libcairo, cairo_surface_destroy) ++ LOAD_FUNCPTR(libcairo, cairo_surface_flush) ++ ++ libgobject2 = wine_dlopen(SONAME_LIBGOBJECT_2_0, RTLD_NOW, NULL, 0); ++ if (!libgobject2) ++ { ++ FIXME("Wine cannot find the %s library.\n", SONAME_LIBGOBJECT_2_0); ++ goto error; ++ } ++ ++ LOAD_FUNCPTR(libgobject2, g_type_check_instance_is_a) ++ return TRUE; ++ ++error: ++ free_gtk3_libs(); ++ return FALSE; ++} ++ ++static BOOL init_gtk3(void) ++{ ++ int i, colors[NUM_SYS_COLORS]; ++ COLORREF refs[NUM_SYS_COLORS]; ++ NONCLIENTMETRICSW metrics; ++ static BOOL initialized; ++ ++ if (!load_gtk3_libs()) ++ return FALSE; ++ ++ if (initialized) ++ return TRUE; ++ initialized = TRUE; ++ ++ pgtk_init(0, NULL); /* Otherwise every call to GTK will fail */ ++ ++ /* apply colors */ ++ for (i = 0; i < NUM_SYS_COLORS; i++) ++ { ++ colors[i] = i; ++ refs[i] = uxtheme_gtk_GetThemeSysColor(NULL, i); ++ } ++ SetSysColors(NUM_SYS_COLORS, colors, refs); ++ ++ /* fix sys params */ ++ memset(&metrics, 0, sizeof(metrics)); ++ metrics.cbSize = sizeof(metrics); ++ SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0); ++ metrics.iMenuHeight = MENU_HEIGHT; ++ SystemParametersInfoW(SPI_SETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0); ++ ++ SystemParametersInfoW(SPI_SETCLEARTYPE, 0, (LPVOID)TRUE, 0); ++ SystemParametersInfoW(SPI_SETFONTSMOOTHING, 0, (LPVOID)TRUE, 0); ++ SystemParametersInfoW(SPI_SETFLATMENU, 0, (LPVOID)TRUE, 0); ++ ++ return TRUE; ++} ++ ++void uxgtk_theme_init(uxgtk_theme_t *theme, const uxgtk_theme_vtable_t *vtable) ++{ ++ theme->vtable = vtable; ++ theme->window = pgtk_window_new(GTK_WINDOW_TOPLEVEL); ++ theme->layout = pgtk_fixed_new(); ++ pgtk_container_add((GtkContainer *)theme->window, theme->layout); ++} ++ ++static const struct ++{ ++ const WCHAR *classname; ++ uxgtk_theme_t *(*create)(void); ++} ++classes[] = ++{ ++ { VSCLASS_BUTTON, uxgtk_button_theme_create }, ++ { VSCLASS_COMBOBOX, uxgtk_combobox_theme_create }, ++ { VSCLASS_EDIT, uxgtk_edit_theme_create }, ++ { VSCLASS_HEADER, uxgtk_header_theme_create }, ++ { VSCLASS_LISTBOX, uxgtk_listbox_theme_create }, ++ { VSCLASS_LISTVIEW, uxgtk_listview_theme_create }, ++ { VSCLASS_MENU, uxgtk_menu_theme_create }, ++ { VSCLASS_REBAR, uxgtk_rebar_theme_create }, ++ { VSCLASS_STATUS, uxgtk_status_theme_create }, ++ { VSCLASS_TAB, uxgtk_tab_theme_create }, ++ { VSCLASS_TOOLBAR, uxgtk_toolbar_theme_create }, ++ { VSCLASS_TRACKBAR, uxgtk_trackbar_theme_create }, ++ { VSCLASS_WINDOW, uxgtk_window_theme_create } ++}; ++ ++BOOL uxtheme_gtk_enabled(void) ++{ ++ static const WCHAR keypath[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0}; ++ static const WCHAR value[] = {'T','h','e','m','e','E','n','g','i','n','e',0}; ++ static const WCHAR gtk[] = {'G','T','K',0}; ++ WCHAR buffer[4]; ++ DWORD size = sizeof(buffer); ++ HKEY key; ++ LONG l; ++ ++ /* @@ Wine registry key: HKCU\Software\Wine */ ++ if (RegOpenKeyExW(HKEY_CURRENT_USER, keypath, 0, KEY_READ, &key)) ++ return FALSE; ++ ++ l = RegQueryValueExW(key, value, NULL, NULL, (BYTE *)buffer, &size); ++ RegCloseKey(key); ++ ++ if (l || lstrcmpiW(buffer, gtk)) ++ return FALSE; ++ ++ return init_gtk3(); ++} ++ ++HRESULT uxtheme_gtk_CloseThemeData(HTHEME htheme) ++{ ++ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; ++ ++ TRACE("(%p)\n", htheme); ++ ++ /* Destroy the toplevel widget */ ++ pgtk_widget_destroy(theme->window); ++ HeapFree(GetProcessHeap(), 0, theme); ++ return S_OK; ++} ++ ++HRESULT uxtheme_gtk_EnableThemeDialogTexture(HWND hwnd, DWORD flags) ++{ ++ HTHEME htheme; ++ ++ TRACE("(%p, %u)\n", hwnd, flags); ++ ++ if (libgtk3 == NULL) ++ return E_NOTIMPL; ++ ++ if (flags & ETDT_USETABTEXTURE) ++ { ++ htheme = GetWindowTheme(hwnd); ++ OpenThemeData(hwnd, VSCLASS_TAB); ++ CloseThemeData(htheme); ++ } ++ ++ return S_OK; /* Always enabled */ ++} ++ ++HRESULT uxtheme_gtk_EnableTheming(BOOL enable) ++{ ++ TRACE("(%u)\n", enable); ++ ++ return S_OK; /* Always enabled */ ++} ++ ++HRESULT uxtheme_gtk_GetCurrentThemeName(LPWSTR filename, int filename_maxlen, ++ LPWSTR color, int color_maxlen, ++ LPWSTR size, int size_maxlen) ++{ ++ TRACE("(%p, %d, %p, %d, %p, %d)\n", filename, filename_maxlen, ++ color, color_maxlen, size, size_maxlen); ++ ++ return E_FAIL; /* To prevent calling EnumThemeColors and so on */ ++} ++ ++DWORD uxtheme_gtk_GetThemeAppProperties(void) ++{ ++ TRACE("()\n"); ++ ++ return STAP_ALLOW_CONTROLS; /* Non-client drawing is not supported */ ++} ++ ++BOOL uxtheme_gtk_IsThemeDialogTextureEnabled(HWND hwnd) ++{ ++ TRACE("(%p)\n", hwnd); ++ ++ return TRUE; /* Always enabled */ ++} ++ ++HTHEME uxtheme_gtk_OpenThemeDataEx(HWND hwnd, LPCWSTR classlist, DWORD flags) ++{ ++ WCHAR *start, *tok, buf[CLASSLIST_MAXLEN]; ++ int i; ++ ++ TRACE("(%p, %s, %#x)\n", hwnd, debugstr_w(classlist), flags); ++ ++ lstrcpynW(buf, classlist, CLASSLIST_MAXLEN - 1); ++ buf[CLASSLIST_MAXLEN - 1] = L'\0'; ++ ++ /* search for the first match */ ++ start = buf; ++ for (tok = buf; *tok; tok++) ++ { ++ if (*tok != ';') continue; ++ *tok = 0; ++ ++ for (i = 0; i < sizeof(classes) / sizeof(classes[0]); i++) ++ if (lstrcmpiW(start, classes[i].classname) == 0) goto found; ++ ++ start = tok + 1; ++ } ++ if (start != tok) ++ { ++ for (i = 0; i < sizeof(classes) / sizeof(classes[0]); i++) ++ if (lstrcmpiW(start, classes[i].classname) == 0) goto found; ++ } ++ ++ FIXME("No matching theme for %s.\n", debugstr_w(classlist)); ++ SetLastError(ERROR_NOT_FOUND); ++ return NULL; ++ ++found: ++ TRACE("Using %s for %s.\n", debugstr_w(classes[i].classname), ++ debugstr_w(classlist)); ++ ++ return classes[i].create(); ++} ++ ++void uxtheme_gtk_SetThemeAppProperties(DWORD flags) ++{ ++ TRACE("(%u)\n", flags); ++} ++ ++HRESULT uxtheme_gtk_SetWindowTheme(HWND hwnd, LPCWSTR sub_app_name, LPCWSTR sub_id_list) ++{ ++ FIXME("(%p, %s, %s)\n", hwnd, debugstr_w(sub_app_name), ++ debugstr_w(sub_id_list)); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeBool(HTHEME htheme, int part_id, int state_id, ++ int prop_id, BOOL *value) ++{ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, value); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeColor(HTHEME htheme, int part_id, int state_id, ++ int prop_id, COLORREF *color) ++{ ++ HRESULT hr; ++ GdkRGBA rgba = {0, 0, 0, 0}; ++ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; ++ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, color); ++ ++ if (theme->vtable == NULL) ++ return E_HANDLE; ++ ++ if (theme->vtable->get_color == NULL) ++ return E_NOTIMPL; ++ ++ if (color == NULL) ++ return E_INVALIDARG; ++ ++ hr = theme->vtable->get_color(theme, part_id, state_id, prop_id, &rgba); ++ ++ if (SUCCEEDED(hr) && rgba.alpha > 0) ++ { ++ *color = RGB((int)(0.5 + CLAMP(rgba.red, 0.0, 1.0) * 255.0), ++ (int)(0.5 + CLAMP(rgba.green, 0.0, 1.0) * 255.0), ++ (int)(0.5 + CLAMP(rgba.blue, 0.0, 1.0) * 255.0)); ++ return S_OK; ++ } ++ ++ return E_FAIL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeEnumValue(HTHEME htheme, int part_id, int state_id, ++ int prop_id, int *value) ++{ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, value); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeFilename(HTHEME htheme, int part_id, int state_id, ++ int prop_id, LPWSTR filename, int maxlen) ++{ ++ TRACE("(%p, %d, %d, %d, %p, %d)\n", htheme, part_id, state_id, prop_id, ++ filename, maxlen); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeFont(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ int prop_id, LOGFONTW *font) ++{ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, font); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeInt(HTHEME htheme, int part_id, int state_id, ++ int prop_id, int *value) ++{ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, value); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeIntList(HTHEME htheme, int part_id, int state_id, ++ int prop_id, INTLIST *intlist) ++{ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, intlist); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeMargins(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ int prop_id, LPRECT rect, MARGINS *margins) ++{ ++ TRACE("(%p, %d, %d, %d, %p, %p)\n", htheme, part_id, state_id, prop_id, rect, margins); ++ ++ memset(margins, 0, sizeof(MARGINS)); /* Set all margins to 0 */ ++ ++ return S_OK; ++} ++ ++HRESULT uxtheme_gtk_GetThemeMetric(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ int prop_id, int *value) ++{ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, value); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemePosition(HTHEME htheme, int part_id, int state_id, ++ int prop_id, POINT *point) ++{ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, point); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemePropertyOrigin(HTHEME htheme, int part_id, int state_id, ++ int prop_id, PROPERTYORIGIN *origin) ++{ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, origin); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeRect(HTHEME htheme, int part_id, int state_id, ++ int prop_id, RECT *rect) ++{ ++ TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, rect); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeString(HTHEME htheme, int part_id, int state_id, ++ int prop_id, LPWSTR buffer, int maxlen) ++{ ++ TRACE("(%p, %d, %d, %d, %p, %d)\n", htheme, part_id, state_id, prop_id, buffer, ++ maxlen); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeTransitionDuration(HTHEME htheme, int part_id, int state_id_from, ++ int state_id_to, int prop_id, DWORD *duration) ++{ ++ TRACE("(%p, %d, %d, %d, %d, %p)\n", htheme, part_id, state_id_from, state_id_to, prop_id, ++ duration); ++ ++ return E_NOTIMPL; ++} ++ ++BOOL uxtheme_gtk_GetThemeSysBool(HTHEME htheme, int bool_id) ++{ ++ TRACE("(%p, %d)\n", htheme, bool_id); ++ ++ SetLastError(ERROR_NOT_SUPPORTED); ++ ++ return FALSE; ++} ++ ++COLORREF uxtheme_gtk_GetThemeSysColor(HTHEME htheme, int color_id) ++{ ++ HRESULT hr = S_OK; ++ COLORREF color = 0; ++ ++ static HTHEME window_htheme = NULL; ++ static HTHEME button_htheme = NULL; ++ static HTHEME edit_htheme = NULL; ++ static HTHEME menu_htheme = NULL; ++ ++ TRACE("(%p, %d)\n", htheme, color_id); ++ ++ if (window_htheme == NULL) ++ { ++ window_htheme = OpenThemeData(NULL, VSCLASS_WINDOW); ++ button_htheme = OpenThemeData(NULL, VSCLASS_BUTTON); ++ edit_htheme = OpenThemeData(NULL, VSCLASS_EDIT); ++ menu_htheme = OpenThemeData(NULL, VSCLASS_MENU); ++ } ++ ++ switch (color_id) ++ { ++ case COLOR_BTNFACE: ++ case COLOR_SCROLLBAR: ++ case COLOR_WINDOWFRAME: ++ case COLOR_INACTIVECAPTION: ++ case COLOR_GRADIENTINACTIVECAPTION: ++ case COLOR_3DDKSHADOW: ++ case COLOR_BTNHIGHLIGHT: ++ case COLOR_ACTIVEBORDER: ++ case COLOR_INACTIVEBORDER: ++ case COLOR_APPWORKSPACE: ++ case COLOR_BACKGROUND: ++ case COLOR_ACTIVECAPTION: ++ case COLOR_GRADIENTACTIVECAPTION: ++ case COLOR_ALTERNATEBTNFACE: ++ case COLOR_INFOBK: /* FIXME */ ++ hr = GetThemeColor(window_htheme, WP_DIALOG, 0, TMT_FILLCOLOR, &color); ++ break; ++ ++ case COLOR_3DLIGHT: ++ case COLOR_BTNSHADOW: ++ hr = GetThemeColor(button_htheme, BP_PUSHBUTTON, PBS_NORMAL, TMT_BORDERCOLOR, &color); ++ break; ++ ++ case COLOR_BTNTEXT: ++ case COLOR_INFOTEXT: ++ case COLOR_WINDOWTEXT: ++ case COLOR_CAPTIONTEXT: ++ hr = GetThemeColor(window_htheme, WP_DIALOG, 0, TMT_TEXTCOLOR, &color); ++ break; ++ ++ case COLOR_HIGHLIGHTTEXT: ++ hr = GetThemeColor(edit_htheme, EP_EDITTEXT, ETS_SELECTED, TMT_TEXTCOLOR, &color); ++ break; ++ ++ case COLOR_GRAYTEXT: ++ case COLOR_INACTIVECAPTIONTEXT: ++ hr = GetThemeColor(button_htheme, BP_PUSHBUTTON, PBS_DISABLED, TMT_TEXTCOLOR, &color); ++ break; ++ ++ case COLOR_HIGHLIGHT: ++ case COLOR_MENUHILIGHT: ++ case COLOR_HOTLIGHT: ++ hr = GetThemeColor(edit_htheme, EP_EDITTEXT, ETS_SELECTED, TMT_FILLCOLOR, &color); ++ break; ++ ++ case COLOR_MENUBAR: ++ hr = GetThemeColor(menu_htheme, MENU_BARBACKGROUND, MB_ACTIVE, TMT_FILLCOLOR, &color); ++ break; ++ ++ case COLOR_MENU: ++ hr = GetThemeColor(menu_htheme, MENU_POPUPBACKGROUND, 0, TMT_FILLCOLOR, &color); ++ break; ++ ++ case COLOR_MENUTEXT: ++ hr = GetThemeColor(menu_htheme, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR, &color); ++ break; ++ ++ case COLOR_WINDOW: ++ hr = GetThemeColor(edit_htheme, EP_EDITTEXT, ETS_NORMAL, TMT_FILLCOLOR, &color); ++ break; ++ ++ default: ++ FIXME("Unknown color %d.\n", color_id); ++ return GetSysColor(color_id); ++ } ++ ++ if (FAILED(hr)) ++ return GetSysColor(color_id); ++ ++ return color; ++} ++ ++HRESULT uxtheme_gtk_GetThemeSysFont(HTHEME htheme, int font_id, LOGFONTW *font) ++{ ++ TRACE("(%p, %d, %p)\n", htheme, font_id, font); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeSysInt(HTHEME htheme, int int_id, int *value) ++{ ++ TRACE("(%p, %d, %p)\n", htheme, int_id, value); ++ ++ return E_NOTIMPL; ++} ++ ++int uxtheme_gtk_GetThemeSysSize(HTHEME htheme, int size_id) ++{ ++ TRACE("(%p, %d)\n", htheme, size_id); ++ ++ SetLastError(ERROR_NOT_SUPPORTED); ++ ++ return -1; ++} ++ ++HRESULT uxtheme_gtk_GetThemeSysString(HTHEME htheme, int string_id, LPWSTR buffer, int maxlen) ++{ ++ TRACE("(%p, %d, %p, %d)\n", htheme, string_id, buffer, maxlen); ++ ++ return E_NOTIMPL; ++} ++ ++static void paint_cairo_surface(cairo_surface_t *surface, HDC target_hdc, ++ int x, int y, int width, int height) ++{ ++ unsigned char *bitmap_data, *surface_data; ++ int i, dib_stride, cairo_stride; ++ HDC bitmap_hdc; ++ HBITMAP bitmap; ++ BITMAPINFO info; ++ BLENDFUNCTION bf; ++ ++ info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); ++ info.bmiHeader.biWidth = width; ++ info.bmiHeader.biHeight = -height; /* top-down, see MSDN */ ++ info.bmiHeader.biPlanes = 1; ++ info.bmiHeader.biBitCount = 32; ++ info.bmiHeader.biCompression = BI_RGB; /* no compression */ ++ info.bmiHeader.biSizeImage = 0; ++ info.bmiHeader.biXPelsPerMeter = 1; ++ info.bmiHeader.biYPelsPerMeter = 1; ++ info.bmiHeader.biClrUsed = 0; ++ info.bmiHeader.biClrImportant = 0; ++ ++ bf.BlendOp = AC_SRC_OVER; ++ bf.BlendFlags = 0; ++ bf.SourceConstantAlpha = 0xff; ++ bf.AlphaFormat = AC_SRC_ALPHA; ++ ++ bitmap_hdc = CreateCompatibleDC(target_hdc); ++ bitmap = CreateDIBSection(bitmap_hdc, &info, DIB_RGB_COLORS, ++ (void **)&bitmap_data, NULL, 0); ++ ++ pcairo_surface_flush(surface); ++ ++ surface_data = pcairo_image_surface_get_data(surface); ++ cairo_stride = pcairo_image_surface_get_stride(surface); ++ dib_stride = width * 4; ++ ++ for (i = 0; i < height; i++) ++ memcpy(bitmap_data + i * dib_stride, surface_data + i * cairo_stride, width * 4); ++ ++ SelectObject(bitmap_hdc, bitmap); ++ ++ GdiAlphaBlend(target_hdc, x, y, width, height, ++ bitmap_hdc, 0, 0, width, height, bf); ++ ++ DeleteObject(bitmap); ++ DeleteDC(bitmap_hdc); ++} ++ ++HRESULT uxtheme_gtk_DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ LPCRECT rect, const DTBGOPTS *options) ++{ ++ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; ++ cairo_surface_t *surface; ++ int width, height; ++ cairo_t *cr; ++ HRESULT hr; ++ ++ TRACE("(%p, %p, %d, %d, %p, %p)\n", htheme, hdc, part_id, state_id, rect, options); ++ ++ if (theme->vtable == NULL) ++ return E_HANDLE; ++ ++ if (theme->vtable->draw_background == NULL) ++ return E_NOTIMPL; ++ ++ width = rect->right - rect->left; ++ height = rect->bottom - rect->top; ++ ++ surface = pcairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); ++ cr = pcairo_create(surface); ++ ++ hr = theme->vtable->draw_background(theme, cr, part_id, state_id, width, height); ++ if (SUCCEEDED(hr)) ++ paint_cairo_surface(surface, hdc, rect->left, rect->top, width, height); ++ ++ pcairo_destroy(cr); ++ pcairo_surface_destroy(surface); ++ return hr; ++} ++ ++HRESULT uxtheme_gtk_DrawThemeTextEx(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ LPCWSTR text, int length, DWORD flags, RECT *rect, ++ const DTTOPTS *options) ++{ ++ RECT rt; ++ HRESULT hr; ++ COLORREF color = RGB(0, 0, 0), oldcolor; ++ ++ TRACE("(%p, %p, %d, %d, %s, %#x, %s, %p)\n", htheme, hdc, part_id, state_id, ++ wine_dbgstr_wn(text, length), flags, wine_dbgstr_rect(rect), options); ++ ++ hr = GetThemeColor(htheme, part_id, state_id, TMT_TEXTCOLOR, &color); ++ if (FAILED(hr)) ++ { ++ FIXME("No color.\n"); ++ /*return hr;*/ ++ } ++ ++ oldcolor = SetTextColor(hdc, color); ++ ++ CopyRect(&rt, rect); ++ ++ SetBkMode(hdc, TRANSPARENT); ++ DrawTextW(hdc, text, length, &rt, flags); ++ ++ SetTextColor(hdc, oldcolor); ++ ++ return S_OK; ++} ++ ++HRESULT uxtheme_gtk_GetThemeBackgroundRegion(HTHEME htheme, HDC hdc, int part_id, ++ int state_id, LPCRECT rect, HRGN *region) ++{ ++ TRACE("(%p, %p, %d, %d, %p, %p)\n", htheme, hdc, part_id, state_id, rect, region); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ RECT *rect, THEMESIZE type, SIZE *size) ++{ ++ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; ++ ++ TRACE("(%p, %p, %d, %d, %p, %d, %p)\n", htheme, hdc, part_id, state_id, rect, type, size); ++ ++ if (theme->vtable == NULL) ++ return E_HANDLE; ++ ++ if (theme->vtable->get_part_size == NULL) ++ return E_NOTIMPL; ++ ++ if (rect == NULL || size == NULL) ++ return E_INVALIDARG; ++ ++ return theme->vtable->get_part_size(theme, part_id, state_id, rect, size); ++} ++ ++HRESULT uxtheme_gtk_GetThemeTextExtent(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ LPCWSTR text, int length, DWORD flags, ++ LPCRECT bounding_rect, LPRECT extent_rect) ++{ ++ TRACE("(%p, %p, %d, %d, %s, %u, %p, %p)\n", htheme, hdc, part_id, state_id, ++ wine_dbgstr_wn(text, length), flags, bounding_rect, extent_rect); ++ ++ return E_NOTIMPL; ++} ++ ++HRESULT uxtheme_gtk_GetThemeTextMetrics(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ TEXTMETRICW *metric) ++{ ++ TRACE("(%p, %p, %d, %d, %p)\n", htheme, hdc, part_id, state_id, metric); ++ ++ if (!GetTextMetricsW(hdc, metric)) ++ return HRESULT_FROM_WIN32(GetLastError()); ++ ++ return S_OK; ++} ++ ++BOOL uxtheme_gtk_IsThemeBackgroundPartiallyTransparent(HTHEME htheme, int part_id, int state_id) ++{ ++ TRACE("(%p, %d, %d)\n", htheme, part_id, state_id); ++ ++ return TRUE; /* The most widgets are partially transparent */ ++} ++ ++BOOL uxtheme_gtk_IsThemePartDefined(HTHEME htheme, int part_id, int state_id) ++{ ++ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; ++ ++ TRACE("(%p, %d, %d)\n", htheme, part_id, state_id); ++ ++ if (theme->vtable == NULL) ++ { ++ SetLastError(ERROR_INVALID_HANDLE); ++ return FALSE; ++ } ++ ++ if (theme->vtable->is_part_defined == NULL) ++ { ++ SetLastError(ERROR_NOT_SUPPORTED); ++ return FALSE; ++ } ++ ++ return theme->vtable->is_part_defined(part_id, state_id); ++} ++ ++#else ++ ++BOOL uxtheme_gtk_enabled(void) ++{ ++ return FALSE; ++} ++ ++HRESULT uxtheme_gtk_CloseThemeData(HTHEME theme) { return 0 }; ++HRESULT uxtheme_gtk_EnableThemeDialogTexture(HWND hwnd, DWORD flags) { return 0 }; ++HRESULT uxtheme_gtk_EnableTheming(BOOL enable) { return 0 }; ++HRESULT uxtheme_gtk_GetCurrentThemeName(LPWSTR filename, int filename_maxlen, ++ LPWSTR color, int color_maxlen, ++ LPWSTR size, int size_maxlen) { return 0 }; ++DWORD uxtheme_gtk_GetThemeAppProperties(void) { return 0 }; ++BOOL uxtheme_gtk_IsThemeDialogTextureEnabled(HWND hwnd) { return 0 }; ++HTHEME uxtheme_gtk_OpenThemeDataEx(HWND hwnd, LPCWSTR classlist, DWORD flags) { return 0 }; ++void uxtheme_gtk_SetThemeAppProperties(DWORD flags) { }; ++HRESULT uxtheme_gtk_SetWindowTheme(HWND hwnd, LPCWSTR sub_app_name, LPCWSTR sub_id_list) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeBool(HTHEME htheme, int part_id, int state_id, ++ int prop_id, BOOL *value) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeColor(HTHEME htheme, int part_id, int state_id, ++ int prop_id, COLORREF *color) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeEnumValue(HTHEME htheme, int part_id, int state_id, ++ int prop_id, int *value) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeFilename(HTHEME htheme, int part_id, int state_id, ++ int prop_id, LPWSTR filename, int maxlen) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeFont(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ int prop_id, LOGFONTW *font) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeInt(HTHEME htheme, int part_id, int state_id, ++ int prop_id, int *value) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeIntList(HTHEME htheme, int part_id, int state_id, ++ int prop_id, INTLIST *intlist) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeMargins(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ int prop_id, LPRECT rect, MARGINS *margins) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeMetric(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ int prop_id, int *value) { return 0 }; ++HRESULT uxtheme_gtk_GetThemePosition(HTHEME htheme, int part_id, int state_id, ++ int prop_id, POINT *point) { return 0 }; ++HRESULT uxtheme_gtk_GetThemePropertyOrigin(HTHEME htheme, int part_id, int state_id, ++ int prop_id, PROPERTYORIGIN *origin) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeRect(HTHEME htheme, int part_id, int state_id, ++ int prop_id, RECT *rect) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeString(HTHEME htheme, int part_id, int state_id, ++ int prop_id, LPWSTR buffer, int maxlen) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeTransitionDuration(HTHEME htheme, int part_id, int state_id_from, ++ int state_id_to, int prop_id, DWORD *duration) { return 0 }; ++BOOL uxtheme_gtk_GetThemeSysBool(HTHEME htheme, int bool_id) { return 0 }; ++COLORREF uxtheme_gtk_GetThemeSysColor(HTHEME htheme, int color_id) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeSysFont(HTHEME htheme, int font_id, LOGFONTW *font) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeSysInt(HTHEME htheme, int int_id, int *value) { return 0 }; ++int uxtheme_gtk_GetThemeSysSize(HTHEME htheme, int size_id) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeSysString(HTHEME htheme, int string_id, LPWSTR buffer, int maxlen) { return 0 }; ++HRESULT uxtheme_gtk_DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ LPCRECT rect, const DTBGOPTS *options) { return 0 }; ++HRESULT uxtheme_gtk_DrawThemeTextEx(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ LPCWSTR text, int length, DWORD flags, RECT *rect, ++ const DTTOPTS *options) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeBackgroundRegion(HTHEME htheme, HDC hdc, int part_id, ++ int state_id, LPCRECT rect, HRGN *region) { return 0 }; ++HRESULT uxtheme_gtk_GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ RECT *rect, THEMESIZE type, SIZE *size) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeTextExtent(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ LPCWSTR text, int length, DWORD flags, ++ LPCRECT bounding_rect, LPRECT extent_rect) { return 0 }; ++HRESULT uxtheme_gtk_GetThemeTextMetrics(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ TEXTMETRICW *metric) { return 0 }; ++BOOL uxtheme_gtk_IsThemeBackgroundPartiallyTransparent(HTHEME htheme, int part_id, int state_id) { return 0 }; ++BOOL uxtheme_gtk_IsThemePartDefined(HTHEME htheme, int part_id, int state_id) { return 0 }; ++ ++#endif /* HAVE_GTK_GTK_H */ +diff --git a/dlls/uxtheme/metric.c b/dlls/uxtheme/metric.c +index 073422f1..244187d1 100644 +--- a/dlls/uxtheme/metric.c ++++ b/dlls/uxtheme/metric.c +@@ -31,6 +31,7 @@ + #include "tmschema.h" + + #include "msstyles.h" ++#include "uxthemedll.h" + + #include "wine/debug.h" + +@@ -46,6 +47,10 @@ BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID) + BOOL ret; + + TRACE("(%p, %d)\n", hTheme, iBoolID); ++ ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeSysBool(hTheme, iBoolID); ++ + SetLastError(0); + if(hTheme) { + if((tp = MSSTYLES_FindMetric(TMT_BOOL, iBoolID))) { +@@ -76,6 +81,10 @@ COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID) + PTHEME_PROPERTY tp; + + TRACE("(%p, %d)\n", hTheme, iColorID); ++ ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeSysColor(hTheme, iColorID); ++ + SetLastError(0); + if(hTheme) { + if((tp = MSSTYLES_FindMetric(TMT_COLOR, iColorID))) { +@@ -108,6 +117,10 @@ HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf) + PTHEME_PROPERTY tp; + + TRACE("(%p, %d)\n", hTheme, iFontID); ++ ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeSysFont(hTheme, iFontID, plf); ++ + if(hTheme) { + if((tp = MSSTYLES_FindMetric(TMT_FONT, iFontID))) { + HDC hdc = GetDC(NULL); +@@ -151,6 +164,10 @@ HRESULT WINAPI GetThemeSysInt(HTHEME hTheme, int iIntID, int *piValue) + TRACE("(%p, %d)\n", hTheme, iIntID); + if(!hTheme) + return E_HANDLE; ++ ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeSysInt(hTheme, iIntID, piValue); ++ + if(iIntID < TMT_FIRSTINT || iIntID > TMT_LASTINT) { + WARN("Unknown IntID: %d\n", iIntID); + return STG_E_INVALIDPARAMETER; +@@ -180,6 +197,9 @@ int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID) + PTHEME_PROPERTY tp; + int i, id = -1; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeSysSize(hTheme, iSizeID); ++ + if(hTheme) { + for(i=0; i TMT_LASTSTRING) { + WARN("Unknown StringID: %d\n", iStringID); + return STG_E_INVALIDPARAMETER; +diff --git a/dlls/uxtheme/property.c b/dlls/uxtheme/property.c +index 0e077aee..ada48287 100644 +--- a/dlls/uxtheme/property.c ++++ b/dlls/uxtheme/property.c +@@ -31,6 +31,7 @@ + #include "tmschema.h" + + #include "msstyles.h" ++#include "uxthemedll.h" + + #include "wine/debug.h" + +@@ -48,6 +49,9 @@ HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeBool(hTheme, iPartId, iStateId, iPropId, pfVal); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_BOOL, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyBool(tp, pfVal); +@@ -65,6 +69,9 @@ HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeColor(hTheme, iPartId, iStateId, iPropId, pColor); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_COLOR, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyColor(tp, pColor); +@@ -84,6 +91,9 @@ HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeEnumValue(hTheme, iPartId, iStateId, iPropId, piVal); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_ENUM, iPropId))) + return E_PROP_ID_UNSUPPORTED; + +@@ -108,6 +118,9 @@ HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeFilename(hTheme, iPartId, iStateId, iPropId, pszThemeFilename, cchMaxBuffChars); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyString(tp, pszThemeFilename, cchMaxBuffChars); +@@ -125,6 +138,9 @@ HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeFont(hTheme, hdc, iPartId, iStateId, iPropId, pFont); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyFont(tp, hdc, pFont); +@@ -142,6 +158,9 @@ HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeInt(hTheme, iPartId, iStateId, iPropId, piVal); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INT, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyInt(tp, piVal); +@@ -159,6 +178,9 @@ HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeIntList(hTheme, iPartId, iStateId, iPropId, pIntList); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyIntList(tp, pIntList); +@@ -176,6 +198,9 @@ HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemePosition(hTheme, iPartId, iStateId, iPropId, pPoint); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_POSITION, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyPosition(tp, pPoint); +@@ -193,6 +218,9 @@ HRESULT WINAPI GetThemeRect(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeRect(hTheme, iPartId, iStateId, iPropId, pRect); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_RECT, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyRect(tp, pRect); +@@ -210,6 +238,9 @@ HRESULT WINAPI GetThemeString(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeString(hTheme, iPartId, iStateId, iPropId, pszBuff, cchMaxBuffChars); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_STRING, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyString(tp, pszBuff, cchMaxBuffChars); +@@ -229,6 +260,9 @@ HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeMargins(hTheme, hdc, iPartId, iStateId, iPropId, prc, pMargins); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_MARGINS, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyMargins(tp, prc, pMargins); +@@ -248,6 +282,9 @@ HRESULT WINAPI GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeMetric(hTheme, hdc, iPartId, iStateId, iPropId, piVal); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) + return E_PROP_ID_UNSUPPORTED; + switch(tp->iPrimitiveType) { +@@ -288,6 +325,9 @@ HRESULT WINAPI GetThemePropertyOrigin(HTHEME hTheme, int iPartId, int iStateId, + if(!hTheme) + return E_HANDLE; + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemePropertyOrigin(hTheme, iPartId, iStateId, iPropId, pOrigin); ++ + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) { + *pOrigin = PO_NOTFOUND; + return S_OK; +diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c +index c898ad32..2f7d40fc 100644 +--- a/dlls/uxtheme/system.c ++++ b/dlls/uxtheme/system.c +@@ -558,6 +558,10 @@ BOOL WINAPI IsAppThemed(void) + BOOL WINAPI IsThemeActive(void) + { + TRACE("\n"); ++ ++ if (uxtheme_gtk_enabled()) ++ return TRUE; ++ + SetLastError(ERROR_SUCCESS); + return bThemeActive; + } +@@ -587,6 +591,9 @@ HRESULT WINAPI EnableTheming(BOOL fEnable) + + TRACE("(%d)\n", fEnable); + ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_EnableTheming(fEnable); ++ + if(fEnable != bThemeActive) { + if(fEnable) + UXTHEME_BackupSystemMetrics(); +@@ -659,7 +666,9 @@ HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags) + if(flags) + FIXME("unhandled flags: %x\n", flags); + +- if(bThemeActive) ++ if (uxtheme_gtk_enabled()) ++ hTheme = uxtheme_gtk_OpenThemeDataEx(hwnd, pszClassList, flags); ++ else if (bThemeActive) + { + pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, ARRAY_SIZE(szAppBuff)); + /* If SetWindowTheme was used on the window, that overrides the class list passed to this function */ +@@ -670,6 +679,7 @@ HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags) + if (pszUseClassList) + hTheme = MSSTYLES_OpenThemeClass(pszAppName, pszUseClassList); + } ++ + if(IsWindow(hwnd)) + SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atWindowTheme), hTheme); + TRACE(" = %p\n", hTheme); +@@ -712,6 +722,10 @@ HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName, + HRESULT hr; + TRACE("(%p,%s,%s)\n", hwnd, debugstr_w(pszSubAppName), + debugstr_w(pszSubIdList)); ++ ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_SetWindowTheme(hwnd, pszSubAppName, pszSubIdList); ++ + hr = UXTHEME_SetWindowProperty(hwnd, atSubAppName, pszSubAppName); + if(SUCCEEDED(hr)) + hr = UXTHEME_SetWindowProperty(hwnd, atSubIdList, pszSubIdList); +@@ -737,6 +751,10 @@ HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars, + LPWSTR pszColorBuff, int cchMaxColorChars, + LPWSTR pszSizeBuff, int cchMaxSizeChars) + { ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetCurrentThemeName(pszThemeFileName, dwMaxNameChars, ++ pszColorBuff, cchMaxColorChars, pszSizeBuff, cchMaxSizeChars); ++ + if(!bThemeActive) + return E_PROP_ID_UNSUPPORTED; + if(pszThemeFileName) lstrcpynW(pszThemeFileName, szCurrentTheme, dwMaxNameChars); +@@ -750,6 +768,8 @@ HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars, + */ + DWORD WINAPI GetThemeAppProperties(void) + { ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_GetThemeAppProperties(); + return dwThemeAppProperties; + } + +@@ -759,6 +779,10 @@ DWORD WINAPI GetThemeAppProperties(void) + void WINAPI SetThemeAppProperties(DWORD dwFlags) + { + TRACE("(0x%08x)\n", dwFlags); ++ ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_SetThemeAppProperties(dwFlags); ++ + dwThemeAppProperties = dwFlags; + } + +@@ -770,6 +794,10 @@ HRESULT WINAPI CloseThemeData(HTHEME hTheme) + TRACE("(%p)\n", hTheme); + if(!hTheme || hTheme == INVALID_HANDLE_VALUE) + return E_HANDLE; ++ ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_CloseThemeData(hTheme); ++ + return MSSTYLES_CloseThemeClass(hTheme); + } + +@@ -797,6 +825,10 @@ BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId) + SetLastError(E_HANDLE); + return FALSE; + } ++ ++ if (uxtheme_gtk_enabled()) ++ return uxtheme_gtk_IsThemePartDefined(hTheme, iPartId, iStateId); ++ + if(MSSTYLES_FindPartState(hTheme, iPartId, iStateId, NULL)) + return TRUE; + return FALSE; +diff --git a/dlls/uxtheme/uxthemedll.h b/dlls/uxtheme/uxthemedll.h +index fee152c9..cdc5958d 100644 +--- a/dlls/uxtheme/uxthemedll.h ++++ b/dlls/uxtheme/uxthemedll.h +@@ -21,6 +21,14 @@ + #ifndef __WINE_UXTHEMEDLL_H + #define __WINE_UXTHEMEDLL_H + ++#include "windef.h" ++#include "winbase.h" ++#include "wingdi.h" ++#include "winuser.h" ++#include "winerror.h" ++#include "winreg.h" ++#include "uxtheme.h" ++ + typedef HANDLE HTHEMEFILE; + + /********************************************************************** +@@ -96,6 +104,70 @@ HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown, + + extern void UXTHEME_InitSystem(HINSTANCE hInst) DECLSPEC_HIDDEN; + ++BOOL uxtheme_gtk_enabled(void) DECLSPEC_HIDDEN; ++ ++HRESULT uxtheme_gtk_CloseThemeData(HTHEME theme) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_EnableThemeDialogTexture(HWND hwnd, DWORD flags) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_EnableTheming(BOOL enable) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetCurrentThemeName(LPWSTR filename, int filename_maxlen, ++ LPWSTR color, int color_maxlen, ++ LPWSTR size, int size_maxlen) DECLSPEC_HIDDEN; ++DWORD uxtheme_gtk_GetThemeAppProperties(void) DECLSPEC_HIDDEN; ++BOOL uxtheme_gtk_IsThemeDialogTextureEnabled(HWND hwnd) DECLSPEC_HIDDEN; ++HTHEME uxtheme_gtk_OpenThemeDataEx(HWND hwnd, LPCWSTR classlist, DWORD flags) DECLSPEC_HIDDEN; ++void uxtheme_gtk_SetThemeAppProperties(DWORD flags) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_SetWindowTheme(HWND hwnd, LPCWSTR sub_app_name, LPCWSTR sub_id_list) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeBool(HTHEME htheme, int part_id, int state_id, ++ int prop_id, BOOL *value) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeColor(HTHEME htheme, int part_id, int state_id, ++ int prop_id, COLORREF *color) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeEnumValue(HTHEME htheme, int part_id, int state_id, ++ int prop_id, int *value) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeFilename(HTHEME htheme, int part_id, int state_id, ++ int prop_id, LPWSTR filename, int maxlen) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeFont(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ int prop_id, LOGFONTW *font) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeInt(HTHEME htheme, int part_id, int state_id, ++ int prop_id, int *value) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeIntList(HTHEME htheme, int part_id, int state_id, ++ int prop_id, INTLIST *intlist) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeMargins(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ int prop_id, LPRECT rect, MARGINS *margins) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeMetric(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ int prop_id, int *value) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemePosition(HTHEME htheme, int part_id, int state_id, ++ int prop_id, POINT *point) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemePropertyOrigin(HTHEME htheme, int part_id, int state_id, ++ int prop_id, PROPERTYORIGIN *origin) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeRect(HTHEME htheme, int part_id, int state_id, ++ int prop_id, RECT *rect) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeString(HTHEME htheme, int part_id, int state_id, ++ int prop_id, LPWSTR buffer, int maxlen) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeTransitionDuration(HTHEME htheme, int part_id, int state_id_from, ++ int state_id_to, int prop_id, DWORD *duration) DECLSPEC_HIDDEN; ++BOOL uxtheme_gtk_GetThemeSysBool(HTHEME htheme, int bool_id) DECLSPEC_HIDDEN; ++COLORREF uxtheme_gtk_GetThemeSysColor(HTHEME htheme, int color_id) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeSysFont(HTHEME htheme, int font_id, LOGFONTW *font) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeSysInt(HTHEME htheme, int int_id, int *value) DECLSPEC_HIDDEN; ++int uxtheme_gtk_GetThemeSysSize(HTHEME htheme, int size_id) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeSysString(HTHEME htheme, int string_id, LPWSTR buffer, int maxlen) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ LPCRECT rect, const DTBGOPTS *options) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_DrawThemeTextEx(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ LPCWSTR text, int length, DWORD flags, RECT *rect, ++ const DTTOPTS *options) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeBackgroundRegion(HTHEME htheme, HDC hdc, int part_id, ++ int state_id, LPCRECT rect, HRGN *region) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ RECT *rect, THEMESIZE type, SIZE *size) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeTextExtent(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ LPCWSTR text, int length, DWORD flags, ++ LPCRECT bounding_rect, LPRECT extent_rect) DECLSPEC_HIDDEN; ++HRESULT uxtheme_gtk_GetThemeTextMetrics(HTHEME htheme, HDC hdc, int part_id, int state_id, ++ TEXTMETRICW *metric) DECLSPEC_HIDDEN; ++BOOL uxtheme_gtk_IsThemeBackgroundPartiallyTransparent(HTHEME htheme, int part_id, int state_id) DECLSPEC_HIDDEN; ++BOOL uxtheme_gtk_IsThemePartDefined(HTHEME htheme, int part_id, int state_id) DECLSPEC_HIDDEN; ++ + /* No alpha blending */ + #define ALPHABLEND_NONE 0 + /* "Cheap" binary alpha blending - but possibly faster */ +diff --git a/dlls/uxtheme/uxthemegtk.h b/dlls/uxtheme/uxthemegtk.h +new file mode 100644 +index 00000000..87cd0456 +--- /dev/null ++++ b/dlls/uxtheme/uxthemegtk.h +@@ -0,0 +1,129 @@ ++/* ++ * GTK uxtheme implementation ++ * ++ * Copyright (C) 2015 Ivan Akulinchev ++ * Copyright (C) 2015 Michael Müller ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++ ++#ifndef UXTHEMEGTK_H ++#define UXTHEMEGTK_H ++ ++#include "windef.h" ++ ++#define GDK_DISABLE_DEPRECATION_WARNINGS ++#include ++ ++typedef struct _uxgtk_theme uxgtk_theme_t; ++typedef struct _uxgtk_theme_vtable uxgtk_theme_vtable_t; ++ ++struct _uxgtk_theme_vtable ++{ ++ HRESULT (*get_color)(uxgtk_theme_t *theme, int part_id, int state_id, ++ int prop_id, GdkRGBA *rgba); ++ HRESULT (*draw_background)(uxgtk_theme_t *theme, cairo_t *cr, int part_id, int state_id, ++ int width, int height); ++ HRESULT (*get_part_size)(uxgtk_theme_t *theme, int part_id, int state_id, ++ RECT *rect, SIZE *size); ++ BOOL (*is_part_defined)(int part_id, int state_id); ++}; ++ ++struct _uxgtk_theme ++{ ++ const uxgtk_theme_vtable_t *vtable; ++ ++ GtkWidget *window; ++ GtkWidget *layout; ++}; ++ ++#define MAKE_FUNCPTR(f) extern typeof(f) * p##f DECLSPEC_HIDDEN ++MAKE_FUNCPTR(cairo_create); ++MAKE_FUNCPTR(cairo_destroy); ++MAKE_FUNCPTR(cairo_image_surface_create); ++MAKE_FUNCPTR(cairo_image_surface_get_data); ++MAKE_FUNCPTR(cairo_image_surface_get_stride); ++MAKE_FUNCPTR(cairo_surface_destroy); ++MAKE_FUNCPTR(cairo_surface_flush); ++MAKE_FUNCPTR(g_type_check_instance_is_a); ++MAKE_FUNCPTR(gtk_bin_get_child); ++MAKE_FUNCPTR(gtk_button_new); ++MAKE_FUNCPTR(gtk_check_button_new); ++MAKE_FUNCPTR(gtk_combo_box_new_with_entry); ++MAKE_FUNCPTR(gtk_container_add); ++MAKE_FUNCPTR(gtk_container_forall); ++MAKE_FUNCPTR(gtk_entry_new); ++MAKE_FUNCPTR(gtk_fixed_new); ++MAKE_FUNCPTR(gtk_frame_new); ++MAKE_FUNCPTR(gtk_init); ++MAKE_FUNCPTR(gtk_label_new); ++MAKE_FUNCPTR(gtk_menu_bar_new); ++MAKE_FUNCPTR(gtk_menu_item_new); ++MAKE_FUNCPTR(gtk_menu_item_set_submenu); ++MAKE_FUNCPTR(gtk_menu_new); ++MAKE_FUNCPTR(gtk_menu_shell_append); ++MAKE_FUNCPTR(gtk_notebook_new); ++MAKE_FUNCPTR(gtk_radio_button_new); ++MAKE_FUNCPTR(gtk_render_arrow); ++MAKE_FUNCPTR(gtk_render_background); ++MAKE_FUNCPTR(gtk_render_check); ++MAKE_FUNCPTR(gtk_render_frame); ++MAKE_FUNCPTR(gtk_render_handle); ++MAKE_FUNCPTR(gtk_render_line); ++MAKE_FUNCPTR(gtk_render_option); ++MAKE_FUNCPTR(gtk_render_slider); ++MAKE_FUNCPTR(gtk_scale_new); ++MAKE_FUNCPTR(gtk_scrolled_window_new); ++MAKE_FUNCPTR(gtk_separator_tool_item_new); ++MAKE_FUNCPTR(gtk_style_context_add_class); ++MAKE_FUNCPTR(gtk_style_context_add_region); ++MAKE_FUNCPTR(gtk_style_context_get_background_color); ++MAKE_FUNCPTR(gtk_style_context_get_border_color); ++MAKE_FUNCPTR(gtk_style_context_get_color); ++MAKE_FUNCPTR(gtk_style_context_remove_class); ++MAKE_FUNCPTR(gtk_style_context_restore); ++MAKE_FUNCPTR(gtk_style_context_save); ++MAKE_FUNCPTR(gtk_style_context_set_junction_sides); ++MAKE_FUNCPTR(gtk_style_context_set_state); ++MAKE_FUNCPTR(gtk_toggle_button_get_type); ++MAKE_FUNCPTR(gtk_toolbar_new); ++MAKE_FUNCPTR(gtk_tree_view_append_column); ++MAKE_FUNCPTR(gtk_tree_view_column_get_button); ++MAKE_FUNCPTR(gtk_tree_view_column_new); ++MAKE_FUNCPTR(gtk_tree_view_get_column); ++MAKE_FUNCPTR(gtk_tree_view_new); ++MAKE_FUNCPTR(gtk_widget_destroy); ++MAKE_FUNCPTR(gtk_widget_get_style_context); ++MAKE_FUNCPTR(gtk_widget_style_get); ++MAKE_FUNCPTR(gtk_window_new); ++#undef MAKE_FUNCPTR ++ ++uxgtk_theme_t *uxgtk_button_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_combobox_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_edit_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_header_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_listbox_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_listview_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_menu_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_rebar_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_status_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_tab_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_toolbar_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_trackbar_theme_create(void) DECLSPEC_HIDDEN; ++uxgtk_theme_t *uxgtk_window_theme_create(void) DECLSPEC_HIDDEN; ++ ++void uxgtk_theme_init(uxgtk_theme_t *theme, const uxgtk_theme_vtable_t *vtable) DECLSPEC_HIDDEN; ++ ++#endif /* UXTHEMEGTK_H */ -- -2.5.0 +2.20.1 diff --git a/patches/uxtheme-GTK_Theming/0001-uxthemegtk-Add-configure-check-and-stub-dll.patch b/patches/uxtheme-GTK_Theming/0001-uxthemegtk-Add-configure-check-and-stub-dll.patch deleted file mode 100644 index 56c85dd7..00000000 --- a/patches/uxtheme-GTK_Theming/0001-uxthemegtk-Add-configure-check-and-stub-dll.patch +++ /dev/null @@ -1,467 +0,0 @@ -From 198cd3cdddaa7ad98d897444877becfe7a591910 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 9 Aug 2015 02:38:18 +0200 -Subject: [PATCH] uxthemegtk: Add configure check and stub dll. - -List of functions updated by Ivan Akulinchev . ---- - aclocal.m4 | 20 ++++ - configure.ac | 22 ++++ - dlls/uxtheme-gtk/Makefile.in | 7 ++ - dlls/uxtheme-gtk/uxtheme-gtk.spec | 1 + - dlls/uxtheme-gtk/uxtheme.c | 218 ++++++++++++++++++++++++++++++++++++++ - dlls/uxtheme-gtk/uxthemegtk.h | 88 +++++++++++++++ - dlls/uxtheme-gtk/version.rc | 21 ++++ - 7 files changed, 377 insertions(+) - create mode 100644 dlls/uxtheme-gtk/Makefile.in - create mode 100644 dlls/uxtheme-gtk/uxtheme-gtk.spec - create mode 100644 dlls/uxtheme-gtk/uxtheme.c - create mode 100644 dlls/uxtheme-gtk/uxthemegtk.h - create mode 100644 dlls/uxtheme-gtk/version.rc - -diff --git a/aclocal.m4 b/aclocal.m4 -index 6ad8363..54e2ccd 100644 ---- a/aclocal.m4 -+++ b/aclocal.m4 -@@ -125,6 +125,26 @@ test -z "$ac_libs" || ac_libs=`echo " $ac_libs" | sed 's/ -L\([[^/]]\)/ -L\$(top - AS_VAR_POPDEF([ac_libs])dnl - AS_VAR_POPDEF([ac_cflags])])dnl - -+dnl **** Get include path from pkg-config **** -+dnl -+dnl Usage: WINE_PACKAGE_INCLUDE_FLAGS(var,pkg-name,[cflags-alternate,[checks]]]) -+dnl -+AC_DEFUN([WINE_PACKAGE_INCLUDE_FLAGS], -+[AC_REQUIRE([WINE_PATH_PKG_CONFIG])dnl -+AS_VAR_PUSHDEF([ac_cflags],[[$1]_CFLAGS])dnl -+AC_ARG_VAR(ac_cflags, [C compiler flags for $2, overriding pkg-config])dnl -+AS_VAR_IF([ac_cflags],[], -+ [AS_VAR_SET_IF([PKG_CONFIG], -+ [ac_cflags=`$PKG_CONFIG --cflags-only-I [$2] 2>/dev/null`])]) -+m4_ifval([$3],[test "$cross_compiling" = yes || ac_cflags=[$]{ac_cflags:-[$3]}]) -+AS_ECHO(["$as_me:${as_lineno-$LINENO}: $2 cflags: $ac_cflags"]) >&AS_MESSAGE_LOG_FD -+ac_save_CPPFLAGS=$CPPFLAGS -+CPPFLAGS="$CPPFLAGS $ac_cflags" -+$4 -+CPPFLAGS=$ac_save_CPPFLAGS -+test -z "$ac_cflags" || ac_cflags=`echo " $ac_cflags" | sed 's/ -I\([[^/]]\)/ -I\$(top_builddir)\/\1/g'` -+AS_VAR_POPDEF([ac_cflags])])dnl -+ - dnl **** Link C code with an assembly file **** - dnl - dnl Usage: WINE_TRY_ASM_LINK(asm-code,includes,function,[action-if-found,[action-if-not-found]]) -diff --git a/configure.ac b/configure.ac -index 40f96df..a45d5b8 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -56,6 +56,7 @@ AC_ARG_WITH(gsm, AS_HELP_STRING([--without-gsm],[do not use libgsm (GSM 06 - [if test "x$withval" = "xno"; then ac_cv_header_gsm_h=no; ac_cv_header_gsm_gsm_h=no; fi]) - AC_ARG_WITH(gssapi, AS_HELP_STRING([--without-gssapi],[do not use GSSAPI (Kerberos SSP support)])) - AC_ARG_WITH(gstreamer, AS_HELP_STRING([--without-gstreamer],[do not use GStreamer (codecs support)])) -+AC_ARG_WITH(gtk3, AS_HELP_STRING([--without-gtk3],[do not use gtk3 (gtk3 theming support)])) - AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic device support)])) - AC_ARG_WITH(jpeg, AS_HELP_STRING([--without-jpeg],[do not use JPEG])) - AC_ARG_WITH(krb5, AS_HELP_STRING([--without-krb5],[do not use krb5 (Kerberos)])) -@@ -1491,6 +1492,26 @@ fi - WINE_NOTICE_WITH(cms,[test "$ac_cv_lib_lcms2_cmsOpenProfileFromFile" != "yes"], - [liblcms2 ${notice_platform}development files not found, Color Management won't be supported.]) - -+dnl **** Check for GTK3 **** -+if test "x$with_gtk3" != "xno"; -+then -+ WINE_PACKAGE_INCLUDE_FLAGS(GTK3, [gtk+-3.0],, -+ [AC_CHECK_HEADERS([gtk/gtk.h]) -+ if test "$ac_cv_header_gtk_gtk_h" = "yes" -+ then -+ WINE_CHECK_SONAME(gobject-2.0,g_object_unref, -+ [WINE_CHECK_SONAME(cairo,cairo_destroy, -+ [WINE_CHECK_SONAME(gtk-3,gtk_style_context_save, -+ [AC_DEFINE(HAVE_GTK3, 1, [Define if GTK 3 is installed])])])]) -+ test "x$ac_cv_lib_soname_gtk_3" != "x" || GTK3_CFLAGS="" -+ else -+ GTK3_CFLAGS="" -+ fi]) -+fi -+WINE_NOTICE_WITH(gtk3,[test "x$ac_cv_lib_soname_gtk_3" = x], -+ [GTK3 ${notice_platform}development files not found, GTK themes won't be supported.]) -+test "x$ac_cv_lib_soname_gtk_3" != "x" || enable_uxtheme_gtk=${enable_uxtheme_gtk:-no} -+ - dnl **** Check for FreeType 2 **** - if test "x$with_freetype" != "xno" - then -@@ -3731,6 +3752,7 @@ WINE_CONFIG_MAKEFILE(dlls/usp10/tests) - WINE_CONFIG_MAKEFILE(dlls/uuid) - WINE_CONFIG_MAKEFILE(dlls/uxtheme) - WINE_CONFIG_MAKEFILE(dlls/uxtheme/tests) -+WINE_CONFIG_MAKEFILE(dlls/uxtheme-gtk) - WINE_CONFIG_MAKEFILE(dlls/vbscript) - WINE_CONFIG_MAKEFILE(dlls/vbscript/tests) - WINE_CONFIG_MAKEFILE(dlls/vcomp) -diff --git a/dlls/uxtheme-gtk/Makefile.in b/dlls/uxtheme-gtk/Makefile.in -new file mode 100644 -index 0000000..07cf3a0f ---- /dev/null -+++ b/dlls/uxtheme-gtk/Makefile.in -@@ -0,0 +1,7 @@ -+MODULE = uxtheme-gtk.dll -+EXTRAINCL = $(GTK3_CFLAGS) -+ -+C_SRCS = \ -+ uxtheme.c -+ -+RC_SRCS = version.rc -diff --git a/dlls/uxtheme-gtk/uxtheme-gtk.spec b/dlls/uxtheme-gtk/uxtheme-gtk.spec -new file mode 100644 -index 0000000..b7db254 ---- /dev/null -+++ b/dlls/uxtheme-gtk/uxtheme-gtk.spec -@@ -0,0 +1 @@ -+# Empty -diff --git a/dlls/uxtheme-gtk/uxtheme.c b/dlls/uxtheme-gtk/uxtheme.c -new file mode 100644 -index 0000000..cd5e3c0 ---- /dev/null -+++ b/dlls/uxtheme-gtk/uxtheme.c -@@ -0,0 +1,218 @@ -+/* -+ * GTK uxtheme implementation -+ * -+ * Copyright (C) 2015 Michael Müller -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#include "config.h" -+#include "wine/port.h" -+#include "wine/library.h" -+ -+#include "wine/debug.h" -+#include "uxthemegtk.h" -+ -+WINE_DEFAULT_DEBUG_CHANNEL(uxthemegtk); -+ -+static void *libgtk3 = NULL; -+static void *libcairo = NULL; -+static void *libgobject2 = NULL; -+ -+#define MAKE_FUNCPTR(f) typeof(f) * p##f = NULL -+MAKE_FUNCPTR(cairo_create); -+MAKE_FUNCPTR(cairo_destroy); -+MAKE_FUNCPTR(cairo_image_surface_create); -+MAKE_FUNCPTR(cairo_image_surface_get_data); -+MAKE_FUNCPTR(cairo_image_surface_get_stride); -+MAKE_FUNCPTR(cairo_surface_destroy); -+MAKE_FUNCPTR(cairo_surface_flush); -+MAKE_FUNCPTR(g_type_check_instance_is_a); -+MAKE_FUNCPTR(gtk_bin_get_child); -+MAKE_FUNCPTR(gtk_button_new); -+MAKE_FUNCPTR(gtk_check_button_new); -+MAKE_FUNCPTR(gtk_combo_box_new_with_entry); -+MAKE_FUNCPTR(gtk_container_add); -+MAKE_FUNCPTR(gtk_container_forall); -+MAKE_FUNCPTR(gtk_entry_new); -+MAKE_FUNCPTR(gtk_fixed_new); -+MAKE_FUNCPTR(gtk_frame_new); -+MAKE_FUNCPTR(gtk_init); -+MAKE_FUNCPTR(gtk_label_new); -+MAKE_FUNCPTR(gtk_menu_bar_new); -+MAKE_FUNCPTR(gtk_menu_item_new); -+MAKE_FUNCPTR(gtk_menu_item_set_submenu); -+MAKE_FUNCPTR(gtk_menu_new); -+MAKE_FUNCPTR(gtk_menu_shell_append); -+MAKE_FUNCPTR(gtk_notebook_new); -+MAKE_FUNCPTR(gtk_radio_button_new); -+MAKE_FUNCPTR(gtk_render_arrow); -+MAKE_FUNCPTR(gtk_render_background); -+MAKE_FUNCPTR(gtk_render_check); -+MAKE_FUNCPTR(gtk_render_frame); -+MAKE_FUNCPTR(gtk_render_handle); -+MAKE_FUNCPTR(gtk_render_line); -+MAKE_FUNCPTR(gtk_render_option); -+MAKE_FUNCPTR(gtk_render_slider); -+MAKE_FUNCPTR(gtk_scale_new); -+MAKE_FUNCPTR(gtk_scrolled_window_new); -+MAKE_FUNCPTR(gtk_separator_tool_item_new); -+MAKE_FUNCPTR(gtk_style_context_add_class); -+MAKE_FUNCPTR(gtk_style_context_add_region); -+MAKE_FUNCPTR(gtk_style_context_get_background_color); -+MAKE_FUNCPTR(gtk_style_context_get_border_color); -+MAKE_FUNCPTR(gtk_style_context_get_color); -+MAKE_FUNCPTR(gtk_style_context_remove_class); -+MAKE_FUNCPTR(gtk_style_context_restore); -+MAKE_FUNCPTR(gtk_style_context_save); -+MAKE_FUNCPTR(gtk_style_context_set_junction_sides); -+MAKE_FUNCPTR(gtk_style_context_set_state); -+MAKE_FUNCPTR(gtk_toggle_button_get_type); -+MAKE_FUNCPTR(gtk_toolbar_new); -+MAKE_FUNCPTR(gtk_tree_view_append_column); -+MAKE_FUNCPTR(gtk_tree_view_column_get_button); -+MAKE_FUNCPTR(gtk_tree_view_column_new); -+MAKE_FUNCPTR(gtk_tree_view_get_column); -+MAKE_FUNCPTR(gtk_tree_view_new); -+MAKE_FUNCPTR(gtk_widget_destroy); -+MAKE_FUNCPTR(gtk_widget_get_style_context); -+MAKE_FUNCPTR(gtk_widget_style_get); -+MAKE_FUNCPTR(gtk_window_new); -+#undef MAKE_FUNCPTR -+ -+static void free_gtk3_libs(void) -+{ -+ if (libgtk3) wine_dlclose(libgtk3, NULL, 0); -+ if (libcairo) wine_dlclose(libcairo, NULL, 0); -+ if (libgobject2) wine_dlclose(libgobject2, NULL, 0); -+ libgtk3 = libcairo = libgobject2 = NULL; -+} -+ -+#define LOAD_FUNCPTR(lib, f) \ -+ if(!(p##f = wine_dlsym(lib, #f, NULL, 0))) \ -+ { \ -+ WARN("Can't find symbol %s.\n", #f); \ -+ goto error; \ -+ } -+ -+static BOOL load_gtk3_libs(void) -+{ -+ libgtk3 = wine_dlopen(SONAME_LIBGTK_3, RTLD_NOW, NULL, 0); -+ if (!libgtk3) -+ { -+ FIXME("Wine cannot find the %s library.\n", SONAME_LIBGTK_3); -+ goto error; -+ } -+ -+ LOAD_FUNCPTR(libgtk3, gtk_bin_get_child) -+ LOAD_FUNCPTR(libgtk3, gtk_button_new) -+ LOAD_FUNCPTR(libgtk3, gtk_check_button_new) -+ LOAD_FUNCPTR(libgtk3, gtk_combo_box_new_with_entry) -+ LOAD_FUNCPTR(libgtk3, gtk_container_add) -+ LOAD_FUNCPTR(libgtk3, gtk_container_forall) -+ LOAD_FUNCPTR(libgtk3, gtk_entry_new) -+ LOAD_FUNCPTR(libgtk3, gtk_fixed_new) -+ LOAD_FUNCPTR(libgtk3, gtk_frame_new) -+ LOAD_FUNCPTR(libgtk3, gtk_init) -+ LOAD_FUNCPTR(libgtk3, gtk_label_new) -+ LOAD_FUNCPTR(libgtk3, gtk_menu_bar_new) -+ LOAD_FUNCPTR(libgtk3, gtk_menu_item_new) -+ LOAD_FUNCPTR(libgtk3, gtk_menu_item_set_submenu) -+ LOAD_FUNCPTR(libgtk3, gtk_menu_new) -+ LOAD_FUNCPTR(libgtk3, gtk_menu_shell_append) -+ LOAD_FUNCPTR(libgtk3, gtk_notebook_new) -+ LOAD_FUNCPTR(libgtk3, gtk_radio_button_new) -+ LOAD_FUNCPTR(libgtk3, gtk_render_arrow) -+ LOAD_FUNCPTR(libgtk3, gtk_render_background) -+ LOAD_FUNCPTR(libgtk3, gtk_render_check) -+ LOAD_FUNCPTR(libgtk3, gtk_render_frame) -+ LOAD_FUNCPTR(libgtk3, gtk_render_handle) -+ LOAD_FUNCPTR(libgtk3, gtk_render_line) -+ LOAD_FUNCPTR(libgtk3, gtk_render_option) -+ LOAD_FUNCPTR(libgtk3, gtk_render_slider) -+ LOAD_FUNCPTR(libgtk3, gtk_scale_new) -+ LOAD_FUNCPTR(libgtk3, gtk_scrolled_window_new) -+ LOAD_FUNCPTR(libgtk3, gtk_separator_tool_item_new) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_add_class) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_add_region) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_get_background_color) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_get_border_color) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_get_color) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_remove_class) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_restore) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_save) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_set_junction_sides) -+ LOAD_FUNCPTR(libgtk3, gtk_style_context_set_state) -+ LOAD_FUNCPTR(libgtk3, gtk_toggle_button_get_type) -+ LOAD_FUNCPTR(libgtk3, gtk_toolbar_new) -+ LOAD_FUNCPTR(libgtk3, gtk_tree_view_append_column) -+ LOAD_FUNCPTR(libgtk3, gtk_tree_view_column_get_button) -+ LOAD_FUNCPTR(libgtk3, gtk_tree_view_column_new) -+ LOAD_FUNCPTR(libgtk3, gtk_tree_view_get_column) -+ LOAD_FUNCPTR(libgtk3, gtk_tree_view_new) -+ LOAD_FUNCPTR(libgtk3, gtk_widget_destroy) -+ LOAD_FUNCPTR(libgtk3, gtk_widget_get_style_context) -+ LOAD_FUNCPTR(libgtk3, gtk_widget_style_get) -+ LOAD_FUNCPTR(libgtk3, gtk_window_new) -+ -+ libcairo = wine_dlopen(SONAME_LIBCAIRO, RTLD_NOW, NULL, 0); -+ if (!libcairo) -+ { -+ FIXME("Wine cannot find the %s library.\n", SONAME_LIBCAIRO); -+ goto error; -+ } -+ -+ LOAD_FUNCPTR(libcairo, cairo_create) -+ LOAD_FUNCPTR(libcairo, cairo_destroy) -+ LOAD_FUNCPTR(libcairo, cairo_image_surface_create) -+ LOAD_FUNCPTR(libcairo, cairo_image_surface_get_data) -+ LOAD_FUNCPTR(libcairo, cairo_image_surface_get_stride) -+ LOAD_FUNCPTR(libcairo, cairo_surface_destroy) -+ LOAD_FUNCPTR(libcairo, cairo_surface_flush) -+ -+ libgobject2 = wine_dlopen(SONAME_LIBGOBJECT_2_0, RTLD_NOW, NULL, 0); -+ if (!libgobject2) -+ { -+ FIXME("Wine cannot find the %s library.\n", SONAME_LIBGOBJECT_2_0); -+ goto error; -+ } -+ -+ LOAD_FUNCPTR(libgobject2, g_type_check_instance_is_a) -+ return TRUE; -+ -+error: -+ free_gtk3_libs(); -+ return FALSE; -+} -+ -+BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) -+{ -+ TRACE("(%p, %d, %p)\n", instance, reason, reserved); -+ -+ switch (reason) -+ { -+ case DLL_PROCESS_ATTACH: -+ DisableThreadLibraryCalls(instance); -+ if (!load_gtk3_libs()) return FALSE; -+ break; -+ -+ case DLL_PROCESS_DETACH: -+ if (reserved) break; -+ free_gtk3_libs(); -+ break; -+ } -+ -+ return TRUE; -+} -diff --git a/dlls/uxtheme-gtk/uxthemegtk.h b/dlls/uxtheme-gtk/uxthemegtk.h -new file mode 100644 -index 0000000..42e4784 ---- /dev/null -+++ b/dlls/uxtheme-gtk/uxthemegtk.h -@@ -0,0 +1,88 @@ -+/* -+ * GTK uxtheme implementation -+ * -+ * Copyright (C) 2015 Michael Müller -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#ifndef UXTHEMEGTK_H -+#define UXTHEMEGTK_H -+ -+#define GDK_DISABLE_DEPRECATION_WARNINGS -+#include -+ -+#define MAKE_FUNCPTR(f) extern typeof(f) * p##f DECLSPEC_HIDDEN -+MAKE_FUNCPTR(cairo_create); -+MAKE_FUNCPTR(cairo_destroy); -+MAKE_FUNCPTR(cairo_image_surface_create); -+MAKE_FUNCPTR(cairo_image_surface_get_data); -+MAKE_FUNCPTR(cairo_image_surface_get_stride); -+MAKE_FUNCPTR(cairo_surface_destroy); -+MAKE_FUNCPTR(cairo_surface_flush); -+MAKE_FUNCPTR(g_type_check_instance_is_a); -+MAKE_FUNCPTR(gtk_bin_get_child); -+MAKE_FUNCPTR(gtk_button_new); -+MAKE_FUNCPTR(gtk_check_button_new); -+MAKE_FUNCPTR(gtk_combo_box_new_with_entry); -+MAKE_FUNCPTR(gtk_container_add); -+MAKE_FUNCPTR(gtk_container_forall); -+MAKE_FUNCPTR(gtk_entry_new); -+MAKE_FUNCPTR(gtk_fixed_new); -+MAKE_FUNCPTR(gtk_frame_new); -+MAKE_FUNCPTR(gtk_init); -+MAKE_FUNCPTR(gtk_label_new); -+MAKE_FUNCPTR(gtk_menu_bar_new); -+MAKE_FUNCPTR(gtk_menu_item_new); -+MAKE_FUNCPTR(gtk_menu_item_set_submenu); -+MAKE_FUNCPTR(gtk_menu_new); -+MAKE_FUNCPTR(gtk_menu_shell_append); -+MAKE_FUNCPTR(gtk_notebook_new); -+MAKE_FUNCPTR(gtk_radio_button_new); -+MAKE_FUNCPTR(gtk_render_arrow); -+MAKE_FUNCPTR(gtk_render_background); -+MAKE_FUNCPTR(gtk_render_check); -+MAKE_FUNCPTR(gtk_render_frame); -+MAKE_FUNCPTR(gtk_render_handle); -+MAKE_FUNCPTR(gtk_render_line); -+MAKE_FUNCPTR(gtk_render_option); -+MAKE_FUNCPTR(gtk_render_slider); -+MAKE_FUNCPTR(gtk_scale_new); -+MAKE_FUNCPTR(gtk_scrolled_window_new); -+MAKE_FUNCPTR(gtk_separator_tool_item_new); -+MAKE_FUNCPTR(gtk_style_context_add_class); -+MAKE_FUNCPTR(gtk_style_context_add_region); -+MAKE_FUNCPTR(gtk_style_context_get_background_color); -+MAKE_FUNCPTR(gtk_style_context_get_border_color); -+MAKE_FUNCPTR(gtk_style_context_get_color); -+MAKE_FUNCPTR(gtk_style_context_remove_class); -+MAKE_FUNCPTR(gtk_style_context_restore); -+MAKE_FUNCPTR(gtk_style_context_save); -+MAKE_FUNCPTR(gtk_style_context_set_junction_sides); -+MAKE_FUNCPTR(gtk_style_context_set_state); -+MAKE_FUNCPTR(gtk_toggle_button_get_type); -+MAKE_FUNCPTR(gtk_toolbar_new); -+MAKE_FUNCPTR(gtk_tree_view_append_column); -+MAKE_FUNCPTR(gtk_tree_view_column_get_button); -+MAKE_FUNCPTR(gtk_tree_view_column_new); -+MAKE_FUNCPTR(gtk_tree_view_get_column); -+MAKE_FUNCPTR(gtk_tree_view_new); -+MAKE_FUNCPTR(gtk_widget_destroy); -+MAKE_FUNCPTR(gtk_widget_get_style_context); -+MAKE_FUNCPTR(gtk_widget_style_get); -+MAKE_FUNCPTR(gtk_window_new); -+#undef MAKE_FUNCPTR -+ -+#endif /* UXTHEMEGTK_H */ -diff --git a/dlls/uxtheme-gtk/version.rc b/dlls/uxtheme-gtk/version.rc -new file mode 100644 -index 0000000..38db521 ---- /dev/null -+++ b/dlls/uxtheme-gtk/version.rc -@@ -0,0 +1,21 @@ -+/* -+ * Copyright (C) 2015 Michael Müller -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#define WINE_FILENAME_STR "uxtheme.dll" -+ -+#include --- -1.9.1 - diff --git a/patches/uxtheme-GTK_Theming/0004-uxthemegtk-Correctly-render-buttons-with-GTK-3.14.0.patch b/patches/uxtheme-GTK_Theming/0003-uxtheme-Correctly-render-buttons-with-GTK-3.14.0.patch similarity index 84% rename from patches/uxtheme-GTK_Theming/0004-uxthemegtk-Correctly-render-buttons-with-GTK-3.14.0.patch rename to patches/uxtheme-GTK_Theming/0003-uxtheme-Correctly-render-buttons-with-GTK-3.14.0.patch index 48d82252..fa9cbe72 100644 --- a/patches/uxtheme-GTK_Theming/0004-uxthemegtk-Correctly-render-buttons-with-GTK-3.14.0.patch +++ b/patches/uxtheme-GTK_Theming/0003-uxtheme-Correctly-render-buttons-with-GTK-3.14.0.patch @@ -1,16 +1,16 @@ -From 372cc1308fcae0aef6ba85e0a1944f2c939dd732 Mon Sep 17 00:00:00 2001 +From 51b2d3854db6bb754a349ba6982fb3645ed14dc8 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 9 Aug 2015 21:09:50 +0200 -Subject: uxthemegtk: Correctly render buttons with GTK >= 3.14.0. +Subject: [PATCH 3/5] uxtheme: Correctly render buttons with GTK >= 3.14.0. --- - dlls/uxtheme-gtk/button.c | 14 +++++++++----- + dlls/uxtheme/gtk-button.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) -diff --git a/dlls/uxtheme-gtk/button.c b/dlls/uxtheme-gtk/button.c -index b4b2d02..b867448 100644 ---- a/dlls/uxtheme-gtk/button.c -+++ b/dlls/uxtheme-gtk/button.c +diff --git a/dlls/uxtheme/gtk-button.c b/dlls/uxtheme/gtk-button.c +index b4b2d023..b8674480 100644 +--- a/dlls/uxtheme/gtk-button.c ++++ b/dlls/uxtheme/gtk-button.c @@ -29,6 +29,10 @@ #include "wine/debug.h" @@ -53,5 +53,5 @@ index b4b2d02..b867448 100644 case CBS_MIXEDDISABLED: return GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT; -- -2.1.0 +2.20.1 diff --git a/patches/uxtheme-GTK_Theming/0003-uxthemegtk-Implement-enumeration-of-themes-color-and.patch b/patches/uxtheme-GTK_Theming/0003-uxthemegtk-Implement-enumeration-of-themes-color-and.patch deleted file mode 100644 index 1f428136..00000000 --- a/patches/uxtheme-GTK_Theming/0003-uxthemegtk-Implement-enumeration-of-themes-color-and.patch +++ /dev/null @@ -1,308 +0,0 @@ -From 2cf0168c9587f0b836a252f6cda65975d5d3cac1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 9 Aug 2015 04:31:32 +0200 -Subject: uxthemegtk: Implement enumeration of themes, color and sizes. - -Various style improvements by Ivan Akulinchev . ---- - dlls/uxtheme-gtk/Makefile.in | 2 +- - dlls/uxtheme-gtk/uxtheme-gtk.spec | 44 +++++++++ - dlls/uxtheme-gtk/uxtheme.c | 181 +++++++++++++++++++++++++++++++++++++- - 3 files changed, 224 insertions(+), 3 deletions(-) - -diff --git a/dlls/uxtheme-gtk/Makefile.in b/dlls/uxtheme-gtk/Makefile.in -index 8cefd51..d1e79fd 100644 ---- a/dlls/uxtheme-gtk/Makefile.in -+++ b/dlls/uxtheme-gtk/Makefile.in -@@ -1,5 +1,5 @@ - MODULE = uxtheme-gtk.dll --IMPORTS = user32 gdi32 advapi32 -+IMPORTS = user32 gdi32 advapi32 shell32 - DELAYIMPORTS = msimg32 - EXTRAINCL = $(GTK3_CFLAGS) - -diff --git a/dlls/uxtheme-gtk/uxtheme-gtk.spec b/dlls/uxtheme-gtk/uxtheme-gtk.spec -index 70cd7ff..4acc0fa 100644 ---- a/dlls/uxtheme-gtk/uxtheme-gtk.spec -+++ b/dlls/uxtheme-gtk/uxtheme-gtk.spec -@@ -1,3 +1,47 @@ -+# Export by Ordinal -+1 stdcall -noname QueryThemeServices() -+2 stdcall -noname OpenThemeFile(wstr wstr wstr ptr long) -+3 stdcall -noname CloseThemeFile(ptr) -+4 stdcall -noname ApplyTheme(ptr ptr ptr) -+7 stdcall -noname GetThemeDefaults(wstr wstr long wstr long) -+8 stdcall -noname EnumThemes(wstr ptr ptr) -+9 stdcall -noname EnumThemeColors(wstr wstr long ptr) -+10 stdcall -noname EnumThemeSizes(wstr wstr long ptr) -+11 stdcall -noname ParseThemeIniFile(wstr wstr ptr ptr) -+13 stub -noname DrawNCPreview -+14 stub -noname RegisterDefaultTheme -+15 stub -noname DumpLoadedThemeToTextFile -+16 stub -noname OpenThemeDataFromFile -+17 stub -noname OpenThemeFileFromData -+18 stub -noname GetThemeSysSize96 -+19 stub -noname GetThemeSysFont96 -+20 stub -noname SessionAllocate -+21 stub -noname SessionFree -+22 stub -noname ThemeHooksOn -+23 stub -noname ThemeHooksOff -+24 stub -noname AreThemeHooksActive -+25 stub -noname GetCurrentChangeNumber -+26 stub -noname GetNewChangeNumber -+27 stub -noname SetGlobalTheme -+28 stub -noname GetGlobalTheme -+29 stub -noname CheckThemeSignature(wstr) -+30 stub -noname LoadTheme -+31 stub -noname InitUserTheme -+32 stub -noname InitUserRegistry -+33 stub -noname ReestablishServerConnection -+34 stub -noname ThemeHooksInstall -+35 stub -noname ThemeHooksRemove -+36 stub -noname RefreshThemeForTS -+43 stub -noname ClassicGetSystemMetrics -+44 stub -noname ClassicSystemParametersInfoA -+45 stub -noname ClassicSystemParametersInfoW -+46 stub -noname ClassicAdjustWindowRectEx -+48 stub -noname GetThemeParseErrorInfo -+60 stub -noname CreateThemeDataFromObjects -+61 stub OpenThemeDataEx -+62 stub -noname ServerClearStockObjects -+63 stub -noname MarkSelection -+ - # System - @ stdcall CloseThemeData(ptr) - @ stdcall EnableThemeDialogTexture(ptr long) -diff --git a/dlls/uxtheme-gtk/uxtheme.c b/dlls/uxtheme-gtk/uxtheme.c -index 22285df..0050036 100644 ---- a/dlls/uxtheme-gtk/uxtheme.c -+++ b/dlls/uxtheme-gtk/uxtheme.c -@@ -33,6 +33,8 @@ - #include "uxtheme.h" - #include "vsstyle.h" - #include "vssym32.h" -+#include "vfwmsgs.h" -+#include "shlobj.h" - - #include "wine/debug.h" - -@@ -131,7 +133,11 @@ MAKE_FUNCPTR(gtk_window_new); - #define MENU_HEIGHT 20 - #define CLASSLIST_MAXLEN 128 - --static const WCHAR THEME_PROPERTY[] = {'u','x','g','t','k','_','t','h','e','m','e',0}; -+static const WCHAR THEME_PROPERTY[] = {'u','x','g','t','k','_','t','h','e','m','e',0}; -+static const WCHAR FAKE_THEME_NAME[] = {'G','T','K','-','3',0}; -+static const WCHAR FAKE_THEME_COLOR[] = {'D','e','f','a','u','l','t',' ','C','o','l','o','r',0}; -+static const WCHAR FAKE_THEME_SIZE[] = {'D','e','f','a','u','l','t',' ','S','i','z','e',0}; -+static WCHAR fake_msstyles_file[MAX_PATH]; - - static void free_gtk3_libs(void) - { -@@ -240,9 +246,12 @@ error: - - static void process_attach(void) - { -+ static const WCHAR themes_subdir[] = {'\\','T','h','e','m','e','s','\\', 'g','t','k','3',0}; -+ static const WCHAR style_file[] = {'\\','g','t','k','3','.','m','s','s','t','y','l','e','s',0}; - int i, colors[NUM_SYS_COLORS]; - COLORREF refs[NUM_SYS_COLORS]; - NONCLIENTMETRICSW metrics; -+ HANDLE file; - - if (!load_gtk3_libs()) - return; -@@ -267,6 +276,52 @@ static void process_attach(void) - SystemParametersInfoW(SPI_SETCLEARTYPE, 0, (LPVOID)TRUE, 0); - SystemParametersInfoW(SPI_SETFONTSMOOTHING, 0, (LPVOID)TRUE, 0); - SystemParametersInfoW(SPI_SETFLATMENU, 0, (LPVOID)TRUE, 0); -+ -+ /* create fake msstyles file */ -+ if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_RESOURCES|CSIDL_FLAG_CREATE, NULL, -+ SHGFP_TYPE_CURRENT, fake_msstyles_file))) -+ { -+ lstrcatW(fake_msstyles_file, themes_subdir); -+ SHCreateDirectoryExW(NULL, fake_msstyles_file, NULL); -+ -+ lstrcatW(fake_msstyles_file, style_file); -+ file = CreateFileW(fake_msstyles_file, GENERIC_WRITE, 0, NULL, CREATE_NEW, -+ FILE_ATTRIBUTE_NORMAL, NULL); -+ if (file != INVALID_HANDLE_VALUE) CloseHandle(file); -+ return; -+ } -+ fake_msstyles_file[0] = 0; -+} -+ -+static BOOL is_fake_theme(const WCHAR *path) -+{ -+ BY_HANDLE_FILE_INFORMATION fake_info, file_info; -+ HANDLE fake_handle, file_handle; -+ BOOL ret; -+ -+ if (!fake_msstyles_file[0]) return FALSE; -+ -+ fake_handle = CreateFileW(fake_msstyles_file, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE | -+ FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -+ if (fake_handle == INVALID_HANDLE_VALUE) return FALSE; -+ -+ file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE | -+ FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -+ if (file_handle == INVALID_HANDLE_VALUE) -+ { -+ CloseHandle(fake_handle); -+ return FALSE; -+ } -+ -+ ret = GetFileInformationByHandle(fake_handle, &fake_info) && -+ GetFileInformationByHandle(file_handle, &file_info) && -+ fake_info.dwVolumeSerialNumber == file_info.dwVolumeSerialNumber && -+ fake_info.nFileIndexHigh == file_info.nFileIndexHigh && -+ fake_info.nFileIndexLow == file_info.nFileIndexLow; -+ -+ CloseHandle(file_handle); -+ CloseHandle(fake_handle); -+ return ret; - } - - void uxgtk_theme_init(uxgtk_theme_t *theme, const uxgtk_theme_vtable_t *vtable) -@@ -377,7 +432,10 @@ HRESULT WINAPI GetCurrentThemeName(LPWSTR filename, int filename_maxlen, - TRACE("(%p, %d, %p, %d, %p, %d)\n", filename, filename_maxlen, - color, color_maxlen, size, size_maxlen); - -- return E_FAIL; /* To prevent calling EnumThemeColors and so on */ -+ if (filename) lstrcpynW(filename, fake_msstyles_file, filename_maxlen); -+ if (color) lstrcpynW(color, FAKE_THEME_COLOR, color_maxlen); -+ if (size) lstrcpynW(size, FAKE_THEME_SIZE, size_maxlen); -+ return S_OK; - } - - DWORD WINAPI GetThemeAppProperties(void) -@@ -1044,6 +1102,125 @@ BOOL WINAPI IsThemePartDefined(HTHEME htheme, int part_id, int state_id) - return theme->vtable->is_part_defined(part_id, state_id); - } - -+DWORD WINAPI QueryThemeServices(void) -+{ -+ TRACE("()\n"); -+ return 3; /* This is what is returned under XP in most cases */ -+} -+ -+HRESULT WINAPI OpenThemeFile(LPCWSTR filename, LPCWSTR color, LPCWSTR size, -+ HTHEMEFILE *hthemefile, DWORD unknown) -+{ -+ TRACE("(%s, %s, %s, %p, %d)\n", debugstr_w(filename), debugstr_w(color), debugstr_w(size), -+ hthemefile, unknown); -+ -+ if (!is_fake_theme(filename)) -+ return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); -+ -+ if (color && lstrcmpW(FAKE_THEME_COLOR, color) != 0) -+ return HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); -+ -+ if (size && lstrcmpW(FAKE_THEME_SIZE, size) != 0) -+ return HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); -+ -+ *hthemefile = (HTHEMEFILE)0xdeadbeef; -+ return S_OK; -+} -+ -+HRESULT WINAPI CloseThemeFile(HTHEMEFILE hthemefile) -+{ -+ TRACE("(%p)\n", hthemefile); -+ return S_OK; -+} -+ -+HRESULT WINAPI ApplyTheme(HTHEMEFILE hthemefile, char *unknown, HWND hwnd) -+{ -+ TRACE("(%p, %s, %p)\n", hthemefile, unknown, hwnd); -+ return S_OK; -+} -+ -+HRESULT WINAPI GetThemeDefaults(LPCWSTR filename, LPWSTR color, DWORD color_maxlen, -+ LPWSTR size, DWORD size_maxlen) -+{ -+ TRACE("(%s, %p, %d, %p, %d)\n", debugstr_w(filename), color, color_maxlen, size, size_maxlen); -+ -+ if (!is_fake_theme(filename)) -+ return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); -+ -+ lstrcpynW(color, FAKE_THEME_COLOR, color_maxlen); -+ lstrcpynW(size, FAKE_THEME_SIZE, size_maxlen); -+ return S_OK; -+} -+ -+HRESULT WINAPI EnumThemes(LPCWSTR themepath, EnumThemeProc callback, LPVOID data) -+{ -+ TRACE("(%s, %p, %p)\n", debugstr_w(themepath), callback, data); -+ -+ /* FIXME: check path */ -+ callback(NULL, fake_msstyles_file, FAKE_THEME_NAME, FAKE_THEME_NAME, NULL, data); -+ -+ return S_OK; -+} -+ -+HRESULT WINAPI EnumThemeColors(LPWSTR filename, LPWSTR size, DWORD color_id, PTHEMENAMES colors) -+{ -+ TRACE("(%s, %s, %d, %p)\n", debugstr_w(filename), debugstr_w(size), color_id, colors); -+ -+ if (!is_fake_theme(filename)) -+ return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); -+ -+ if (size && lstrcmpW(FAKE_THEME_SIZE, size) != 0) -+ return E_PROP_ID_UNSUPPORTED; -+ -+ if (color_id != 0) -+ return E_PROP_ID_UNSUPPORTED; -+ -+ lstrcpynW(colors->szName, FAKE_THEME_COLOR, -+ sizeof(colors->szName) / sizeof(WCHAR)); -+ lstrcpynW(colors->szDisplayName, FAKE_THEME_COLOR, -+ sizeof(colors->szDisplayName) / sizeof(WCHAR)); -+ lstrcpynW(colors->szTooltip, FAKE_THEME_COLOR, -+ sizeof(colors->szTooltip) / sizeof(WCHAR)); -+ return S_OK; -+} -+ -+HRESULT WINAPI EnumThemeSizes(LPWSTR filename, LPWSTR color, DWORD size_id, PTHEMENAMES sizes) -+{ -+ TRACE("(%s, %s, %d, %p)\n", debugstr_w(filename), debugstr_w(color), size_id, sizes); -+ -+ if (!is_fake_theme(filename)) -+ return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); -+ -+ if (color && lstrcmpW(FAKE_THEME_COLOR, color) != 0) -+ return E_PROP_ID_UNSUPPORTED; -+ -+ if (size_id != 0) -+ return E_PROP_ID_UNSUPPORTED; -+ -+ lstrcpynW(sizes->szName, FAKE_THEME_SIZE, -+ sizeof(sizes->szName) / sizeof(WCHAR)); -+ lstrcpynW(sizes->szDisplayName, FAKE_THEME_SIZE, -+ sizeof(sizes->szDisplayName) / sizeof(WCHAR)); -+ lstrcpynW(sizes->szTooltip, FAKE_THEME_SIZE, -+ sizeof(sizes->szTooltip) / sizeof(WCHAR)); -+ return S_OK; -+} -+ -+HRESULT WINAPI ParseThemeIniFile(LPCWSTR filename, LPWSTR unknown, -+ ParseThemeIniFileProc callback, LPVOID data) -+{ -+ TRACE("(%s, %s, %p, %p)\n", debugstr_w(filename), debugstr_w(unknown), callback, data); -+ return E_NOTIMPL; -+} -+ -+HRESULT WINAPI CheckThemeSignature(LPCWSTR filename) -+{ -+ if (!is_fake_theme(filename)) -+ return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); -+ -+ return S_OK; -+} -+ - BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) - { - TRACE("(%p, %d, %p)\n", instance, reason, reserved); --- -2.5.0 - diff --git a/patches/uxtheme-GTK_Theming/0006-uxthemegtk-Reset-FPU-flags-before-calling-GTK3-funct.patch b/patches/uxtheme-GTK_Theming/0004-uxtheme-Reset-FPU-flags-before-calling-GTK3-function.patch similarity index 56% rename from patches/uxtheme-GTK_Theming/0006-uxthemegtk-Reset-FPU-flags-before-calling-GTK3-funct.patch rename to patches/uxtheme-GTK_Theming/0004-uxtheme-Reset-FPU-flags-before-calling-GTK3-function.patch index d63761fa..4e1b2a3c 100644 --- a/patches/uxtheme-GTK_Theming/0006-uxthemegtk-Reset-FPU-flags-before-calling-GTK3-funct.patch +++ b/patches/uxtheme-GTK_Theming/0004-uxtheme-Reset-FPU-flags-before-calling-GTK3-function.patch @@ -1,19 +1,19 @@ -From fa7e6a770944d1e8663e6062ee83df778d6cf7af Mon Sep 17 00:00:00 2001 +From 94806d7ea8a23f94823f2a29e75a85dba55d2076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 22 Aug 2015 15:41:15 +0200 -Subject: uxthemegtk: Reset FPU flags before calling GTK3 functions. +Subject: [PATCH] uxtheme: Reset FPU flags before calling GTK3 functions. --- - dlls/uxtheme-gtk/uxtheme.c | 57 ++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 55 insertions(+), 2 deletions(-) + dlls/uxtheme/gtk.c | 58 +++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 55 insertions(+), 3 deletions(-) -diff --git a/dlls/uxtheme-gtk/uxtheme.c b/dlls/uxtheme-gtk/uxtheme.c -index 37af3bc..22d3ffb 100644 ---- a/dlls/uxtheme-gtk/uxtheme.c -+++ b/dlls/uxtheme-gtk/uxtheme.c -@@ -139,6 +139,27 @@ static const WCHAR FAKE_THEME_COLOR[] = {'D','e','f','a','u','l','t',' ','C',' - static const WCHAR FAKE_THEME_SIZE[] = {'D','e','f','a','u','l','t',' ','S','i','z','e',0}; - static WCHAR fake_msstyles_file[MAX_PATH]; +diff --git a/dlls/uxtheme/gtk.c b/dlls/uxtheme/gtk.c +index bbee8e87..86ea4d1b 100644 +--- a/dlls/uxtheme/gtk.c ++++ b/dlls/uxtheme/gtk.c +@@ -117,6 +117,27 @@ MAKE_FUNCPTR(gtk_window_new); + #define MENU_HEIGHT 20 + #define CLASSLIST_MAXLEN 128 +static inline WORD reset_fpu_flags(void) +{ @@ -39,17 +39,14 @@ index 37af3bc..22d3ffb 100644 static void free_gtk3_libs(void) { if (libgtk3) wine_dlclose(libgtk3, NULL, 0); -@@ -384,6 +405,7 @@ static void paint_cairo_surface(cairo_surface_t *surface, HDC target_hdc, - HRESULT WINAPI CloseThemeData(HTHEME htheme) +@@ -319,11 +340,15 @@ BOOL uxtheme_gtk_enabled(void) + HRESULT uxtheme_gtk_CloseThemeData(HTHEME htheme) { uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; + WORD fpu_flags; TRACE("(%p)\n", htheme); -@@ -394,7 +416,10 @@ HRESULT WINAPI CloseThemeData(HTHEME htheme) - return E_HANDLE; - /* Destroy the toplevel widget */ + fpu_flags = reset_fpu_flags(); pgtk_widget_destroy(theme->window); @@ -58,26 +55,29 @@ index 37af3bc..22d3ffb 100644 HeapFree(GetProcessHeap(), 0, theme); return S_OK; } -@@ -480,6 +505,7 @@ HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist) +@@ -381,6 +406,8 @@ BOOL uxtheme_gtk_IsThemeDialogTextureEnabled(HWND hwnd) + HTHEME uxtheme_gtk_OpenThemeDataEx(HWND hwnd, LPCWSTR classlist, DWORD flags) { WCHAR *start, *tok, buf[CLASSLIST_MAXLEN]; - uxgtk_theme_t *theme; ++ uxgtk_theme_t *theme; + WORD fpu_flags; int i; - TRACE("(%p, %s)\n", hwnd, debugstr_w(classlist)); -@@ -526,7 +552,10 @@ found: + TRACE("(%p, %s, %#x)\n", hwnd, debugstr_w(classlist), flags); +@@ -414,7 +441,11 @@ found: TRACE("Using %s for %s.\n", debugstr_w(classes[i].classname), debugstr_w(classlist)); +- return classes[i].create(); + fpu_flags = reset_fpu_flags(); - theme = classes[i].create(); ++ theme = classes[i].create(); + set_fpu_flags(fpu_flags); + - if (theme && IsWindow(hwnd)) - SetPropW(hwnd, THEME_PROPERTY, theme); ++ return theme; + } -@@ -561,6 +590,7 @@ HRESULT WINAPI GetThemeColor(HTHEME htheme, int part_id, int state_id, + void uxtheme_gtk_SetThemeAppProperties(DWORD flags) +@@ -444,6 +475,7 @@ HRESULT uxtheme_gtk_GetThemeColor(HTHEME htheme, int part_id, int state_id, HRESULT hr; GdkRGBA rgba = {0, 0, 0, 0}; uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; @@ -85,18 +85,17 @@ index 37af3bc..22d3ffb 100644 TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, color); -@@ -577,7 +607,10 @@ HRESULT WINAPI GetThemeColor(HTHEME htheme, int part_id, int state_id, +@@ -456,7 +488,9 @@ HRESULT uxtheme_gtk_GetThemeColor(HTHEME htheme, int part_id, int state_id, + if (color == NULL) return E_INVALIDARG; - TRACE("%s->get_color()\n", theme->vtable->classname); -+ + fpu_flags = reset_fpu_flags(); hr = theme->vtable->get_color(theme, part_id, state_id, prop_id, &rgba); + set_fpu_flags(fpu_flags); if (SUCCEEDED(hr) && rgba.alpha > 0) { -@@ -860,6 +893,7 @@ HRESULT WINAPI DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int st +@@ -758,6 +792,7 @@ HRESULT uxtheme_gtk_DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, i uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; cairo_surface_t *surface; int width, height; @@ -104,7 +103,7 @@ index 37af3bc..22d3ffb 100644 cairo_t *cr; HRESULT hr; -@@ -877,6 +911,8 @@ HRESULT WINAPI DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int st +@@ -772,6 +807,8 @@ HRESULT uxtheme_gtk_DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, i width = rect->right - rect->left; height = rect->bottom - rect->top; @@ -113,7 +112,7 @@ index 37af3bc..22d3ffb 100644 surface = pcairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); cr = pcairo_create(surface); -@@ -887,6 +923,9 @@ HRESULT WINAPI DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int st +@@ -781,6 +818,9 @@ HRESULT uxtheme_gtk_DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, i pcairo_destroy(cr); pcairo_surface_destroy(surface); @@ -123,8 +122,8 @@ index 37af3bc..22d3ffb 100644 return hr; } -@@ -1021,6 +1060,8 @@ HRESULT WINAPI GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int state_i - RECT *rect, THEMESIZE type, SIZE *size) +@@ -826,6 +866,8 @@ HRESULT uxtheme_gtk_GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int st + RECT *rect, THEMESIZE type, SIZE *size) { uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; + HRESULT result; @@ -132,12 +131,11 @@ index 37af3bc..22d3ffb 100644 TRACE("(%p, %p, %d, %d, %p, %d, %p)\n", htheme, hdc, part_id, state_id, rect, type, size); -@@ -1037,7 +1078,12 @@ HRESULT WINAPI GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int state_i +@@ -838,7 +880,11 @@ HRESULT uxtheme_gtk_GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int st + if (rect == NULL || size == NULL) return E_INVALIDARG; - TRACE("%s->get_part_size()\n", theme->vtable->classname); - return theme->vtable->get_part_size(theme, part_id, state_id, rect, size); -+ + fpu_flags = reset_fpu_flags(); + result = theme->vtable->get_part_size(theme, part_id, state_id, rect, size); + set_fpu_flags(fpu_flags); @@ -145,9 +143,9 @@ index 37af3bc..22d3ffb 100644 + return result; } - HRESULT WINAPI GetThemeTextExtent(HTHEME htheme, HDC hdc, int part_id, int state_id, -@@ -1081,6 +1127,8 @@ BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME htheme, int part_id, in - BOOL WINAPI IsThemePartDefined(HTHEME htheme, int part_id, int state_id) + HRESULT uxtheme_gtk_GetThemeTextExtent(HTHEME htheme, HDC hdc, int part_id, int state_id, +@@ -872,6 +918,8 @@ BOOL uxtheme_gtk_IsThemeBackgroundPartiallyTransparent(HTHEME htheme, int part_i + BOOL uxtheme_gtk_IsThemePartDefined(HTHEME htheme, int part_id, int state_id) { uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; + WORD fpu_flags; @@ -155,12 +153,11 @@ index 37af3bc..22d3ffb 100644 TRACE("(%p, %d, %d)\n", htheme, part_id, state_id); -@@ -1103,7 +1151,12 @@ BOOL WINAPI IsThemePartDefined(HTHEME htheme, int part_id, int state_id) +@@ -887,7 +935,11 @@ BOOL uxtheme_gtk_IsThemePartDefined(HTHEME htheme, int part_id, int state_id) + return FALSE; } - TRACE("%s->is_part_defined()\n", theme->vtable->classname); - return theme->vtable->is_part_defined(part_id, state_id); -+ + fpu_flags = reset_fpu_flags(); + result = theme->vtable->is_part_defined(part_id, state_id); + set_fpu_flags(fpu_flags); @@ -168,7 +165,7 @@ index 37af3bc..22d3ffb 100644 + return result; } - DWORD WINAPI QueryThemeServices(void) + #else -- -2.5.0 +2.20.1 diff --git a/patches/uxtheme-GTK_Theming/0005-uxtheme-Fix-some-incorrect-error-codes.patch b/patches/uxtheme-GTK_Theming/0005-uxtheme-Fix-some-incorrect-error-codes.patch new file mode 100644 index 00000000..163c1c43 --- /dev/null +++ b/patches/uxtheme-GTK_Theming/0005-uxtheme-Fix-some-incorrect-error-codes.patch @@ -0,0 +1,34 @@ +From 538e7170f2c8927428c7a4fb7a383ab85af7e318 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Wed, 27 Jan 2016 08:16:10 +0100 +Subject: [PATCH 5/5] uxtheme: Fix some incorrect error codes. + +--- + dlls/uxtheme/gtk.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dlls/uxtheme/gtk.c b/dlls/uxtheme/gtk.c +index a5465356..74d55ada 100644 +--- a/dlls/uxtheme/gtk.c ++++ b/dlls/uxtheme/gtk.c +@@ -457,7 +457,7 @@ HRESULT uxtheme_gtk_SetWindowTheme(HWND hwnd, LPCWSTR sub_app_name, LPCWSTR sub_ + FIXME("(%p, %s, %s)\n", hwnd, debugstr_w(sub_app_name), + debugstr_w(sub_id_list)); + +- return E_NOTIMPL; ++ return S_OK; + } + + HRESULT uxtheme_gtk_GetThemeBool(HTHEME htheme, int part_id, int state_id, +@@ -924,7 +924,7 @@ BOOL uxtheme_gtk_IsThemePartDefined(HTHEME htheme, int part_id, int state_id) + + if (theme->vtable == NULL) + { +- SetLastError(ERROR_INVALID_HANDLE); ++ SetLastError(E_HANDLE); + return FALSE; + } + +-- +2.20.1 + diff --git a/patches/uxtheme-GTK_Theming/0005-uxthemegtk-Print-class-name-before-calling-vtable-fu.patch b/patches/uxtheme-GTK_Theming/0005-uxthemegtk-Print-class-name-before-calling-vtable-fu.patch deleted file mode 100644 index a2c5d205..00000000 --- a/patches/uxtheme-GTK_Theming/0005-uxthemegtk-Print-class-name-before-calling-vtable-fu.patch +++ /dev/null @@ -1,220 +0,0 @@ -From 6670a2999420323cb4c63d7aaa47638a5abd98fa Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sat, 22 Aug 2015 05:08:42 +0200 -Subject: uxthemegtk: Print class name before calling vtable functions. - ---- - dlls/uxtheme-gtk/button.c | 1 + - dlls/uxtheme-gtk/combobox.c | 1 + - dlls/uxtheme-gtk/edit.c | 1 + - dlls/uxtheme-gtk/header.c | 4 +++- - dlls/uxtheme-gtk/listbox.c | 1 + - dlls/uxtheme-gtk/menu.c | 1 + - dlls/uxtheme-gtk/rebar.c | 1 + - dlls/uxtheme-gtk/status.c | 1 + - dlls/uxtheme-gtk/tab.c | 1 + - dlls/uxtheme-gtk/toolbar.c | 1 + - dlls/uxtheme-gtk/trackbar.c | 1 + - dlls/uxtheme-gtk/uxtheme.c | 4 ++++ - dlls/uxtheme-gtk/uxthemegtk.h | 1 + - dlls/uxtheme-gtk/window.c | 1 + - 14 files changed, 19 insertions(+), 1 deletion(-) - -diff --git a/dlls/uxtheme-gtk/button.c b/dlls/uxtheme-gtk/button.c -index b867448..3d8e6eb 100644 ---- a/dlls/uxtheme-gtk/button.c -+++ b/dlls/uxtheme-gtk/button.c -@@ -483,6 +483,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t button_vtable = - { -+ "button", - get_color, - draw_background, - get_part_size, -diff --git a/dlls/uxtheme-gtk/combobox.c b/dlls/uxtheme-gtk/combobox.c -index 38abb82..66299a9 100644 ---- a/dlls/uxtheme-gtk/combobox.c -+++ b/dlls/uxtheme-gtk/combobox.c -@@ -191,6 +191,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t combobox_vtable = - { -+ "combobox", - NULL, /* get_color */ - draw_background, - NULL, /* get_part_size */ -diff --git a/dlls/uxtheme-gtk/edit.c b/dlls/uxtheme-gtk/edit.c -index eb5f108..60b7b3f 100644 ---- a/dlls/uxtheme-gtk/edit.c -+++ b/dlls/uxtheme-gtk/edit.c -@@ -180,6 +180,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t edit_vtable = - { -+ "edit", - get_color, - draw_background, - NULL, /* get_part_size */ -diff --git a/dlls/uxtheme-gtk/header.c b/dlls/uxtheme-gtk/header.c -index 11c0245..353c7ac 100644 ---- a/dlls/uxtheme-gtk/header.c -+++ b/dlls/uxtheme-gtk/header.c -@@ -92,7 +92,9 @@ static BOOL is_part_defined(int part_id, int state_id) - return (part_id == HP_HEADERITEM); - } - --static const uxgtk_theme_vtable_t header_vtable = { -+static const uxgtk_theme_vtable_t header_vtable = -+{ -+ "header", - NULL, /* get_color */ - draw_background, - NULL, /* get_part_size */ -diff --git a/dlls/uxtheme-gtk/listbox.c b/dlls/uxtheme-gtk/listbox.c -index 53e1391..7450378 100644 ---- a/dlls/uxtheme-gtk/listbox.c -+++ b/dlls/uxtheme-gtk/listbox.c -@@ -88,6 +88,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t listbox_vtable = - { -+ "listbox", - NULL, /* get_color */ - draw_background, - NULL, /* get_part_size */ -diff --git a/dlls/uxtheme-gtk/menu.c b/dlls/uxtheme-gtk/menu.c -index b24a085..d6cdeca 100644 ---- a/dlls/uxtheme-gtk/menu.c -+++ b/dlls/uxtheme-gtk/menu.c -@@ -154,6 +154,7 @@ static HRESULT get_color(uxgtk_theme_t *theme, int part_id, int state_id, - - static const uxgtk_theme_vtable_t menu_vtable = - { -+ "menu", - get_color, - NULL, /* draw_background */ - NULL, /* get_part_size */ -diff --git a/dlls/uxtheme-gtk/rebar.c b/dlls/uxtheme-gtk/rebar.c -index 03650ae..714a9e7 100644 ---- a/dlls/uxtheme-gtk/rebar.c -+++ b/dlls/uxtheme-gtk/rebar.c -@@ -71,6 +71,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t rebar_vtable = - { -+ "rebar", - NULL, /* get_color */ - draw_background, - NULL, /* get_part_size */ -diff --git a/dlls/uxtheme-gtk/status.c b/dlls/uxtheme-gtk/status.c -index e2a937a..8398360 100644 ---- a/dlls/uxtheme-gtk/status.c -+++ b/dlls/uxtheme-gtk/status.c -@@ -122,6 +122,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t status_vtable = - { -+ "status", - NULL, /* get_color */ - draw_background, - get_part_size, -diff --git a/dlls/uxtheme-gtk/tab.c b/dlls/uxtheme-gtk/tab.c -index 31bdc0e..6ad40bb 100644 ---- a/dlls/uxtheme-gtk/tab.c -+++ b/dlls/uxtheme-gtk/tab.c -@@ -166,6 +166,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t tab_vtable = - { -+ "tab", - NULL, /* get_color */ - draw_background, - NULL, /* get_part_size */ -diff --git a/dlls/uxtheme-gtk/toolbar.c b/dlls/uxtheme-gtk/toolbar.c -index be8fbae..6158353 100644 ---- a/dlls/uxtheme-gtk/toolbar.c -+++ b/dlls/uxtheme-gtk/toolbar.c -@@ -138,6 +138,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t toolbar_vtable = - { -+ "toolbar", - NULL, /* get_color */ - draw_background, - NULL, /* get_part_size */ -diff --git a/dlls/uxtheme-gtk/trackbar.c b/dlls/uxtheme-gtk/trackbar.c -index 58df246..f576fbe 100644 ---- a/dlls/uxtheme-gtk/trackbar.c -+++ b/dlls/uxtheme-gtk/trackbar.c -@@ -149,6 +149,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t trackbar_vtable = - { -+ "trackbar", - NULL, /* get_color */ - draw_background, - NULL, /* get_part_size */ -diff --git a/dlls/uxtheme-gtk/uxtheme.c b/dlls/uxtheme-gtk/uxtheme.c -index 0050036..37af3bc 100644 ---- a/dlls/uxtheme-gtk/uxtheme.c -+++ b/dlls/uxtheme-gtk/uxtheme.c -@@ -576,6 +576,7 @@ HRESULT WINAPI GetThemeColor(HTHEME htheme, int part_id, int state_id, - if (color == NULL) - return E_INVALIDARG; - -+ TRACE("%s->get_color()\n", theme->vtable->classname); - hr = theme->vtable->get_color(theme, part_id, state_id, prop_id, &rgba); - - if (SUCCEEDED(hr) && rgba.alpha > 0) -@@ -879,6 +880,7 @@ HRESULT WINAPI DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int st - surface = pcairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); - cr = pcairo_create(surface); - -+ TRACE("%s->draw_background()\n", theme->vtable->classname); - hr = theme->vtable->draw_background(theme, cr, part_id, state_id, width, height); - if (SUCCEEDED(hr)) - paint_cairo_surface(surface, hdc, rect->left, rect->top, width, height); -@@ -1034,6 +1036,7 @@ HRESULT WINAPI GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int state_i - if (rect == NULL || size == NULL) - return E_INVALIDARG; - -+ TRACE("%s->get_part_size()\n", theme->vtable->classname); - return theme->vtable->get_part_size(theme, part_id, state_id, rect, size); - } - -@@ -1099,6 +1102,7 @@ BOOL WINAPI IsThemePartDefined(HTHEME htheme, int part_id, int state_id) - return FALSE; - } - -+ TRACE("%s->is_part_defined()\n", theme->vtable->classname); - return theme->vtable->is_part_defined(part_id, state_id); - } - -diff --git a/dlls/uxtheme-gtk/uxthemegtk.h b/dlls/uxtheme-gtk/uxthemegtk.h -index 17307f1..79037fb 100644 ---- a/dlls/uxtheme-gtk/uxthemegtk.h -+++ b/dlls/uxtheme-gtk/uxthemegtk.h -@@ -32,6 +32,7 @@ typedef struct _uxgtk_theme_vtable uxgtk_theme_vtable_t; - - struct _uxgtk_theme_vtable - { -+ const char *classname; - HRESULT (*get_color)(uxgtk_theme_t *theme, int part_id, int state_id, - int prop_id, GdkRGBA *rgba); - HRESULT (*draw_background)(uxgtk_theme_t *theme, cairo_t *cr, int part_id, int state_id, -diff --git a/dlls/uxtheme-gtk/window.c b/dlls/uxtheme-gtk/window.c -index cf617ef..8b1478c 100644 ---- a/dlls/uxtheme-gtk/window.c -+++ b/dlls/uxtheme-gtk/window.c -@@ -141,6 +141,7 @@ static BOOL is_part_defined(int part_id, int state_id) - - static const uxgtk_theme_vtable_t window_vtable = - { -+ "window", - get_color, - draw_background, - NULL, /* get_part_size */ --- -2.5.0 - diff --git a/patches/uxtheme-GTK_Theming/0007-uxthemegtk-Add-export-for-OpenThemeDataEx.patch b/patches/uxtheme-GTK_Theming/0007-uxthemegtk-Add-export-for-OpenThemeDataEx.patch deleted file mode 100644 index b8f1a4df..00000000 --- a/patches/uxtheme-GTK_Theming/0007-uxthemegtk-Add-export-for-OpenThemeDataEx.patch +++ /dev/null @@ -1,59 +0,0 @@ -From e82e7adedc71f3a2cb3f8a4c7af5ffbfaad48885 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Wed, 27 Jan 2016 08:20:28 +0100 -Subject: uxthemegtk: Add export for OpenThemeDataEx. - ---- - dlls/uxtheme-gtk/uxtheme-gtk.spec | 2 +- - dlls/uxtheme-gtk/uxtheme.c | 9 +++++++-- - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/dlls/uxtheme-gtk/uxtheme-gtk.spec b/dlls/uxtheme-gtk/uxtheme-gtk.spec -index 4acc0fa..c4a619a 100644 ---- a/dlls/uxtheme-gtk/uxtheme-gtk.spec -+++ b/dlls/uxtheme-gtk/uxtheme-gtk.spec -@@ -38,7 +38,7 @@ - 46 stub -noname ClassicAdjustWindowRectEx - 48 stub -noname GetThemeParseErrorInfo - 60 stub -noname CreateThemeDataFromObjects --61 stub OpenThemeDataEx -+61 stdcall OpenThemeDataEx(ptr wstr long) - 62 stub -noname ServerClearStockObjects - 63 stub -noname MarkSelection - -diff --git a/dlls/uxtheme-gtk/uxtheme.c b/dlls/uxtheme-gtk/uxtheme.c -index b520f6f..15fc231 100644 ---- a/dlls/uxtheme-gtk/uxtheme.c -+++ b/dlls/uxtheme-gtk/uxtheme.c -@@ -501,14 +501,14 @@ BOOL WINAPI IsThemeDialogTextureEnabled(HWND hwnd) - return TRUE; /* Always enabled */ - } - --HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist) -+HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR classlist, DWORD flags) - { - WCHAR *start, *tok, buf[CLASSLIST_MAXLEN]; - uxgtk_theme_t *theme; - WORD fpu_flags; - int i; - -- TRACE("(%p, %s)\n", hwnd, debugstr_w(classlist)); -+ TRACE("(%p, %s, %x)\n", hwnd, debugstr_w(classlist), flags); - - if (libgtk3 == NULL) - { -@@ -562,6 +562,11 @@ found: - return theme; - } - -+HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist) -+{ -+ return OpenThemeDataEx(hwnd, classlist, 0); -+} -+ - void WINAPI SetThemeAppProperties(DWORD flags) - { - TRACE("(%u)\n", flags); --- -2.6.4 - diff --git a/patches/uxtheme-GTK_Theming/0008-uxthemegtk-Fix-some-incorrect-error-codes.patch b/patches/uxtheme-GTK_Theming/0008-uxthemegtk-Fix-some-incorrect-error-codes.patch deleted file mode 100644 index 87288b31..00000000 --- a/patches/uxtheme-GTK_Theming/0008-uxthemegtk-Fix-some-incorrect-error-codes.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 60dd76b04fa8aad2200f91660d0277a1c403dbab Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Wed, 27 Jan 2016 08:16:10 +0100 -Subject: uxthemegtk: Fix some incorrect error codes. - ---- - dlls/uxtheme-gtk/uxtheme.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/dlls/uxtheme-gtk/uxtheme.c b/dlls/uxtheme-gtk/uxtheme.c -index ab369f5..631c4da 100644 ---- a/dlls/uxtheme-gtk/uxtheme.c -+++ b/dlls/uxtheme-gtk/uxtheme.c -@@ -519,7 +519,7 @@ HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR classlist, DWORD flags) - /* comctl32.dll likes to send NULL */ - if (classlist == NULL) - { -- SetLastError(ERROR_INVALID_PARAMETER); -+ SetLastError(E_POINTER); - return NULL; - } - -@@ -578,7 +578,7 @@ HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR sub_app_name, - FIXME("(%p, %s, %s)\n", hwnd, debugstr_w(sub_app_name), - debugstr_w(sub_id_list)); - -- return E_NOTIMPL; -+ return S_OK; - } - - HRESULT WINAPI GetThemeBool(HTHEME htheme, int part_id, int state_id, -@@ -1145,7 +1145,7 @@ BOOL WINAPI IsThemePartDefined(HTHEME htheme, int part_id, int state_id) - - if (theme == NULL || theme->vtable == NULL) - { -- SetLastError(ERROR_INVALID_HANDLE); -+ SetLastError(E_HANDLE); - return FALSE; - } - --- -2.6.4 - diff --git a/patches/uxtheme-GTK_Theming/0009-uxthemegtk-Validate-theme-handles-before-accessing-p.patch b/patches/uxtheme-GTK_Theming/0009-uxthemegtk-Validate-theme-handles-before-accessing-p.patch deleted file mode 100644 index f964f7ab..00000000 --- a/patches/uxtheme-GTK_Theming/0009-uxthemegtk-Validate-theme-handles-before-accessing-p.patch +++ /dev/null @@ -1,192 +0,0 @@ -From f5278dc9cd67771aace50ba14bce51626719ac7c Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Wed, 27 Jan 2016 08:53:14 +0100 -Subject: uxthemegtk: Validate theme handles before accessing private data. - ---- - dlls/uxtheme-gtk/uxtheme.c | 47 +++++++++++++++++++++++++++++++++---------- - dlls/uxtheme-gtk/uxthemegtk.h | 2 +- - 2 files changed, 37 insertions(+), 12 deletions(-) - -diff --git a/dlls/uxtheme-gtk/uxtheme.c b/dlls/uxtheme-gtk/uxtheme.c -index 631c4da..aeaeb06 100644 ---- a/dlls/uxtheme-gtk/uxtheme.c -+++ b/dlls/uxtheme-gtk/uxtheme.c -@@ -3,6 +3,7 @@ - * - * Copyright (C) 2015 Ivan Akulinchev - * Copyright (C) 2015 Michael Müller -+ * Copyright (C) 2016 Sebastian Lackner - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public -@@ -36,6 +37,7 @@ - #include "vfwmsgs.h" - #include "shlobj.h" - -+#include "wine/exception.h" - #include "wine/debug.h" - - #include "uxthemegtk.h" -@@ -129,6 +131,7 @@ MAKE_FUNCPTR(gtk_widget_style_get); - MAKE_FUNCPTR(gtk_window_new); - #undef MAKE_FUNCPTR - -+#define HTHEME_MAGIC 0x4b544758 - #define NUM_SYS_COLORS (COLOR_MENUBAR + 1) - #define MENU_HEIGHT 20 - #define CLASSLIST_MAXLEN 128 -@@ -265,6 +268,26 @@ error: - return FALSE; - } - -+static uxgtk_theme_t *impl_from_HTHEME(HTHEME htheme) -+{ -+ uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ if (!htheme || htheme == INVALID_HANDLE_VALUE) return NULL; -+ __TRY -+ { -+ if (theme->magic != HTHEME_MAGIC) theme = NULL; -+ } -+ __EXCEPT_PAGE_FAULT -+ { -+ theme = NULL; -+ } -+ __ENDTRY -+ -+ if (!theme) -+ FIXME("Theme handle %p is invalid\n", htheme); -+ -+ return theme; -+} -+ - static void process_attach(void) - { - static const WCHAR themes_subdir[] = {'\\','T','h','e','m','e','s','\\', 'g','t','k','3',0}; -@@ -347,6 +370,7 @@ static BOOL is_fake_theme(const WCHAR *path) - - void uxgtk_theme_init(uxgtk_theme_t *theme, const uxgtk_theme_vtable_t *vtable) - { -+ theme->magic = HTHEME_MAGIC; - theme->vtable = vtable; - theme->window = pgtk_window_new(GTK_WINDOW_TOPLEVEL); - theme->layout = pgtk_fixed_new(); -@@ -404,7 +428,7 @@ static void paint_cairo_surface(cairo_surface_t *surface, HDC target_hdc, - - HRESULT WINAPI CloseThemeData(HTHEME htheme) - { -- uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ uxgtk_theme_t *theme; - WORD fpu_flags; - - TRACE("(%p)\n", htheme); -@@ -412,7 +436,7 @@ HRESULT WINAPI CloseThemeData(HTHEME htheme) - if (libgtk3 == NULL) - return E_NOTIMPL; - -- if (theme == NULL) -+ if (!(theme = impl_from_HTHEME(htheme))) - return E_HANDLE; - - /* Destroy the toplevel widget */ -@@ -420,6 +444,7 @@ HRESULT WINAPI CloseThemeData(HTHEME htheme) - pgtk_widget_destroy(theme->window); - set_fpu_flags(fpu_flags); - -+ theme->magic = 0; - HeapFree(GetProcessHeap(), 0, theme); - return S_OK; - } -@@ -592,17 +617,17 @@ HRESULT WINAPI GetThemeBool(HTHEME htheme, int part_id, int state_id, - HRESULT WINAPI GetThemeColor(HTHEME htheme, int part_id, int state_id, - int prop_id, COLORREF *color) - { -- HRESULT hr; - GdkRGBA rgba = {0, 0, 0, 0}; -- uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ uxgtk_theme_t *theme; - WORD fpu_flags; -+ HRESULT hr; - - TRACE("(%p, %d, %d, %d, %p)\n", htheme, part_id, state_id, prop_id, color); - - if (libgtk3 == NULL) - return E_NOTIMPL; - -- if (theme == NULL || theme->vtable == NULL) -+ if (!(theme = impl_from_HTHEME(htheme))) - return E_HANDLE; - - if (theme->vtable->get_color == NULL) -@@ -895,8 +920,8 @@ HRESULT WINAPI DrawThemeBackground(HTHEME htheme, HDC hdc, int part_id, int stat - HRESULT WINAPI DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int state_id, - LPCRECT rect, const DTBGOPTS *options) - { -- uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; - cairo_surface_t *surface; -+ uxgtk_theme_t *theme; - int width, height; - WORD fpu_flags; - cairo_t *cr; -@@ -907,7 +932,7 @@ HRESULT WINAPI DrawThemeBackgroundEx(HTHEME htheme, HDC hdc, int part_id, int st - if (libgtk3 == NULL) - return E_NOTIMPL; - -- if (theme == NULL || theme->vtable == NULL) -+ if (!(theme = impl_from_HTHEME(htheme))) - return E_HANDLE; - - if (theme->vtable->draw_background == NULL) -@@ -1064,7 +1089,7 @@ HRESULT WINAPI GetThemeBackgroundRegion(HTHEME htheme, HDC hdc, int part_id, int - HRESULT WINAPI GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int state_id, - RECT *rect, THEMESIZE type, SIZE *size) - { -- uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ uxgtk_theme_t *theme; - HRESULT result; - WORD fpu_flags; - -@@ -1073,7 +1098,7 @@ HRESULT WINAPI GetThemePartSize(HTHEME htheme, HDC hdc, int part_id, int state_i - if (libgtk3 == NULL) - return E_NOTIMPL; - -- if (theme == NULL || theme->vtable == NULL) -+ if (!(theme = impl_from_HTHEME(htheme))) - return E_HANDLE; - - if (theme->vtable->get_part_size == NULL) -@@ -1131,7 +1156,7 @@ BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME htheme, int part_id, in - - BOOL WINAPI IsThemePartDefined(HTHEME htheme, int part_id, int state_id) - { -- uxgtk_theme_t *theme = (uxgtk_theme_t *)htheme; -+ uxgtk_theme_t *theme; - WORD fpu_flags; - BOOL result; - -@@ -1143,7 +1168,7 @@ BOOL WINAPI IsThemePartDefined(HTHEME htheme, int part_id, int state_id) - return FALSE; - } - -- if (theme == NULL || theme->vtable == NULL) -+ if (!(theme = impl_from_HTHEME(htheme))) - { - SetLastError(E_HANDLE); - return FALSE; -diff --git a/dlls/uxtheme-gtk/uxthemegtk.h b/dlls/uxtheme-gtk/uxthemegtk.h -index 79037fb..185366b 100644 ---- a/dlls/uxtheme-gtk/uxthemegtk.h -+++ b/dlls/uxtheme-gtk/uxthemegtk.h -@@ -44,8 +44,8 @@ struct _uxgtk_theme_vtable - - struct _uxgtk_theme - { -+ DWORD magic; - const uxgtk_theme_vtable_t *vtable; -- - GtkWidget *window; - GtkWidget *layout; - }; --- -2.6.4 - diff --git a/patches/uxtheme-GTK_Theming/0010-Add-buffering-functions.patch b/patches/uxtheme-GTK_Theming/0010-Add-buffering-functions.patch deleted file mode 100644 index c8263146..00000000 --- a/patches/uxtheme-GTK_Theming/0010-Add-buffering-functions.patch +++ /dev/null @@ -1,355 +0,0 @@ -From 42a2a5837c231b6593e562a0c17f8a1513ea4d25 Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Thu, 7 Feb 2019 14:39:12 +1100 -Subject: [PATCH] Add buffering functions - -This is just a copy of buffer.c from uxtheme. -Fixes -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46587 ---- - dlls/uxtheme-gtk/Makefile.in | 1 + - dlls/uxtheme-gtk/buffer.c | 300 ++++++++++++++++++++++++++++++++++++++ - dlls/uxtheme-gtk/uxtheme-gtk.spec | 8 + - 3 files changed, 309 insertions(+) - create mode 100644 dlls/uxtheme-gtk/buffer.c - -diff --git a/dlls/uxtheme-gtk/Makefile.in b/dlls/uxtheme-gtk/Makefile.in -index d1e79fd4..2cbff61 100644 ---- a/dlls/uxtheme-gtk/Makefile.in -+++ b/dlls/uxtheme-gtk/Makefile.in -@@ -4,6 +4,7 @@ DELAYIMPORTS = msimg32 - EXTRAINCL = $(GTK3_CFLAGS) - - C_SRCS = \ -+ buffer.c \ - button.c \ - combobox.c \ - edit.c \ -diff --git a/dlls/uxtheme-gtk/buffer.c b/dlls/uxtheme-gtk/buffer.c -new file mode 100644 -index 0000000..32d341c ---- /dev/null -+++ b/dlls/uxtheme-gtk/buffer.c -@@ -0,0 +1,300 @@ -+/* -+ * uxtheme Double-buffered Drawing API -+ * -+ * Copyright (C) 2008 Reece H. Dunn -+ * Copyright 2017 Nikolay Sivov for CodeWeavers -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#include "config.h" -+ -+#include -+#include -+ -+#include "windef.h" -+#include "winbase.h" -+#include "winuser.h" -+#include "wingdi.h" -+#include "vfwmsgs.h" -+#include "uxtheme.h" -+ -+#include "wine/debug.h" -+#include "wine/heap.h" -+ -+WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); -+ -+struct paintbuffer -+{ -+ HDC targetdc; -+ HDC memorydc; -+ HBITMAP bitmap; -+ RECT rect; -+ void *bits; -+}; -+ -+static void free_paintbuffer(struct paintbuffer *buffer) -+{ -+ DeleteObject(buffer->bitmap); -+ DeleteDC(buffer->memorydc); -+ heap_free(buffer); -+} -+ -+static struct paintbuffer *get_buffer_obj(HPAINTBUFFER handle) -+{ -+ if (!handle) -+ return NULL; -+ return handle; -+} -+ -+/*********************************************************************** -+ * BufferedPaintInit (UXTHEME.@) -+ */ -+HRESULT WINAPI BufferedPaintInit(VOID) -+{ -+ FIXME("Stub ()\n"); -+ return S_OK; -+} -+ -+/*********************************************************************** -+ * BufferedPaintUnInit (UXTHEME.@) -+ */ -+HRESULT WINAPI BufferedPaintUnInit(VOID) -+{ -+ FIXME("Stub ()\n"); -+ return S_OK; -+} -+ -+/*********************************************************************** -+ * BeginBufferedPaint (UXTHEME.@) -+ */ -+HPAINTBUFFER WINAPI BeginBufferedPaint(HDC targetdc, const RECT *rect, -+ BP_BUFFERFORMAT format, BP_PAINTPARAMS *params, HDC *retdc) -+{ -+ char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors[256])]; -+ BITMAPINFO *bmi = (BITMAPINFO *)bmibuf; -+ struct paintbuffer *buffer; -+ -+ TRACE("(%p %s %d %p %p)\n", targetdc, wine_dbgstr_rect(rect), format, -+ params, retdc); -+ -+ if (retdc) -+ *retdc = NULL; -+ -+ if (!targetdc || IsRectEmpty(rect)) -+ return NULL; -+ -+ if (params) -+ FIXME("painting parameters are ignored\n"); -+ -+ buffer = heap_alloc(sizeof(*buffer)); -+ buffer->targetdc = targetdc; -+ buffer->rect = *rect; -+ buffer->memorydc = CreateCompatibleDC(targetdc); -+ -+ switch (format) -+ { -+ case BPBF_COMPATIBLEBITMAP: -+ buffer->bitmap = CreateCompatibleBitmap(targetdc, rect->right - rect->left, rect->bottom - rect->top); -+ buffer->bits = NULL; -+ break; -+ case BPBF_DIB: -+ case BPBF_TOPDOWNDIB: -+ case BPBF_TOPDOWNMONODIB: -+ /* create DIB section */ -+ memset(bmi, 0, sizeof(bmibuf)); -+ bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader); -+ bmi->bmiHeader.biHeight = format == BPBF_DIB ? rect->bottom - rect->top : -+ -(rect->bottom - rect->top); -+ bmi->bmiHeader.biWidth = rect->right - rect->left; -+ bmi->bmiHeader.biBitCount = format == BPBF_TOPDOWNMONODIB ? 1 : 32; -+ bmi->bmiHeader.biPlanes = 1; -+ bmi->bmiHeader.biCompression = BI_RGB; -+ buffer->bitmap = CreateDIBSection(buffer->memorydc, bmi, DIB_RGB_COLORS, &buffer->bits, NULL, 0); -+ break; -+ default: -+ WARN("Unknown buffer format %d\n", format); -+ buffer->bitmap = NULL; -+ free_paintbuffer(buffer); -+ return NULL; -+ } -+ -+ if (!buffer->bitmap) -+ { -+ WARN("Failed to create buffer bitmap\n"); -+ free_paintbuffer(buffer); -+ return NULL; -+ } -+ -+ SetWindowOrgEx(buffer->memorydc, rect->left, rect->top, NULL); -+ IntersectClipRect(buffer->memorydc, rect->left, rect->top, rect->right, rect->bottom); -+ DeleteObject(SelectObject(buffer->memorydc, buffer->bitmap)); -+ -+ *retdc = buffer->memorydc; -+ -+ return (HPAINTBUFFER)buffer; -+} -+ -+/*********************************************************************** -+ * EndBufferedPaint (UXTHEME.@) -+ */ -+HRESULT WINAPI EndBufferedPaint(HPAINTBUFFER bufferhandle, BOOL update) -+{ -+ struct paintbuffer *buffer = get_buffer_obj(bufferhandle); -+ -+ TRACE("(%p %d)\n", bufferhandle, update); -+ -+ if (!buffer) -+ return E_INVALIDARG; -+ -+ if (update) -+ { -+ if (!BitBlt(buffer->targetdc, buffer->rect.left, buffer->rect.top, -+ buffer->rect.right - buffer->rect.left, buffer->rect.bottom - buffer->rect.top, -+ buffer->memorydc, buffer->rect.left, buffer->rect.top, SRCCOPY)) -+ { -+ WARN("BitBlt() failed\n"); -+ } -+ } -+ -+ free_paintbuffer(buffer); -+ return S_OK; -+} -+ -+/*********************************************************************** -+ * BufferedPaintClear (UXTHEME.@) -+ */ -+HRESULT WINAPI BufferedPaintClear(HPAINTBUFFER hBufferedPaint, const RECT *prc) -+{ -+ FIXME("Stub (%p %p)\n", hBufferedPaint, prc); -+ return E_NOTIMPL; -+} -+ -+/*********************************************************************** -+ * BufferedPaintSetAlpha (UXTHEME.@) -+ */ -+HRESULT WINAPI BufferedPaintSetAlpha(HPAINTBUFFER hBufferedPaint, const RECT *prc, BYTE alpha) -+{ -+ FIXME("Stub (%p %p %u)\n", hBufferedPaint, prc, alpha); -+ return E_NOTIMPL; -+} -+ -+/*********************************************************************** -+ * GetBufferedPaintBits (UXTHEME.@) -+ */ -+HRESULT WINAPI GetBufferedPaintBits(HPAINTBUFFER bufferhandle, RGBQUAD **bits, int *width) -+{ -+ struct paintbuffer *buffer = get_buffer_obj(bufferhandle); -+ -+ TRACE("(%p %p %p)\n", buffer, bits, width); -+ -+ if (!bits || !width) -+ return E_POINTER; -+ -+ if (!buffer || !buffer->bits) -+ return E_FAIL; -+ -+ *bits = buffer->bits; -+ *width = buffer->rect.right - buffer->rect.left; -+ -+ return S_OK; -+} -+ -+/*********************************************************************** -+ * GetBufferedPaintDC (UXTHEME.@) -+ */ -+HDC WINAPI GetBufferedPaintDC(HPAINTBUFFER bufferhandle) -+{ -+ struct paintbuffer *buffer = get_buffer_obj(bufferhandle); -+ -+ TRACE("(%p)\n", buffer); -+ -+ return buffer ? buffer->memorydc : NULL; -+} -+ -+/*********************************************************************** -+ * GetBufferedPaintTargetDC (UXTHEME.@) -+ */ -+HDC WINAPI GetBufferedPaintTargetDC(HPAINTBUFFER bufferhandle) -+{ -+ struct paintbuffer *buffer = get_buffer_obj(bufferhandle); -+ -+ TRACE("(%p)\n", buffer); -+ -+ return buffer ? buffer->targetdc : NULL; -+} -+ -+/*********************************************************************** -+ * GetBufferedPaintTargetRect (UXTHEME.@) -+ */ -+HRESULT WINAPI GetBufferedPaintTargetRect(HPAINTBUFFER bufferhandle, RECT *rect) -+{ -+ struct paintbuffer *buffer = get_buffer_obj(bufferhandle); -+ -+ TRACE("(%p %p)\n", buffer, rect); -+ -+ if (!rect) -+ return E_POINTER; -+ -+ if (!buffer) -+ return E_FAIL; -+ -+ *rect = buffer->rect; -+ return S_OK; -+} -+ -+/*********************************************************************** -+ * BeginBufferedAnimation (UXTHEME.@) -+ */ -+HANIMATIONBUFFER WINAPI BeginBufferedAnimation(HWND hwnd, HDC hdcTarget, const RECT *rcTarget, -+ BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, -+ BP_ANIMATIONPARAMS *pAnimationParams, HDC *phdcFrom, -+ HDC *phdcTo) -+{ -+ FIXME("Stub (%p %p %p %u %p %p %p %p)\n", hwnd, hdcTarget, rcTarget, dwFormat, -+ pPaintParams, pAnimationParams, phdcFrom, phdcTo); -+ -+ return NULL; -+} -+ -+/*********************************************************************** -+ * BufferedPaintRenderAnimation (UXTHEME.@) -+ */ -+BOOL WINAPI BufferedPaintRenderAnimation(HWND hwnd, HDC hdcTarget) -+{ -+ FIXME("Stub (%p %p)\n", hwnd, hdcTarget); -+ -+ return FALSE; -+} -+ -+/*********************************************************************** -+ * BufferedPaintStopAllAnimations (UXTHEME.@) -+ */ -+HRESULT WINAPI BufferedPaintStopAllAnimations(HWND hwnd) -+{ -+ FIXME("Stub (%p)\n", hwnd); -+ -+ return E_NOTIMPL; -+} -+ -+/*********************************************************************** -+ * EndBufferedAnimation (UXTHEME.@) -+ */ -+HRESULT WINAPI EndBufferedAnimation(HANIMATIONBUFFER hbpAnimation, BOOL fUpdateTarget) -+{ -+ FIXME("Stub (%p %u)\n", hbpAnimation, fUpdateTarget); -+ -+ return E_NOTIMPL; -+} -diff --git a/dlls/uxtheme-gtk/uxtheme-gtk.spec b/dlls/uxtheme-gtk/uxtheme-gtk.spec -index c4a619a..f4cf37f 100644 ---- a/dlls/uxtheme-gtk/uxtheme-gtk.spec -+++ b/dlls/uxtheme-gtk/uxtheme-gtk.spec -@@ -43,6 +43,14 @@ - 63 stub -noname MarkSelection - - # System -+@ stdcall BeginBufferedAnimation(ptr ptr ptr long ptr ptr ptr ptr) -+@ stdcall BeginBufferedPaint(ptr ptr long ptr ptr) -+@ stdcall BufferedPaintClear(ptr ptr) -+@ stdcall BufferedPaintInit() -+@ stdcall BufferedPaintRenderAnimation(ptr ptr) -+@ stdcall BufferedPaintSetAlpha(ptr ptr long) -+@ stdcall BufferedPaintStopAllAnimations(ptr) -+@ stdcall BufferedPaintUnInit() - @ stdcall CloseThemeData(ptr) - @ stdcall EnableThemeDialogTexture(ptr long) - @ stdcall EnableTheming(long) --- -1.9.1 - diff --git a/patches/uxtheme-GTK_Theming/definition b/patches/uxtheme-GTK_Theming/definition index 4c264752..ad66ec1b 100644 --- a/patches/uxtheme-GTK_Theming/definition +++ b/patches/uxtheme-GTK_Theming/definition @@ -2,4 +2,3 @@ # sha1: ecbca8e848834180092d9078be0762a60617fcd7 Fixes: Add support for GTK3 theming -Depends: ntdll-DllRedirects diff --git a/patches/winecfg-Staging/0005-winecfg-Add-option-to-enable-disable-GTK3-theming.patch b/patches/winecfg-Staging/0005-winecfg-Add-option-to-enable-disable-GTK3-theming.patch index fb729601..e1d90006 100644 --- a/patches/winecfg-Staging/0005-winecfg-Add-option-to-enable-disable-GTK3-theming.patch +++ b/patches/winecfg-Staging/0005-winecfg-Add-option-to-enable-disable-GTK3-theming.patch @@ -1,4 +1,4 @@ -From 179cacadcf7f5e0fbaff2e61dbf009593e4257e8 Mon Sep 17 00:00:00 2001 +From ad78908234abc43ef56b5d005e22abde445f8760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sun, 9 Aug 2015 18:01:11 +0200 Subject: winecfg: Add option to enable/disable GTK3 theming. @@ -10,10 +10,10 @@ Subject: winecfg: Add option to enable/disable GTK3 theming. 3 files changed, 31 insertions(+) diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h -index a1fbc69..b94e773 100644 +index f8c2fdf8..96f24290 100644 --- a/programs/winecfg/resource.h +++ b/programs/winecfg/resource.h -@@ -217,6 +217,7 @@ +@@ -218,6 +218,7 @@ #define IDC_ENABLE_VAAPI 9002 #define IDC_ENABLE_EAX 9003 #define IDC_ENABLE_HIDEWINE 9004 @@ -22,7 +22,7 @@ index a1fbc69..b94e773 100644 /* About tab */ #define IDC_ABT_OWNER 8432 diff --git a/programs/winecfg/staging.c b/programs/winecfg/staging.c -index c908d24..5a978d6 100644 +index 2e305a2c..b573db71 100644 --- a/programs/winecfg/staging.c +++ b/programs/winecfg/staging.c @@ -99,6 +99,27 @@ static void hidewine_set(BOOL status) @@ -36,8 +36,8 @@ index c908d24..5a978d6 100644 +{ +#ifdef HAVE_GTK3 + BOOL ret; -+ char *value = get_reg_key(config_key, keypath("DllRedirects"), "uxtheme", NULL); -+ ret = (value && !strcmp(value, "uxtheme-gtk.dll")); ++ char *value = get_reg_key(config_key, keypath(""), "ThemeEngine", NULL); ++ ret = (value && !strcasecmp(value, "GTK")); + HeapFree(GetProcessHeap(), 0, value); + return ret; +#else @@ -47,7 +47,7 @@ index c908d24..5a978d6 100644 +static void gtk3_set(BOOL status) +{ +#ifdef HAVE_GTK3 -+ set_reg_key(config_key, keypath("DllRedirects"), "uxtheme", status ? "uxtheme-gtk.dll" : NULL); ++ set_reg_key(config_key, keypath(""), "ThemeEngine", status ? "GTK" : NULL); +#endif +} @@ -80,10 +80,10 @@ index c908d24..5a978d6 100644 break; } diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc -index ce7261b..f838a04 100644 +index 469ae101..33f2642e 100644 --- a/programs/winecfg/winecfg.rc +++ b/programs/winecfg/winecfg.rc -@@ -319,6 +319,7 @@ BEGIN +@@ -323,6 +323,7 @@ BEGIN CONTROL "Enable &VAAPI as backend for DXVA2 GPU decoding",IDC_ENABLE_VAAPI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,55,230,8 CONTROL "Enable Environmental Audio E&xtensions (EAX)",IDC_ENABLE_EAX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,70,230,8 CONTROL "&Hide Wine version from applications",IDC_ENABLE_HIDEWINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,85,230,8 @@ -92,5 +92,5 @@ index ce7261b..f838a04 100644 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -- -2.7.4 +2.20.1