commit python-pywlroots for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pywlroots for openSUSE:Factory checked in at 2023-04-29 17:28:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pywlroots (Old) and /work/SRC/openSUSE:Factory/.python-pywlroots.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-pywlroots" Sat Apr 29 17:28:36 2023 rev:7 rq:1083639 version:0.16.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pywlroots/python-pywlroots.changes 2023-02-28 12:49:25.612768811 +0100 +++ /work/SRC/openSUSE:Factory/.python-pywlroots.new.1533/python-pywlroots.changes 2023-04-29 17:28:42.642690495 +0200 @@ -1,0 +2,11 @@ +Sat Apr 22 09:43:25 UTC 2023 - Soc Virnyl Estela <socvirnyl.estela@gmail.com> + +- Update to version 0.16.4: + * add idle_notify_v1 protocol + * add helpers for XDG activation v1 protocol + * add helpers for presentation time protocol + * add helpers for mapping input devices to outputs + * enable xwayland feature for wlroots build setup when making a release + * minor keyboard handling improvements + +------------------------------------------------------------------- Old: ---- pywlroots-0.16.0.tar.gz New: ---- pywlroots-0.16.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pywlroots.spec ++++++ --- /var/tmp/diff_new_pack.8pqKWe/_old 2023-04-29 17:28:43.154693262 +0200 +++ /var/tmp/diff_new_pack.8pqKWe/_new 2023-04-29 17:28:43.158693283 +0200 @@ -18,7 +18,7 @@ %bcond_without test Name: python-pywlroots -Version: 0.16.0 +Version: 0.16.4 Release: 0 Summary: Python binding to the wlroots library using cffi License: NCSA ++++++ pywlroots-0.16.0.tar.gz -> pywlroots-0.16.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/PKG-INFO new/pywlroots-0.16.4/PKG-INFO --- old/pywlroots-0.16.0/PKG-INFO 2023-02-20 19:41:30.589552900 +0100 +++ new/pywlroots-0.16.4/PKG-INFO 2023-04-08 15:05:17.716930600 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pywlroots -Version: 0.16.0 +Version: 0.16.4 Summary: Python binding to the wlroots library using cffi Home-page: https://github.com/flacjacket/pywlroots Author: Sean Vig diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/pywlroots.egg-info/PKG-INFO new/pywlroots-0.16.4/pywlroots.egg-info/PKG-INFO --- old/pywlroots-0.16.0/pywlroots.egg-info/PKG-INFO 2023-02-20 19:41:30.000000000 +0100 +++ new/pywlroots-0.16.4/pywlroots.egg-info/PKG-INFO 2023-04-08 15:05:17.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pywlroots -Version: 0.16.0 +Version: 0.16.4 Summary: Python binding to the wlroots library using cffi Home-page: https://github.com/flacjacket/pywlroots Author: Sean Vig diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/pywlroots.egg-info/SOURCES.txt new/pywlroots-0.16.4/pywlroots.egg-info/SOURCES.txt --- old/pywlroots-0.16.0/pywlroots.egg-info/SOURCES.txt 2023-02-20 19:41:30.000000000 +0100 +++ new/pywlroots-0.16.4/pywlroots.egg-info/SOURCES.txt 2023-04-08 15:05:17.000000000 +0200 @@ -59,6 +59,7 @@ wlroots/wlr_types/gamma_control_v1.py wlroots/wlr_types/idle.py wlroots/wlr_types/idle_inhibit_v1.py +wlroots/wlr_types/idle_notify_v1.py wlroots/wlr_types/input_device.py wlroots/wlr_types/input_inhibit.py wlroots/wlr_types/keyboard.py @@ -72,6 +73,7 @@ wlroots/wlr_types/pointer.py wlroots/wlr_types/pointer_constraints_v1.py wlroots/wlr_types/pointer_gestures_v1.py +wlroots/wlr_types/presentation_time.py wlroots/wlr_types/primary_selection_v1.py wlroots/wlr_types/relative_pointer_manager_v1.py wlroots/wlr_types/scene.py @@ -85,6 +87,7 @@ wlroots/wlr_types/virtual_keyboard_v1.py wlroots/wlr_types/virtual_pointer_v1.py wlroots/wlr_types/xcursor_manager.py +wlroots/wlr_types/xdg_activation_v1.py wlroots/wlr_types/xdg_decoration_v1.py wlroots/wlr_types/xdg_output_v1.py wlroots/wlr_types/xdg_shell.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/setup.cfg new/pywlroots-0.16.4/setup.cfg --- old/pywlroots-0.16.0/setup.cfg 2023-02-20 19:41:30.589552900 +0100 +++ new/pywlroots-0.16.4/setup.cfg 2023-04-08 15:05:17.720930800 +0200 @@ -3,7 +3,8 @@ version = attr:version.version url = https://github.com/flacjacket/pywlroots license = MIT -license_file = LICENSE +license_files = + LICENSE description = Python binding to the wlroots library using cffi long_description = file: README.rst long_description_content_type = text/x-rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/tiny/server.py new/pywlroots-0.16.4/tiny/server.py --- old/pywlroots-0.16.0/tiny/server.py 2023-02-20 19:41:29.000000000 +0100 +++ new/pywlroots-0.16.4/tiny/server.py 2023-04-08 15:05:16.000000000 +0200 @@ -17,6 +17,7 @@ from wlroots.util.log import logger from wlroots.wlr_types import ( Cursor, + idle_notify_v1, Keyboard, Output, OutputLayout, @@ -99,6 +100,9 @@ self._cursor = cursor self._cursor_manager = cursor_manager + # idle_notify_v1 support + self.idle_notify = idle_notify_v1.IdleNotifierV1(self._display) + # the seat manages the keyboard focus information self._seat = seat self.keyboards: list[KeyboardHandler] = [] @@ -195,6 +199,7 @@ self.grabbed_view.xdg_surface.set_size(new_width, new_height) def process_cursor_motion(self, time) -> None: + self.idle_notify.notify_activity(self._seat) if self.cursor_mode == CursorMode.MOVE: self._process_cursor_move() return @@ -226,6 +231,7 @@ self._seat.keyboard_notify_modifiers(modifiers) def send_key(self, key_event: KeyboardKeyEvent, input_device: InputDevice) -> None: + self.idle_notify.notify_activity(self._seat) keyboard = Keyboard.from_input_device(input_device) keyboard_modifier = keyboard.modifier @@ -300,7 +306,8 @@ # keep track of this and automatically send key events to the # appropriate clients without additional work on your part. keyboard = self._seat.keyboard - self._seat.keyboard_notify_enter(view.xdg_surface.surface, keyboard) + if keyboard: + self._seat.keyboard_notify_enter(view.xdg_surface.surface, keyboard) # ############################################################# # surface handling callbacks diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/ffi_build.py new/pywlroots-0.16.4/wlroots/ffi_build.py --- old/pywlroots-0.16.0/wlroots/ffi_build.py 2023-02-20 19:41:29.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/ffi_build.py 2023-04-08 15:05:16.000000000 +0200 @@ -89,8 +89,13 @@ return has_xwayland -# backend.h +# typedef helpers CDEF = """ +typedef int32_t clockid_t; +""" + +# backend.h +CDEF += """ struct wlr_backend_impl; struct wlr_backend @@ -281,6 +286,8 @@ struct wlr_input_device *dev, double x, double y); void wlr_cursor_warp_absolute(struct wlr_cursor *cur, struct wlr_input_device *dev, double x, double y); +void wlr_cursor_absolute_to_layout_coords(struct wlr_cursor *cur, + struct wlr_input_device *dev, double x, double y, double *lx, double *ly); void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev, double delta_x, double delta_y); void wlr_cursor_set_surface(struct wlr_cursor *cur, struct wlr_surface *surface, @@ -289,6 +296,10 @@ struct wlr_input_device *dev); void wlr_cursor_attach_output_layout(struct wlr_cursor *cur, struct wlr_output_layout *l); +void wlr_cursor_map_to_output(struct wlr_cursor *cur, + struct wlr_output *output); +void wlr_cursor_map_input_to_output(struct wlr_cursor *cur, + struct wlr_input_device *dev, struct wlr_output *output); """ # types/wlr_compositor.h @@ -843,6 +854,19 @@ struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display *display); """ +# types/wlr_idle_notify_v1.h +CDEF += """ +struct wlr_idle_notifier_v1; + +struct wlr_idle_notifier_v1 *wlr_idle_notifier_v1_create(struct wl_display *display); + +void wlr_idle_notifier_v1_set_inhibited(struct wlr_idle_notifier_v1 *notifier, + bool inhibited); + +void wlr_idle_notifier_v1_notify_activity(struct wlr_idle_notifier_v1 *notifier, + struct wlr_seat *seat); +""" + # types/wlr_input_device.h CDEF += """ enum wlr_button_state { @@ -1646,6 +1670,15 @@ wlr_primary_selection_v1_device_manager_create(struct wl_display *display); """ +# types/wlr_presentation_time.h +CDEF += """ +struct wlr_presentation { + ...; +}; +struct wlr_presentation *wlr_presentation_create(struct wl_display *display, + struct wlr_backend *backend); +""" + # types/wlr_primary_selection.h CDEF += """ void wlr_seat_set_primary_selection(struct wlr_seat *seat, @@ -1917,7 +1950,6 @@ int64_t tv_nsec; ...; }; -typedef int32_t clockid_t; int clock_gettime(clockid_t clk_id, struct timespec *tp); #define CLOCK_MONOTONIC ... @@ -2267,6 +2299,29 @@ }; """ +# types/wlr_xdg_activation_v1.h +CDEF += """ +struct wlr_xdg_activation_v1 { + uint32_t token_timeout_msec; + struct wl_list tokens; + + struct { + struct wl_signal destroy; + struct wl_signal request_activate; + } events; + ...; +}; + +struct wlr_xdg_activation_v1_request_activate_event { + struct wlr_xdg_activation_v1 *activation; + struct wlr_xdg_activation_token_v1 *token; + struct wlr_surface *surface; +}; + +struct wlr_xdg_activation_v1 *wlr_xdg_activation_v1_create( + struct wl_display *display); +""" + # types/wlr_xdg_decoration_v1.h CDEF += """ enum wlr_xdg_toplevel_decoration_v1_mode { @@ -2732,6 +2787,7 @@ #include <wlr/types/wlr_gamma_control_v1.h> #include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_idle_inhibit_v1.h> +#include <wlr/types/wlr_idle_notify_v1.h> #include <wlr/types/wlr_input_inhibitor.h> #include <wlr/types/wlr_keyboard.h> #include <wlr/types/wlr_layer_shell_v1.h> @@ -2745,6 +2801,7 @@ #include <wlr/types/wlr_pointer.h> #include <wlr/types/wlr_pointer_constraints_v1.h> #include <wlr/types/wlr_pointer_gestures_v1.h> +#include <wlr/types/wlr_presentation_time.h> #include <wlr/types/wlr_primary_selection.h> #include <wlr/types/wlr_primary_selection_v1.h> #include <wlr/types/wlr_relative_pointer_v1.h> @@ -2756,6 +2813,7 @@ #include <wlr/types/wlr_virtual_keyboard_v1.h> #include <wlr/types/wlr_virtual_pointer_v1.h> #include <wlr/types/wlr_xcursor_manager.h> +#include <wlr/types/wlr_xdg_activation_v1.h> #include <wlr/types/wlr_xdg_decoration_v1.h> #include <wlr/types/wlr_xdg_output_v1.h> #include <wlr/types/wlr_xdg_shell.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/version.py new/pywlroots-0.16.4/wlroots/version.py --- old/pywlroots-0.16.0/wlroots/version.py 2023-02-20 19:41:29.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/version.py 2023-04-08 15:05:16.000000000 +0200 @@ -1,3 +1,3 @@ # Copyright (c) Sean Vig 2021 -version = "0.16.0" +version = "0.16.4" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/wlr_types/__init__.py new/pywlroots-0.16.4/wlroots/wlr_types/__init__.py --- old/pywlroots-0.16.0/wlroots/wlr_types/__init__.py 2023-02-20 19:41:29.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/wlr_types/__init__.py 2023-04-08 15:05:16.000000000 +0200 @@ -34,6 +34,7 @@ PointerConstraintV1, ) from .pointer_gestures_v1 import PointerGesturesV1 # noqa: F401 +from .presentation_time import Presentation # noqa: F401 from .primary_selection_v1 import PrimarySelectionV1DeviceManager # noqa: F401 from .relative_pointer_manager_v1 import RelativePointerManagerV1 # noqa: F401 from .scene import ( # noqa: F401 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/wlr_types/cursor.py new/pywlroots-0.16.4/wlroots/wlr_types/cursor.py --- old/pywlroots-0.16.0/wlroots/wlr_types/cursor.py 2023-02-20 19:41:29.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/wlr_types/cursor.py 2023-04-08 15:05:16.000000000 +0200 @@ -7,6 +7,7 @@ from wlroots import ffi, PtrHasData, lib from .input_device import InputDevice, InputDeviceType +from .output import Output from .output_layout import OutputLayout from .pointer import ( PointerAxisEvent, @@ -263,3 +264,31 @@ def __exit__(self, exc_type, exc_value, exc_tb) -> None: """Clean up the cursor when exiting the context""" self.destroy() + + def map_to_output(self, output: Output | None) -> None: + """ + Attaches this cursor to the given output, which must be among the outputs in the + current output_layout for this cursor. This call is invalid for a cursor without + an associated output layout. + """ + if output is None: + output_ptr = ffi.NULL + else: + output_ptr = output._ptr + + lib.wlr_cursor_map_to_output(self._ptr, output_ptr) + + def map_input_to_output( + self, input_device: InputDevice, output: Output | None + ) -> None: + """ + Maps all input from a specific input device to a given output. The input device + must be attached to this cursor and the output must be among the outputs in the + attached output layout. + """ + if output is None: + output_ptr = ffi.NULL + else: + output_ptr = output._ptr + + lib.wlr_cursor_map_input_to_output(self._ptr, input_device._ptr, output_ptr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/wlr_types/idle_notify_v1.py new/pywlroots-0.16.4/wlroots/wlr_types/idle_notify_v1.py --- old/pywlroots-0.16.0/wlroots/wlr_types/idle_notify_v1.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/wlr_types/idle_notify_v1.py 2023-04-08 15:05:16.000000000 +0200 @@ -0,0 +1,33 @@ +# Copyright (c) Charbel Assaad 2023 +from pywayland.server import Display + +from wlroots import lib, Ptr + +from .seat import Seat + + +class IdleNotifierV1(Ptr): + def __init__(self, display: Display) -> None: + self._ptr = lib.wlr_idle_notifier_v1_create(display._ptr) + + @property + def inhibited(self) -> bool: + return bool(self._ptr.inhibited) + + def set_inhibited(self, inhibited: bool) -> None: + """ + Inhibit idle. + + Compositors should call this function when the idle state is disabled, e.g. + because a visible client is using the idle-inhibit protocol. + """ + lib.wlr_idle_notifier_v1_set_inhibited(self._ptr, inhibited) + + def notify_activity(self, seat: Seat) -> None: + """ + Notify for user activity on a seat. + + Compositors should call this function whenever an input event is triggered + on a seat. + """ + lib.wlr_idle_notifier_v1_notify_activity(self._ptr, seat._ptr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/wlr_types/keyboard.py new/pywlroots-0.16.4/wlroots/wlr_types/keyboard.py --- old/pywlroots-0.16.0/wlroots/wlr_types/keyboard.py 2023-02-20 19:41:29.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/wlr_types/keyboard.py 2023-04-08 15:05:16.000000000 +0200 @@ -128,14 +128,11 @@ @property def modifier(self) -> KeyboardModifier: """The enum representing the currently active modifier keys""" + if self._ptr == ffi.NULL: + raise RuntimeError("Tried to get modifier for NULL keyboard.") modifiers = lib.wlr_keyboard_get_modifiers(self._ptr) return KeyboardModifier(modifiers) - @property - def destroyed(self) -> bool: - """Tells you whether or not this keyboard has been destroyed""" - return self._ptr == ffi.NULL - class KeyboardModifiers(Ptr): def __init__(self, ptr) -> None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/wlr_types/pointer.py new/pywlroots-0.16.4/wlroots/wlr_types/pointer.py --- old/pywlroots-0.16.0/wlroots/wlr_types/pointer.py 2023-02-20 19:41:29.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/wlr_types/pointer.py 2023-04-08 15:05:16.000000000 +0200 @@ -1,10 +1,12 @@ # Copyright (c) Sean Vig 2019 # Copyright (c) Matt Colligan 2022 +from __future__ import annotations + import enum from weakref import WeakKeyDictionary -from wlroots import Ptr, ffi, lib +from wlroots import Ptr, ffi, lib, str_or_none from .input_device import ButtonState, InputDevice @@ -29,12 +31,21 @@ def __init__(self, ptr) -> None: self._ptr = ptr + @classmethod + def from_input_device(cls, input_device: InputDevice) -> Pointer: + return Pointer(lib.wlr_pointer_from_input_device(input_device._ptr)) + @property def base(self) -> InputDevice: device_ptr = ffi.addressof(self._ptr.base) _weakkeydict[device_ptr] = self._ptr return InputDevice(device_ptr) + @property + def output_name(self) -> str | None: + """The name of any associated output""" + return str_or_none(self._ptr.output_name) + class _PointerEvent(Ptr): @property diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/wlr_types/presentation_time.py new/pywlroots-0.16.4/wlroots/wlr_types/presentation_time.py --- old/pywlroots-0.16.0/wlroots/wlr_types/presentation_time.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/wlr_types/presentation_time.py 2023-04-08 15:05:16.000000000 +0200 @@ -0,0 +1,24 @@ +# Copyright (c) Matt Colligan 2023 + +from __future__ import annotations + +from typing import TYPE_CHECKING + +from wlroots import ffi, Ptr, lib + +if TYPE_CHECKING: + from pywayland.server import Display + + from wlroots.backend import Backend + + +class Presentation(Ptr): + def __init__(self, ptr) -> None: + """A presentation time manager: struct wlr_presentation.""" + self._ptr = ffi.cast("struct wlr_presentation *", ptr) + + @classmethod + def create(cls, display: Display, backend: Backend) -> Presentation: + """Create a `struct wlr_xdg_activation_v1` for the given display.""" + ptr = lib.wlr_presentation_create(display._ptr, backend._ptr) + return cls(ptr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/wlr_types/scene.py new/pywlroots-0.16.4/wlroots/wlr_types/scene.py --- old/pywlroots-0.16.0/wlroots/wlr_types/scene.py 2023-02-20 19:41:29.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/wlr_types/scene.py 2023-04-08 15:05:16.000000000 +0200 @@ -14,6 +14,7 @@ from wlroots.util.clock import Timespec from wlroots.wlr_types import Buffer, Output, OutputLayout from wlroots.wlr_types.layer_shell_v1 import LayerSurfaceV1 + from wlroots.wlr_types.presentation_time import Presentation from wlroots.wlr_types.xdg_shell import XdgSurface @@ -38,6 +39,13 @@ """Get a scene-graph output from a wlr_output.""" return lib.wlr_scene_attach_output_layout(self._ptr, output_layout._ptr) + def set_presentation(self, presentation: Presentation) -> None: + """ + Handle presentation feedback for all surfaces in the scene, assuming that scene + outputs and the scene rendering functions are used. + """ + lib.wlr_scene_set_presentation(self._ptr, presentation._ptr) + def get_scene_output(self, output: Output) -> SceneOutput: """Get a scene-graph output from a wlr_output.""" ptr = lib.wlr_scene_get_scene_output(self._ptr, output._ptr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/wlr_types/seat.py new/pywlroots-0.16.4/wlroots/wlr_types/seat.py --- old/pywlroots-0.16.0/wlroots/wlr_types/seat.py 2023-02-20 19:41:29.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/wlr_types/seat.py 2023-04-08 15:05:16.000000000 +0200 @@ -115,9 +115,11 @@ return SeatKeyboardState(keyboard_state_ptr) @property - def keyboard(self) -> Keyboard: - """Get the keyboard associated with this seat""" + def keyboard(self) -> Keyboard | None: + """Get the active keyboard for the seat.""" keyboard_ptr = lib.wlr_seat_get_keyboard(self._ptr) + if keyboard_ptr == ffi.NULL: + return None return Keyboard(keyboard_ptr) def destroy(self) -> None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywlroots-0.16.0/wlroots/wlr_types/xdg_activation_v1.py new/pywlroots-0.16.4/wlroots/wlr_types/xdg_activation_v1.py --- old/pywlroots-0.16.0/wlroots/wlr_types/xdg_activation_v1.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pywlroots-0.16.4/wlroots/wlr_types/xdg_activation_v1.py 2023-04-08 15:05:16.000000000 +0200 @@ -0,0 +1,48 @@ +# Copyright (c) Matt Colligan 2023 + +from __future__ import annotations + +from typing import TYPE_CHECKING +from weakref import WeakKeyDictionary + +from pywayland.server import Signal + +from wlroots import ffi, Ptr, lib +from .surface import Surface + +if TYPE_CHECKING: + from pywayland.server import Display + +_weakkeydict: WeakKeyDictionary = WeakKeyDictionary() + + +class XdgActivationV1(Ptr): + def __init__(self, ptr) -> None: + """An XDG activation manager: struct wlr_xdg_activation_v1.""" + self._ptr = ffi.cast("struct wlr_xdg_activation_v1 *", ptr) + + self.destroy_event = Signal(ptr=ffi.addressof(self._ptr.events.destroy)) + self.request_activate_event = Signal( + ptr=ffi.addressof(self._ptr.events.request_activate), + data_wrapper=XdgActivationV1RequestActivateEvent, + ) + + @classmethod + def create(cls, display: Display) -> XdgActivationV1: + """Create a `struct wlr_xdg_activation_v1` for the given display.""" + ptr = lib.wlr_xdg_activation_v1_create(display._ptr) + return cls(ptr) + + +class XdgActivationV1RequestActivateEvent(Ptr): + def __init__(self, ptr) -> None: + """struct wlr_xdg_activation_v1_request_activate_event""" + self._ptr = ffi.cast( + "struct wlr_xdg_activation_v1_request_activate_event *", ptr + ) + + @property + def surface(self) -> Surface: + surface_ptr = self._ptr.surface + _weakkeydict[surface_ptr] = self._ptr + return Surface(surface_ptr)
participants (1)
-
Source-Sync