JBrowser Source Docs

jbrowser.platform.win

Generated from the source code of JBrowser 1.5.4.

jbrowser/platform/win.py · 428 lines

Windows 11 integration via the Win32 / DWM APIs (ctypes).

  • Mica / Mica Alt / Acrylic system backdrops (DWMWA_SYSTEMBACKDROP_TYPE)
  • Custom-drawn title bar that keeps native behaviour: the top caption is removed in WM_NCCALCSIZE while the invisible side/bottom resize borders, drop shadow, rounded corners, Aero Snap and the Windows 11 Snap Layouts flyout (HTMAXBUTTON) all remain.
  • DPAPI for protecting local secrets, system accent colour, AppUserModelID.

Constants#

MARGINS#

class MARGINS(ctypes.Structure)source

NCCALCSIZE_PARAMS#

class NCCALCSIZE_PARAMS(ctypes.Structure)source

APPBARDATA#

class APPBARDATA(ctypes.Structure)source

DATA_BLOB#

class DATA_BLOB(ctypes.Structure)source

NativeFrame#

class NativeFramesource
NativeFrame(hwnd_getter: Callable[[], int], dpr_getter: Callable[[], float], hit_test: Callable[[QPoint], int], on_max_hover: Callable[[bool], None], on_max_press: Callable[[bool], None], on_max_click: Callable[[], None])

Implements the non-client behaviour for a custom-titlebar top-level window.

hit_test(local_logical_point) -> int is supplied by the window and returns HTCAPTION for drag regions, HTMAXBUTTON over the maximise button, else HTCLIENT.

Attributes

Name Value
RESIZE_BORDER 6
CORNER 14

NativeFrame.handle#

handle(msg_ptr: int) -> tuple[bool, int]source

Functions#

set_dark_title#

set_dark_title(hwnd: int, dark: bool) -> Nonesource

set_caption_colors#

set_caption_colors(hwnd: int, background: QColor, text: QColor) -> Nonesource

Tint a native title bar (Windows 11) so it matches the window content.

set_corner_preference#

set_corner_preference(hwnd: int, preference: int=DWMWCP_ROUND) -> Nonesource

Rounded corners (2 = round, 3 = small) — used for popups, menus and tooltips.

apply_backdrop#

apply_backdrop(hwnd: int, material: str, dark: bool) -> boolsource

Apply a Windows 11 system backdrop. Returns True when a translucent material is active.

refresh_frame#

refresh_frame(hwnd: int) -> Nonesource

is_maximized#

is_maximized(hwnd: int) -> boolsource

set_app_user_model_id#

set_app_user_model_id(app_id: str) -> Nonesource

system_accent_color#

system_accent_color() -> QColor | Nonesource

system_animations_enabled#

system_animations_enabled() -> boolsource

dpapi_protect#

dpapi_protect(data: bytes, entropy: bytes=b'JBrowser') -> bytessource

dpapi_unprotect#

dpapi_unprotect(data: bytes, entropy: bytes=b'JBrowser') -> bytessource

running_as_admin#

running_as_admin() -> boolsource

True when this process runs elevated (as administrator).

authenticode#

authenticode(path: str) -> tuple[str, str]source

The Authenticode signature of a file: (status, signer subject), e.g. ("Valid", "CN=…") or ("NotSigned", ""). ("Unknown", "") when it can't be checked. Takes about half a second.

reveal_in_explorer#

reveal_in_explorer(path: str) -> Nonesource