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;
|
||||
}, undefined);
|
||||
|
||||
const spacingRadians = Math.asin(monitorSpacingPixels / 2 / radiusPixels) * 2;
|
||||
if (closestWrap.pixel !== monitorBeginPixel) {
|
||||
// there's a gap between the cached wrap value and this one
|
||||
const gapPixels = monitorBeginPixel - closestWrap.pixel;
|
||||
const gapHalfRadians = Math.asin(gapPixels / 2 / radiusPixels);
|
||||
const gapRadians = gapHalfRadians * 2;
|
||||
|
||||
const appliedSpacingRadians = Math.trunc(gapPixels / monitorLengthPixels) * spacingRadians;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
const spacingRadians = monitorBeginPixel === 0 ? 0 : Math.asin(monitorSpacingPixels / 2 / radiusPixels);
|
||||
const monitorHalfRadians = Math.asin(monitorLengthPixels / 2 / radiusPixels);
|
||||
const centerRadians = closestWrap.radians + spacingRadians + monitorHalfRadians;
|
||||
const centerRadians = closestWrap.radians + 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
|
||||
cachedMonitorWrap.push({ pixel: monitorBeginPixel + monitorLengthPixels, radians: endRadians });
|
||||
cachedMonitorWrap.push({ pixel: monitorBeginPixel + monitorLengthPixels, radians: endRadians + spacingRadians });
|
||||
return {
|
||||
begin: closestWrap.radians,
|
||||
center: centerRadians,
|
||||
|
|
@ -609,12 +611,12 @@ export const VirtualMonitorsActor = GObject.registerClass({
|
|||
GObject.ParamFlags.READWRITE,
|
||||
'horizontal', ['horizontal', 'vertical', 'none']
|
||||
),
|
||||
'monitor-spacing': GObject.ParamSpec.double(
|
||||
'monitor-spacing': GObject.ParamSpec.int(
|
||||
'monitor-spacing',
|
||||
'Monitor Spacing',
|
||||
'Visual spacing between monitors',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
0.0, 1.0, 0.0
|
||||
0, 100, 0
|
||||
),
|
||||
'target-monitor': GObject.ParamSpec.jsobject(
|
||||
'target-monitor',
|
||||
|
|
@ -858,7 +860,7 @@ export const VirtualMonitorsActor = GObject.registerClass({
|
|||
height: monitor.height
|
||||
})),
|
||||
actualWrapScheme,
|
||||
this.monitor_spacing
|
||||
this.monitor_spacing / 1000.0
|
||||
);
|
||||
|
||||
// normalize the center vectors
|
||||
|
|
|
|||
|
|
@ -118,9 +118,9 @@
|
|||
How the monitors are wrapped around the viewport
|
||||
</description>
|
||||
</key>
|
||||
<key name="monitor-spacing" type="d">
|
||||
<key name="monitor-spacing" type="i">
|
||||
<default>
|
||||
0.0
|
||||
0
|
||||
</default>
|
||||
<summary>Monitor spacing</summary>
|
||||
<description>
|
||||
|
|
|
|||
|
|
@ -185,21 +185,23 @@
|
|||
<property name="valign">3</property>
|
||||
<property name="draw-value">true</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="has-origin">false</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment" id="monitor_spacing_adjustment">
|
||||
<property name="lower">0.0</property>
|
||||
<property name="upper">0.5</property>
|
||||
<property name="step-increment">0.01</property>
|
||||
<property name="value">0.0</property>
|
||||
<property name="lower">0</property>
|
||||
<property name="upper">100</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="value">0</property>
|
||||
</object>
|
||||
</property>
|
||||
<marks>
|
||||
<mark value="0.0" position="bottom"></mark>
|
||||
<mark value="0.25" position="bottom"></mark>
|
||||
<mark value="0.5" position="bottom"></mark>
|
||||
<mark value="0" position="bottom"></mark>
|
||||
<mark value="25" position="bottom"></mark>
|
||||
<mark value="50" position="bottom"></mark>
|
||||
<mark value="75" position="bottom"></mark>
|
||||
<mark value="100" position="bottom"></mark>
|
||||
</marks>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
|||
Loading…
Reference in New Issue