From dc991b68cdb58e0fe065e20857a06264accdd288 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Wed, 20 Dec 2017 02:32:21 -0500 Subject: [PATCH] [Linux only] CEF Upgrade to 2785 (#626) * Force HiDPI to scale factor 1.0 for now on Linux * Linux only: Changes required for CEF 2785 Integration * 1) Removed force-device-scale-factor code\n 2) Introduced Delayed resize to repaginate view port content 3) Change the minor version of CEF to 1486 * Removing unused variable. * Address review comments. * Reverting the space change. --- Gruntfile.js | 2 +- appshell/appshell_extensions.js | 5 ++++- appshell/browser/root_window_gtk.cc | 33 +++++++++++++++++++++++++++++ appshell/client_handler.cpp | 6 +++++- appshell/client_handler.h | 6 +++++- 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8758a8f1e..3335e0664 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -38,7 +38,7 @@ module.exports = function (grunt) { } if (platform === "linux") { - cef_version = "3.2704.1414"; + cef_version = "3.2785.1486"; } grunt.initConfig({ diff --git a/appshell/appshell_extensions.js b/appshell/appshell_extensions.js index 91a945444..ebfbf6155 100644 --- a/appshell/appshell_extensions.js +++ b/appshell/appshell_extensions.js @@ -942,5 +942,8 @@ if (!appshell.app) { // Alias the appshell object to brackets. This is temporary and should be removed. - brackets = appshell; + // The following is now moved to Global.js as newer versions of CEF crash upon + // eval of this statement. + //brackets = appshell; + })(); diff --git a/appshell/browser/root_window_gtk.cc b/appshell/browser/root_window_gtk.cc index b22c63509..d566bbdd3 100644 --- a/appshell/browser/root_window_gtk.cc +++ b/appshell/browser/root_window_gtk.cc @@ -360,6 +360,36 @@ void RootWindowGtk::CreateRootWindow(const CefBrowserSettings& settings) { } } +// The following function makes sure we repaginate +// the content once the window is shown first. The +// problem was that the view port was not getting +// updated and a fake resize was required for the +// content to repaginate. +void DelayedResize(GtkWidget* window_) { + if(window_){ + GtkWindow* window = GTK_WINDOW(window_); + GdkWindow* gdk_window = gtk_widget_get_window(window_); + + gint x; + gint y; + gint width; + gint height; + gint depth; + + gdk_window_get_geometry (gdk_window, + &x, + &y, + &width, + &height, + &depth); + + // A hack to repaginate the content inside the window. + // Nudge the width and height by one pixel, so that the + // resize is not noticeable. + gdk_window_resize (gdk_window, width + 1, height + 1); + } +} + void RootWindowGtk::OnBrowserCreated(CefRefPtr browser) { REQUIRE_MAIN_THREAD(); @@ -367,6 +397,9 @@ void RootWindowGtk::OnBrowserCreated(CefRefPtr browser) { // created. if (is_popup_) CreateRootWindow(CefBrowserSettings()); + + // Post a message to CEF queue for delated resize. + CefPostTask(TID_UI, base::Bind(&DelayedResize, window_)); } void RootWindowGtk::OnBrowserWindowDestroyed() { diff --git a/appshell/client_handler.cpp b/appshell/client_handler.cpp index 18698d2f6..9add38a83 100644 --- a/appshell/client_handler.cpp +++ b/appshell/client_handler.cpp @@ -202,7 +202,11 @@ bool ClientHandler::OnDragEnter(CefRefPtr browser, } void ClientHandler::OnLoadStart(CefRefPtr browser, - CefRefPtr frame) { + CefRefPtr frame + #ifdef OS_LINUX + ,TransitionType transition_type + #endif + ) { CEF_REQUIRE_UI_THREAD(); if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { diff --git a/appshell/client_handler.h b/appshell/client_handler.h index ed6ade301..b9a516c99 100644 --- a/appshell/client_handler.h +++ b/appshell/client_handler.h @@ -126,7 +126,11 @@ virtual bool OnBeforePopup(CefRefPtr browser, // CefLoadHandler methods virtual void OnLoadStart(CefRefPtr browser, - CefRefPtr frame) OVERRIDE; + CefRefPtr frame + #ifdef OS_LINUX + ,TransitionType transition_type + #endif + ) OVERRIDE; virtual void OnLoadEnd(CefRefPtr browser, CefRefPtr frame, int httpStatusCode) OVERRIDE;