WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
wkgtk-printing.diff (text/plain), 4.88 KB, created by
Carlos Garcia Campos
on 2020-06-01 06:22:21 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2020-06-01 06:22:21 PDT
Size:
4.88 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c40035f039c2..332cf5826015 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,15 @@ >+2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK4] Add printing support >+ https://bugs.webkit.org/show_bug.cgi?id=212320 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add gtk_dialog_run() to GTK4. >+ >+ * platform/gtk/GtkVersioning.h: >+ (gtk_dialog_run): >+ > 2020-05-30 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK4] Make inspector work >diff --git a/Source/WebCore/platform/gtk/GtkVersioning.h b/Source/WebCore/platform/gtk/GtkVersioning.h >index 8b881b45d9fc..23b5bf5841ed 100644 >--- a/Source/WebCore/platform/gtk/GtkVersioning.h >+++ b/Source/WebCore/platform/gtk/GtkVersioning.h >@@ -207,6 +207,25 @@ gtk_native_dialog_run(GtkNativeDialog* dialog) > return context.response; > } > >+static inline int >+gtk_dialog_run(GtkDialog* dialog) >+{ >+ struct RunDialogContext { >+ GMainLoop *loop; >+ int response; >+ } context = { g_main_loop_new(nullptr, FALSE), 0 }; >+ >+ gtk_widget_show(GTK_WIDGET(dialog)); >+ g_signal_connect(dialog, "response", G_CALLBACK(+[](GtkDialog*, int response, RunDialogContext* context) { >+ context->response = response; >+ g_main_loop_quit(context->loop); >+ }), &context); >+ g_main_loop_run(context.loop); >+ g_main_loop_unref(context.loop); >+ >+ return context.response; >+} >+ > #else // USE(GTK4) > > static inline void >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 018e9c50f275..f9a577952d3f 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,17 @@ >+2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK4] Add printing support >+ https://bugs.webkit.org/show_bug.cgi?id=212320 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Printing API hasn't changed, the only problem was that we were using gtk_dialog_run() and gdk threads deprecated API. >+ >+ * UIProcess/API/gtk/WebKitPrintOperation.cpp: >+ (webkitPrintOperationRunDialog): Remove GTK4 ifdefs. >+ * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: >+ (WebKit::WebPrintOperationGtk::print): Use g_idle_add_full() instead of gdk threads deprecated API. >+ > 2020-06-01 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK4] Wheel events are always handled by the main frame view >diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp b/Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp >index 8cae2a2f7ea8..67eccadc560e 100644 >--- a/Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp >+++ b/Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp >@@ -252,9 +252,6 @@ static void notifySelectedPrinterCallback(GtkPrintUnixDialog* dialog, GParamSpec > > static WebKitPrintOperationResponse webkitPrintOperationRunDialog(WebKitPrintOperation* printOperation, GtkWindow* parent) > { >-#if USE(GTK4) >- return WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL; >-#else > GtkPrintUnixDialog* printDialog = GTK_PRINT_UNIX_DIALOG(gtk_print_unix_dialog_new(0, parent)); > gtk_print_unix_dialog_set_manual_capabilities(printDialog, static_cast<GtkPrintCapabilities>(GTK_PRINT_CAPABILITY_NUMBER_UP > | GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT >@@ -299,7 +296,6 @@ static WebKitPrintOperationResponse webkitPrintOperationRunDialog(WebKitPrintOpe > gtk_widget_destroy(GTK_WIDGET(printDialog)); > > return returnValue; >-#endif > } > #else > // TODO: We need to add an implementation for Windows. >diff --git a/Source/WebKit/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp b/Source/WebKit/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp >index e9113c96ae35..f1337a0e5e70 100644 >--- a/Source/WebKit/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp >+++ b/Source/WebKit/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp >@@ -737,18 +737,17 @@ void WebPrintOperationGtk::print(cairo_surface_t* surface, double xDPI, double y > m_xDPI = xDPI; > m_yDPI = yDPI; > m_cairoContext = adoptRef(cairo_create(surface)); >-#if !USE(GTK4) >+ > // Make sure the print pages idle has more priority than IPC messages comming from > // the IO thread, so that the EndPrinting message is always handled once the print > // operation has finished. See https://bugs.webkit.org/show_bug.cgi?id=122801. > unsigned idlePriority = m_printMode == PrintInfo::PrintModeSync ? G_PRIORITY_DEFAULT - 10 : G_PRIORITY_DEFAULT_IDLE + 10; > GMainLoop* mainLoop = data->mainLoop.get(); >- m_printPagesIdleId = gdk_threads_add_idle_full(idlePriority, printPagesIdle, data.release(), printPagesIdleDone); >+ m_printPagesIdleId = g_idle_add_full(idlePriority, printPagesIdle, data.release(), printPagesIdleDone); > if (m_printMode == PrintInfo::PrintModeSync) { > ASSERT(mainLoop); > g_main_loop_run(mainLoop); > } >-#endif > } > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
aperez
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 212320
: 400731