Skip to content

Commit

Permalink
feat(nav): add minimize and maximize buttons (#56)
Browse files Browse the repository at this point in the history
* feat(nav): add minimize and maximize buttons

* fix: main view's max y may less than min

* Update README.md
  • Loading branch information
pewsheen authored Jun 14, 2024
1 parent b72c68d commit 7b6f45f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A web browser that plays old world blues to build new world hope.

https://github.com/european-browser/verso/assets/8409985/a7a92fa4-5980-44d1-a9b5-81ff23c01ba6
![](https://github.com/pewsheen/verso/assets/460329/7df44c7d-a4c5-4393-8378-a8b7bc438b03)

Verso is a web browser built on top of Servo web engine. It's still under development. We dont' accept any feature request at the moment.
But if you are interested, feel free to help test it.
Expand Down
5 changes: 2 additions & 3 deletions resources/panel.html

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,15 @@ impl Window {
"REFRESH" => {
events.push(EmbedderEvent::Reload(id));
}
"MINIMIZE" => {
self.window.set_minimized(true);
}
"MAXIMIZE" => {
let is_maximized = self.window.is_maximized();
self.window.set_maximized(!is_maximized);
}
e => log::warn!("Verso Panel hasn't supported handling this prompt message yet: {e}")
}

}
let _ = sender.send(None);
},
Expand Down Expand Up @@ -302,7 +308,7 @@ impl Window {
let size = self.window.inner_size();
let size = Size2D::new(size.width as i32, size.height as i32);
let mut rect = DeviceIntRect::from_size(size).to_f32();
rect.min.y = 76.;
rect.min.y = rect.max.y.min(76.);
events.push(EmbedderEvent::FocusWebView(w));
events.push(EmbedderEvent::MoveResizeWebView(w, rect));
}
Expand Down Expand Up @@ -414,7 +420,7 @@ impl Window {

if let Some(w) = &self.webview {
let mut rect = DeviceIntRect::from_size(size).to_f32();
rect.min.y = 76.;
rect.min.y = rect.max.y.min(76.);
events.push(EmbedderEvent::MoveResizeWebView(w.id(), rect));
}
}
Expand Down

0 comments on commit 7b6f45f

Please sign in to comment.