1 | This note describes areas where implementation of keynav for panels was |
---|
2 | difficult. |
---|
3 | |
---|
4 | - PanelWidget and objects on the panel such as launchers and applets need to |
---|
5 | be focusable |
---|
6 | |
---|
7 | Both the PanelWidget and objects on the panel need to be focusable in order |
---|
8 | to invoke the context menu using only the keyboard. In the normal course of |
---|
9 | things, GTK+ does not support a widget and its children be focusable. |
---|
10 | |
---|
11 | Instead of requiring the PanelWidget be focusable we have introduced a key |
---|
12 | binding Ctrl+F10 which pops up the panel's context menu. So a PanelWidget |
---|
13 | is focusable only when it does not have any children. There is, therefore, |
---|
14 | no need for the key binding Ctrl+Tab to move the focus to the PanelWidget from |
---|
15 | an applet or a launcher. |
---|
16 | |
---|
17 | The function panel_widget_real_focus is PanelWidget's default signal |
---|
18 | handler for focus signal. This function is called when either PanelWidget |
---|
19 | or a child has focus and Tab or arrow keys are used to move focus. If the |
---|
20 | PanelWidget has focus and the PanelWidget has children the GTK_CAN_FOCUS flag |
---|
21 | is unset so that a child can receive focus. |
---|
22 | |
---|
23 | - An applet with a tooltip receives focus |
---|
24 | |
---|
25 | If an applet has a tooltip, the applet willr eceive focus so that the tooltip |
---|
26 | can be displayed, even if the applet contains focusable widgets. The |
---|
27 | focusable widgets in the applet can be traversed using the arrow jeys. |
---|
28 | |
---|
29 | |
---|
30 | - Tab should move focus from within an applet to the next object on the panel |
---|
31 | |
---|
32 | This is implemented by defining an action signal "move_focus_out_of_applet" |
---|
33 | on PanelApplet and binding Tab and Shift+Tab to this action. |
---|
34 | |
---|
35 | When focus is in an applet the event is passed to the focus widget then its |
---|
36 | children until a toplevel is reached unless the event is handled. This is |
---|
37 | done in gtk_window_key_press_event(). The original implemementation for |
---|
38 | "move_focus_out_of_applet" had the action signal defined on PanelAppletFrame |
---|
39 | but as a GtkSocket always reports a key press event as being handled when |
---|
40 | the GtkPlug is in a different process, the event has not passed to the |
---|
41 | PanelAppletFrame. |
---|
42 | |
---|
43 | The implementation for "moving_focus_out_of_applet" sets a flag |
---|
44 | moving_focus_out so that the function panel_applet_focus() which is |
---|
45 | PanelApplet's default signal handler for focus signal will not attempt to |
---|
46 | move the focus within the applet if this flag is set. |
---|
47 | |
---|
48 | |
---|
49 | - Implementing key bindings |
---|
50 | |
---|
51 | If focus is in an applet which is in another process, the GtkSocket will |
---|
52 | report the key stroke as having been handled. This means that key bindings |
---|
53 | will not be activated. The workaround for this is to handle those key |
---|
54 | strokes in panel_event() a signal handler for the event signal in panel.c. |
---|
55 | However, we only want to handle some keybindings, for example we do not want |
---|
56 | to handle Shift+F10, which displays the context menu, and Ctrl+F1, which |
---|
57 | displays the tooltip, but we do want to handle Ctrl+F10 which displays the |
---|
58 | panel's context menu. |
---|
59 | |
---|
60 | |
---|
61 | - Focus indication |
---|
62 | |
---|
63 | We need a mechanism that will make visible which panel has focus. We also |
---|
64 | need to do this without impacting current behaviour. |
---|
65 | |
---|
66 | We set the state of a PanelWidget to GTK_STATE_SELECTED whan focus is in a |
---|
67 | PanelWidget. We provide a default panel rc file gnome-panelrc, which is |
---|
68 | installed in $(datadir). This rc file sets the default default color for |
---|
69 | SELECTED for any widget which is a descended from a PanelWidget or |
---|
70 | PanelApplet to be the same as the NORMAL colour. |
---|
71 | |
---|
72 | If there is a requirement to make panel focus indication visible, the |
---|
73 | following lines added to ~/.gtkrc-2.0 will make a selected panel prelight |
---|
74 | color. |
---|
75 | |
---|
76 | style "prelight-selected" |
---|
77 | { |
---|
78 | fg[SELECTED] = { 0, 0, 0 } |
---|
79 | bg[SELECTED] = { 0xea60, 0xea60, 0xea60 } |
---|
80 | } |
---|
81 | |
---|
82 | widget_class "*PanelWidget*" style "prelight-selected" |
---|
83 | widget_class "*PanelApplet*" style "prelight-selected" |
---|
84 | |
---|