Dim the screen underneath when a context menu is open

This commit is contained in:
James Babcock committed 2026-09-03 01:25:10 -07:00
1 parent 83c3732ba7
commit 9234458dd6
13 files changed
+211 -14

No files matched your search

+17
View File
@@ -120,6 +120,11 @@ function nonNegativeNumber(value: number): number {
return Number.isFinite(numeric) ? Math.max(0, numeric) : 0;
}
/** A 0..1 brightness factor as the compositor's 0..256 fixed-point form. */
export function dimFactor256(factor: number): number {
return Math.round(Math.max(0, Math.min(1, factor)) * 256);
}
export class FaceclawCommunicatorBridge {
private readonly communicator: any;
private readonly listenerProxy: any;
@@ -524,6 +529,18 @@ export class FaceclawCommunicatorBridge {
});
}
/**
* Dim every compositor surface whose zOrder is below `belowZOrder` to
* `factor` (0..1; 1 = no dimming) of its brightness; takes effect at the
* next composite. How a shell overlay's Layer.dimUnderneath reaches the
* window surfaces beneath the shell surface.
*/
async setUnderlayDim(belowZOrder: number, factor: number): Promise<void> {
await this.enqueueJavaCall(() => {
this.communicator.setUnderlayDim(Math.round(belowZOrder), dimFactor256(factor));
});
}
/** Show or hide a compositor surface; takes effect at the next composite. */
async setSurfaceVisible(id: string, visible: boolean): Promise<void> {
await this.enqueueJavaCall(() => {