fix key binding issue, text scaling, and maybe render bug

macos-click-through
keith 5 years ago
parent 0f10f186e8
commit 8448d1b5a9

2
Cargo.lock generated

@ -1635,7 +1635,6 @@ dependencies = [
"bitflags",
"lazy_static",
"libc",
"raw-window-handle",
"sdl2-sys",
]
@ -1785,7 +1784,6 @@ dependencies = [
[[package]]
name = "skulpin"
version = "0.5.2"
source = "git+https://github.com/Kethku/skulpin?branch=sdl2#396bc7d52240a05384c73de1e117a601b1e2e5ff"
dependencies = [
"ash",
"cocoa",

@ -12,6 +12,7 @@ font-kit = "0.5.0"
skribo = { git = "https://github.com/linebender/skribo" }
lru = "0.4.3"
skulpin = { git = "https://github.com/Kethku/skulpin", branch = "sdl2" }
# skulpin = { path = "../skulpin" }
derive-new = "0.5"
rmpv = "0.4.4"
rust-embed = { version = "5.2.0", features = ["debug-embed"] }

@ -76,7 +76,7 @@ pub fn ui_loop() {
let mut skulpin_renderer = RendererBuilder::new()
.prefer_integrated_gpu()
.use_vulkan_debug_layer(true)
.present_mode_priority(vec![PresentMode::Mailbox, PresentMode::Immediate])
.present_mode_priority(vec![PresentMode::Immediate])
.coordinate_system(CoordinateSystem::Logical)
.build(&window)
.expect("Failed to create renderer");
@ -100,6 +100,7 @@ pub fn ui_loop() {
window.set_title(&title).expect("Could not set title");
}
let mut ignore_text_input = false;
for event in event_pump.poll_iter() {
match event {
Event::Quit {..} => break 'running,
@ -107,6 +108,7 @@ pub fn ui_loop() {
Event::KeyDown { keycode: Some(keycode), keymod: modifiers, .. } => {
if let Some((key_text, special)) = parse_keycode(keycode) {
let will_text_input =
!modifiers.contains(Mod::LCTRLMOD) &&
!modifiers.contains(Mod::RCTRLMOD) &&
!modifiers.contains(Mod::LALTMOD) &&
@ -118,15 +120,20 @@ pub fn ui_loop() {
}
BRIDGE.queue_command(UiCommand::Keyboard(append_modifiers(modifiers, key_text, special)));
ignore_text_input = true;
}
},
Event::TextInput { text, .. } => {
if ignore_text_input {
ignore_text_input = false;
} else {
let text = if text == "<" {
String::from("<lt>")
} else {
text
};
BRIDGE.queue_command(UiCommand::Keyboard(text))
}
},
Event::MouseMotion { x, y, .. } => {
let grid_x = (x as f32 / renderer.font_width) as i64;

Loading…
Cancel
Save