nitpicker: Remove <global-keys> compound node

This commit is contained in:
Norman Feske 2014-06-17 09:59:51 +02:00
parent dbebfd624e
commit 295b4241aa
3 changed files with 17 additions and 22 deletions

View File

@ -122,13 +122,11 @@ append config {
<domain name="default" color="#ffffff"/>
<policy label="" domain="default"/>
<global-keys>
<key name="KEY_SCROLLLOCK" operation="xray" />
<key name="KEY_SYSRQ" operation="kill" />
<key name="KEY_PRINT" operation="kill" />
<key name="KEY_F11" operation="kill" />
<key name="KEY_F12" operation="xray" />
</global-keys>
<global-key name="KEY_SCROLLLOCK" operation="xray" />
<global-key name="KEY_SYSRQ" operation="kill" />
<global-key name="KEY_PRINT" operation="kill" />
<global-key name="KEY_F11" operation="kill" />
<global-key name="KEY_F12" operation="xray" />
</config>
</start>
<start name="launchpad">

View File

@ -33,16 +33,13 @@ keyboard shortcuts, namely the X-ray mode and the kill mode. The keys
for toggling those functions can be defined as follows:
! <config>
! <global-keys>
! <key name="KEY_SCROLLLOCK" operation="xray" />
! <key name="KEY_PRINT" operation="kill" />
! </global-keys>
! <global-key name="KEY_SCROLLLOCK" operation="xray" />
! <global-key name="KEY_PRINT" operation="kill" />
! </config>
The '<global-keys>' node contains the policy for handling global keys. Each
'<key>' subnode expresses a rule for named key. The 'operation' attribute
refers nitpicker's built-in operations. In the example above, the X-ray
mode can be activated via the scroll-lock key and the kill mode can be
Each '<global-key>' node expresses a rule for a named key. The 'operation'
attribute refers nitpicker's built-in operations. In the example above, the
X-ray mode can be activated via the scroll-lock key and the kill mode can be
activated via the print key.
Alternatively to specifying an 'operation' attribute, a key node can contain
@ -55,10 +52,8 @@ the key specified in the '<key>' node. For the routing of global keys to
clients, the order of '<key>' nodes is important. If multiple nodes exists for
different labels, the first match will take effect. For example:
! <global-keys>
! <key name="KEY_F11" label="launchpad -> testnit" />
! <key name="KEY_F11" label="launchpad" />
! </global-keys>
! <global-key name="KEY_F11" label="launchpad -> testnit" />
! <global-key name="KEY_F11" label="launchpad" />
The "launchpad" client will receive all key sequences starting with F11 unless
the "launchpad -> testnit" program is running. As soon as testnit gets started

View File

@ -33,14 +33,16 @@ void Global_keys::apply_config(Session_list &session_list)
for (unsigned i = 0; i < NUM_POLICIES; i++)
_policies[i].undefine();
char const *node_type = "global-key";
using Genode::Xml_node;
try {
Xml_node node = Genode::config()->xml_node().sub_node("global-keys").sub_node("key");
Xml_node node = Genode::config()->xml_node().sub_node(node_type);
for (; ; node = node.next("key")) {
for (; ; node = node.next(node_type)) {
if (!node.has_attribute("name")) {
PWRN("attribute 'name' missing in <key> config node");
PWRN("attribute 'name' missing in <global-key> config node");
continue;
}