diff options
author | Руслан Ижбулатов <lrn1986@gmail.com> | 2014-07-29 08:18:32 +0000 |
---|---|---|
committer | Руслан Ижбулатов <lrn1986@gmail.com> | 2014-08-05 06:41:31 +0000 |
commit | 0d02cc8203e1a43506c0e81f392492aedadb6fa3 (patch) | |
tree | bd52cdc4add8c43b7aad0017ba54ed432b50ea2a /gtk/gtkprintoperation-win32.c | |
parent | 31d08bd85e312ba05b7890b403c8a50cfdf52c4f (diff) | |
download | gtk+-0d02cc8203e1a43506c0e81f392492aedadb6fa3.tar.gz |
Make sure native W32 print dialog uses visual styles
For that to happen the libgtk3 is embedded with a manifest that requests
common controls library 6.x, and GTK lazily calls InitCommonControlsEx()
to initialize those. Then this manifest is used to temporarily override
the process activation contest when loading comdlg32 (which contains the
code for the print dialog), ensuring that it too depends on common
controls 6.x, even if the application that uses GTK does not.
https://bugzilla.gnome.org/show_bug.cgi?id=733773
Diffstat (limited to 'gtk/gtkprintoperation-win32.c')
-rw-r--r-- | gtk/gtkprintoperation-win32.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c index e59eb9f675..3ac6bc47bf 100644 --- a/gtk/gtkprintoperation-win32.c +++ b/gtk/gtkprintoperation-win32.c @@ -1657,6 +1657,25 @@ gtk_print_operation_run_with_dialog (GtkPrintOperation *op, GtkPrintOperationPrivate *priv; IPrintDialogCallback *callback; HPROPSHEETPAGE prop_page; + static volatile gsize common_controls_initialized = 0; + + if (g_once_init_enter (&common_controls_initialized)) + { + BOOL initialized; + INITCOMMONCONTROLSEX icc; + + memset (&icc, 0, sizeof (icc)); + icc.dwSize = sizeof (icc); + icc.dwICC = ICC_WIN95_CLASSES; + + initialized = InitCommonControlsEx (&icc); + if (!initialized) + g_warning ("Failed to InitCommonControlsEx: %lu\n", GetLastError ()); + + _gtk_load_dll_with_libgtk3_manifest ("comdlg32.dll"); + + g_once_init_leave (&common_controls_initialized, initialized ? 1 : 0); + } *do_print = FALSE; |