summaryrefslogtreecommitdiff
path: root/src/window_manager.rs
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2023-11-05 14:17:49 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2023-11-05 14:17:49 +1300
commitcd3769a48efcc3fdd2dc1304b1babfe6d26f788d (patch)
tree37c62c9ce10bd415326e4b1abac42e3a73d8d78f /src/window_manager.rs
parent8e08d723ff7a853f2b10dc0f1408911d5801cea8 (diff)
downloadphosphor-cd3769a48efcc3fdd2dc1304b1babfe6d26f788d.zip
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.
Diffstat (limited to 'src/window_manager.rs')
-rw-r--r--src/window_manager.rs12
1 files changed, 5 insertions, 7 deletions
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();