[PATCH] version 1 of keyboard navigation patch
Hi'all, The first version (1) of my keyboard navigation patch is ready. See the end of this message for download instructions. Do note that the tab/frame patch already contains this functionality, so there is no need (and no way) to apply this patch on top of that or the other way around. The patch adds Keyboard navigation with configurable key bindings to (the CVS version of) Dillo. Please test it and let me know what you (don't) like. Even though keyboard navigation does not make much sense with devices without keyboards (pda's, etc), there is no configure option to disable it. Let me know if there is a need for such an option (it is easily implementable). Personally I think there is... For keyboard navigation to work Dillo has to track the position of individual words in a document, which increases memory overhead with 4 bytes per word. However, there seems to be some animosity against the added complexity of conditionally compiled code (enclosed in #ifdef ... #endif). More information on keyboard navigation can be found in the document "Keyboard_Navigation.txt" in the doc/ directory which I'll just reproduce it here: Keyboard Navigation =================== You can use the keyboard to navigate links and controls in Dillo. In the default configuration, the following keys are used: Alt-Up: link UP Alt-Down: link DOWN Alt-Left: link LEFT Alt-Right: link RIGHT Enter: follow link or activate GTK+ widget Escape: unhighlight link In a non-frames version of Dillo the following keys are also used: Tab: NEXT link Shift-Tab: PREVIOUS link these keys are not bound by default in a frames-capable version of Dillo because they are used to navigate between frames. You are free to bind them (or any other key combination) to these functions though (see Keyboard bindings) Sometimes the result of link UP and link DOWN seems a bit unpredictable. This can happen when the next UP or DOWN link is currently not visible (below the bottom or above the top of the window). The screen coordinates for words are only known when they are in the visible area of the viewport, so off-screen links are accessed sequentially instead. Search and keyboard navigation ------------------------------ Keyboard navigation works with the Search feature: if search hits a link, it will be focused. Press <Enter> in the viewport to follow the link, <Esc> to unhighlight it. When using the status bar for search (an optional feature in the tabbed version of Dillo), press <Esc> to close the search entry followed by <Enter> to follow the link. A second <Esc> will unhighlight the focused link. Pressing <Enter> in the search entry (popup or status bar) repeats the search. History ------- The focus location is saved when navigating to another document in the same window or tab. This makes it possible to go back in history and continue to the next link on the page. Form fields ----------- The same keys used for link navigation work for form field navigation. Do note however that form fields, being embedded GTK+ widgets, can have their own bindings for some functions. As an example, the space bar is bound to the activate function in radio buttons. Keyboard bindings ================= It is possible to change the keyboard bindings used for keyboard navigation, either through editing the dillorc or by adding a section to any of the current GTK+ rc-files. The syntax is the same, the only difference is the addition of the preference keyword "key_bindings" in the dillorc and the fact that the bindings have to be enclosed in double quotes. As an example, this configuration (in gtkrc) uses the numerical keypad for link navigation: binding "keypad-keys" { bind "KP_Add" { "focus_move" (0) } bind "KP_Subtract" { "focus_move" (1) } bind "KP_8" { "focus_move" (2) } bind "KP_2" { "focus_move" (3) } bind "KP_4" { "focus_move" (4) } bind "KP_6" { "focus_move" (5) } bind "KP_Enter" { "focus_activate" () } } class "GtkDwScrolledFrame" binding "keypad-keys" You can also use 'widget "*dillo-content" instead of 'class "GtkDwScrolledFrame" if you prefer to use widget names: widget "*dillo-content" binding "keypad-keys" This one (in dillorc, note the enclosing double quotes, the use of single quotes and the preference name 'key_bindings') makes Dillo behave like the vi editor when it comes to link navigation: key_bindings = "binding 'vi-keys' { bind 'k' { 'focus_move' (2) } bind 'j' { 'focus_move' (3) } bind 'h' { 'focus_move' (4) } bind 'l' { 'focus_move' (5) } } class 'GtkDwScrolledFrame' binding 'vi-keys'" The numerical values after "focus_move" are actually GTK enumeration values, but the current implementation does not support this. It would of course look much better to be able to write "focus_move" (GTK_DIR_DOWN) instead of "focus_move" (3)... It is also possible to bind a sequence of actions to a single keypress by adding more actions after the first. Bugz^Hs ======= - Image links without alt text do not work with keyboard navigation. - Image links with alt text work, but Dillo is currently not able to scroll to them. This can lead to 'hidden' focused links, use the scroll keys or scroll bars to bring them in to view. This problem is shared with the Search feature. It is caused by a deficiency in the widget iterator function which is used for scrolling. - The sometimes unpredictable behaviour of link UP/DOWN can be classified as a bug. Or not. It is probably hard to solve this. The root cause is the use of incremental display in dw_page, which is in itself a good feature. To good to mess it up with some hack to get each and every link in the right place before using keyboard navigation. TODO ==== Well, apart from fixing those bugs... Maybe merge focus with search, they have quite a lot in common. This would save some code and memory. It would also mess up the current design, so maybe this is not such a good idea. Add more GTK+ bindings, replacing current key_press event handling. ... Download instructions ===================== There is currently only one version of the patch, made against 20031014 CVS. Sorry, no 0.7.3 support (yet...). As always, have a look at the patch website (http://www.geocities.com/ikbenfrank/) for the latest version of the patch. This patch does NOT apply on top of the tab/frame patch, and the tab/frame patch does not apply on top of this one! The tab/frame patch already contains this functionality, so it is not needed. Also, there is some overlap in the patched files, so I'd have to create a special version of this patch for this purpose. http://www.geocities.com/ikbenfrank/dillo-200310142300-kbnav.patch.gz size: 14336 bytes (gzipped, as downloaded) 62481 bytes (uncompressed) md5sum: 06c21168960cc5de12437ab4abff6d45 (gzipped, as downloaded) a1317f63190ad0df9501bbb257f8c137 (uncompressed) Cheers//Frank -- WWWWW ________________________ ## o o\ / Frank de Lange \ }# \| / +46-734352015 \ \ `--| _/ <Hacker for Hire> \ `---' \ +31-640037120 / \ frank@unternet.org / `------------------------' [ "Omnis enim res, quae dando non deficit, dum habetur et non datur, nondum habetur, quomodo habenda est." ] -- WWWWW ________________________ ## o o\ / Frank de Lange \ }# \| / \ \ `--| _/ <Hacker for Hire> \ `---' \ +46-734352015 / \ frank@unternet.org / `------------------------' [ "Omnis enim res, quae dando non deficit, dum habetur et non datur, nondum habetur, quomodo habenda est." ]
participants (1)
-
Frank de Lange