jbrowser.platform.win
Generated from the source code of JBrowser 1.4.1.
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#
| Name | Value |
|---|---|
IS_WINDOWS |
sys.platform == 'win32' |
WIN_BUILD |
sys.getwindowsversion().build if IS_WINDOWS else 0 |
IS_WIN11 |
WIN_BUILD >= 22000 |
WM_NCACTIVATE |
134 |
WM_NCCALCSIZE |
131 |
WM_NCHITTEST |
132 |
WM_NCMOUSEMOVE |
160 |
WM_NCLBUTTONDOWN |
161 |
WM_NCLBUTTONUP |
162 |
WM_NCLBUTTONDBLCLK |
163 |
WM_NCRBUTTONDOWN |
164 |
WM_NCRBUTTONUP |
165 |
WM_NCMOUSELEAVE |
674 |
WM_SETTINGCHANGE |
26 |
WM_DWMCOLORIZATIONCOLORCHANGED |
800 |
HTCLIENT |
1 |
HTCAPTION |
2 |
HTMAXBUTTON |
9 |
DWMWA_USE_IMMERSIVE_DARK_MODE |
20 |
DWMWA_USE_IMMERSIVE_DARK_MODE_OLD |
19 |
DWMWA_WINDOW_CORNER_PREFERENCE |
33 |
DWMWA_SYSTEMBACKDROP_TYPE |
38 |
DWMWA_MICA_EFFECT_LEGACY |
1029 |
DWMWCP_ROUND |
2 |
BACKDROPS |
{'solid': 1, 'mica': 2, 'acrylic': 3, 'mica_alt': 4} |
SWP_FRAMECHANGED_FLAGS |
1 | 2 | 4 | 16 | 32 |
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
reveal_in_explorer#
reveal_in_explorer(path: str) -> Nonesource