Column: make stack offsets configurable
This commit is contained in:
@@ -280,14 +280,14 @@
|
||||
</item>
|
||||
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_manualScrollStep">
|
||||
<widget class="QLabel" name="label_stackOffsetX">
|
||||
<property name="text">
|
||||
<string>Manual scroll step size:</string>
|
||||
<string>Horizontal offset for stacked columns:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="kcfg_manualScrollStep">
|
||||
<widget class="QSpinBox" name="kcfg_stackOffsetX">
|
||||
<property name="suffix">
|
||||
<string> px</string>
|
||||
</property>
|
||||
@@ -301,6 +301,48 @@
|
||||
</item>
|
||||
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_stackOffsetY">
|
||||
<property name="text">
|
||||
<string>Vertical offset for stacked columns:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="kcfg_stackOffsetY">
|
||||
<property name="suffix">
|
||||
<string> px</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_manualScrollStep">
|
||||
<property name="text">
|
||||
<string>Manual scroll step size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="kcfg_manualScrollStep">
|
||||
<property name="suffix">
|
||||
<string> px</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_presetWidths">
|
||||
<property name="text">
|
||||
<string>Preset widths:</string>
|
||||
@@ -310,7 +352,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="kcfg_presetWidths">
|
||||
<property name="toolTip">
|
||||
<string>Comma-separated list of widths. Supported units: "px" and "%".</string>
|
||||
@@ -318,14 +360,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="8" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_offScreenOpacity">
|
||||
<property name="text">
|
||||
<string>Obscured window opacity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QSpinBox" name="kcfg_offScreenOpacity">
|
||||
<property name="suffix">
|
||||
<string> %</string>
|
||||
|
||||
@@ -5,6 +5,8 @@ type Config = {
|
||||
gapsOuterRight: number;
|
||||
gapsInnerHorizontal: number;
|
||||
gapsInnerVertical: number;
|
||||
stackOffsetX: number;
|
||||
stackOffsetY: number;
|
||||
manualScrollStep: number;
|
||||
presetWidths: string;
|
||||
offScreenOpacity: number;
|
||||
|
||||
@@ -84,6 +84,16 @@ const configDef = [
|
||||
type: "UInt",
|
||||
default: 8,
|
||||
},
|
||||
{
|
||||
name: "stackOffsetX",
|
||||
type: "UInt",
|
||||
default: 8,
|
||||
},
|
||||
{
|
||||
name: "stackOffsetY",
|
||||
type: "UInt",
|
||||
default: 32,
|
||||
},
|
||||
{
|
||||
name: "manualScrollStep",
|
||||
type: "UInt",
|
||||
|
||||
@@ -6,8 +6,6 @@ class Column {
|
||||
private stacked: boolean;
|
||||
private focusTaker: Window|null;
|
||||
private static readonly minWidth = 40;
|
||||
public static readonly stackOffsetX = 10; // TODO: make configurable
|
||||
public static readonly stackOffsetY = 30; // TODO: make configurable
|
||||
|
||||
constructor(grid: Grid, leftColumn: Column|null) {
|
||||
this.gridX = 0;
|
||||
@@ -234,15 +232,15 @@ class Column {
|
||||
|
||||
public arrangeStacked(x: number) {
|
||||
const nWindows = this.windows.length();
|
||||
const windowWidth = this.width - (nWindows - 1) * Column.stackOffsetX;
|
||||
const windowHeight = this.grid.desktop.tilingArea.height - (nWindows - 1) * Column.stackOffsetY;
|
||||
const windowWidth = this.width - (nWindows - 1) * this.grid.config.stackOffsetX;
|
||||
const windowHeight = this.grid.desktop.tilingArea.height - (nWindows - 1) * this.grid.config.stackOffsetY;
|
||||
|
||||
let windowX = x;
|
||||
let windowY = this.grid.desktop.tilingArea.y;
|
||||
for (const window of this.windows.iterator()) {
|
||||
window.arrange(windowX, windowY, windowWidth, windowHeight);
|
||||
windowX += Column.stackOffsetX;
|
||||
windowY += Column.stackOffsetY;
|
||||
windowX += this.grid.config.stackOffsetX;
|
||||
windowY += this.grid.config.stackOffsetY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
type LayoutConfig = {
|
||||
gapsInnerHorizontal: number;
|
||||
gapsInnerVertical: number;
|
||||
stackOffsetX: number;
|
||||
stackOffsetY: number;
|
||||
offScreenOpacity: number;
|
||||
stackColumnsByDefault: boolean;
|
||||
resizeNeighborColumn: boolean;
|
||||
|
||||
@@ -40,6 +40,8 @@ class World {
|
||||
const layoutConfig = {
|
||||
gapsInnerHorizontal: config.gapsInnerHorizontal,
|
||||
gapsInnerVertical: config.gapsInnerVertical,
|
||||
stackOffsetX: config.stackOffsetX,
|
||||
stackOffsetY: config.stackOffsetY,
|
||||
offScreenOpacity: config.offScreenOpacity / 100.0,
|
||||
stackColumnsByDefault: config.stackColumnsByDefault,
|
||||
resizeNeighborColumn: config.resizeNeighborColumn,
|
||||
|
||||
@@ -152,10 +152,10 @@ namespace Assert {
|
||||
function getRectInGridStacked(column: number, window: number, nColumns: number, nWindows: number) {
|
||||
const columnX = startX + column * (columnWidth + config.gapsInnerHorizontal);
|
||||
return new MockQmlRect(
|
||||
columnX + window * Column.stackOffsetX,
|
||||
tilingArea.y + window * Column.stackOffsetY,
|
||||
columnWidth - (nWindows-1) * Column.stackOffsetX,
|
||||
tilingArea.height - (nWindows-1) * Column.stackOffsetY,
|
||||
columnX + window * config.stackOffsetX,
|
||||
tilingArea.y + window * config.stackOffsetY,
|
||||
columnWidth - (nWindows-1) * config.stackOffsetX,
|
||||
tilingArea.height - (nWindows-1) * config.stackOffsetY,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user