fix mouse scaling

macos-click-through
keith 5 years ago
parent 242b541ed3
commit f70956866a

15
Cargo.lock generated

@ -1924,8 +1924,7 @@ dependencies = [
[[package]] [[package]]
name = "skulpin" name = "skulpin"
version = "0.9.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
checksum = "9dd4af3f78364d587c25990361d63d4e9707e7f4a40636c2875db39212b11786"
dependencies = [ dependencies = [
"log", "log",
"skulpin-app-winit", "skulpin-app-winit",
@ -1937,8 +1936,7 @@ dependencies = [
[[package]] [[package]]
name = "skulpin-app-winit" name = "skulpin-app-winit"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
checksum = "b94b802ebaa595692fdf7e68535a301e0dc21146839766d4fca6b4085e7efcad"
dependencies = [ dependencies = [
"log", "log",
"skulpin-renderer", "skulpin-renderer",
@ -1948,8 +1946,7 @@ dependencies = [
[[package]] [[package]]
name = "skulpin-renderer" name = "skulpin-renderer"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
checksum = "951abd350f1f0fd54acceb479e9af6329cda9e35498da5242c6f07255af4580c"
dependencies = [ dependencies = [
"ash", "ash",
"log", "log",
@ -1960,8 +1957,7 @@ dependencies = [
[[package]] [[package]]
name = "skulpin-renderer-sdl2" name = "skulpin-renderer-sdl2"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
checksum = "766028ec539df61ad43b8378467d08c2e866a1967141c292c34e5118cf22c592"
dependencies = [ dependencies = [
"log", "log",
"sdl2", "sdl2",
@ -1971,8 +1967,7 @@ dependencies = [
[[package]] [[package]]
name = "skulpin-renderer-winit" name = "skulpin-renderer-winit"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
checksum = "23e6adf5a21a5108143a6225835010aeee4ef0e83285716fd89e0e6ea3e0081c"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"log", "log",

@ -15,7 +15,7 @@ euclid = "0.20.7"
font-kit = "0.6.0" font-kit = "0.6.0"
skribo = { git = "https://github.com/linebender/skribo" } skribo = { git = "https://github.com/linebender/skribo" }
lru = "0.4.3" lru = "0.4.3"
skulpin = { version = "0.9.0", features=["skulpin_sdl2"] } skulpin = { git = "https://github.com/kethku/skulpin", branch = "windows-dpi-fix", features = ["skulpin_sdl2"] }
derive-new = "0.5" derive-new = "0.5"
rmpv = "0.4.4" rmpv = "0.4.4"
rust-embed = { version = "5.2.0", features = ["debug-embed"] } rust-embed = { version = "5.2.0", features = ["debug-embed"] }

@ -273,7 +273,8 @@ impl WindowWrapper {
(y as f32 / self.renderer.font_height) as u32, (y as f32 / self.renderer.font_height) as u32,
); );
self.mouse_position = physical_size.to_logical(1.0); let sdl_window_wrapper = Sdl2Window::new(&self.window);
self.mouse_position = physical_size.to_logical(sdl_window_wrapper.scale_factor());
if self.mouse_down && previous_position != self.mouse_position { if self.mouse_down && previous_position != self.mouse_position {
BRIDGE.queue_command(UiCommand::Drag( BRIDGE.queue_command(UiCommand::Drag(
self.mouse_position.width, self.mouse_position.width,

Loading…
Cancel
Save