From d174e435c1b753280943b90b321aaf5b7f20a949 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Tue, 21 May 2024 11:31:13 -0400 Subject: [PATCH] is_foreground_window stubs for other backends --- druid-shell/src/backend/gtk/window.rs | 4 ++++ druid-shell/src/backend/mac/window.rs | 4 ++++ druid-shell/src/backend/wayland/window.rs | 4 ++++ druid-shell/src/backend/web/window.rs | 4 ++++ druid-shell/src/backend/x11/window.rs | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/druid-shell/src/backend/gtk/window.rs b/druid-shell/src/backend/gtk/window.rs index f413fbb8e..688610583 100644 --- a/druid-shell/src/backend/gtk/window.rs +++ b/druid-shell/src/backend/gtk/window.rs @@ -1056,6 +1056,10 @@ impl WindowHandle { } } + pub fn is_foreground_window(&self) -> bool { + true + } + pub fn set_window_state(&mut self, size_state: window::WindowState) { use window::WindowState::{Maximized, Minimized, Restored}; let cur_size_state = self.get_window_state(); diff --git a/druid-shell/src/backend/mac/window.rs b/druid-shell/src/backend/mac/window.rs index c8f9399b5..2707cfd91 100644 --- a/druid-shell/src/backend/mac/window.rs +++ b/druid-shell/src/backend/mac/window.rs @@ -1362,6 +1362,10 @@ impl WindowHandle { } } + pub fn is_foreground_window(&self) -> bool { + true + } + pub fn get_window_state(&self) -> WindowState { unsafe { let window: id = msg_send![*self.nsview.load(), window]; diff --git a/druid-shell/src/backend/wayland/window.rs b/druid-shell/src/backend/wayland/window.rs index ff77140c1..c9b741413 100644 --- a/druid-shell/src/backend/wayland/window.rs +++ b/druid-shell/src/backend/wayland/window.rs @@ -134,6 +134,10 @@ impl WindowHandle { self.inner.surface.get_size() } + pub fn is_foreground_window(&self) -> bool { + true + } + pub fn set_window_state(&mut self, _current_state: window::WindowState) { tracing::warn!("set_window_state is unimplemented on wayland"); } diff --git a/druid-shell/src/backend/web/window.rs b/druid-shell/src/backend/web/window.rs index a3ac1e48c..80f74fb77 100644 --- a/druid-shell/src/backend/web/window.rs +++ b/druid-shell/src/backend/web/window.rs @@ -528,6 +528,10 @@ impl WindowHandle { Size::new(0.0, 0.0) } + pub fn is_foreground_window(&self) -> bool { + true + } + pub fn content_insets(&self) -> Insets { warn!("WindowHandle::content_insets unimplemented for web."); Insets::ZERO diff --git a/druid-shell/src/backend/x11/window.rs b/druid-shell/src/backend/x11/window.rs index c6e8ee00a..d2cf0c7a0 100644 --- a/druid-shell/src/backend/x11/window.rs +++ b/druid-shell/src/backend/x11/window.rs @@ -1718,6 +1718,10 @@ impl WindowHandle { } } + pub fn is_foreground_window(&self) -> bool { + true + } + pub fn set_window_state(&self, _state: window::WindowState) { warn!("WindowHandle::set_window_state is currently unimplemented for X11 backend."); }