X Tutup
Skip to content

Commit ced25bf

Browse files
committed
Update print handler gtk patch (cztomczak#403)
1 parent d688f42 commit ced25bf

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

src/subprocess/print_handler_gtk.patch

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git print_handler_gtk.cc print_handler_gtk.cc
2-
index 9a822b7a..18c8c1c4 100644
2+
index 9a822b7a..3bfc30c5 100644
33
--- print_handler_gtk.cc
44
+++ print_handler_gtk.cc
5-
@@ -1,22 +1,23 @@
5+
@@ -1,22 +1,25 @@
66
+// COPIED from upstream "cef/tests/cefclient/browser/" directory
77
+// with minor modifications. See the .patch file in current directory.
88
+
@@ -23,32 +23,42 @@ index 9a822b7a..18c8c1c4 100644
2323
#include "include/base/cef_logging.h"
2424
#include "include/base/cef_macros.h"
2525
#include "include/wrapper/cef_helpers.h"
26-
-
26+
+#include "include/wrapper/cef_closure_task.h"
27+
2728
-#include "tests/cefclient/browser/root_window.h"
2829
-
2930
-namespace client {
30-
+#include "include/wrapper/cef_closure_task.h"
31+
+#include "client_handler/x11.h"
3132

3233
namespace {
3334

34-
@@ -431,10 +432,12 @@ struct ClientPrintHandlerGtk::PrintHandler {
35-
// Returns the GtkWindow* for the browser. Will return NULL when using the
36-
// Views framework.
37-
GtkWindow* GetWindow() {
35+
@@ -373,7 +376,7 @@ struct ClientPrintHandlerGtk::PrintHandler {
36+
CefRefPtr<CefPrintDialogCallback> callback) {
37+
dialog_callback_ = callback;
38+
39+
- GtkWindow* parent = GetWindow();
40+
+ GtkWindow* parent = CefBrowser_GetGtkWindow(browser_);
41+
// TODO(estade): We need a window title here.
42+
dialog_ = gtk_print_unix_dialog_new(NULL, parent);
43+
g_signal_connect(dialog_, "delete-event",
44+
@@ -428,16 +431,6 @@ struct ClientPrintHandlerGtk::PrintHandler {
45+
}
46+
47+
private:
48+
- // Returns the GtkWindow* for the browser. Will return NULL when using the
49+
- // Views framework.
50+
- GtkWindow* GetWindow() {
3851
- scoped_refptr<RootWindow> root_window =
3952
- RootWindow::GetForBrowser(browser_->GetIdentifier());
4053
- if (root_window)
4154
- return GTK_WINDOW(root_window->GetWindowHandle());
42-
+ // TODO(cefpython): Test the code that is commented out whether it works
43-
+ /*
44-
+ CefWindowHandle hwnd = browser_->GetWindowHandle();
45-
+ if (hwnd)
46-
+ return GTK_WINDOW(hwnd);
47-
+ */
48-
return NULL;
49-
}
50-
51-
@@ -626,5 +629,3 @@ ClientPrintHandlerGtk::PrintHandler* ClientPrintHandlerGtk::GetPrintHandler(
55+
- return NULL;
56+
- }
57+
-
58+
void OnDialogResponse(GtkDialog* dialog, gint response_id) {
59+
int num_matched_handlers = g_signal_handlers_disconnect_by_func(
60+
dialog_, reinterpret_cast<gpointer>(&OnDialogResponseThunk), this);
61+
@@ -626,5 +619,3 @@ ClientPrintHandlerGtk::PrintHandler* ClientPrintHandlerGtk::GetPrintHandler(
5262
DCHECK(it != print_handler_map_.end());
5363
return it->second;
5464
}

0 commit comments

Comments
 (0)
X Tutup