mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Fix window close handling (#98)
Currently we interned WM_DELETE_WINDOW but does not call XSetWMProtocols to listen to it, causing a fatal error when closing the window by clicking "X". This patch fixes the issue.
This commit is contained in:
parent
5234be4283
commit
e2acdad0c2
|
@ -257,7 +257,7 @@ impl Window {
|
||||||
// FIXME: this DisplayInfo should be a singleton, hence this code
|
// FIXME: this DisplayInfo should be a singleton, hence this code
|
||||||
// is probably no good when using multiple windows.
|
// is probably no good when using multiple windows.
|
||||||
|
|
||||||
let d = DisplayInfo::new()?;
|
let mut d = DisplayInfo::new()?;
|
||||||
|
|
||||||
let scale = Self::get_scale_factor(width, height, d.screen_width, d.screen_height, opts.scale);
|
let scale = Self::get_scale_factor(width, height, d.screen_width, d.screen_height, opts.scale);
|
||||||
|
|
||||||
|
@ -326,6 +326,7 @@ impl Window {
|
||||||
|
|
||||||
(d.lib.XClearWindow)(d.display, handle);
|
(d.lib.XClearWindow)(d.display, handle);
|
||||||
(d.lib.XMapRaised)(d.display, handle);
|
(d.lib.XMapRaised)(d.display, handle);
|
||||||
|
(d.lib.XSetWMProtocols)(d.display, handle, &mut d.wm_delete_window, 1);
|
||||||
(d.lib.XFlush)(d.display);
|
(d.lib.XFlush)(d.display);
|
||||||
|
|
||||||
let mut draw_buffer: Vec<u32> = Vec::new();
|
let mut draw_buffer: Vec<u32> = Vec::new();
|
||||||
|
|
Loading…
Reference in a new issue