summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2016-10-21 15:26:42 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2016-11-22 11:40:57 +0800
commit17fe2288e80a3a78222f53575548ba4e26a6a042 (patch)
tree86b254e487bf4a33b4e8bd8c03620ad7fc0ea8a2
parent1f7ab7c069855b21f0a7c05dbf0d3e9d08caa507 (diff)
downloadgtk+-17fe2288e80a3a78222f53575548ba4e26a6a042.tar.gz
gtk/gtkprintoperation-win32.c: Fix for GTK+-4.0 API
We no longer have GtkPlug nor GtkWin32EmbedManifest for GTK+-4.x, and it is not entirely clear at this point what would be the "best" replacement for them, but this issue here prevents GTK+-3.89.x building on Windows. As a result, this is a fast port to avoid using APIs that have been removed for 4.x, and things seem to work properly (the print.c page printed). https://bugzilla.gnome.org/show_bug.cgi?id=773299
-rw-r--r--gtk/gtkprintoperation-win32.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c
index f4142cf145..ee1294d303 100644
--- a/gtk/gtkprintoperation-win32.c
+++ b/gtk/gtkprintoperation-win32.c
@@ -42,10 +42,8 @@
#include "gtkprint-win32.h"
#include "gtkintl.h"
#include "gtkinvisible.h"
-#include "gtkplug.h"
-#include "gtk.h"
-#include "gtkwin32embedwidget.h"
#include "gtkprivate.h"
+#include "gtkwidgetprivate.h"
#define MAX_PAGE_RANGES 20
#define STATUS_POLLING_TIME 2000
@@ -1349,7 +1347,6 @@ plug_grab_notify (GtkWidget *widget,
was_grabbed);
}
-
static INT_PTR CALLBACK
pageDlgProc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
{
@@ -1363,10 +1360,12 @@ pageDlgProc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
op = GTK_PRINT_OPERATION ((gpointer)page->lParam);
op_win32 = op->priv->platform_data;
+ plug = g_object_new(GTK_TYPE_WIDGET, NULL);
SetWindowLongPtrW (wnd, GWLP_USERDATA, (LONG_PTR)op);
-
- plug = _gtk_win32_embed_widget_new (wnd);
+
+ _gtk_widget_set_is_toplevel (plug, TRUE);
+
gtk_window_set_modal (GTK_WINDOW (plug), TRUE);
op_win32->embed_widget = plug;
gtk_container_add (GTK_CONTAINER (plug), op->priv->custom_widget);
@@ -1396,8 +1395,22 @@ pageDlgProc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
op = GTK_PRINT_OPERATION (GetWindowLongPtrW (wnd, GWLP_USERDATA));
op_win32 = op->priv->platform_data;
- return _gtk_win32_embed_widget_dialog_procedure (GTK_WIN32_EMBED_WIDGET (op_win32->embed_widget),
- wnd, message, wparam, lparam);
+ /* TODO: We don't have GtkWin32EmbedWidgets anymore, but it is not currently clear
+ * at this point what will be the proper replacement for this. For now,
+ * do the message handling that was in _gtk_win32_embed_widget_dialog_procedure ()
+ * here and fill in the rest when things become clearer.
+ */
+ if (message == WM_SIZE)
+ {
+ GtkAllocation alloc;
+ alloc.width = LOWORD (lparam);
+ alloc.height = HIWORD (lparam);
+
+ gtk_widget_set_allocation (op_win32->embed_widget, &alloc);
+ gtk_widget_queue_resize (op_win32->embed_widget);
+ }
+
+ return FALSE;
}
return FALSE;