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
Feature: Add Window Padding Support #1632
Feature: Add Window Padding Support #1632
Conversation
Extra Thoughts
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. I'm not sure about the way the padding details are passed around, but that's okay.
I'd say a config file setting accessible from NeoVim, someone might want to change it on-the-fly. Nope, there's no dedicated Neovide config file (yet), there was some effort in #1119 but it has stalled atm. |
@MultisampledNight thanks for the feedback! I ended up querying the settings inside of Hope that’s okay 👍 |
I’ll take a look at #1119 and see if I can help, would you like that to merge before this? |
I don't have any preference about the specific order. |
681835e
to
48cd696
Compare
Looks pretty awesome! I just tested this and found two slight issues:
|
Thanks for the feedback 😸 I just updated the PR to handle redrawing the window when configuring the window padding at runtime, and I changed the window padding names based on your recommendation. Let me know if there's anything else I should take a look at 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, other things interfered.
src/window/mod.rs
Outdated
let padding_changed = window_padding != self.renderer.window_padding; | ||
if padding_changed { | ||
self.renderer.handle_window_padding_update(window_padding); | ||
} | ||
|
||
if self.saved_inner_size != new_size || font_changed || padding_changed { | ||
self.saved_inner_size = new_size; | ||
self.handle_new_grid_size(new_size); | ||
self.skia_renderer.resize(&self.windowed_context); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When testing, it feels like padding changes are applied exactly one "environment change" such as a redraw too late. I believe this whole block needs to be moved right after you construct WindowPadding
in order to mitigate this, a short random experiment seems to confirm this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks for testing this out 🙏
Can you clarify something for me, are you recommending I move this code:
let padding_changed = window_padding != self.renderer.window_padding;
if padding_changed {
self.renderer.handle_window_padding_update(window_padding);
}
if self.saved_inner_size != new_size || font_changed || padding_changed {
self.saved_inner_size = new_size;
self.handle_new_grid_size(new_size);
self.skia_renderer.resize(&self.windowed_context);
}
Above this code?
if REDRAW_SCHEDULER.should_draw() || SETTINGS.get::<WindowSettings>().no_idle {
font_changed = self.renderer.draw_frame(self.skia_renderer.canvas(), dt);
self.skia_renderer.gr_context.flush(None);
self.windowed_context.swap_buffers().unwrap();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side question, are you referring to the visual behavior that happens during a resize or when the padding changes? I've experimented with moving the construction window padding like so:
let window_settings = SETTINGS.get::<WindowSettings>();
let window_padding = WindowPadding {
top: window_settings.padding_top,
left: window_settings.padding_left,
right: window_settings.padding_right,
bottom: window_settings.padding_bottom,
};
let padding_changed = window_padding != self.renderer.window_padding;
if padding_changed {
self.renderer.window_padding = window_padding;
}
if self.saved_inner_size != new_size || font_changed || padding_changed {
self.saved_inner_size = new_size;
self.handle_new_grid_size(new_size);
self.skia_renderer.resize(&self.windowed_context);
}
Which could resolve some issues with accidentally using an outdated window padding, and seemed a bit snappier when resizing, but let me know if this is related to what you were saying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that's exactly what I meant. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay great! I just pushed up some commits that implement your recommendations. Let me know if this seems good 👍
Otherwise your work is awesome! I believe those things should be the last ones. |
(for what it's worth please do drop by a short notice if you think you're done, slightly unsure atm) |
Yup I think I’m done making changes. Though please double check my latest changes please, and then I think it’s ready to merge. |
Yeah, I miscommunicated on my part about how I meant to reorder the respect-resize hunk. The change is simple enough, I'll do it real quick. |
Okay sounds good, thank you for the assist 🙌 |
"real quick" is what it said and came back half an hour later. Anyways, good to go I guess! chooooooooooo chooooooooooooooooo thank you! |
Co-authored-by: MultisampledNight <contact@multisamplednight.com>
What kind of change does this PR introduce?
This change introduces a feature for adding window padding in Neovide.
Did this PR introduce a breaking change?
This change should not have introduced any breaking changes, the default window padding is zero for all sides.
Related: #140