History

Barbaric method to make arrowless keyboards usable

Or non QWERTY layouts. I tried to think of a way to make that neat and configurable, i really did, but...

malc committed 5 years ago

Commit 33ca8001 parent 8634d204 files · +23 −2Browse files

Unified · Split

4 files
  1. main.ml +15 −0
  2. wsi.mli +2 −0
  3. wsi/cocoa/wsi.ml +1 −0
  4. wsi/x11/wsi.ml +5 −2
main.ml+15−0
@@ -616,6 +616,20 @@ let layoutready layout = · 615 unmodified lines
616 alltilesvisible;616 alltilesvisible;
617;;617;;
618 618
619let mapc code =
620 let viewmapcode = function
621 (* remap some key codes to arrows in view mode *)
622 | 44 -> 113
623 | 45 -> 116
624 | 46 -> 111
625 | 47 -> 114
626 | n -> n
627 in
628 match state.mode with
629 | View -> viewmapcode code
630 | LinkNav _ | Textentry _ | Birdseye _ -> code
631;;
632
619let gotoxy x y =633let gotoxy x y =
620 let y = bound y 0 state.maxy in634 let y = bound y 0 state.maxy in
621 let y, layout =635 let y, layout =
@@ -5052,6 +5066,7 @@ let () = · 4430 unmodified lines
5052 display ();5066 display ();
5053 Wsi.mapwin ();5067 Wsi.mapwin ();
5054 Wsi.setcursor Wsi.CURSOR_INHERIT;5068 Wsi.setcursor Wsi.CURSOR_INHERIT;
5069 Wsi.setmapc mapc;
5055 Sys.set_signal Sys.sighup (Sys.Signal_handle (fun _ -> reload ()));5070 Sys.set_signal Sys.sighup (Sys.Signal_handle (fun _ -> reload ()));
5056 5071
5057 let rec reap () =5072 let rec reap () =
wsi.mli+2−0
@@ -38,8 +38,10 @@ class type t = · 37 unmodified lines
38 method opendoc : string -> unit38 method opendoc : string -> unit
39 end;;39 end;;
40 40
41type keycode = int;;
41val setcursor : cursor -> unit;;42val setcursor : cursor -> unit;;
42val settitle : string -> unit;;43val settitle : string -> unit;;
44val setmapc : (keycode -> keycode) -> unit;;
43val swapb : unit -> unit;;45val swapb : unit -> unit;;
44val readresp : Unix.file_descr -> unit;;46val readresp : Unix.file_descr -> unit;;
45val init : t -> int -> int -> Unix.file_descr * int * int;;47val init : t -> int -> int -> Unix.file_descr * int * int;;
wsi/cocoa/wsi.ml+1−0
@@ -312,3 +312,4 @@ let ks2kt = · 311 unmodified lines
312 | code when code land 0xff00 = 0xff00 -> Ctrl code312 | code when code land 0xff00 = 0xff00 -> Ctrl code
313 | code -> Code code313 | code -> Code code
314 314
315let setmapc = ignore
wsi/x11/wsi.ml+5−2
@@ -101,11 +101,12 @@ type state = · 100 unmodified lines
101 ; mutable levl5mask : int101 ; mutable levl5mask : int
102 ; mutable xkb : bool102 ; mutable xkb : bool
103 ; mutable fscale : float103 ; mutable fscale : float
104 ; mutable mapc : keycode -> keycode
104 }105 }
105and fs =106and fs =
106 | NoFs107 | NoFs
107 | Fs of (int * int * int * int)108 | Fs of (int * int * int * int)
108;;109and keycode = int;;
109 110
110let state =111let state =
111 { mink = max_int112 { mink = max_int
@@ -140,6 +141,7 @@ let state = · 28 unmodified lines
140 ; levl5mask = 0141 ; levl5mask = 0
141 ; xkb = false142 ; xkb = false
142 ; fscale = 1.0143 ; fscale = 1.0
144 ; mapc = Fun.id
143 }145 }
144;;146;;
145 147
@@ -484,7 +486,7 @@ let readresp sock = · 338 unmodified lines
484 | 2 -> (* key press *)486 | 2 -> (* key press *)
485 if Array.length state.keymap > 0487 if Array.length state.keymap > 0
486 then488 then
487 let code = r8 resp 1 in489 let code = r8 resp 1 |> state.mapc in
488 let mask = r16 resp 28 in490 let mask = r16 resp 28 in
489 let keysym = getkeysym code mask in491 let keysym = getkeysym code mask in
490 vlog "keysym = %x %c mask %#x code %d"492 vlog "keysym = %x %c mask %#x code %d"
@@ -1289,3 +1291,4 @@ let ks2kt = · 798 unmodified lines
1289;;1291;;
1290 1292
1291let fontsizescale n = float n *. state.fscale |> truncate;;1293let fontsizescale n = float n *. state.fscale |> truncate;;
1294let setmapc f = state.mapc <- f;;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t