Compare commits

...

2 Commits

Author SHA1 Message Date
LGUG2Z
d91c70e2e8 fix(wm): ignore com hwnds on monitor polling 2022-04-20 14:17:41 -07:00
LGUG2Z
61760fc77d fix(wm): don't err on failed window serialization 2022-04-20 13:47:44 -07:00
2 changed files with 8 additions and 7 deletions

View File

@@ -76,7 +76,9 @@ impl WindowManager {
let monitor_idx = self.monitor_idx_from_window(*window)
.ok_or_else(|| anyhow!("there is no monitor associated with this window, it may have already been destroyed"))?;
self.focus_monitor(monitor_idx)?;
if window.class()? != "OleMainThreadWndClass" {
self.focus_monitor(monitor_idx)?;
}
}
_ => {}
}

View File

@@ -5,7 +5,7 @@ use std::fmt::Formatter;
use color_eyre::eyre::anyhow;
use color_eyre::Result;
use schemars::JsonSchema;
use serde::ser::Error;
use serde::ser::SerializeStruct;
use serde::Serialize;
use serde::Serializer;
@@ -64,24 +64,23 @@ impl Serialize for Window {
"title",
&self
.title()
.map_err(|_| S::Error::custom("could not get window title"))?,
.unwrap_or_else(|_| "could not get window title".to_string()),
)?;
state.serialize_field(
"exe",
&self
.exe()
.map_err(|_| S::Error::custom("could not get window exe"))?,
.unwrap_or_else(|_| "could not get window exe".to_string()),
)?;
state.serialize_field(
"class",
&self
.class()
.map_err(|_| S::Error::custom("could not get window class"))?,
.unwrap_or_else(|_| "could not get window class".to_string()),
)?;
state.serialize_field(
"rect",
&WindowsApi::window_rect(self.hwnd())
.map_err(|_| S::Error::custom("could not get window rect"))?,
&WindowsApi::window_rect(self.hwnd()).unwrap_or_default(),
)?;
state.end()
}