jbrowser.ui.backdrop
Generated from the source code of JBrowser 1.6.2.
One owner for a top-level window's Windows 11 look: the system material behind it and its light/dark mode.
Windows keeps that state per native window, and more than one party touches it: JBrowser, and Qt, which re-applies its own idea of light/dark to every window frame when the application palette or colour scheme changes. Earlier versions applied the state from several places, read it back, rebuilt the material when it looked wrong and changed JBrowser's whole look when Windows reported a failure. On some PCs those reactions fed each other: pale windows behind dark text, a stale rectangle after maximising, a caption that stopped dragging, a window that flashed black or white and stopped responding.
So, per window, one Backdrop:
- applies the material and the mode when they change (and once for each new native window), and never reads anything back from Windows;
- after anything that can reset the mode (palette or theme changes, activation, window state changes, Windows settings broadcasts), sets the mode again. Setting the same value is free and changes nothing on screen, so nothing can loop;
- never rebuilds the material, never forces a frame refresh and never restyles the application.
JBrowser also paints its own base colour under its content (Theme.backdrop_layers), so the window
stays readable whatever Windows draws behind it.
Backdrop#
class Backdrop(QObject)source
Backdrop(window: QWidget, kind: str='window')
Keeps window's system backdrop and light/dark mode in step with the theme.
kind is "window" (a frameless JBrowser window with a material), "popup" (a borderless
popup: Acrylic over the whole window) or "frame" (a dialog with a native title bar: only the
mode and the caption colours).
Backdrop.schedule#
schedule() -> Nonesource
Apply soon, once, after the current event (Qt's own handling of it comes first).
Backdrop.apply#
apply(showing: bool=False) -> Nonesource
Qt overrides: eventFilter
Functions#
caption_hit#
caption_hit(window: QWidget, local: QPoint, max_button: QWidget | None) -> intsource
The hit-test code for a point in a frameless JBrowser window: the caption (drag), the maximise button (Snap Layouts) or ordinary client area. Never raises: an error here used to make the window procedure fall back to "client area", and the window stopped dragging.