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

wl: Support multiple wl_seats #623

Merged
merged 2 commits into from
Nov 1, 2023
Merged

Conversation

psaavedra
Copy link
Member

@psaavedra psaavedra commented Oct 24, 2023

This change extend the WL platform to support more than one WL Seat registered to the Cog app.

Now the CogWlDisplay contains a default seat. This is the first registered and then the last seat activated. This is used for the shell_popup_surface and for the on_mouse_target_changed handlers. The CogWlDisplay also contains the rest of the CogWlPlatform in a list.

The listeners associated to input methods (pointer, keyboard and touch) now pass the CogWlSeat as contextual information to the callbacks. The CogWlPlatform object is still accessible because this is attached as user_data to the wl_surface on creation time and associated to the seats as [pointer|keyboard|touch]_target then the input event is activated. These also updates what is the default seat.

This patch also fixes the tracking of the serials for the input methods. Now each different kind of input method for each Seat is stored individually and updated according. Still it is possible to get the latest serial using the suitable cog_wl_seat_get_serial() function.

Some other code was cleaned-up and relocated in cot-utils-wl as functions: cog_wl_display_add_seat; cog_wl_seat_create(); cog_wl_seat_destroy(); void cog_wl_text_input_clear(); cog_wl_text_input_set().

Also CogWlDisplay create/destroy logic is wrapped inside of the cog_wl_display_create() and cog_wl_display_destroy() functions and move these to cog-utils-wl.

@psaavedra psaavedra requested a review from aperezdc October 24, 2023 15:10
@psaavedra psaavedra self-assigned this Oct 24, 2023
@psaavedra psaavedra changed the title wl: Support multiple wl_seats [wip] wl: Support multiple wl_seats Oct 24, 2023
@psaavedra psaavedra force-pushed the psaavedra/main-refactorings-623 branch 12 times, most recently from 8e70423 to bce7a5c Compare October 25, 2023 22:00
@psaavedra psaavedra changed the title [wip] wl: Support multiple wl_seats wl: Support multiple wl_seats Oct 25, 2023
@psaavedra psaavedra force-pushed the psaavedra/main-refactorings-623 branch 3 times, most recently from 7bd5ce4 to d3d5479 Compare October 25, 2023 22:41
@aperezdc aperezdc added the enhancement New feature or request label Oct 27, 2023
@psaavedra psaavedra force-pushed the psaavedra/main-refactorings-623 branch 2 times, most recently from 47e331a to a321b21 Compare October 27, 2023 13:34
Copy link
Member

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. The first commit can land as-is, but I have a few notes on the other one. Please take a look and update the patch, or comment if you think your current approach is better 😸

platform/wayland/cog-platform-wl.c Outdated Show resolved Hide resolved
platform/wayland/cog-platform-wl.c Outdated Show resolved Hide resolved
platform/wayland/cog-platform-wl.c Show resolved Hide resolved
Copy link
Member Author

@psaavedra psaavedra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some additional comments to justify and explain the implementation details.

platform/wayland/cog-platform-wl.c Show resolved Hide resolved
platform/wayland/cog-platform-wl.c Show resolved Hide resolved
platform/wayland/cog-platform-wl.c Show resolved Hide resolved
platform/wayland/cog-platform-wl.c Show resolved Hide resolved
platform/wayland/cog-platform-wl.c Outdated Show resolved Hide resolved
platform/wayland/cog-platform-wl.c Show resolved Hide resolved
platform/wayland/cog-platform-wl.c Outdated Show resolved Hide resolved
Wrap the creation and destruction of a Wayland display inside of the
cog_wl_display_create() and cog_wl_display_destroy() functions and move
these to cog-utils-wl.
@psaavedra psaavedra force-pushed the psaavedra/main-refactorings-623 branch from a321b21 to a43b0fc Compare October 31, 2023 19:49
Copy link
Member

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's now nicer and easier to follow, thanks!

Patch LGTM with a small nit you may want to fix before landing.

platform/wayland/cog-platform-wl.c Outdated Show resolved Hide resolved
A CogWlDisplay contains a default seat. This default value is the first seat
registered and hereafter the last one activated. This is used for the
shell_popup_surface and for the on_mouse_target_changed handlers. The
CogWlDisplay also contains the rest of the CogWlPlatform in a list.

This patch also fixes the tracking of the serials for the input methods.
Now each different kind of input method for each Seat is stored
individually and updated according. Still it is possible to get the
latest serial using the suitable cog_wl_seat_get_serial() function.

Some code was cleaned-up and relocated in cot-utils-wl as
functions: cog_wl_display_add_seat; cog_wl_seat_create();
cog_wl_seat_destroy(); void cog_wl_text_input_clear(); cog_wl_text_input_set()
@psaavedra psaavedra force-pushed the psaavedra/main-refactorings-623 branch from a43b0fc to 5896b0b Compare November 1, 2023 08:09
@psaavedra psaavedra merged commit 7202c36 into master Nov 1, 2023
5 checks passed
@psaavedra psaavedra deleted the psaavedra/main-refactorings-623 branch November 1, 2023 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants