JBrowser Source Docs

jbrowser.ui.backdrop

Generated from the source code of JBrowser 2.0.3.

jbrowser/ui/backdrop.py · 141 lines

Each top-level window's frame: its light/dark mode, rounded corners and first appearance.

JBrowser's windows are opaque and paint their own look (the Frosted picture, ui/frost.py, or the Solid colour); Windows' see-through materials are never used. What is left for Windows to know is small, and Backdrop keeps it in step with the theme:

  • the window's light/dark mode (DWMWA_USE_IMMERSIVE_DARK_MODE: the outline, and the caption of dialogs with a native title bar, whose caption colours are set too). Qt re-applies its own idea of light/dark to every frame when the palette changes, so the mode is set again after anything that can reset it; setting the same value changes nothing on screen, so nothing can loop;
  • rounded corners;
  • a new window stays cloaked (invisible, but there for Windows and Qt) until its first frame is painted, so it never flashes white or black.

Backdrop#

class Backdrop(QObject)source
Backdrop(window: QWidget, kind: str='window')

Keeps window's frame in step with the theme. kind is "window" (a frameless JBrowser window), "popup" (a borderless popup: only rounded corners) or "frame" (a dialog with a native title bar: the mode and the caption colours).

Attributes

Name Value
CLOAK_MS 90

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.