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

More Wayland core support: menus are placed correctly. #123

Merged
merged 6 commits into from Jan 16, 2018

Conversation

AlanGriffiths
Copy link
Contributor

Some stubs implemented and windows are only created when we know their size.

  o some stubs implemented;
  o windows are only created when we know their size.
Copy link
Contributor

@gerboland gerboland left a comment

Choose a reason for hiding this comment

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

A few comments/questions inline

{
resize_handler = handler;
}

void set_hide_handler(std::function<void()> const& handler)
void set_hide_handler(std::function<void(bool visible)> const& handler)
Copy link
Contributor

Choose a reason for hiding this comment

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

So this will result in hide_handler(true) actually making it visible? Confusing!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll rename it

mir::shell::SurfaceSpecification mods;
mods.state = mir_window_state_fullscreen;
if (output)
if (surface_id.as_value())
Copy link
Contributor

Choose a reason for hiding this comment

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

surface_id can not have a value? /me raises eyebrow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

surface_id has a value of 0 until we create a window in the Mir scene, after which it identifies the window. (I'll listen to ideas on how to manage this state better.)

mir_surface->surface_id = surface_id;

{
// The shell isn't guaranteed to respect the requested size
Copy link
Contributor

Choose a reason for hiding this comment

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

Any idea if this is a Wayland policy too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No direct knowledge, but I don't see how else things can be done e.g. for a tiling WM.

Copy link
Contributor

@RAOF RAOF left a comment

Choose a reason for hiding this comment

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

Could you please split out the functional changes from the whitespace/namespace changes? It makes it really difficult to see what the functional change is here.

The functional changes themselves look correct, modulo my query about static_cast.

@@ -1477,7 +1482,7 @@ class WlSeat
{
auto me = reinterpret_cast<WlSeat*>(data);
auto resource = wl_resource_create(client, &wl_seat_interface,
std::min(version, 6u), id);
std::min(version, 6u), id);
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to match our style guide, of 4-space continuations?

uint32_t /*flags*/) override
{
auto const session = session_for_client(client);
auto* tmp = wl_resource_get_user_data(parent);
auto& parent_surface = *static_cast<WlSurface*>(tmp);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this safe? wl_resource_get_user_data(parent) will be a wayland::Surface* type-erased to void*. Shouldn't that be static_cast<WlSurface*>(static_castwayland::Surface*(tmp)), in order to ensure the correct offset?

uint32_t /*flags*/) override
{
auto const session = session_for_client(client);
auto* tmp = wl_resource_get_user_data(parent);
auto& parent_surface = *static_cast<WlSurface*>(tmp);
Copy link
Contributor

Choose a reason for hiding this comment

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

Likewise, is this safe?

.of_type(mir_window_type_freestyle)
.of_size(geom::Size{640, 480})
.with_buffer_stream(mir_surface.stream_id);
auto* mir_surface = static_cast<WlSurface*>(tmp);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I know this is existing code, but is it actually safe?

wl_resource_get_user_data(surface) will return a void* pointing to a wayland::Surface; I don't think static_cast-ing directly to a WlSurface* is guaranteed to do the right thing?

Shouldn't it be static_cast<WlSurface*>(static_cast<wayland::Surface*>(tmp))?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. Fix on the way.

Copy link
Contributor

@gerboland gerboland left a comment

Choose a reason for hiding this comment

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

No objections here!

@RAOF
Copy link
Contributor

RAOF commented Jan 16, 2018

Ooops, yes.
bors r+

bors bot added a commit that referenced this pull request Jan 16, 2018
123: More Wayland core support: menus are placed correctly. r=RAOF a=AlanGriffiths

Some stubs implemented and windows are only created when we know their size.
Copy link
Contributor

@RAOF RAOF left a comment

Choose a reason for hiding this comment

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

Yeah, I reviewed this a while ago but wasn't logged in. Oops.

@bors
Copy link
Contributor

bors bot commented Jan 16, 2018

Build succeeded

@bors bors bot merged commit b9b2f96 into master Jan 16, 2018
@bors bors bot deleted the better-wayland-support branch January 16, 2018 10:42
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.

None yet

3 participants