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

Windows/Linux: work towards replacing native window frame with our own custom buttons #1094

Merged
merged 16 commits into from
Feb 7, 2023

Conversation

emilk
Copy link
Member

@emilk emilk commented Feb 5, 2023

Work towards #1063

This PR adds the code for the new custom window frame but with the feature disabled. It should therefore be safe to merge.

The rounding of the corners is done manually for each panel. A more robust solution would be to render to an offscreen buffer and then do the rounding afterwards, but hacking that into eframe is more work than we have before release 😬

TODO

Future work

  • Fix window resizing UI on both Wayland and Xorg
  • Fix lower right corner (paint_time_ranges_gaps). Maybe turn off rounding?
  • Test on Linux X11
  • Test on Linux Wayland
  • Test on Windows
  • Custom icons for close/maximize/minimize
  • I think we need to center the panel buttons?

How main looks like on Gnome/xorg:

image

Current state of this PR:

With CUSTOM_WINDOW_DECORATIONS enabled:

image

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I've added a line to CHANGELOG.md (if this is a big enough change to warrant it)

@emilk emilk changed the title Windows/Linux: replace native window frame with our own custom buttons Windows/Linux: work towars replacing native window frame with our own custom buttons Feb 6, 2023
@emilk emilk marked this pull request as ready for review February 6, 2023 08:41
@emilk emilk marked this pull request as draft February 6, 2023 13:25
@jleibs
Copy link
Member

jleibs commented Feb 6, 2023

This breaks window resizing UI on both Wayland and Xorg. Without this change you still get normal drag-to-resize behavior at the window borders / corners, but with this change the edges/corners are unresponsive and resize can only be done using context menu to resize.

@jleibs
Copy link
Member

jleibs commented Feb 6, 2023

Also, nit: but is it intentional that the bottom right-hand corner is square while the remaining corners are rounded?
Edit: I see this is mentioned in the TODO.

Still: proof of life it's working on linux and looks great:
image

@teh-cmc
Copy link
Member

teh-cmc commented Feb 7, 2023

Same, no issue on either Wayland nor XWayland

@emilk
Copy link
Member Author

emilk commented Feb 7, 2023

This breaks window resizing UI on both Wayland and Xorg. Without this change you still get normal drag-to-resize behavior at the window borders / corners, but with this change the edges/corners are unresponsive and resize can only be done using context menu to resize.

That's a deal breaker 😭

@emilk
Copy link
Member Author

emilk commented Feb 7, 2023

Ok, I will rework this PR to hide the changes behind future flag

@emilk
Copy link
Member Author

emilk commented Feb 7, 2023

I guess nobody tested this on Windows then?

@emilk emilk marked this pull request as ready for review February 7, 2023 09:35
@emilk
Copy link
Member Author

emilk commented Feb 7, 2023

Ok, the feature (CUSTOM_WINDOW_DECORATIONS) is now turned off, so this should be safe to merge.

@Wumpf Wumpf self-requested a review February 7, 2023 09:40
Comment on lines +650 to +652
let close_response = ui
.add(Button::new(RichText::new("❌").size(button_height)))
.on_hover_text("Close the window");
Copy link
Member

Choose a reason for hiding this comment

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

we already have icons for all of these, we should use those instead

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we do?

We have icons for maximizing and restoring Space Views (below), but we shouldn't reuse them for the window controls

image

Copy link
Member

Choose a reason for hiding this comment

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

would have taken those
image

crates/re_viewer/src/app.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/app.rs Show resolved Hide resolved
@emilk emilk changed the title Windows/Linux: work towars replacing native window frame with our own custom buttons Windows/Linux: work towards replacing native window frame with our own custom buttons Feb 7, 2023
@emilk emilk merged commit 6f821c2 into main Feb 7, 2023
@emilk emilk deleted the emilk/custom-window-frame branch February 7, 2023 12:09
@SkyfallWasTaken
Copy link

SkyfallWasTaken commented Jan 7, 2024

Now that this PR has been merged, would it be possible for re_ui::CUSTOM_WINDOW_DECORATIONS to be set to true? (Apologies if this is the wrong place to ask)

@emilk
Copy link
Member Author

emilk commented Jan 7, 2024

No, #1063 is not ready to be closed yet - it needs testing on Linux and Windows first, and probably some fixes in eframe and/or winit: https://github.com/emilk/egui/issues?q=is%3Aissue+is%3Aopen+custom_window_frame

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.

None yet

5 participants