Skip to content

Conversation

mmstick
Copy link
Member

@mmstick mmstick commented Aug 6, 2025

  • Fixed keyboard focus sometimes being lost (sent to wrong window in stack) when focusing windows in a stack
  • Fix tab overflow overlay gradient colors to use the recommended gradients in Figma
  • Fix padding of elements in the tab, which will now match the Figma design
  • Track Tab hover state to apply hover background tab colors
  • Cache tab model data in CosmicStackInternal to borrow and reuse between view method calls
  • Refactored properties in CosmicStackInternal to not require Arc
  • Refactored CosmicStack to queue window add/remove/swap messages for CosmicStackInternal's update method
    • Eliminates need for a Mutex when accessing windows attached to CosmicStackInternal
    • Lets CosmicStackInternal cache tab model data, and keep it in sync with window order changes
    • Allows CosmicStackInternal to redraw itself without needing to force a redraw
    • Fixes keyboard focus sometimes being sent to the wrong window in the stack on focus changes

@mmstick mmstick requested a review from Drakulix August 6, 2025 15:35
Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

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

This is quite the challenge to review, I would've really appreciated this to be split in a few more manageable commits - especially the larger refactorings like the Arc and moving a lot of the logic into update.

Refactored CosmicStack to queue window add/remove/swap messages for CosmicStackInternal's update method
Eliminates need for a Mutex when accessing windows attached to CosmicStackInternal
Lets CosmicStackInternal cache tab model data, and keep it in sync with window order changes
Allows CosmicStackInternal to redraw itself without needing to force a redraw

I am not sure, that this is a good idea for multiple reasons:

  • We potentially call this in a completely different thread, which I am not sure is even valid for the wayland-objects involved here. The Send-impls here are not sound - just necessary for the render/main-logic split. Sadly iced doesn't allow us to split this as neatly resulting in this mess.
  • We potentially delay focus events even longer by doing this and only the next keyboard event afterwards actually dispatch the correct events, while e.g. modifiers/key events might still go to the previous window as long as we aren't done processing that queue. For that reason I believe, that this likely introduces even more corner-cases than it fixes.

A proper fix for the latter would be Smithay/smithay#1384, which would us allow to easily send these events, where they should happen.

Realistically we need to rework set_active and the like to have access to the full State to accomplish that and properly fix this.

Fixes keyboard focus sometimes being sent to the wrong window in the stack on focus changes

How does it fix that, btw? From what I can decipher, it doesn't look like we actually handle things differently, just at a different point of time.

Have you been able to debug where the code previous went wrong or are you simply not able to reproduce the issue after the refactor?

@Drakulix
Copy link
Member

Drakulix commented Aug 6, 2025

Sorry if that came over as a bit harsh.

Fix tab overflow overlay gradient colors to use the recommended gradients in Figma
Fix padding of elements in the tab, which will now match the Figma design
Track Tab hover state to apply hover background tab colors
Cache tab model data in CosmicStackInternal to borrow and reuse between view method calls

These are all very welcome and I appreciate the design around the tab-model a lot. Given this is all bundled into a single commit, I just felt like I had to address the issues first, sorry!

@mmstick mmstick force-pushed the stack branch 5 times, most recently from 559b50d to d8995a6 Compare August 7, 2025 05:08
Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

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

Looks great apart from some minor issues!

renderer.with_layer(bounds, |renderer| {
if state.overflowed {
let overlay = match (theme.cosmic().is_dark, self.selected) {
(true, false) => Color {
Copy link
Member

Choose a reason for hiding this comment

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

I guess it would be nice to move these into constants with proper names, but given they are only used once, this isn't important.

@mmstick
Copy link
Member Author

mmstick commented Sep 25, 2025

Rebased and removed the last commit. Still testing though

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.

2 participants