diff --git a/remglk/src/glkapi/mod.rs b/remglk/src/glkapi/mod.rs index 3fe1597..4cd3f25 100644 --- a/remglk/src/glkapi/mod.rs +++ b/remglk/src/glkapi/mod.rs @@ -1503,19 +1503,23 @@ where S: Default + GlkSystem { let keywin = Into::::into(&win.key); let keywin = lock!(keywin); match keywin.wintype { - WindowType::Buffer => if win.vertical { + WindowType::Buffer => if win.size > 0 { + if win.vertical { win.size as f64 * self.metrics.buffercharwidth + self.metrics.buffermarginx } else { win.size as f64 * self.metrics.buffercharheight + self.metrics.buffermarginy } - WindowType::Graphics => win.size as f64 + (if win.vertical {self.metrics.graphicsmarginx} else {self.metrics.graphicsmarginy}), - WindowType::Grid => if win.vertical { + } else {0.0}, + WindowType::Graphics => if win.size > 0 {win.size as f64 + (if win.vertical {self.metrics.graphicsmarginx} else {self.metrics.graphicsmarginy})} else {0.0}, + WindowType::Grid => if win.size > 0 { + if win.vertical { win.size as f64 * self.metrics.gridcharwidth + self.metrics.gridmarginx } else { win.size as f64 * self.metrics.gridcharheight + self.metrics.gridmarginy } + } else {0.0}, _ => unreachable!(), } } diff --git a/remglk/src/glkapi/protocol.rs b/remglk/src/glkapi/protocol.rs index c3177e9..37ddc3f 100644 --- a/remglk/src/glkapi/protocol.rs +++ b/remglk/src/glkapi/protocol.rs @@ -733,6 +733,9 @@ pub struct WindowUpdate { #[serde(skip_serializing_if = "Option::is_none")] pub gridwidth: Option, pub height: f64, + /** Whether the window should be completely hidden, though could potentially still respond to character events */ + #[serde(skip_serializing_if = "Not::not")] + pub hidden: bool, /** Window ID */ pub id: u32, /** Left position */ diff --git a/remglk/src/glkapi/windows.rs b/remglk/src/glkapi/windows.rs index 6ffcbc9..6e1811b 100644 --- a/remglk/src/glkapi/windows.rs +++ b/remglk/src/glkapi/windows.rs @@ -86,17 +86,20 @@ impl Window { } // Now give it to the specific window types for them to fill in + let height = self.wbox.bottom - self.wbox.top; + let width = self.wbox.right - self.wbox.left; self.data.update(WindowUpdate { id: self.id, input: input_update, size: protocol::WindowUpdate { - height: self.wbox.bottom - self.wbox.top, + height, + hidden: height == 0.0 || width == 0.0, id: self.id, left: self.wbox.left, rock: self.rock, top: self.wbox.top, wintype: self.wintype, - width: self.wbox.right - self.wbox.left, + width, ..Default::default() }, ..Default::default()