replace DrawingArea._onStyleChanged() by DrawingArea._updateStyle()

In test of gnome-shell 32 (in VM), 'style-changed' was regularly emitted
during drawing, so all 'this.current...' style properties was
initialized and it was impossible to select style with 'Ctrl+...'
shortcuts.
Now style is gathered on drawing mode entered, which is by the way more
frugal.
Keep watch possible regressions.
This commit is contained in:
abakkk 2019-03-16 12:35:14 +01:00
parent e3788ba37f
commit 764d18a090
1 changed files with 2 additions and 4 deletions

View File

@ -55,9 +55,6 @@ var DrawingArea = new Lang.Class({
_init: function(params, monitor, helper, loadJson) { _init: function(params, monitor, helper, loadJson) {
this.parent({ style_class: 'draw-on-your-screen', name: params && params.name ? params.name : ""}); this.parent({ style_class: 'draw-on-your-screen', name: params && params.name ? params.name : ""});
// 'style-changed' is emitted when 'this' is added to an actor
// ('this' needs to be in the stage to query theme_node)
this.connect('style-changed', this._onStyleChanged.bind(this));
this.connect('repaint', this._repaint.bind(this)); this.connect('repaint', this._repaint.bind(this));
this.settings = Convenience.getSettings(); this.settings = Convenience.getSettings();
@ -84,7 +81,7 @@ var DrawingArea = new Lang.Class({
this.queue_repaint(); this.queue_repaint();
}, },
_onStyleChanged: function() { _updateStyle: function() {
try { try {
let themeNode = this.get_theme_node(); let themeNode = this.get_theme_node();
for (let i = 1; i < 10; i++) { for (let i = 1; i < 10; i++) {
@ -470,6 +467,7 @@ var DrawingArea = new Lang.Class({
this.scrollHandler = this.connect('scroll-event', this._onScroll.bind(this)); this.scrollHandler = this.connect('scroll-event', this._onScroll.bind(this));
this.selectShape(Shapes.NONE); this.selectShape(Shapes.NONE);
this.get_parent().set_background_color(this.hasBackground ? this.activeBackgroundColor : null); this.get_parent().set_background_color(this.hasBackground ? this.activeBackgroundColor : null);
this._updateStyle();
}, },
leaveDrawingMode: function(save) { leaveDrawingMode: function(save) {