[gnome-shell/gnome-3-10] layout: Set high dpi scaling factor
- From: Adel Gadllah <agadllah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-10] layout: Set high dpi scaling factor
- Date: Sat, 15 Feb 2014 12:18:14 +0000 (UTC)
commit 470889f1c303f96493c218949a52756910b5a53c
Author: Adel Gadllah <adel gadllah gmail com>
Date: Wed Feb 12 17:40:01 2014 +0100
layout: Set high dpi scaling factor
Set the scaling factor when the dpi is above the hidpi threshold.
https://bugzilla.gnome.org/show_bug.cgi?id=705410
js/ui/layout.js | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 17073a6..ab03f51 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -31,6 +31,9 @@ const MESSAGE_TRAY_PRESSURE_TIMEOUT = 1000; // ms
const HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels
const HOT_CORNER_PRESSURE_TIMEOUT = 1000; // ms
+// We scale up when the dpi is higher then this (same value used by gsd)
+const HIGH_DPI_LIMIT = 192;
+
function isPopupMetaWindow(actor) {
switch(actor.meta_window.get_window_type()) {
case Meta.WindowType.DROPDOWN_MENU:
@@ -484,8 +487,19 @@ const LayoutManager = new Lang.Class({
return false;
},
+ _updateScaling: function() {
+ let primary = this.monitors[this.primaryIndex];
+ let dpi_x = primary.width / (global.gdk_screen.get_monitor_width_mm(this.primaryIndex) / 25.4);
+ let dpi_y = primary.height / (global.gdk_screen.get_monitor_height_mm(this.primaryIndex) / 25.4);
+ if (dpi_x > HIGH_DPI_LIMIT && dpi_y > HIGH_DPI_LIMIT)
+ St.ThemeContext.get_for_stage(global.stage).scale_factor = 2;
+ else
+ St.ThemeContext.get_for_stage(global.stage).scale_factor = 1;
+ },
+
_monitorsChanged: function() {
this._updateMonitors();
+ this._updateScaling();
this._updateBoxes();
this._updateTrayBarrier();
this._updateHotCorners();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]