xref: /aosp_15_r20/external/crosvm/gpu_display/src/gpu_display_win/window_manager.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 // Copyright 2023 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 use std::rc::Rc;
6 
7 use anyhow::Result;
8 use base::Tube;
9 
10 use super::math_util::Size;
11 use super::surface::DisplayProperties;
12 use super::window::GuiWindow;
13 use super::window_message_processor::WindowPosMessage;
14 
15 pub(crate) struct NoopWindowManager {}
16 
17 impl NoopWindowManager {
18     /// If initialized in fullscreen mode, we would use 16:9 aspect ratio when switching to windowed
19     /// mode. Note that the caller should call `set_initial_window_pos()` after window messages can
20     /// be routed to `WindowManager`.
new( _window: &GuiWindow, _display_properties: &DisplayProperties, _initial_host_viewport_size: Size, _gpu_main_display_tube: Option<Rc<Tube>>, ) -> Result<Self>21     pub fn new(
22         _window: &GuiWindow,
23         _display_properties: &DisplayProperties,
24         _initial_host_viewport_size: Size,
25         _gpu_main_display_tube: Option<Rc<Tube>>,
26     ) -> Result<Self> {
27         Ok(Self {})
28     }
29 
30     /// This should be called only after window messages can be routed to `WindowManager`, since we
31     /// rely on them to properly set the host viewport size after resizing the window.
set_initial_window_pos(&mut self, _window: &GuiWindow) -> Result<()>32     pub fn set_initial_window_pos(&mut self, _window: &GuiWindow) -> Result<()> {
33         Ok(())
34     }
35 
handle_display_change(&mut self, _window: &GuiWindow)36     pub fn handle_display_change(&mut self, _window: &GuiWindow) {}
37 
handle_window_pos_message(&mut self, _window: &GuiWindow, _message: &WindowPosMessage)38     pub fn handle_window_pos_message(&mut self, _window: &GuiWindow, _message: &WindowPosMessage) {}
39 }
40