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

Add keepBorder <theme> option and enable it by default #876

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

Consolatis
Copy link
Member

@Consolatis Consolatis commented Apr 14, 2023

Fixes #813

Just a quick and dirty implementation with not that much testing.

TODO:

  • Add comment about !view->ssd in ssd_thickness()
  • Decide if we want to keep the keepBorder setting and if not
    • Remove the setting
    • Update docs
  • SSD resets on unfullscreen

@johanmalm
Copy link
Collaborator

Thanks! Looks good.
I took it for a test-drive and found that on labwc --reconfigure all views go back to showing titlebars. Other than that, seems to work really well.

@Consolatis
Copy link
Member Author

Another issue is that manually enabling SSDs on a CSD client correctly shows the SSD but when then disabling it again (with keepBorder enabled) it will keep the borders, e.g. once SSD is enabled you can't get rid of it anymore. I am not sure how that could be fixed as the intention to disable the SSD can mean different things.

@johanmalm johanmalm mentioned this pull request Jul 7, 2023
@hype3
Copy link
Contributor

hype3 commented Aug 6, 2023

Hi.

Any news how this goes?

@Consolatis
Copy link
Member Author

Consolatis commented Aug 8, 2023

The first issue (keep state on Reconfigure) should be relatively easy to fix (but requires saving some state outside of struct ssd).

The second issue however.. I am not sure.

  • Maybe we could try to figure out if the view is using client side decorations and in that case completely disable the SSD - including the border - rather than just hiding the titlebar.
  • Or we could have this being a 3-state action, e.g. SSD visible, ToggleDecorations with keepBorder set
    • 1st time: disable titlebar, e.g. only border visible
    • 2nd time: destroy the whole SSD
    • 3rd time: create the whole SSD

The second option (3-state) sounds not that hard to implement actually but I am not sure if that is the behavior a user would expect. In my eyes it seems like the most flexible option though as it allows the user to express all variants including having no decorations at all, even with keepBorder enabled. That is not the case with the first option or with the current state of this PR.

Edit:
I have implemented the 3-state option and personally I like how it behaves. Testing / comments about its behavior welcome. We could even remove the keepBorder setting completely and just always have ToggleDecorations use that 3-state variant. Thoughts @johanmalm?

Restore-on-Reconfigure still needs fixing.

@johanmalm
Copy link
Collaborator

Yes, I think this proposal makes a lot of sense. It would be pretty annoying if someone turned on SSD on a CSD client and then couldn't get rid of it 😄

I've had a play and it feels nice. It keeps it clean with the current client-menu too.

If - in the future - there is a use-case of a more direct set/unset of titlebar/ssd I guess we could add window-action like:

<action name="SetServerSideDecorationMode" mode="none|border|all"/>

I've just had a fresh look through the code. It's probably just my brain not keeping up, but...

src/ssd/ssd.c:36: why !view->ssd in if-statement

@Consolatis
Copy link
Member Author

Consolatis commented Aug 9, 2023

Yes, I think this proposal makes a lot of sense. It would be pretty annoying if someone turned on SSD on a CSD client and then couldn't get rid of it smile

I've had a play and it feels nice. It keeps it clean with the current client-menu too.

So completely remove the keepBorder setting and just always use the 3-state variant?

If - in the future - there is a use-case of a more direct set/unset of titlebar/ssd I guess we could add window-action like:

<action name="SetServerSideDecorationMode" mode="none|border|all"/>

Good idea. That would also be useful for the window rules. Or we add further options to the existing property instead.

I've just had a fresh look through the code. It's probably just my brain not keeping up, but...
src/ssd/ssd.c:36: why !view->ssd in if-statement

Just looked at that part and was confused as well. But it actually makes sense if what the comment on top says is true: that function has to return the correct dimensions even before ssd_create() has been called (view->ssd == NULL) but the view is configured to use a SSD (view->ssd_enabled). If the view doesn't want the SSD we return early on the top:

	/*
	 * Check preconditions for displaying SSD. Note that this
	 * needs to work even before ssd_create() has been called.
	 */
	if (!view->ssd_enabled || view->fullscreen) {
		return (struct border){ 0 };
	}

Thus when we are at the bottom of the function it doesn't matter if view->ssd has already been created or not and we always add the titlebar height (unless it has been disabled by only showing the border). I'll try to add a sensible comment on there so it makes sense on the first look rather than requiring a complete analyses of the function.

Edit:
Fixed border-only-on-reconfigure without adding a new struct view state.
Found a new issue though: unfullscreening resets the SSD as well and this likely won't work without having an external state.
But I'll wait with fixing that until it is clear if we want to keep the keepBorder setting or not.

@johanmalm
Copy link
Collaborator

Good stuff.

Yes, completely remove the keepBorder setting and just always use the 3-state variant. It’s a deviation from Openbox, but I think we need the flexibility.

@Consolatis
Copy link
Member Author

I had some further thoughts on the keepBorder setting. There may be situations where people don't want the border only mode (I am using ToggleDecorations as part of a keybind together with Maximize for example). To allow keep using the old pattern of on / off I left the config setting in place but have it default to true.

So unless the user manually disables the setting the 3-state variant is used, with the config setting disabled the old 2-state variant. I think this is a good compromise about flexibility and respecting user wishes. But I would also be up to remove the option if @johanmalm prefers.

Also added docs and fixed exiting fullscreen. IMHO this PR is basically ready, would just need to squash the commits into one and write a proper commit message. A final test would also be appreciated.

@johanmalm
Copy link
Collaborator

Good compromise.
LGTM

@johanmalm
Copy link
Collaborator

Have tested. Works well.

With the new keepBorder option enabled, the
ToggleDecorations action now has 3 states:

- the first time only disables the titlebar
- the second time disables the whole SSD
- the third time enables the whole SSD again

When the keepBorder action is disabled, the old 2-state
behavior is restored, e.g. the ToggleDecorations action
only toggles between on and off.

Fixes labwc#813
@Consolatis Consolatis changed the title [wip] add keepBorder Add keepBorder <theme> option and enable it by default Aug 10, 2023
@Consolatis Consolatis marked this pull request as ready for review August 10, 2023 14:01
@Consolatis Consolatis merged commit e39744f into labwc:master Aug 10, 2023
5 checks passed
@Consolatis Consolatis deleted the feature/keep_border branch August 10, 2023 14:09
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.

Openbox keepBorder feature
3 participants