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

Allow multiple viewports on Wayland platform #646

Closed
wants to merge 22 commits into from

Conversation

psaavedra
Copy link
Member

@psaavedra psaavedra commented Nov 3, 2023

  • wl: Fix unused variable display warning
  • wl: Split cog_platform_configure in 2 stages (create and configure)
    • Disassociate the configuration respect of the creation of the platform.
  • wl: Allow platform implementations can provide their own viewport class
    • Optionally, platform plug-in implementations can provide their own
      viewport class by overriding the CogPlatform.get_viewport_type method.
  • wl: Initial empty implementation of CogWlViewport
  • wl: Move CogWlWindow to the CogWlViewport
  • wl: Replace the shell and platform CogWlViewport unique reference with a GHashTable
  • wl: Add default CogWlViewport/CogWlView
  • wl: Extend CogShell API for add/remove CogViewport

@psaavedra psaavedra marked this pull request as draft November 3, 2023 20:36
@psaavedra psaavedra force-pushed the psaavedra/multiple_viewports branch 3 times, most recently from f16ac8d to c624e03 Compare November 5, 2023 14:04
@psaavedra psaavedra marked this pull request as ready for review November 5, 2023 14:04
@psaavedra psaavedra changed the title Allow multiple viewports Allow multiple viewports on Wayland platform Nov 5, 2023
@psaavedra psaavedra marked this pull request as draft November 5, 2023 14:52
@psaavedra psaavedra force-pushed the psaavedra/multiple_viewports branch 6 times, most recently from 62b8a48 to 5b9507f Compare November 7, 2023 10:34
Convenient reference to make explicit and accessible what is the
Viewport where the CogView is attached.
Code now uses the CogViewport assigned to the CogView instead of the
global CogViewport reference inside of the Platform.
The cog_wl_platform_popup_create() uses the information of the viewport
for setting the surface. The viewport in use will be the one associated
to the View.
The input method context is now defined and assigned to the View once
this is added to a Viewport, in cog_viewport_add(). Before is not
possible since we need to have access to the wl_surface associated to
the Viewport->Window for configuring the IM context.
Added new functons in the CogShell API for handling multiple Viewport:

* cog_shell_viewport_lookup(CogShell *, CogViewportKey);
* cog_shell_viewport_new(CogShell *, CogViewportKey);
* cog_shell_viewport_remove(CogShell *, CogViewportKey);

Also added the CogShell::create-viewport signal. This signal is
emitted when the shell creates a new a new CogViewport. Handling this
signal allows to customize the actions required to be done during the
creation of a new viewport.

This modifies the behaviour of the 'cog_shell_get_viewport()'. This
creates a default viewport in order to keep the current behavior. This
creation of the default viewport is lazy and it is delayed until the
invokation of the 'cog_shell_get_viewport()'.

Finally, this also clarifies how the launcher based on Cog should to
perform the start-up:

1. Create the Platform
2. Create the Shell
3. Configure the platform using the created Shell
4. Shell startup

(see documentation in 'cog_launcher_startup()').
... and reset the reference in the Platform if the destroyed popup
is the same.
Add a new multiple-stack example program which shows how to attach
2 viewports to the CogShell. Each viewport iterates over a couple
of views.
Gets if the view is visible inside of the viewport where the view
is attached.

Returns: True if the view is visible in its viewport and false in any
other case.
Set the view as the one visible inside of the viewport where the view is
attached.
... on pointer_on_enter, touch_on_down and keyboard_on_enter.

It can be possible a race condition during the destruction of a CogView
if, during this action, the UI-process is receiving and trying to
process an input event.

Under this scenario, the wl_surface associated could be not longer
there so the input handler will receive a null-pointer (0x0).

Backtrace:

```
0  0x6f45a3bc in wl_proxy_get_user_data (proxy=proxy@entry=0x0)
    at ../wayland/src/wayland-client.c:2135

    at /usr/include/wayland-client-protocol.h:3393
    fixed_x=0, fixed_y=5, surface=0x0, data=0x6cf09088) <<<<<<<<<<<<<
```
Support the ivi-application protocol, adding two new cog_wl_viewport_set_id()
and cog_wl_viewport_get_id() functions. If the ivi-application protocol is
being used, it will set the identifier for the surface associated to the
window, otherwise it is a no-op.

Based on a patch originally from Claudio Saavedra <[email protected]>
and Adrian Perez de Castro <[email protected]>.
In some unstable compisitors it could be posible to receive touch
up/motion evebts inmediatelly after a touch up (touch deini the touch
target).
Set the priority of PwlSource to G_PRIORITY_HIGH+30 to handle
Wayland events as quick as possible.

Based on a patch originally from Adrian Perez de Castro <[email protected]>.
@psaavedra psaavedra self-assigned this Nov 23, 2023
@psaavedra
Copy link
Member Author

Replaced by #675

@psaavedra psaavedra closed this Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant