-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
feat(linux): Add necessary features for creating GL windows #495
Conversation
// Set GDK Visual | ||
if let Some(screen) = window.screen() { | ||
if let Some(visual) = screen.rgba_visual() { | ||
window.set_visual(Some(&visual)); | ||
} | ||
} | ||
|
||
window.connect_draw(|_, cr| { | ||
cr.set_source_rgba(0., 0., 0., 0.); | ||
cr.set_operator(cairo::Operator::Source); | ||
let _ = cr.paint(); | ||
cr.set_operator(cairo::Operator::Over); | ||
Inhibit(false) | ||
}); | ||
window.set_app_paintable(true); | ||
// Set a few attributes to make the window can be painted. | ||
// See Gtk drawing model for more info: | ||
// https://docs.gtk.org/gtk3/drawing-model.html | ||
window.set_app_paintable(true); | ||
let widget = window.upcast_ref::<gtk::Widget>(); | ||
unsafe { | ||
gtk::ffi::gtk_widget_set_double_buffered(widget.to_glib_none().0, 0); |
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.
Many are optional but I make these become default to all windows.
Tested with wry and it looks fine.
This should also reduce some overhead when dealing with draw signal overall.
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.
sounds fine, we can revert back if any issues are reported.
- Rename trait method name to `with_transparent_draw`. - Use enum struct variant on WireUpEvents. - Hide doc on x11 module.
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
fix: remove a typo, closes #___, #___
)Other information
Here are some features added for incoming GL window feature:
EventLoopWindowTargetExtUnix
for methods to determine if the backend is x11 or wayland.x11
module for glutin internal use. This is basically just x11-dl, but winit secretly exports it.auto_transparent
attribute so users can draw the window manually.There might be more but these are the minimum requirements for egui + glutin/glow.