mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(desktop-widgets): restore mouse interaction. fix #2293
This commit is contained in:
@@ -57,10 +57,19 @@ Variants {
|
|||||||
id: window
|
id: window
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
screen: screenLoader.modelData
|
screen: screenLoader.modelData
|
||||||
mask: DesktopWidgetRegistry.editMode ? null : emptyRegion
|
mask: DesktopWidgetRegistry.editMode ? null : widgetsMask
|
||||||
|
|
||||||
|
// Dynamic mask: combine clickable regions for each loaded widget
|
||||||
|
property var _maskRegions: []
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: maskRegionComponent
|
||||||
|
Region {}
|
||||||
|
}
|
||||||
|
|
||||||
Region {
|
Region {
|
||||||
id: emptyRegion
|
id: widgetsMask
|
||||||
|
regions: window._maskRegions
|
||||||
}
|
}
|
||||||
|
|
||||||
WlrLayershell.layer: WlrLayer.Bottom
|
WlrLayershell.layer: WlrLayer.Bottom
|
||||||
@@ -278,6 +287,7 @@ Variants {
|
|||||||
|
|
||||||
required property var modelData
|
required property var modelData
|
||||||
required property int index
|
required property int index
|
||||||
|
property var _maskRegion: null
|
||||||
|
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
// Access registeredWidgets and pluginReloadCounter to create reactive binding
|
// Access registeredWidgets and pluginReloadCounter to create reactive binding
|
||||||
@@ -293,6 +303,13 @@ Variants {
|
|||||||
item.widgetData = modelData;
|
item.widgetData = modelData;
|
||||||
item.widgetIndex = index;
|
item.widgetIndex = index;
|
||||||
|
|
||||||
|
// Create mask region so this widget receives mouse input
|
||||||
|
_maskRegion = maskRegionComponent.createObject(window);
|
||||||
|
_maskRegion.item = item;
|
||||||
|
var newRegions = window._maskRegions.slice();
|
||||||
|
newRegions.push(_maskRegion);
|
||||||
|
window._maskRegions = newRegions;
|
||||||
|
|
||||||
// Inject plugin API for plugin widgets
|
// Inject plugin API for plugin widgets
|
||||||
if (DesktopWidgetRegistry.isPluginWidget(modelData.id)) {
|
if (DesktopWidgetRegistry.isPluginWidget(modelData.id)) {
|
||||||
var pluginId = modelData.id.replace("plugin:", "");
|
var pluginId = modelData.id.replace("plugin:", "");
|
||||||
@@ -303,6 +320,18 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up mask region when widget unloads
|
||||||
|
onItemChanged: {
|
||||||
|
if (!item && _maskRegion) {
|
||||||
|
var region = _maskRegion;
|
||||||
|
_maskRegion = null;
|
||||||
|
window._maskRegions = window._maskRegions.filter(function (r) {
|
||||||
|
return r !== region;
|
||||||
|
});
|
||||||
|
region.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user