mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-02 03:28:28 -04:00
fix hover popouts in frame mode
This commit is contained in:
@@ -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.")
|
||||
|
||||
@@ -772,6 +772,34 @@
|
||||
],
|
||||
"icon": "display_settings"
|
||||
},
|
||||
{
|
||||
"section": "hoverPopouts",
|
||||
"label": "Hover Popouts",
|
||||
"tabIndex": 3,
|
||||
"category": "Dank Bar",
|
||||
"keywords": [
|
||||
"another",
|
||||
"bar",
|
||||
"dank",
|
||||
"delay",
|
||||
"hover",
|
||||
"hovering",
|
||||
"moving",
|
||||
"open",
|
||||
"over",
|
||||
"panel",
|
||||
"popout",
|
||||
"popouts",
|
||||
"reveal",
|
||||
"statusbar",
|
||||
"switches",
|
||||
"taskbar",
|
||||
"topbar",
|
||||
"widget"
|
||||
],
|
||||
"icon": "touch_app",
|
||||
"description": "Open widget popouts by hovering over the bar. Moving to another widget switches the popout."
|
||||
},
|
||||
{
|
||||
"section": "barPosition",
|
||||
"label": "Position",
|
||||
|
||||
Reference in New Issue
Block a user