Skip to content

Commit

Permalink
xdg: Rename TopLevel to Toplevel
Browse files Browse the repository at this point in the history
  • Loading branch information
jwijenbergh committed May 6, 2024
1 parent 25fabf8 commit 3a96a3c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions wlroots/wlr_types/xdg_decoration_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from wlroots import PtrHasData, ffi, lib

from .xdg_shell import XdgTopLevel
from .xdg_shell import XdgToplevel

if TYPE_CHECKING:
from pywayland.server import Display
Expand Down Expand Up @@ -53,10 +53,10 @@ def __init__(self, ptr) -> None:
)

@property
def toplevel(self) -> XdgTopLevel:
def toplevel(self) -> XdgToplevel:
toplevel_ptr = self._ptr.toplevel
_weakkeydict[toplevel_ptr] = self._ptr
return XdgTopLevel(toplevel_ptr)
return XdgToplevel(toplevel_ptr)

@property
def manager(self) -> XdgDecorationManagerV1:
Expand Down
44 changes: 22 additions & 22 deletions wlroots/wlr_types/xdg_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class XdgSurfaceRole(enum.IntEnum):
POPUP = lib.WLR_XDG_SURFACE_ROLE_POPUP


class XdgTopLevelWMCapabilities(enum.IntFlag):
class XdgToplevelWMCapabilities(enum.IntFlag):
WINDOW_MENU = lib.WLR_XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU
MAXIMIZE = lib.WLR_XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE
FULLSCREEN = lib.WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN
Expand Down Expand Up @@ -104,15 +104,15 @@ def role(self) -> XdgSurfaceRole:
return XdgSurfaceRole(self._ptr.role)

@property
def toplevel(self) -> XdgTopLevel:
def toplevel(self) -> XdgToplevel:
"""Return the top level xdg object
This shell must be a top level role
"""
if self.role != XdgSurfaceRole.TOPLEVEL:
raise ValueError(f"xdg surface must be top-level, got: {self.role}")

toplevel = XdgTopLevel(self._ptr.toplevel)
toplevel = XdgToplevel(self._ptr.toplevel)

# the toplevel does not own the ptr data, ensure the underlying cdata
# is kept alive
Expand Down Expand Up @@ -170,7 +170,7 @@ def set_tiled(self, tiled_edges: int) -> int:
def set_bounds(self, width: int, height: int) -> int:
return lib.wlr_xdg_toplevel_set_bounds(self._ptr.toplevel, width, height)

def set_wm_capabilities(self, caps: XdgTopLevelWMCapabilities) -> int:
def set_wm_capabilities(self, caps: XdgToplevelWMCapabilities) -> int:
return lib.wlr_xdg_toplevel_set_wm_capabilities(self._ptr.toplevel, caps)

def send_close(self) -> int:
Expand Down Expand Up @@ -236,7 +236,7 @@ def serial(self) -> int:
return self._ptr.serial


class XdgTopLevel(Ptr):
class XdgToplevel(Ptr):
def __init__(self, ptr) -> None:
"""A top level surface object
Expand All @@ -256,27 +256,27 @@ def __init__(self, ptr) -> None:
)
self.request_move_event = Signal(
ptr=ffi.addressof(self._ptr.events.request_move),
data_wrapper=XdgTopLevelMoveEvent,
data_wrapper=XdgToplevelMoveEvent,
)
self.request_resize_event = Signal(
ptr=ffi.addressof(self._ptr.events.request_resize),
data_wrapper=XdgTopLevelResizeEvent,
data_wrapper=XdgToplevelResizeEvent,
)
self.request_show_window_menu_event = Signal(
ptr=ffi.addressof(self._ptr.events.request_show_window_menu),
data_wrapper=XdgTopLevelShowWindowMenuEvent,
data_wrapper=XdgToplevelShowWindowMenuEvent,
)
self.set_parent_event = Signal(ptr=ffi.addressof(self._ptr.events.set_parent))
self.set_title_event = Signal(ptr=ffi.addressof(self._ptr.events.set_title))
self.set_app_id_event = Signal(ptr=ffi.addressof(self._ptr.events.set_app_id))

@property
def parent(self) -> XdgTopLevel | None:
def parent(self) -> XdgToplevel | None:
"""The parent of this toplevel"""
parent_ptr = self._ptr.parent
if parent_ptr == ffi.NULL:
return None
return XdgTopLevel(parent_ptr)
return XdgToplevel(parent_ptr)

@property
def title(self) -> str | None:
Expand All @@ -289,19 +289,19 @@ def app_id(self) -> str | None:
return str_or_none(self._ptr.app_id)

@property
def requested(self) -> XdgTopLevelRequested:
def requested(self) -> XdgToplevelRequested:
"""Requested initial state"""
return XdgTopLevelRequested(self._ptr.requested)
return XdgToplevelRequested(self._ptr.requested)


class XdgTopLevelMoveEvent(Ptr):
class XdgToplevelMoveEvent(Ptr):
def __init__(self, ptr) -> None:
self._ptr = ffi.cast("struct wlr_xdg_toplevel_move_event *", ptr)

@property
def toplevel(self) -> XdgTopLevel:
def toplevel(self) -> XdgToplevel:
# TODO: keep weakref
return XdgTopLevel(self._ptr.toplevel)
return XdgToplevel(self._ptr.toplevel)

# TODO: seat client

Expand All @@ -310,14 +310,14 @@ def serial(self) -> int:
return self._ptr.serial


class XdgTopLevelResizeEvent(Ptr):
class XdgToplevelResizeEvent(Ptr):
def __init__(self, ptr) -> None:
self._ptr = ffi.cast("struct wlr_xdg_toplevel_resize_event *", ptr)

@property
def toplevel(self) -> XdgTopLevel:
def toplevel(self) -> XdgToplevel:
# TODO: keep weakref
return XdgTopLevel(self._ptr.toplevel)
return XdgToplevel(self._ptr.toplevel)

# TODO: seat client

Expand All @@ -330,14 +330,14 @@ def edges(self) -> Edges:
return self._ptr.edges


class XdgTopLevelShowWindowMenuEvent(Ptr):
class XdgToplevelShowWindowMenuEvent(Ptr):
def __init__(self, ptr) -> None:
self._ptr = ffi.cast("struct wlr_xdg_toplevel_show_window_menu_event *", ptr)

@property
def toplevel(self) -> XdgTopLevel:
def toplevel(self) -> XdgToplevel:
# TODO: keep weakref
return XdgTopLevel(self._ptr.toplevel)
return XdgToplevel(self._ptr.toplevel)

# TODO: seat client

Expand Down Expand Up @@ -420,7 +420,7 @@ def reactive(self) -> bool:
return self._ptr.reactive


class XdgTopLevelRequested(Ptr):
class XdgToplevelRequested(Ptr):
def __init__(self, ptr) -> None:
self._ptr = ptr

Expand Down

0 comments on commit 3a96a3c

Please sign in to comment.