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

Introduce CogViewport, add support in the Wayland plug-in and example program #644

Merged
merged 4 commits into from
Nov 3, 2023

Conversation

aperezdc
Copy link
Member

@aperezdc aperezdc commented Nov 2, 2023

This PR brings in the following:

  • A new CogViewport class, which represents an “output” to display one of a set of view.
  • Adapting CogShell to use a viewport instead of a single view. At some point we will want to uncouple the shell (see Disentangle CogShell from CogPlatform #634) but this replacement is enough for now.
  • Add an examples/viewport.c example program which shows how to switch between among the views of a viewport.
  • Adapt the Wayland platform plug-in to no longer assume that there is a single view.

I would recommend reviewing each commit separately.

Add a new CogViewport class, which represents a container (e.g. a
window, output surface, GTK widget, etc.) which can display one web
view out from a group. The container can itself be observable using
its "add" and "remove" signals, tracks a "visible" view, and ensures
that only the visible view has the "visible" state flag enabled.
@aperezdc aperezdc added the enhancement New feature or request label Nov 2, 2023
@aperezdc aperezdc self-assigned this Nov 2, 2023
@psaavedra
Copy link
Member

One comment after a first quick test:

  • The Fullscreen resize is working fine
  • The same for the popup option menu. Works OK
  • However, the virtual keyboard stopped working with this change. I don't any obvious reason for this. What change is adding this regression is not obvious to me after reading the patch. I am trying to go deeply inside this issue right now.

@aperezdc
Copy link
Member Author

aperezdc commented Nov 3, 2023

  • However, the virtual keyboard stopped working with this change. I don't any obvious reason for this. What change is adding this regression is not obvious to me after reading the patch. I am trying to go deeply inside this issue right now.

Thanks for testing, I hadn't tried the virtual keyboard support so I didn't notice. I will try to take a look later.

Copy link
Member

@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.

other than the mentioned regression found with the focus. The rest of the changes looks really great.

I also notice the view->platform is not really needed and removed from the code. I am fine with this also.

I think the PR were be ready for land once you update it according my suggestion and passes the code-style checker.

Use a CogViewport instead of a single web view. This will allow the
current platform plug-ins to show in their output one of many views
without needing many changes.

Note that in the future platform plug-ins should be updated to avoid
using globals and make them handle multiple viewports (e.g. windows)
as well.
Add an examples/ subdirectory, and a new simple-stack example program
which shows how to attach multiple views to the CogShell view stack
and switch among them.
Replace the single view saved in the CogWlPlatform by the viewport
being used by the shell, taking care that only the visible view gets
to update the contents of the Wayland surface and that input events
get sent to the visible view as well.

There are some locations where the visible view is assumed to be also
the focused one, which may not be true later on when multiple viewports
are supported. This compromise is okay for the time being and may need
to be revisited later on.
@aperezdc
Copy link
Member Author

aperezdc commented Nov 3, 2023

@psaavedra Updated, PTAL when you have a minute 🙏🏼

Copy link
Member

@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.

Awesome. LGTM now.

@aperezdc aperezdc merged commit c85b758 into master Nov 3, 2023
5 checks passed
@aperezdc aperezdc deleted the aperezdc/viewport branch November 3, 2023 12:25
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