diff --git a/area.js b/area.js
index 1580a2d..321fb84 100644
--- a/area.js
+++ b/area.js
@@ -241,7 +241,7 @@ var DrawingArea = new Lang.Class({
while (this.squareAreaSize * 2 < Math.min(this.monitor.width, this.monitor.height))
this.squareAreaSize *= 2;
} else {
- this.squareAreaSize = Math.max(64, Me.drawingSettings.get_uint('square-area-size'));
+ this.squareAreaSize = Me.drawingSettings.get_uint('square-area-size');
}
this.areaBackgroundColor = getClutterColorFromString(Me.drawingSettings.get_string('background-color'), 'BLACK');
@@ -251,16 +251,16 @@ var DrawingArea = new Lang.Class({
this.gridLineSpacing = Math.round(this.monitor.width / (5 * GRID_TILES_HORIZONTAL_NUMBER));
this.gridLineWidth = this.gridLineSpacing / 20;
} else {
- this.gridLineSpacing = Math.max(1, Me.drawingSettings.get_uint('grid-line-spacing'));
- this.gridLineWidth = Math.round(Math.max(0.1, Me.drawingSettings.get_double('grid-line-width')) * 100) / 100;
+ this.gridLineSpacing = Me.drawingSettings.get_uint('grid-line-spacing');
+ this.gridLineWidth = Math.round(Me.drawingSettings.get_double('grid-line-width') * 100) / 100;
}
this.dashOffset = Math.round(Me.drawingSettings.get_double('dash-offset') * 100) / 100;
if (Me.drawingSettings.get_boolean('dash-array-auto')) {
this.dashArray = [0, 0];
} else {
- let on = Math.round(Math.max(0, Me.drawingSettings.get_double('dash-array-on')) * 100) / 100;
- let off = Math.round(Math.max(0, Me.drawingSettings.get_double('dash-array-off')) * 100) / 100;
+ let on = Math.round(Me.drawingSettings.get_double('dash-array-on') * 100) / 100;
+ let off = Math.round(Me.drawingSettings.get_double('dash-array-off') * 100) / 100;
this.dashArray = [on, off];
}
},
diff --git a/elements.js b/elements.js
index e7b5905..3191dfb 100644
--- a/elements.js
+++ b/elements.js
@@ -35,18 +35,18 @@ var getPangoFontFamilies = function() {
};
const getFillRuleSvgName = function(fillRule) {
- return fillRule == Pango.FillRule.EVEN_ODD ? 'evenodd' : 'nonzero';
+ return fillRule == Cairo.FillRule.EVEN_ODD ? 'evenodd' : 'nonzero';
};
const getLineCapSvgName = function(lineCap) {
- return lineCap == Pango.LineCap.BUTT ? 'butt' :
- lineCap == Pango.LineCap.SQUASH ? 'square' :
+ return lineCap == Cairo.LineCap.BUTT ? 'butt' :
+ lineCap == Cairo.LineCap.SQUASH ? 'square' :
'round';
};
const getLineJoinSvgName = function(lineJoin) {
- return lineJoin == Pango.LineJoin.MITER ? 'miter' :
- lineJoin == Pango.LineJoin.BEVEL ? 'bevel' :
+ return lineJoin == Cairo.LineJoin.MITER ? 'miter' :
+ lineJoin == Cairo.LineJoin.BEVEL ? 'bevel' :
'round';
};
diff --git a/prefs.js b/prefs.js
index 998cc56..dea0c8f 100644
--- a/prefs.js
+++ b/prefs.js
@@ -181,8 +181,8 @@ const DrawingPage = new GObject.Class({
let squareAreaAutoButton = new Gtk.CheckButton({ label: _("Auto"),
name: this.schema.get_key('square-area-auto').get_summary(),
tooltip_text: this.schema.get_key('square-area-auto').get_description() });
- let squareAreaSizeButton = new PixelSpinButton({ width_chars: 5, digits: 0,
- adjustment: Gtk.Adjustment.new(0, 64, 32768, 1, 10, 0),
+ let squareAreaSizeButton = new PixelSpinButton({ width_chars: 5, digits: 0, step: 1,
+ range: this.schema.get_key('square-area-size').get_range(),
name: this.schema.get_key('square-area-size').get_summary(),
tooltip_text: this.schema.get_key('square-area-size').get_description() });
this.settings.bind('square-area-auto', squareAreaAutoButton, 'active', 0);
@@ -204,12 +204,12 @@ const DrawingPage = new GObject.Class({
let gridLineAutoButton = new Gtk.CheckButton({ label: _("Auto"),
name: this.schema.get_key('grid-line-auto').get_summary(),
tooltip_text: this.schema.get_key('grid-line-auto').get_description() });
- let gridLineWidthButton = new PixelSpinButton({ width_chars: 5, digits: 1,
- adjustment: Gtk.Adjustment.new(0, 0.1, 10, 0.1, 1, 0),
+ let gridLineWidthButton = new PixelSpinButton({ width_chars: 5, digits: 1, step: 0.1,
+ range: this.schema.get_key('grid-line-width').get_range(),
name: this.schema.get_key('grid-line-width').get_summary(),
tooltip_text: this.schema.get_key('grid-line-width').get_description() });
- let gridLineSpacingButton = new PixelSpinButton({ width_chars: 5, digits: 1,
- adjustment: Gtk.Adjustment.new(0, 1, 16384, 1, 10, 0),
+ let gridLineSpacingButton = new PixelSpinButton({ width_chars: 5, digits: 1, step: 1,
+ range: this.schema.get_key('grid-line-spacing').get_range(),
name: this.schema.get_key('grid-line-spacing').get_summary(),
tooltip_text: this.schema.get_key('grid-line-spacing').get_description() });
this.settings.bind('grid-line-auto', gridLineAutoButton, 'active', 0);
@@ -241,12 +241,12 @@ const DrawingPage = new GObject.Class({
let dashArrayAutoButton = new Gtk.CheckButton({ label: _("Auto"),
name: this.schema.get_key('dash-array-auto').get_summary(),
tooltip_text: this.schema.get_key('dash-array-auto').get_description() });
- let dashArrayOnButton = new PixelSpinButton({ width_chars: 5, digits: 1,
- adjustment: Gtk.Adjustment.new(0, 0, 16384, 0.1, 1, 0),
+ let dashArrayOnButton = new PixelSpinButton({ width_chars: 5, digits: 1, step: 0.1,
+ range: this.schema.get_key('dash-array-on').get_range(),
name: this.schema.get_key('dash-array-on').get_summary(),
tooltip_text: this.schema.get_key('dash-array-on').get_description() });
- let dashArrayOffButton = new PixelSpinButton({ width_chars: 5, digits: 1,
- adjustment: Gtk.Adjustment.new(0, 0, 16384, 0.1, 1, 0),
+ let dashArrayOffButton = new PixelSpinButton({ width_chars: 5, digits: 1, step: 0.1,
+ range: this.schema.get_key('dash-array-off').get_range(),
name: this.schema.get_key('dash-array-off').get_summary(),
tooltip_text: this.schema.get_key('dash-array-off').get_description() });
this.settings.bind('dash-array-auto', dashArrayAutoButton, 'active', 0);
@@ -260,8 +260,8 @@ const DrawingPage = new GObject.Class({
toolsListBox.add(dashArrayRow);
let dashOffsetRow = new PrefRow({ label: this.schema.get_key('dash-offset').get_summary() });
- let dashOffsetButton = new PixelSpinButton({ width_chars: 5, digits: 1,
- adjustment: Gtk.Adjustment.new(0, -16384, 16384, 0.1, 1, 0),
+ let dashOffsetButton = new PixelSpinButton({ width_chars: 5, digits: 1, step: 0.1,
+ range: this.schema.get_key('dash-offset').get_range(),
name: this.schema.get_key('dash-offset').get_summary(),
tooltip_text: this.schema.get_key('dash-offset').get_description() });
this.settings.bind('dash-offset', dashOffsetButton, 'value', 0);
@@ -523,6 +523,28 @@ const PixelSpinButton = new GObject.Class({
Name: 'DrawOnYourScreenPixelSpinButton',
GTypeName: 'DrawOnYourScreenPixelSpinButton',
Extends: Gtk.SpinButton,
+ Properties: {
+ 'range': GObject.param_spec_variant('range', 'range', 'GSettings range',
+ GLib.VariantType.new('(sv)'), null, GObject.ParamFlags.WRITABLE),
+
+ 'step': GObject.ParamSpec.double('step', 'step', 'step increment',
+ GObject.ParamFlags.WRITABLE,
+ 0, 1000, 1)
+ },
+
+ set range(range) {
+ let [type, variant] = range.deep_unpack();
+ if (type == 'range') {
+ let [min, max] = variant.deep_unpack();
+ this.adjustment.set_lower(min);
+ this.adjustment.set_upper(max);
+ }
+ },
+
+ set step(step) {
+ this.adjustment.set_step_increment(step);
+ this.adjustment.set_page_increment(step * 10);
+ },
// Add 'px' unit.
vfunc_output: function() {
diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled
index 85cce3a..411939e 100644
Binary files a/schemas/gschemas.compiled and b/schemas/gschemas.compiled differ
diff --git a/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml b/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml
index beea9e5..a0af683 100644
--- a/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.draw-on-your-screen.gschema.xml
@@ -48,16 +48,19 @@
Compute the lengths from the line width
+
5
Dash array on
The dash length in pixels
+
15
Dash array off
The gap between the dashes in pixels
+
0
Dash offset
The dash offset in pixels
@@ -73,11 +76,13 @@
Compute the lengths from the screen size
+
10
Grid overlay line spacing
The gap between lines in pixels
+
0.5
Grid overlay line width
The line width in pixels
@@ -102,6 +107,7 @@
Compute the size of the square area from the screen size
+
512
Square area size
The size of the square area in pixels