From cd3769a48efcc3fdd2dc1304b1babfe6d26f788d Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Sun, 5 Nov 2023 14:17:49 +1300 Subject: Implement window scaling A window now can declare a scale factor to be used when rendering logical pixels to a physical window. Each logical pixel will be drawn as an NxN block of physical pixels, where N is the scale factor. --- src/window_manager.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/window_manager.rs') diff --git a/src/window_manager.rs b/src/window_manager.rs index 065d517..2652682 100644 --- a/src/window_manager.rs +++ b/src/window_manager.rs @@ -31,7 +31,7 @@ impl WindowManager { // Called when the event loop is first initialized. Event::NewEvents(StartCause::Init) => (), - Event::NewEvents(_) => { + Event::NewEvents(..) => { control_flow.set_wait_timeout(self.min_frame_duration); } @@ -46,7 +46,7 @@ impl WindowManager { use WindowEvent::*; match event { - Resized(dim) => window.resize(Dimensions::new(dim.width, dim.height)), + Resized(dim) => window.resize_buffer_and_surface(Dimensions::new(dim.width, dim.height)), Moved(position) => window.controller.on_move(Point::new(position.x, position.y)), Focused(is_focused) => window.controller.on_focus_change(is_focused), @@ -76,9 +76,9 @@ impl WindowManager { KeyboardInput { input, .. } => if let Ok(input) = input.try_into() { window.controller.on_keyboard_input(input)}, ModifiersChanged(state) => window.controller.on_keyboard_modifier_change(state), ReceivedCharacter(character) => window.controller.on_character_input(character), - HoveredFile(path) => window.controller.on_file_hover(path), + HoveredFile(path) => window.controller.on_file_hover(&path), HoveredFileCancelled => window.controller.on_file_hover_cancel(), - DroppedFile(path) => window.controller.on_file_drop(path), + DroppedFile(path) => window.controller.on_file_drop(&path), CloseRequested => { window.controller.on_close_request(); @@ -105,9 +105,7 @@ impl WindowManager { for window in self.windows.values_mut() { window.controller.on_process(); window.update_title(); - window.update_minimum_size(); - window.update_maximum_size(); - window.update_resizable(); + window.update_window_size(); window.update_cursor_icon(); window.update_cursor_visible(); window.handle_render_request(); -- cgit v1.2.3-70-g09d2