1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-03 12:08:31 -04:00

fix hover popouts in frame mode

This commit is contained in:
bbedward
2026-07-22 13:21:22 -04:00
parent 602697ef51
commit cee7957e15
3 changed files with 59 additions and 0 deletions
+29
View File
@@ -235,6 +235,33 @@ PanelWindow {
return Math.max(0, Math.round(Theme.px(value, win._dpr)));
}
function _pointInBand(lx, ly, bx, by, bw, bh, pad) {
return lx >= bx - pad && lx < bx + bw + pad && ly >= by - pad && ly < by + bh + pad;
}
function containsGlobalPoint(gx, gy, padding) {
if (!win._connectedActive || !win.contentItem)
return false;
const origin = win.contentItem.mapToItem(null, 0, 0);
if (!origin)
return false;
const pad = padding !== undefined ? padding : 16;
const lx = gx - origin.x;
const ly = gy - origin.y;
const w = win._windowRegionWidth;
const h = win._windowRegionHeight;
const edges = win.barEdges;
if (edges.includes("top") && win._pointInBand(lx, ly, 0, 0, w, win.cutoutTopInset, pad))
return true;
if (edges.includes("bottom") && win._pointInBand(lx, ly, 0, h - win.cutoutBottomInset, w, win.cutoutBottomInset, pad))
return true;
if (edges.includes("left") && win._pointInBand(lx, ly, 0, 0, win.cutoutLeftInset, h, pad))
return true;
if (edges.includes("right") && win._pointInBand(lx, ly, w - win.cutoutRightInset, 0, win.cutoutRightInset, h, pad))
return true;
return false;
}
readonly property int cutoutTopInset: win._regionInt(barEdges.includes("top") ? SettingsData.frameBarSize : SettingsData.frameThickness)
readonly property int cutoutBottomInset: win._regionInt(barEdges.includes("bottom") ? SettingsData.frameBarSize : SettingsData.frameThickness)
readonly property int cutoutLeftInset: win._regionInt(barEdges.includes("left") ? SettingsData.frameBarSize : SettingsData.frameThickness)
@@ -1093,10 +1120,12 @@ PanelWindow {
}
Component.onCompleted: {
KeyboardFocus.registerBarWindow(win);
win._scheduleBlurRebuild();
win._scheduleSurfaceRefresh();
}
Component.onDestruction: {
KeyboardFocus.unregisterBarWindow(win);
blurRebuildAction.cancel();
surfaceRefreshAction.cancel();
win._teardownBlur();
@@ -1256,6 +1256,8 @@ Item {
}
SettingsToggleCard {
settingKey: "hoverPopouts"
tags: ["bar", "hover", "popout", "reveal", "widget", "delay"]
iconName: "touch_app"
title: I18n.tr("Hover Popouts")
description: I18n.tr("Open widget popouts by hovering over the bar. Moving to another widget switches the popout.")