A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cztomczak/cefpython/issues/241 below:

JS dialogs and file dialogs not working on Linux · Issue #241 · cztomczak/cefpython · GitHub

Upstream CEF 51 is now using X11 library for window management. Previously it used GTK. Now with X11 under the hood there are no default implementations for dialogs in libcef on Linux and that includes: print dialog, js dialogs, file dialog. However the cefclient sample application provides implementations for these dialogs using the GTK library. But it needs to be copied with a few minor modifications. Print dialog was already implemented in Issue #238 by copying print_handler_gtk.cc / print_handler_gtk.h files almost entirely.

To implement js/file dialogs copy these two files from upstream cefclient:

  1. https://bitbucket.org/chromiumembedded/cef/src/60b37186508edb13da9dff185f1b9658be674152/tests/cefclient/browser/dialog_handler_gtk.cc?at=master&fileviewer=file-view-default (and rename to .cpp)
  2. https://bitbucket.org/chromiumembedded/cef/src/60b37186508edb13da9dff185f1b9658be674152/tests/cefclient/browser/dialog_handler_gtk.h?at=master&fileviewer=file-view-default

Also copy some code from cefclient's client_handler.h/client_handler.cc and add it somewhere in cefpython's src/client_handler/client_handler.cpp/h files:

#if defined(OS_LINUX)
#include "cefclient/browser/dialog_handler_gtk.h"
#endif

...

#if defined(OS_LINUX)
  // Custom dialog handler for GTK.
  CefRefPtr<ClientDialogHandlerGtk> dialog_handler_;
#endif

...

#if defined(OS_LINUX)
  CefRefPtr<CefDialogHandler> GetDialogHandler() OVERRIDE {
    return dialog_handler_;
  }
  CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() OVERRIDE {
    return dialog_handler_;
  }
#endif

...

#if defined(OS_LINUX)
  // Provide the GTK-based dialog implementation on Linux.
  dialog_handler_ = new ClientDialogHandlerGtk();
#endif

This will require a bit more of modifications than it was required when copying Print dialog. That's because we already expose JSDialogHandler callbacks to python:

https://github.com/cztomczak/cefpython/blob/master/api/JavascriptDialogHandler.md

So the code needs to be modified to take into account that if there is a JavascriptDialogHandler callback provided in Python then use it, otherwise use the default implementation copied from cefclient. This might require modifying the javascript_dialog_handler.pyx file.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4