Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
[Linux only] CEF Upgrade to 2785 (#626)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
nethip authored and swmitra committed Dec 20, 2017
1 parent 908ed15 commit 6153714
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = function (grunt) {
}

if (platform === "linux") {
cef_version = "3.2704.1414";
cef_version = "3.2785.1486";
}

grunt.initConfig({
Expand Down
5 changes: 4 additions & 1 deletion appshell/appshell_extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

})();
33 changes: 33 additions & 0 deletions appshell/browser/root_window_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,46 @@ 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<CefBrowser> browser) {
REQUIRE_MAIN_THREAD();

// For popup browsers create the root window once the browser has been
// 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() {
Expand Down
6 changes: 5 additions & 1 deletion appshell/client_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
}

void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) {
CefRefPtr<CefFrame> frame
#ifdef OS_LINUX
,TransitionType transition_type
#endif
) {
CEF_REQUIRE_UI_THREAD();

if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
Expand Down
6 changes: 5 additions & 1 deletion appshell/client_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,

// CefLoadHandler methods
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) OVERRIDE;
CefRefPtr<CefFrame> frame
#ifdef OS_LINUX
,TransitionType transition_type
#endif
) OVERRIDE;
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int httpStatusCode) OVERRIDE;
Expand Down

0 comments on commit 6153714

Please sign in to comment.