mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-11 13:51:01 -05:00
Fix resize on Wayland when creating new window
When we have currently active context when asking EGL on Wayland to
create new context it'll lock the backing buffer of surface using that context.
So making it non-current before-hand to prevent it.
Follow-up to 90552e3
.
This commit is contained in:
parent
75b0005619
commit
28e3fc7c64
2 changed files with 17 additions and 0 deletions
|
@ -495,6 +495,16 @@ impl Window {
|
||||||
self.windowed_context.resize(size);
|
self.windowed_context.resize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn make_not_current(&mut self) {
|
||||||
|
if self.windowed_context.is_current() {
|
||||||
|
self.windowed_context.replace_with(|context| unsafe {
|
||||||
|
// We do ensure that context is current before any rendering operation due to multi
|
||||||
|
// window support, so we don't need extra "type aid" from glutin here.
|
||||||
|
context.make_not_current().expect("context swap").treat_as_current()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn make_current(&mut self) {
|
pub fn make_current(&mut self) {
|
||||||
if !self.windowed_context.is_current() {
|
if !self.windowed_context.is_current() {
|
||||||
self.windowed_context
|
self.windowed_context
|
||||||
|
|
|
@ -1344,6 +1344,13 @@ impl Processor {
|
||||||
GlutinEvent::UserEvent(Event {
|
GlutinEvent::UserEvent(Event {
|
||||||
payload: EventType::CreateWindow(options), ..
|
payload: EventType::CreateWindow(options), ..
|
||||||
}) => {
|
}) => {
|
||||||
|
// XXX Ensure that no context is current when creating a new window, otherwise
|
||||||
|
// it may lock the backing buffer of the surface of current context when asking
|
||||||
|
// e.g. EGL on Wayland to create a new context.
|
||||||
|
for window_context in self.windows.values_mut() {
|
||||||
|
window_context.display.window.make_not_current();
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(err) = self.create_window(event_loop, proxy.clone(), options) {
|
if let Err(err) = self.create_window(event_loop, proxy.clone(), options) {
|
||||||
error!("Could not open window: {:?}", err);
|
error!("Could not open window: {:?}", err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue