Skip to content

Commit

Permalink
feat(xwayland): add xcb_icccm_wm_hints_t attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
shyguyCreate committed Oct 19, 2024
1 parent ebafb5a commit 4135fd4
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
9 changes: 8 additions & 1 deletion wlroots/ffi_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3151,7 +3151,14 @@ def has_xwayland() -> bool:
typedef uint32_t xcb_window_t;
typedef uint32_t xcb_atom_t;
typedef struct {
...;
int32_t flags;
uint32_t input;
int32_t initial_state;
xcb_pixmap_t icon_pixmap;
xcb_window_t icon_window;
int32_t icon_x, icon_y;
xcb_pixmap_t icon_mask;
xcb_window_t window_group;
} xcb_icccm_wm_hints_t;
typedef struct {
uint32_t flags;
Expand Down
48 changes: 48 additions & 0 deletions wlroots/xwayland.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@ def protocols(self) -> list[int]:
"""This is an array of xcb_atom_t."""
return ffi.unpack(self._ptr.protocols, self._ptr.protocols_len)

@property
def hints(self) -> Hints | None:
ptr = self._ptr.hints
if ptr == ffi.NULL:
return None
return Hints(ptr)

@property
def size_hints(self) -> SizeHints | None:
ptr = self._ptr.size_hints
Expand Down Expand Up @@ -423,6 +430,47 @@ def minimize(self) -> bool:
return self._ptr.minimize


class Hints(Ptr):
def __init__(self, ptr) -> None:
self._ptr = ffi.cast("xcb_icccm_wm_hints_t *", ptr)

@property
def flags(self) -> int:
return self._ptr.flags

@property
def input(self) -> int:
return self._ptr.input

@property
def initial_state(self) -> int:
return self._ptr.initial_state

@property
def icon_pixmap(self) -> int:
return self._ptr.icon_pixmap

@property
def icon_window(self) -> int:
return self._ptr.icon_window

@property
def icon_x(self) -> int:
return self._ptr.icon_x

@property
def icon_y(self) -> int:
return self._ptr.icon_y

@property
def icon_mask(self) -> int:
return self._ptr.icon_mask

@property
def window_group(self) -> int:
return self._ptr.window_group


class SizeHints(Ptr):
def __init__(self, ptr) -> None:
self._ptr = ffi.cast("xcb_size_hints_t *", ptr)
Expand Down

0 comments on commit 4135fd4

Please sign in to comment.