Fix monitor spacing issue with monitors to the left of the primary, update controls
This commit is contained in:
parent
efdb6b464c
commit
44feff832c
|
|
@ -73,24 +73,26 @@ function monitorWrap(cachedMonitorWrap, radiusPixels, monitorSpacingPixels, moni
|
||||||
return (!previous || Math.abs(current.pixel - monitorBeginPixel) < Math.abs(previous.pixel - monitorBeginPixel)) ? current : previous;
|
return (!previous || Math.abs(current.pixel - monitorBeginPixel) < Math.abs(previous.pixel - monitorBeginPixel)) ? current : previous;
|
||||||
}, undefined);
|
}, undefined);
|
||||||
|
|
||||||
|
const spacingRadians = Math.asin(monitorSpacingPixels / 2 / radiusPixels) * 2;
|
||||||
if (closestWrap.pixel !== monitorBeginPixel) {
|
if (closestWrap.pixel !== monitorBeginPixel) {
|
||||||
// there's a gap between the cached wrap value and this one
|
// there's a gap between the cached wrap value and this one
|
||||||
const gapPixels = monitorBeginPixel - closestWrap.pixel;
|
const gapPixels = monitorBeginPixel - closestWrap.pixel;
|
||||||
const gapHalfRadians = Math.asin(gapPixels / 2 / radiusPixels);
|
const gapHalfRadians = Math.asin(gapPixels / 2 / radiusPixels);
|
||||||
const gapRadians = gapHalfRadians * 2;
|
const gapRadians = gapHalfRadians * 2;
|
||||||
|
|
||||||
|
const appliedSpacingRadians = Math.trunc(gapPixels / monitorLengthPixels) * spacingRadians;
|
||||||
|
|
||||||
// update the closestWrap value and cache it
|
// update the closestWrap value and cache it
|
||||||
closestWrap = { pixel: monitorBeginPixel, radians: closestWrap.radians + gapRadians };
|
closestWrap = { pixel: monitorBeginPixel, radians: closestWrap.radians + gapRadians + appliedSpacingRadians };
|
||||||
cachedMonitorWrap.push(closestWrap);
|
cachedMonitorWrap.push(closestWrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
const spacingRadians = monitorBeginPixel === 0 ? 0 : Math.asin(monitorSpacingPixels / 2 / radiusPixels);
|
|
||||||
const monitorHalfRadians = Math.asin(monitorLengthPixels / 2 / radiusPixels);
|
const monitorHalfRadians = Math.asin(monitorLengthPixels / 2 / radiusPixels);
|
||||||
const centerRadians = closestWrap.radians + spacingRadians + monitorHalfRadians;
|
const centerRadians = closestWrap.radians + monitorHalfRadians;
|
||||||
const endRadians = centerRadians + monitorHalfRadians;
|
const endRadians = centerRadians + monitorHalfRadians;
|
||||||
|
|
||||||
// since we're computing the end values for this monitor, cache them too in case they line up with a future monitor
|
// since we're computing the end values for this monitor, cache them too in case they line up with a future monitor
|
||||||
cachedMonitorWrap.push({ pixel: monitorBeginPixel + monitorLengthPixels, radians: endRadians });
|
cachedMonitorWrap.push({ pixel: monitorBeginPixel + monitorLengthPixels, radians: endRadians + spacingRadians });
|
||||||
return {
|
return {
|
||||||
begin: closestWrap.radians,
|
begin: closestWrap.radians,
|
||||||
center: centerRadians,
|
center: centerRadians,
|
||||||
|
|
@ -609,12 +611,12 @@ export const VirtualMonitorsActor = GObject.registerClass({
|
||||||
GObject.ParamFlags.READWRITE,
|
GObject.ParamFlags.READWRITE,
|
||||||
'horizontal', ['horizontal', 'vertical', 'none']
|
'horizontal', ['horizontal', 'vertical', 'none']
|
||||||
),
|
),
|
||||||
'monitor-spacing': GObject.ParamSpec.double(
|
'monitor-spacing': GObject.ParamSpec.int(
|
||||||
'monitor-spacing',
|
'monitor-spacing',
|
||||||
'Monitor Spacing',
|
'Monitor Spacing',
|
||||||
'Visual spacing between monitors',
|
'Visual spacing between monitors',
|
||||||
GObject.ParamFlags.READWRITE,
|
GObject.ParamFlags.READWRITE,
|
||||||
0.0, 1.0, 0.0
|
0, 100, 0
|
||||||
),
|
),
|
||||||
'target-monitor': GObject.ParamSpec.jsobject(
|
'target-monitor': GObject.ParamSpec.jsobject(
|
||||||
'target-monitor',
|
'target-monitor',
|
||||||
|
|
@ -858,7 +860,7 @@ export const VirtualMonitorsActor = GObject.registerClass({
|
||||||
height: monitor.height
|
height: monitor.height
|
||||||
})),
|
})),
|
||||||
actualWrapScheme,
|
actualWrapScheme,
|
||||||
this.monitor_spacing
|
this.monitor_spacing / 1000.0
|
||||||
);
|
);
|
||||||
|
|
||||||
// normalize the center vectors
|
// normalize the center vectors
|
||||||
|
|
|
||||||
|
|
@ -118,9 +118,9 @@
|
||||||
How the monitors are wrapped around the viewport
|
How the monitors are wrapped around the viewport
|
||||||
</description>
|
</description>
|
||||||
</key>
|
</key>
|
||||||
<key name="monitor-spacing" type="d">
|
<key name="monitor-spacing" type="i">
|
||||||
<default>
|
<default>
|
||||||
0.0
|
0
|
||||||
</default>
|
</default>
|
||||||
<summary>Monitor spacing</summary>
|
<summary>Monitor spacing</summary>
|
||||||
<description>
|
<description>
|
||||||
|
|
|
||||||
|
|
@ -185,21 +185,23 @@
|
||||||
<property name="valign">3</property>
|
<property name="valign">3</property>
|
||||||
<property name="draw-value">true</property>
|
<property name="draw-value">true</property>
|
||||||
<property name="value-pos">0</property>
|
<property name="value-pos">0</property>
|
||||||
<property name="digits">2</property>
|
<property name="digits">0</property>
|
||||||
<property name="width-request">350</property>
|
<property name="width-request">350</property>
|
||||||
<property name="has-origin">false</property>
|
<property name="has-origin">false</property>
|
||||||
<property name="adjustment">
|
<property name="adjustment">
|
||||||
<object class="GtkAdjustment" id="monitor_spacing_adjustment">
|
<object class="GtkAdjustment" id="monitor_spacing_adjustment">
|
||||||
<property name="lower">0.0</property>
|
<property name="lower">0</property>
|
||||||
<property name="upper">0.5</property>
|
<property name="upper">100</property>
|
||||||
<property name="step-increment">0.01</property>
|
<property name="step-increment">1</property>
|
||||||
<property name="value">0.0</property>
|
<property name="value">0</property>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
<marks>
|
<marks>
|
||||||
<mark value="0.0" position="bottom"></mark>
|
<mark value="0" position="bottom"></mark>
|
||||||
<mark value="0.25" position="bottom"></mark>
|
<mark value="25" position="bottom"></mark>
|
||||||
<mark value="0.5" position="bottom"></mark>
|
<mark value="50" position="bottom"></mark>
|
||||||
|
<mark value="75" position="bottom"></mark>
|
||||||
|
<mark value="100" position="bottom"></mark>
|
||||||
</marks>
|
</marks>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue