Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

xwayland: add server and basic window functionality #10

Merged
merged 4 commits into from
Jul 21, 2020
Merged

xwayland: add server and basic window functionality #10

merged 4 commits into from
Jul 21, 2020

Conversation

alex-courtis
Copy link
Contributor

dwl: Great News

So happy to find this project! I'm a massive dwm fan, who knows it is soon time to move to wayland.

Using the mature wlroots is the right thing to do, even if it's not quite suckless. I even started such a project, but never followed through: https://github.com/alex-courtis/wdwm

I am hopeful that the preserved structure of dwl will result in many dwm patches still applying, or applying with little change.

Happy to help in any way I can, so I picked a task off the feature list in the readme.

cheers,
Alex

XWayland

These changes add the X server and dwl functionality for basic X clients. It's been tested with st, chromium and intellij, at scale 1 and 2.

I don't know your preferences: merge incrementally or keep a long running branch until feature complete. This PR is here, you can decide.

Next:

  • Dropdown menu support
  • X selection to wayland selection
  • Focus passing between surfaces from the same process (for Jetbrains)
  • X properties providing
  • Floating windows

Remaining functionality will be added at the same time dwl implements e.g. fullscreen

struct wl_listener map;
struct wl_listener unmap;
struct wl_listener destroy;
struct wlr_box geom; /* layout-relative, includes border */
int isxdg;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could become an enum, when we add layer shell.

title = broken;
} else {
if (!(title = c->xwayland_surface->title))
title = broken;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

xwayland does not have an app_id

Copy link
Owner

Choose a reason for hiding this comment

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

It does appear to still have instance/class though

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 does appear to still have instance/class though

We can add those when we use them e.g. rules based on class.

else
surface = wlr_surface_surface_at(c->xwayland_surface->surface,
cursor->x - c->geom.x - c->bw,
cursor->y - c->geom.y - c->bw, NULL, NULL);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cases like these intentionally invoke different methods, as the xdg version has more functionality.

@@ -1550,6 +1643,7 @@ main(int argc, char *argv[])
run(startup_cmd);

/* Once wl_display_run returns, we shut down the server. */
wlr_xwayland_destroy(xwayland);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is null safe.

union {
struct wlr_xdg_surface *xdg_surface;
struct wlr_xwayland_surface *xwayland_surface;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The anonymous-union-and-a-boolean seemed the simplest approach, and sway is using it.

Happy to change if anything better is suggested.

dwl.c Outdated
surface = c->xdg_surface->surface;
if (c && !surface) {
surface = WLR_SURFACE(c);
}

Choose a reason for hiding this comment

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

It looks like this repo prefers to omit braces when an if contains a single statement. This change does not match that style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed; thanks for spotting it.

@theotherjimmy
Copy link

Thanks for getting back to the review! It looks like your commits are all the same message. I'm not sure what the policy is for this repo (note that they may prefer you not rebase/force push more than they care about commit messages), but I encourage commit messages that describe what's going on in the commit. Something like "Remove braces from single-statement if" is what I would write for that last commit.

@alex-courtis
Copy link
Contributor Author

/nudge @djpohly

@djpohly djpohly merged commit 57fef50 into djpohly:master Jul 21, 2020
@djpohly
Copy link
Owner

djpohly commented Jul 21, 2020

Thanks @alex-courtis for the work! Sorry I couldn't get to major dwl stuff until now (teaching + research + pandemic = crazy), but this looks like a great starting point for XWayland.

@alex-courtis
Copy link
Contributor Author

Thanks @alex-courtis for the work! Sorry I couldn't get to major dwl stuff until now (teaching + research + pandemic = crazy), but this looks like a great starting point for XWayland.

No worries. More xwayland PRs incoming.

@yoandrisolis yoandrisolis mentioned this pull request Jul 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants