From: Michael D. Lowis Date: Fri, 23 Feb 2018 20:48:34 +0000 (-0500) Subject: added tracking of modifiers X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=e74ce7a0c62461b4a8dfda9520dbf97581f8b235;p=archive%2Ftide-ocaml.git added tracking of modifiers --- diff --git a/edit.ml b/edit.ml index 6ab045a..3a7e2b1 100644 --- a/edit.ml +++ b/edit.ml @@ -3,6 +3,7 @@ open X11 let tags_view = ref (View.empty 640 480) let edit_view = ref (View.empty 640 480) let divider = ref 0 +let modifiers = ref 0 let focus_view = ref edit_view (* Mouse Actions @@ -62,16 +63,19 @@ let onfocus focused = let onsetregion x y = Printf.printf "setregion %d %d %b" x y (y <= !divider); print_endline ""; - if y <= !divider then - focus_view := tags_view - else - focus_view := edit_view + if !modifiers == 0 then + if y <= !divider then + focus_view := tags_view + else + focus_view := edit_view let onkeypress mods rune = + modifiers := mods; Printf.printf "keypress %d %d" mods rune; print_endline "" let onmousebtn mods btn x y pressed nclicks = + modifiers := mods; if pressed then match btn with | 1 -> onselect mods x y nclicks | 2 -> onexec mods x y nclicks @@ -81,6 +85,7 @@ let onmousebtn mods btn x y pressed nclicks = | _ -> () let onmousemove mods x y = + modifiers := mods; Printf.printf "select (%d,%d)" x y; print_endline ""; select_at ~extend:true !focus_view x y