mirror of
https://github.com/oleid/gnome-shell-teatime.git
synced 2022-04-29 18:53:50 +00:00
Implement HiDPI scaling
This commit is contained in:
parent
51062d0eee
commit
2a053cf4ea
@ -399,6 +399,11 @@ const TeaTime = new Lang.Class({
|
|||||||
|
|
||||||
this._logo.setColor(this._primaryColor, this._secondaryColor);
|
this._logo.setColor(this._primaryColor, this._secondaryColor);
|
||||||
this._graphicalTimer.setColor(this._primaryColor, this._secondaryColor);
|
this._graphicalTimer.setColor(this._primaryColor, this._secondaryColor);
|
||||||
|
|
||||||
|
// forward (possible) scaling style change to child
|
||||||
|
let scaling = Utils.getGlobalDisplayScaleFactor();
|
||||||
|
this._logo.setScaling(scaling);
|
||||||
|
this._graphicalTimer.setScaling(scaling);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
11
src/icon.js
11
src/icon.js
@ -26,8 +26,9 @@ const TwoColorIcon = new Lang.Class({
|
|||||||
reactive: true,
|
reactive: true,
|
||||||
style: 'padding: 0px 2px'
|
style: 'padding: 0px 2px'
|
||||||
});
|
});
|
||||||
this.set_width(size);
|
this._base_size = size;
|
||||||
this.set_height(size);
|
this.setScaling(Utils.getGlobalDisplayScaleFactor());
|
||||||
|
|
||||||
this._drawingObject = drawingObject;
|
this._drawingObject = drawingObject;
|
||||||
|
|
||||||
this.connect('repaint', Lang.bind(this, this._drawIcon));
|
this.connect('repaint', Lang.bind(this, this._drawIcon));
|
||||||
@ -51,6 +52,12 @@ const TwoColorIcon = new Lang.Class({
|
|||||||
this._secundaryColor = secundary;
|
this._secundaryColor = secundary;
|
||||||
this.queue_repaint();
|
this.queue_repaint();
|
||||||
},
|
},
|
||||||
|
setScaling: function (newScale) {
|
||||||
|
this._default_scale = newScale;
|
||||||
|
this.set_width(this._base_size * this._default_scale);
|
||||||
|
this.set_height(this._base_size * this._default_scale);
|
||||||
|
this.queue_repaint();
|
||||||
|
},
|
||||||
setStatus: function (newStatus) {
|
setStatus: function (newStatus) {
|
||||||
this._customStatus = newStatus;
|
this._customStatus = newStatus;
|
||||||
this.queue_repaint();
|
this.queue_repaint();
|
||||||
|
@ -9,6 +9,7 @@ const ExtensionUtils = imports.misc.extensionUtils;
|
|||||||
const Me = ExtensionUtils.getCurrentExtension();
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
const Config = imports.misc.config;
|
const Config = imports.misc.config;
|
||||||
const Gst = imports.gi.Gst;
|
const Gst = imports.gi.Gst;
|
||||||
|
const St = imports.gi.St;
|
||||||
|
|
||||||
const TEATIME_STEEP_TIMES_KEY = 'steep-times';
|
const TEATIME_STEEP_TIMES_KEY = 'steep-times';
|
||||||
const TEATIME_FULLSCREEN_NOTIFICATION_KEY = 'fullscreen-notification';
|
const TEATIME_FULLSCREEN_NOTIFICATION_KEY = 'fullscreen-notification';
|
||||||
@ -138,3 +139,7 @@ function setCairoColorFromClutter(cr, c) {
|
|||||||
let s = 1.0 / 255;
|
let s = 1.0 / 255;
|
||||||
cr.setSourceRGBA(s * c.red, s * c.green, s * c.blue, s * c.alpha);
|
cr.setSourceRGBA(s * c.red, s * c.green, s * c.blue, s * c.alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getGlobalDisplayScaleFactor() {
|
||||||
|
return St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user