#8370: Onscreen keyboard -------------------------------------+----------------------------- Reporter: X512 | Owner: korli Type: enhancement | Status: new Priority: normal | Milestone: R1 Component: Add-Ons/Input Filters | Version: R1/Development Resolution: | Keywords: Acer, W500, GCI Blocked By: 8338, 9545 | Blocking: Has a Patch: 0 | Platform: All -------------------------------------+----------------------------- Comment (by X512): Replying to [comment:11 axeld]: > Not really. Duplicating code is not a good idea, in any case. I think that that duplicating code is OK when it makes development clearer and faster. I prefer to write as simple as possible and use as few as possible. Trying to generalize everything will produce unmanageable code full of bugs. Sometimes it's better to throw old code away and write it again than maintain it and fix bugs in it. One thing that can be really utilized is KeyboardHandler. It incapsulates all keyboard logic. KeyboardHandler produce messages from key state changes, holds Caps Num and Scroll Lock key states and handles keymap. For now in Haiku message generation is duplicated in keyboard input_server device and Keymap preflet. > I don't see this. Are you referring to the rounded borders, by any chance? It waste a lot of CPU time without round borders too. Just try to drag some window on top of Keymap preflet or resize it. It redraws very slow. I use drawing buttons in MouseDown, MouseUp directy instead of Draw for lower CPU time consumption when writing text fast (but for now it is disabled because some keys such as Shift update whole keyboard, KeyboardHandler have no API for it). Drawing one key is faster than all keys. > Sure, KeyboardView does not have these features. I just can't understand how rewriting it completely is any easier than adding them. It requires understanding foregin code that is complicated task. Current KeyboardView has a lot of overengineering. Also new code is clear, easy understandable an free of legacy. First I have idea to use keyboard from that preflet, but don't understand how to make it work separate; it always crash. Actually writing keyboard view is not hard task, first version was done in few hours. In summary I worked on this keyboard for 3 days. > KeyboardView already supports arbitrary layouts. It don't support ''editing'' layouts. Currentlly layouts can be edited using special delarative language only which is user-unfriendly. > Was there any particular reason to implement this as a keyboard device within the input_server rather than as a stand-alone application? How does the keyboard know when it should be visible? Keyboard requires to send messages to system, so it can be implemented only as input_server driver or kernel driver to be fully-functional keyboard (but anyway it can not work in KDL unfortuneately). For now keyboard is always visible. To hide keyboard just move add-on outside "add-ons" folder. Later I plan to add replicant to deskbar for showing/hiding keyboard. About automatic detection when keyboard is needed: it could be shown when user focus BView that accept input. View that accept input can be recognized by B_INPUT_METHOD_AWARE flag or some new flag because B_INPUT_METHOD_AWARE actually means that view can show diffrerent text blocks. Any BView that supports input method is also support text input, but not all BView that don't support input methods don't support text editing (but this is bad and should be fixed if possible because it pervents convient japanese etc text editing). Obvoiusly user should have ability to disable automatic showing/hiding keyboard. Also keyboard is used not only for text input. It is also used for different kinds of editing (selecting items in Tracker, copy-paste etc) and games. So user should have ability to showing keyboard manually. -- Ticket URL: <http://dev.haiku-os.org/ticket/8370#comment:12> Haiku <http://dev.haiku-os.org> Haiku - the operating system.