buffet / kiwmi

A fully programmable Wayland Compositor
Mozilla Public License 2.0
585 stars 22 forks source link

Add wlr_output_manager support #62

Open Uks2 opened 2 years ago

Uks2 commented 2 years ago

This allows things like wlr-randr to work.

There's the standard wlroots plumbing to connect up, plus a few extra checks here and there to make sure we're not trying to access an output that doesn't exist anymore.

ghost commented 2 years ago

Can you split the diff unrelated to wlr_output_manager into a separate commit? It’s quite small i know, but it would help make the history cleaner.

Uks2 commented 2 years ago

Wait! No! This version isn't sending events to lua at all. Rats.

I'll see if I can fix that tomorrow...

Uks2 commented 2 years ago

Another small problem I've noticed: if you disable a monitor using wlr-randr or whatever, the bounds for the cursor remain unchanged; you can move it off screen, into the invisible place where that monitor used to be.

I'm not sure why that's happening. When we create a wlr_cursor, we associate the wlr_output_layout with it, and wlroots registers its own handler for when that layout changes. I'll need to take a closer look at some point.

ghost commented 2 years ago

I believe that’s related to https://github.com/buffet/kiwmi/pull/62#discussion_r909450955: the wlr_output_layout doesn’t add/remove outputs as they are enabled/disabled, the compositor has to do it itself. (This behaviour is useful e.g. for wlr-output-power-management.)

ghost commented 2 years ago

IIRC there was some issue before with sometimes erroneously getting a new output event, so i’ll see if it’s still there or got fixed mid-way

Seems like it got fixed and/or i remember wrongly.

Edit: for the record, it’s only me being dumb again and testing my rebase rather than this PR. That wrong event was apparently caused by changes in wlroots 0.16. No need to worry for now; it can be solved when the time comes.

ghost commented 2 years ago

The commit message also isn’t right anymore (fortunately):

It required the addition of a flag to the output structure, because, when applying or testing a new layout, you have to go through each output and check that all their new configurations work. Then, if they all do, you go through again commit those changes and send off new output events and such. But you need a way of keeping track of which outputs have had their enabled status changed and it was simpler to just put that in the output's struct than to create some whole new data structure.