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

Pointer: Added data property #174

Closed
wants to merge 7 commits into from
Closed
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
10 changes: 7 additions & 3 deletions tiny/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
Keyboard,
Output,
OutputLayout,
OutputState,
Scene,
SceneBuffer,
SceneNodeType,
Expand Down Expand Up @@ -346,9 +347,12 @@ def server_new_xdg_surface(self, listener, xdg_surface: XdgSurface) -> None:
def server_new_output(self, listener, output: Output) -> None:
output.init_render(self._allocator, self._renderer)

output.set_mode(output.preferred_mode())
output.enable()
output.commit()
state = OutputState()
state.enabled = True
state.mode = output.preferred_mode()
state.adaptive_sync_enabled = True # Will be disabled if unsupported

output.commit(state)

self.outputs.append(output)
self._output_layout.add_auto(output)
Expand Down
115 changes: 77 additions & 38 deletions wlroots/ffi_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,17 @@ def has_xwayland() -> bool:
};

struct wlr_output_state {
bool enabled;
float scale;
enum wl_output_transform transform;
bool adaptive_sync_enabled;
uint32_t render_format;
enum wl_output_subpixel subpixel;
struct wlr_output_mode *mode;
struct {
int32_t width, height;
int32_t refresh; // mHz, may be zero
} custom_mode;
...;
};

Expand Down Expand Up @@ -1172,12 +1183,36 @@ def has_xwayland() -> bool:
bool wlr_output_test(struct wlr_output *output);
bool wlr_output_commit(struct wlr_output *output);
void wlr_output_rollback(struct wlr_output *output);
bool wlr_output_test_state(struct wlr_output *output,
const struct wlr_output_state *state);
bool wlr_output_commit_state(struct wlr_output *output,
const struct wlr_output_state *state);

void wlr_output_state_set_enabled(struct wlr_output_state *state,
bool enabled);
void wlr_output_state_set_mode(struct wlr_output_state *state,
struct wlr_output_mode *mode);
void wlr_output_state_set_custom_mode(struct wlr_output_state *state,
int32_t width, int32_t height, int32_t refresh);
void wlr_output_state_set_scale(struct wlr_output_state *state, float scale);
void wlr_output_state_set_transform(struct wlr_output_state *state,
enum wl_output_transform transform);
void wlr_output_state_set_adaptive_sync_enabled(struct wlr_output_state *state,
bool enabled);
void wlr_output_state_set_render_format(struct wlr_output_state *state,
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);

enum wl_output_transform wlr_output_transform_invert(
enum wl_output_transform tr);

enum wl_output_transform wlr_output_transform_compose(
enum wl_output_transform tr_a, enum wl_output_transform tr_b);

"""

# types/wlr_output_damage.h
Expand Down Expand Up @@ -1341,6 +1376,10 @@ def has_xwayland() -> bool:
struct wlr_output_configuration_v1 *config, struct wlr_output *output);
void wlr_output_configuration_v1_destroy(
struct wlr_output_configuration_v1 *config);

void wlr_output_head_v1_state_apply(
const struct wlr_output_head_v1_state *head_state,
struct wlr_output_state *output_state);
"""

# types/wlr_output_powewr_management_v1.h
Expand Down Expand Up @@ -2166,23 +2205,23 @@ def has_xwayland() -> bool:
struct wlr_keyboard *wlr_seat_get_keyboard(struct wlr_seat *seat);

void wlr_seat_touch_point_focus(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t time_msec,
int32_t touch_id, double sx, double sy);
struct wlr_surface *surface, uint32_t time_msec,
int32_t touch_id, double sx, double sy);
void wlr_seat_touch_point_clear_focus(struct wlr_seat *seat, uint32_t time_msec,
int32_t touch_id);
int32_t touch_id);
uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t time_msec,
int32_t touch_id, double sx, double sy);
struct wlr_surface *surface, uint32_t time_msec,
int32_t touch_id, double sx, double sy);
void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time_msec,
int32_t touch_id);
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);
int32_t touch_id, double sx, double sy);
void wlr_seat_touch_notify_cancel(struct wlr_seat *seat,
struct wlr_surface *surface);
struct wlr_surface *surface);
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,
struct wlr_seat_touch_grab *grab);
struct wlr_seat_touch_grab *grab);
void wlr_seat_touch_end_grab(struct wlr_seat *wlr_seat);
bool wlr_seat_touch_has_grab(struct wlr_seat *seat);

Expand Down Expand Up @@ -2238,57 +2277,57 @@ def has_xwayland() -> bool:
# types/wlr_touch.h
CDEF += """
struct wlr_touch {
struct wlr_input_device base;
const struct wlr_touch_impl *impl;
char *output_name;
double width_mm, height_mm;
struct {
struct wl_signal down; // struct wlr_touch_down_event
struct wl_signal up; // struct wlr_touch_up_event
struct wl_signal motion; // struct wlr_touch_motion_event
struct wl_signal cancel; // struct wlr_touch_cancel_event
struct wl_signal frame;
} events;
struct wlr_input_device base;
const struct wlr_touch_impl *impl;
char *output_name;
double width_mm, height_mm;
struct {
struct wl_signal down; // struct wlr_touch_down_event
struct wl_signal up; // struct wlr_touch_up_event
struct wl_signal motion; // struct wlr_touch_motion_event
struct wl_signal cancel; // struct wlr_touch_cancel_event
struct wl_signal frame;
} events;

void *data;
void *data;

...;
};

struct wlr_touch_down_event {
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
// From 0..1
double x, y;
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
// From 0..1
double x, y;
...;
};

struct wlr_touch_up_event {
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
...;
};

struct wlr_touch_motion_event {
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
// From 0..1
double x, y;
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
// From 0..1
double x, y;
...;
};

struct wlr_touch_cancel_event {
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
...;
};

struct wlr_touch *wlr_touch_from_input_device(
struct wlr_input_device *input_device);
struct wlr_input_device *input_device);
"""

# types/wlr_virtual_keyboard_v1.h
Expand Down
2 changes: 1 addition & 1 deletion wlroots/wlr_types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .keyboard import Keyboard # noqa: F401
from .layer_shell_v1 import LayerShellV1 # noqa: F401
from .matrix import Matrix # noqa: F401
from .output import Output # noqa: F401
from .output import Output, OutputState # noqa: F401
from .output_damage import OutputDamage # noqa: F401
from .output_layout import OutputLayout # noqa: F401
from .pointer import ( # noqa: F401
Expand Down
Loading
Loading