Skip to content

Commit

Permalink
TODO: fixup these commits into previous
Browse files Browse the repository at this point in the history
  • Loading branch information
jwijenbergh committed Dec 26, 2024
1 parent bd190cb commit f1148d8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 43 deletions.
56 changes: 37 additions & 19 deletions wlroots/ffi_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def has_xwayland() -> bool:
struct wlr_surface {
struct wl_resource *resource;
struct wlr_renderer *renderer;
struct wlr_compositor *compositor;
struct wlr_client_buffer *buffer;
struct pixman_region32 buffer_damage;
struct pixman_region32 opaque_region;
Expand Down Expand Up @@ -996,7 +996,7 @@ def has_xwayland() -> bool:
int32_t phys_width, phys_height; // mm
// Note: some backends may have zero modes
struct wl_list modes; // wlr_output_mode::link
struct wl_list modes; // wlr_output_mode.link
struct wlr_output_mode *current_mode;
int32_t width, height;
int32_t refresh; // mHz, may be zero
Expand All @@ -1008,39 +1008,63 @@ def has_xwayland() -> bool:
enum wlr_output_adaptive_sync_status adaptive_sync_status;
uint32_t render_format;
// Indicates whether making changes to adaptive sync status is supported.
// If false, changes to adaptive sync status is guaranteed to fail. If
// true, changes may either succeed or fail.
bool adaptive_sync_supported;
bool needs_frame;
// damage for cursors and fullscreen surface, in output-local coordinates
bool frame_pending;
// true for example with VR headsets
bool non_desktop;
// Commit sequence number. Incremented on each commit, may overflow.
uint32_t commit_seq;
struct {
// Request to render a frame
struct wl_signal frame;
struct wl_signal damage;
// Emitted when software cursors or backend-specific logic damage the
// output
struct wl_signal damage; // struct wlr_output_event_damage
// Emitted when a new frame needs to be committed (because of
// backend-specific logic)
struct wl_signal needs_frame;
struct wl_signal precommit;
struct wl_signal commit;
struct wl_signal present;
struct wl_signal bind;
// Emitted right before commit
struct wl_signal precommit; // struct wlr_output_event_precommit
// Emitted right after commit
struct wl_signal commit; // struct wlr_output_event_commit
// Emitted right after a commit has been presented to the user for
// enabled outputs
struct wl_signal present; // struct wlr_output_event_present
// Emitted after a client bound the wl_output global
struct wl_signal bind; // struct wlr_output_event_bind
struct wl_signal description;
struct wl_signal request_state;
struct wl_signal request_state; // struct wlr_output_event_request_state
struct wl_signal destroy;
} events;
struct wl_event_source *idle_frame;
struct wl_event_source *idle_done;
int attach_render_locks;
struct wl_list cursors;
int attach_render_locks; // number of locks forcing rendering
struct wl_list cursors; // wlr_output_cursor.link
struct wlr_output_cursor *hardware_cursor;
struct wlr_swapchain *cursor_swapchain;
struct wlr_buffer *cursor_front_buffer;
int software_cursor_locks;
int software_cursor_locks; // number of locks forcing software cursors
struct wl_list layers; // wlr_output_layer.link
struct wlr_allocator *allocator;
struct wlr_renderer *renderer;
struct wlr_swapchain *swapchain;
struct wlr_buffer *back_buffer;
struct wl_listener display_destroy;
struct wlr_addon_set addons;
void *data;
Expand All @@ -1061,7 +1085,6 @@ def has_xwayland() -> bool:
struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output);
bool wlr_output_attach_render(struct wlr_output *output, int *buffer_age);
void wlr_output_transformed_resolution(struct wlr_output *output,
int *width, int *height);
void wlr_output_effective_resolution(struct wlr_output *output,
Expand All @@ -1088,9 +1111,6 @@ def has_xwayland() -> bool:
uint32_t format);
void wlr_output_state_set_subpixel(struct wlr_output_state *state,
enum wl_output_subpixel subpixel);
void wlr_output_render_software_cursors(struct wlr_output *output,
struct pixman_region32 *damage);
"""

# util/transform.h
Expand Down Expand Up @@ -2080,8 +2100,7 @@ def has_xwayland() -> bool:
int32_t touch_id);
void wlr_seat_touch_notify_motion(struct wlr_seat *seat, uint32_t time_msec,
int32_t touch_id, double sx, double sy);
void wlr_seat_touch_notify_cancel(struct wlr_seat *seat,
struct wlr_surface *surface, struct wlr_seat_client *seat_client);
void wlr_seat_touch_notify_cancel(struct wlr_seat *seat, struct wlr_seat_client *seat_client);
void wlr_seat_touch_notify_frame(struct wlr_seat *seat);
int wlr_seat_touch_num_points(struct wlr_seat *seat);
void wlr_seat_touch_start_grab(struct wlr_seat *wlr_seat,
Expand Down Expand Up @@ -2482,7 +2501,6 @@ def has_xwayland() -> bool:
struct wl_listener toplevel_destroy;
struct wl_listener surface_configure;
struct wl_listener surface_ack_configure;
struct wl_listener surface_commit;
void *data;
...;
Expand Down
23 changes: 1 addition & 22 deletions wlroots/wlr_types/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ def __init__(self, ptr) -> None:
The `frame` event will be emitted when it is a good time for the
compositor to submit a new frame.
To render a new frame, compositors should call
`wlr_output_attach_render`, render and call `wlr_output_commit`. No
rendering should happen outside a `frame` event handler or before
`wlr_output_attach_render`.
:param ptr:
The wlr_output cdata pointer
"""
Expand Down Expand Up @@ -132,7 +127,7 @@ def init_render(self, allocator: Allocator, renderer: Renderer) -> None:
Can only be called once.
Call this function prior to any call to `attach_render`, `commit`, or
Call this function prior to any call to `commit`, or
`cursor_create`. The buffer capabilities of the provided must match the
capabilities of the output's backend. Raises error otherwise.
"""
Expand All @@ -141,15 +136,6 @@ def init_render(self, allocator: Allocator, renderer: Renderer) -> None:
"Output capabilities must match the capabilities of the output's backend."
)

def attach_render(self) -> None:
"""Attach the renderer's buffer to the output
Compositors must call this function before rendering. After they are
done rendering, they should call `.commit()` to submit the new frame.
"""
if not lib.wlr_output_attach_render(self._ptr, ffi.NULL):
raise RuntimeError("Unable to attach render")

def commit(self, output_state: OutputState) -> bool:
"""Commit the pending output state
Expand All @@ -176,13 +162,6 @@ def transformed_resolution(self) -> tuple[int, int]:
height = height_ptr[0]
return width, height

def render_software_cursors(self, damage: PixmanRegion32 | None = None) -> None:
"""Renders software cursors
This is a utility function that can be called when compositors render.
"""
lib.wlr_output_render_software_cursors(self._ptr, ptr_or_null(damage))

@staticmethod
def transform_invert(transform: WlOutput.transform) -> WlOutput.transform:
"""Returns the transform that, when composed with transform gives transform.normal"""
Expand Down
4 changes: 2 additions & 2 deletions wlroots/wlr_types/seat.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ def touch_point_clear_focus(
"""Clear the focused surface for the touch point given by `touch_id`."""
lib.wlr_seat_touch_point_clear_focus(self._ptr, time_msec, touch_id)

def touch_notify_cancel(self, surface: Surface, client: Client):
def touch_notify_cancel(self, client: Client):
"""Notify the seat that this is a global gesture and the client should
cancel processing it. Defers to any grab of the touch device."""
lib.wlr_seat_touch_notify_cancel(self._ptr, surface._ptr, client._ptr)
lib.wlr_seat_touch_notify_cancel(self._ptr, client._ptr)

def touch_notify_frame(self) -> None:
lib.wlr_seat_touch_notify_frame(self._ptr)
Expand Down

0 comments on commit f1148d8

Please sign in to comment.