Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Final prep before Linux Wayland support#20336

Closed
wmww wants to merge 1 commit intoflutter:masterfrom
wmww:final-wayland-prep
Closed

Final prep before Linux Wayland support#20336
wmww wants to merge 1 commit intoflutter:masterfrom
wmww:final-wayland-prep

Conversation

@wmww
Copy link
Contributor

@wmww wmww commented Aug 7, 2020

Description

  • Refactor and simplify the FlRenderer setup process (fl_renderer_start() is now the only relevant publicly facing method)
  • Allow accessing a FlView from an FlRenderer. This view can be used as a widget, and from it you can get a window. This prevents a patchwork of sending widgets and windows to various functions at various times.
  • Replace get_visual() with setup_window_attr(), which allows renderer implementations to customize window creation in a cleaner and more flexible way

After this is merged, all that's left is to add the FlRendererWayland file and Wayland support is good to go.

Related Issues

flutter/flutter#57932

Tests

None

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the contributor guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the C++, Objective-C, Java style guides for the engine.
  • I read the tree hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation.
  • All existing and new tests are passing.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change.

@wmww
Copy link
Contributor Author

wmww commented Aug 7, 2020

@robert-ancell

@auto-assign auto-assign bot requested a review from gw280 August 7, 2020 17:33
@robert-ancell robert-ancell force-pushed the final-wayland-prep branch 5 times, most recently from f71ca53 to 5db9a79 Compare August 17, 2020 23:07
G_DEFINE_QUARK(fl_renderer_error_quark, fl_renderer_error)

typedef struct {
FlView* view;
Copy link
Contributor

Choose a reason for hiding this comment

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

This has created an unnecessary circular dependency. fl_renderer_get_view is only used at initialization, so the view can just be passed through those methods.

Copy link
Contributor Author

@wmww wmww Aug 19, 2020

Choose a reason for hiding this comment

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

Since It's used in a few places in construction in X11 and in map/unmap functions on Wayland (which you can now see in my draft PR: https://github.com/flutter/engine/pull/20629/files), I thought it was cleaner to allow accessing it from the renderer. We could pass it around everywhere and store a copy in FlRendererWayland instead of FlRenderer, but I didn't see the advantage of that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm reviewing #20629 and it looks like a lot of the fl_renderer_get_view calls aren't necessary.

g_set_error(error, fl_renderer_error_quark(), FL_RENDERER_ERROR_FAILED,
"Can not create EGL surface: FlRendererX11::window not set");
GdkWindow* window = gtk_widget_get_window(
gtk_widget_get_toplevel(GTK_WIDGET(fl_renderer_get_view(renderer))));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this require the toplevel widget?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't and that was actually causing a rendering bug. Fixed.

@robert-ancell robert-ancell force-pushed the final-wayland-prep branch 4 times, most recently from 5e69091 to 5a249d5 Compare August 18, 2020 00:21
@robert-ancell
Copy link
Contributor

@wmww I've fixed the smaller issues and updated your branch. I'm having trouble reviewing these changes as a lot of interfaces are changing, and it's not clear if this is the right way forward. I think what would work better is a WIP PR that contains all the Wayland changes, and then make smaller PRs that bring some of the changes over one step at a time. I think "Consolidate FlRenderer initialization into fl_renderer_start() " and "Replace FlRenderer::get_visual() with more generic FlRenderer::setup_window_attr()" should be good to go now, but "Expose FlRenderer's FlView" needs more thought.

@wmww wmww mentioned this pull request Aug 19, 2020
9 tasks
@wmww
Copy link
Contributor Author

wmww commented Aug 19, 2020

Full Wayland support PR up. Do you understand the test_web failure? Because I do not.

@wmww wmww force-pushed the final-wayland-prep branch 3 times, most recently from 60ccf62 to 7a25479 Compare August 25, 2020 23:45
@wmww wmww force-pushed the final-wayland-prep branch from 7a25479 to 1cb75c5 Compare August 28, 2020 03:10
@robert-ancell
Copy link
Contributor

I've made a PR to #20629 that resolves the issue with the change in this PR. So we should be able to land #20629 without this change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants