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

[RFC] client: Rewrite the client stacking code in Lua. #3751

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Elv13
Copy link
Member

@Elv13 Elv13 commented Dec 12, 2022

This adds 2 new requests:

  • request::raise: Helps to decouple ewmh and client class internally plus allow some focus stealing policies.
  • reqest::restack: Send why something is restacked to Lua. It allows to do things like sending a client to the back of a layout rather than use the master area.

This is mostly a 1:1 port of the C code. The idea is to use this as a starting point to have a stack per tag rather than something global. It also paves the way for stacking wibox among clients in a predictable way. None of that is exposed in the public API as part of this commit. The point is to get enough going so the wibox desktop layer PR (#3750 ) can be implemented on top of this.

@Elv13 Elv13 force-pushed the client_stacking branch 2 times, most recently from 8432624 to 17f062e Compare December 12, 2022 07:30
@Elv13 Elv13 force-pushed the client_stacking branch 2 times, most recently from fac155d to 22a3461 Compare December 12, 2022 08:05
@codecov
Copy link

codecov bot commented Dec 12, 2022

Codecov Report

Merging #3751 (c6a9148) into master (1239cdf) will increase coverage by 0.04%.
The diff coverage is 80.83%.

@@            Coverage Diff             @@
##           master    #3751      +/-   ##
==========================================
+ Coverage   90.97%   91.01%   +0.04%     
==========================================
  Files         900      900              
  Lines       57500    57553      +53     
==========================================
+ Hits        52309    52381      +72     
+ Misses       5191     5172      -19     
Flag Coverage Δ
gcov 91.01% <80.83%> (+0.04%) ⬆️
luacov 93.70% <87.27%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
event.c 78.10% <0.00%> (-0.78%) ⬇️
event.h 100.00% <ø> (ø)
objects/client.h 70.00% <ø> (+7.50%) ⬆️
root.c 87.43% <ø> (-0.42%) ⬇️
objects/client.c 82.92% <50.00%> (-0.21%) ⬇️
lib/awful/layout/init.lua 92.47% <87.27%> (-1.39%) ⬇️
stack.c 96.72% <97.43%> (+0.11%) ⬆️
objects/drawin.c 90.51% <100.00%> (+2.55%) ⬆️
tests/examples/screen/template.lua 96.64% <0.00%> (-0.21%) ⬇️
... and 7 more

Copy link
Contributor

@Aproxia-dev Aproxia-dev left a comment

Choose a reason for hiding this comment

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

All this seems pretty good, and at first glance it works fine too. I'm sending this message from this branch right now, actually.
The only things that I'd point out other than the changes i have requested, is that spawning windows feels somewhat sluggish compared to the main branch, but I don't think that that's a dealbreaker for most people lol

for _, c in ipairs(clients) do append(c) end
for i=#drawins, 1, -1 do append(drawins[i].get_wibox()) end
Copy link
Contributor

Choose a reason for hiding this comment

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

These two lines should be swapped, as in the original C code, drawins are rendered under clients. (plus it kinda ruins the point of ontop)

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure about this, swapping those line breaks quite a few things. For example, the client go on top of the wibar in the "old" builds. If I swap these, the wibox goes on top. That doesn't mean it didn't break anything. It's after all not exactly what it did before. What did you witness being in the wrong order?

Copy link
Contributor

Choose a reason for hiding this comment

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

That must've been a mistake on my end. Wiboxes do indeed go on top when these two lines are swapped. I just thought that it would be the other way around. Didn't notice line 482 inserting into the table at index 1 lol

Copy link
Member

Choose a reason for hiding this comment

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

IMO client should go over wibar only if it have c.ontop == true

lib/awful/layout/init.lua Outdated Show resolved Hide resolved
This adds 2 new requests:

 * request::raise: Helps to decouple ewmh and client class
    internally plus allow some focus stealing policies.
 * reqest::restack: Send *why* something is restacked to Lua. It
    allows to do things like sending a client to the back of a
    layout rather than use the master area.

This is mostly a 1:1 port of the C code. The idea is to use this as
a starting point to have a stack per `tag` rather than something
global. It also paves the way for stacking wibox among clients
in a predictable way. None of that is exposed in the public API
as part of this commit. The point is to get enough going so the
wibox desktop layer PR can be implemented on top of this.
* \param c The client to push.
* \param context An human readable reason of why this was done.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* \param context An human readable reason of why this was done.
* \param context A human-readable reason of why this was done.

Though, I'd disagree that this is "human-readable". The only values for this I've seen in the PR are cryptic, single word strings like "maprequest".

If the context is supposed to be human-readable, i.e. printed, it should at the very least include the full caller's function name, so that you have something to search for.
Or if context is supposed to be compared to programmatically, it should be an enum, with each value documented.

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.

4 participants