[arch-commits] Commit in electron/trunk (3 files)
Nicola Squartini
tensor5 at archlinux.org
Wed Sep 28 10:18:31 UTC 2016
Date: Wednesday, September 28, 2016 @ 10:18:31
Author: tensor5
Revision: 190706
upgpkg: electron 1.4.1-2
Handle HiDPI without the GDK_SCALE hack.
Added:
electron/trunk/chromium-gtk3-hidpi.patch
Modified:
electron/trunk/PKGBUILD
Deleted:
electron/trunk/electron.sh
---------------------------+
PKGBUILD | 10 +++++---
chromium-gtk3-hidpi.patch | 49 ++++++++++++++++++++++++++++++++++++++++++++
electron.sh | 6 -----
3 files changed, 55 insertions(+), 10 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2016-09-28 10:08:43 UTC (rev 190705)
+++ PKGBUILD 2016-09-28 10:18:31 UTC (rev 190706)
@@ -4,7 +4,7 @@
_chromiumver=53.0.2785.113
pkgname=electron
pkgver=1.4.1
-pkgrel=1
+pkgrel=2
pkgdesc='Build cross platform desktop apps with web technologies'
arch=('i686' 'x86_64')
url='http://electron.atom.io/'
@@ -50,11 +50,11 @@
'libchromiumcontent-use-system-ffmpeg.patch'
'libchromiumcontent-use-system-tools.patch'
'chromium-cups.patch'
+ 'chromium-gtk3-hidpi.patch'
'chromium-gtk3-use-x11-backend.patch'
'chromium-unset-madv_free.patch'
'chromium-use-system-ffmpeg.patch'
'chromium-use-system-minizip.patch'
- 'electron.sh'
)
noextract=("chromium-${_chromiumver}.tar.xz")
sha256sums=('SKIP'
@@ -89,11 +89,11 @@
'6751b93f47c294a5b3ebca0e5fbb608cc034ac5ac0b30872916f42ba2cae4c5e'
'2fb2157c854dab173a2ef9b4aa0ab5bb3c0dd077447c4719c7554eee6e0546b6'
'f0db776be86c01020c6d28c9b4d2f53391692698231655003dcde43dea4eacb6'
+ '697767af13945702e57a182db561493d5fee431e82b17a776afe7fa1226ce353'
'9fd584d6198b915ad35198d1fcb6318e5ecb43b0befca95384148a305e2954dd'
'ccba3002243fb1f9a67c8a60af310706caa591d12aef45f1d0f4bda47626f3ab'
'7cda59fe372b37beca079adf55b951b4f3a6c7a5490813b729fa145562d2ba12'
'bc78d7af8e514ea28caa6c6ccaf78cc3e80044ef862e2ca7978439f183e36179'
- 'c4d171ea37c421e5e586f8735595012ad4aada9a3be9bfe86bc8abb5c5d1488e'
)
_chromium_flags=('fastbuild=2'
@@ -186,6 +186,7 @@
fi
cd src
patch -Np1 -i "${srcdir}"/chromium-cups.patch # fixes build with CUPS 2.2
+ patch -Np1 -i "${srcdir}"/chromium-gtk3-hidpi.patch
patch -Np1 -i "${srcdir}"/chromium-gtk3-use-x11-backend.patch
patch -Np1 -i "${srcdir}"/chromium-unset-madv_free.patch # fixes crash with kernels < 4.5
patch -Np1 -i "${srcdir}"/chromium-use-system-ffmpeg.patch
@@ -235,7 +236,8 @@
views_resources_200_percent.pak \
"${pkgdir}"/usr/lib/electron
install -m755 electron "${pkgdir}"/usr/lib/electron
- install -D -m755 "${srcdir}"/electron.sh "${pkgdir}"/usr/bin/electron
+ install -dm755 "${pkgdir}"/usr/bin
+ ln -s ../lib/electron/electron "${pkgdir}"/usr/bin
# namcap warning: Referenced library 'libnode.so' is an uninstalled dependency
# Fixable by moving libnode.so to /usr/lib
install -m644 libnode.so "${pkgdir}"/usr/lib/electron
Added: chromium-gtk3-hidpi.patch
===================================================================
--- chromium-gtk3-hidpi.patch (rev 0)
+++ chromium-gtk3-hidpi.patch 2016-09-28 10:18:31 UTC (rev 190706)
@@ -0,0 +1,49 @@
+--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
++++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+@@ -454,12 +454,18 @@
+
+ // Queries GTK for its font DPI setting and returns the number of pixels in a
+ // point.
++#if GTK_MAJOR_VERSION == 2
+ double GetPixelsInPoint(float device_scale_factor) {
++#else
++double GetPixelsInPoint() {
++#endif
+ double dpi = GetDPI();
+
++#if GTK_MAJOR_VERSION == 2
+ // Take device_scale_factor into account — if Chrome already scales the
+ // entire UI up by 2x, we should not also scale up.
+ dpi /= device_scale_factor;
++#endif
+
+ // There are 72 points in an inch.
+ return dpi / 72.0;
+@@ -1371,8 +1377,13 @@
+ // Round the value when converting to pixels to match GTK's logic.
+ const double size_points = pango_font_description_get_size(desc) /
+ static_cast<double>(PANGO_SCALE);
++#if GTK_MAJOR_VERSION == 2
+ default_font_size_pixels_ = static_cast<int>(
+ GetPixelsInPoint(device_scale_factor_) * size_points + 0.5);
++#else
++ default_font_size_pixels_ = static_cast<int>(
++ GetPixelsInPoint() * size_points + 0.5);
++#endif
+ query.point_size = static_cast<int>(size_points);
+ }
+
+@@ -1405,8 +1416,13 @@
+ float Gtk2UI::GetDeviceScaleFactor() const {
+ if (display::Display::HasForceDeviceScaleFactor())
+ return display::Display::GetForcedDeviceScaleFactor();
++#if GTK_MAJOR_VERSION == 2
+ const int kCSSDefaultDPI = 96;
+ const float scale = GetDPI() / kCSSDefaultDPI;
++#else
++ const float scale = static_cast<float>(gdk_window_get_scale_factor(
++ gdk_screen_get_root_window(gdk_screen_get_default())));
++#endif
+
+ // Blacklist scaling factors <130% (crbug.com/484400) and round
+ // to 1 decimal to prevent rendering problems (crbug.com/485183).
Deleted: electron.sh
===================================================================
--- electron.sh 2016-09-28 10:08:43 UTC (rev 190705)
+++ electron.sh 2016-09-28 10:18:31 UTC (rev 190706)
@@ -1,6 +0,0 @@
-#!/usr/bin/bash
-
-# Workaround for scaling issues on HiDPI displays
-export GDK_SCALE=${GDK_SCALE:-1}
-
-exec /usr/lib/electron/electron "$@"
More information about the arch-commits
mailing list