[gtk+] gtk/gtkprintoperation-win32.c: Fix for GTK+-4.0 API
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk/gtkprintoperation-win32.c: Fix for GTK+-4.0 API
- Date: Tue, 22 Nov 2016 03:42:56 +0000 (UTC)
commit 17fe2288e80a3a78222f53575548ba4e26a6a042
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Fri Oct 21 15:26:42 2016 +0800
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
gtk/gtkprintoperation-win32.c | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c
index f4142cf..ee1294d 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]