Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Output events, updated OutputState properties #211

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
0.17.1 -- unreleased
--------------------
* Added more properties to ``OutputState``
* Added support for various ``Output`` events
(`#209 <https://github.com/flacjacket/pywlroots/issue/209>`_):
* Renamed ``OutputEventRequestState`` to ``OutputRequestStateEvent``
(the previous name is still available as an alias
`#210 <https://github.com/flacjacket/pywlroots/issue/210>`_)


0.17.0 -- 2024-05-12
------
--------------------
* Support for wlroots 0.17.x
* **Breaking change** Rename all declarations of XdgTopLevel.* to XdgToplevel.*

Expand Down
90 changes: 76 additions & 14 deletions wlroots/ffi_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,21 +738,21 @@ def has_xwayland() -> bool:
# types/wlr_fractional_scale_v1.h
CDEF += """
struct wlr_fractional_scale_manager_v1 {
struct wl_global *global;
struct wl_global *global;

struct {
struct wl_signal destroy;
} events;
struct {
struct wl_signal destroy;
} events;

...;
...;
};


void wlr_fractional_scale_v1_notify_scale(
struct wlr_surface *surface, double scale);
struct wlr_surface *surface, double scale);

struct wlr_fractional_scale_manager_v1 *wlr_fractional_scale_manager_v1_create(
struct wl_display *display, uint32_t version);
struct wl_display *display, uint32_t version);
"""

# types/wlr_gamma_control_v1.h
Expand Down Expand Up @@ -1116,6 +1116,58 @@ def has_xwayland() -> bool:
...;
};

struct wlr_output_event_damage {
struct wlr_output *output;
const pixman_region32 *damage; // output-buffer-local coordinates
...;
};

struct wlr_output_event_precommit {
struct wlr_output *output;
struct timespec *when;
const struct wlr_output_state *state;
...;
};

struct wlr_output_event_commit {
struct wlr_output *output;
struct timespec *when;
const struct wlr_output_state *state;
...;
};

enum wlr_output_present_flag {
WLR_OUTPUT_PRESENT_VSYNC = ...,
WLR_OUTPUT_PRESENT_HW_CLOCK = ...,
WLR_OUTPUT_PRESENT_HW_COMPLETION = ...,
WLR_OUTPUT_PRESENT_ZERO_COPY = ...,
...
};

struct wlr_output_event_present {
struct wlr_output *output;
// Frame submission for which this presentation event is for (see
// wlr_output.commit_seq).
uint32_t commit_seq;
// Whether the frame was presented at all.
bool presented;
// Time when the content update turned into light the first time.
struct timespec *when;
// Vertical retrace counter. Zero if unavailable.
unsigned seq;
// Prediction of how many nanoseconds after `when` the very next output
// refresh may occur. Zero if unknown.
int refresh; // nsec
uint32_t flags; // enum wlr_output_present_flag
...;
};

struct wlr_output_event_bind {
struct wlr_output *output;
struct wl_resource *resource;
...;
};

struct wlr_output_event_request_state {
struct wlr_output *output;
const struct wlr_output_state *state;
Expand Down Expand Up @@ -1172,6 +1224,16 @@ 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_state_set_buffer(struct wlr_output_state *state,
struct wlr_buffer *buffer);
bool wlr_output_state_set_gamma_lut(struct wlr_output_state *state,
size_t ramp_size, const uint16_t *r, const uint16_t *g, const uint16_t *b);
void wlr_output_state_set_damage(struct wlr_output_state *state,
const pixman_region32 *damage);
void wlr_output_state_set_layers(struct wlr_output_state *state,
struct wlr_output_layer_state *layers, size_t layers_len);
bool wlr_output_state_copy(struct wlr_output_state *dst,
const struct wlr_output_state *src);

void wlr_output_render_software_cursors(struct wlr_output *output,
struct pixman_region32 *damage);
Expand Down Expand Up @@ -1837,7 +1899,7 @@ def has_xwayland() -> bool:
struct wlr_scene_buffer *scene_buffer);

struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent,
int width, int height, const float color[static 4]);
int width, int height, const float color[static 4]);

void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, int width, int height);

Expand Down Expand Up @@ -1899,7 +1961,7 @@ def has_xwayland() -> bool:
struct wlr_scene_tree *parent, struct wlr_surface *surface);

void wlr_scene_subsurface_tree_set_clip(struct wlr_scene_node *node,
struct wlr_box *clip);
struct wlr_box *clip);

struct wlr_scene_tree *wlr_scene_xdg_surface_create(
struct wlr_scene_tree *parent, struct wlr_xdg_surface *xdg_surface);
Expand Down Expand Up @@ -2266,15 +2328,15 @@ def has_xwayland() -> bool:
};

struct wlr_session_lock_surface_v1_state {
uint32_t width, height;
uint32_t configure_serial;
uint32_t width, height;
uint32_t configure_serial;
};

struct wlr_session_lock_surface_v1_configure {
struct wl_list link; // wlr_session_lock_surface_v1.configure_list
uint32_t serial;
struct wl_list link; // wlr_session_lock_surface_v1.configure_list
uint32_t serial;

uint32_t width, height;
uint32_t width, height;
};

struct wlr_session_lock_surface_v1 {
Expand Down
4 changes: 2 additions & 2 deletions wlroots/util/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def __init__(self, ptr) -> None:
"""A wrapper aronud a timespec struct"""
self._ptr = ptr

@classmethod
def get_monotonic_time(cls) -> Timespec:
@staticmethod
def get_monotonic_time() -> Timespec:
"""Get the current monotonic time"""
timespec = ffi.new("struct timespec *")
ret = lib.clock_gettime(lib.CLOCK_MONOTONIC, timespec)
Expand Down
Loading
Loading