guint config_dock_app_move_button;
guint config_dock_app_move_modifiers;
-guint config_keyboard_reset_keycode;
-guint config_keyboard_reset_state;
+guint config_keyboard_reset_keycode;
+guint config_keyboard_reset_state;
+gboolean config_keyboard_rebind_on_mapping_notify;
gint config_mouse_threshold;
gint config_mouse_dclicktime;
parse_key(n, NULL);
n = obt_xml_find_node(n->next, "keybind");
}
+
+ if ((n = obt_xml_find_node(node->children, "rebindOnMappingNotify")))
+ config_keyboard_rebind_on_mapping_notify = obt_xml_node_bool(n);
}
/*
if ((n = obt_xml_find_node(node, "screenEdgeWarpMouse")))
config_mouse_screenedgewarp = obt_xml_node_bool(n);
- n = obt_xml_find_node(node, "context");
- while (n) {
+ for (n = obt_xml_find_node(node, "context");
+ n;
+ n = obt_xml_find_node(n->next, "context"))
+ {
gchar *modcxstr;
ObFrameContext cx;
if (!obt_xml_attr_string(n, "name", &cxstr))
- goto next_n;
+ continue;
modcxstr = g_strdup(cxstr); /* make a copy to mutilate */
while (frame_next_context_from_string(modcxstr, &cx)) {
continue;
}
- nbut = obt_xml_find_node(n->children, "mousebind");
- while (nbut) {
+ for (nbut = obt_xml_find_node(n->children, "mousebind");
+ nbut;
+ nbut = obt_xml_find_node(nbut->next, "mousebind"))
+ {
+
+ gchar **button, **buttons;
+
if (!obt_xml_attr_string(nbut, "button", &buttonstr))
- goto next_nbut;
+ continue;
if (obt_xml_attr_contains(nbut, "action", "press"))
mact = OB_MOUSE_ACTION_PRESS;
else if (obt_xml_attr_contains(nbut, "action", "release"))
else if (obt_xml_attr_contains(nbut, "action", "drag"))
mact = OB_MOUSE_ACTION_MOTION;
else
- goto next_nbut;
+ continue;
- nact = obt_xml_find_node(nbut->children, "action");
- while (nact) {
+ buttons = g_strsplit(buttonstr, " ", 0);
+ for (nact = obt_xml_find_node(nbut->children, "action");
+ nact;
+ nact = obt_xml_find_node(nact->next, "action"))
+ {
ObActionsAct *action;
- if ((action = actions_parse(nact)))
- mouse_bind(buttonstr, cx, mact, action);
- nact = obt_xml_find_node(nact->next, "action");
+ /* actions_parse() creates one ref to the action, but we need
+ * exactly one ref per binding we use it for. */
+ if ((action = actions_parse(nact))) {
+ for (button = buttons; *button; ++button) {
+ actions_act_ref(action);
+ mouse_bind(*button, cx, mact, action);
+ }
+ actions_act_unref(action);
+ }
}
- g_free(buttonstr);
- next_nbut:
- nbut = obt_xml_find_node(nbut->next, "mousebind");
+ g_strfreev(buttons);
+ g_free(buttonstr);
}
}
g_free(modcxstr);
g_free(cxstr);
- next_n:
- n = obt_xml_find_node(n->next, "context");
}
}
config_theme_window_list_icon_size = 96;
}
- n = obt_xml_find_node(node, "font");
- while (n) {
+ for (n = obt_xml_find_node(node, "font");
+ n;
+ n = obt_xml_find_node(n->next, "font"))
+ {
xmlNodePtr fnode;
RrFont **font;
gchar *name = g_strdup(RrDefaultFontFamily);
else if (obt_xml_attr_contains(n, "place","InactiveOnScreenDisplay"))
font = &config_font_inactiveosd;
else
- goto next_font;
+ continue;
if ((fnode = obt_xml_find_node(n->children, "name"))) {
g_free(name);
*font = RrFontOpen(ob_rr_inst, name, size, weight, slant);
g_free(name);
- next_font:
- n = obt_xml_find_node(n->next, "font");
}
}
g_slist_free(config_desktops_names);
config_desktops_names = NULL;
- nname = obt_xml_find_node(n->children, "name");
- while (nname) {
+ for (nname = obt_xml_find_node(n->children, "name");
+ nname;
+ nname = obt_xml_find_node(nname->next, "name"))
+ {
config_desktops_names =
g_slist_append(config_desktops_names,
obt_xml_node_string(nname));
- nname = obt_xml_find_node(nname->next, "name");
}
}
if ((n = obt_xml_find_node(node, "popupTime")))
#endif
}
- while ((node = obt_xml_find_node(node, "file"))) {
+ for (node = obt_xml_find_node(node, "file");
+ node;
+ node = obt_xml_find_node(node->next, "file"))
+ {
gchar *c = obt_xml_node_string(node);
config_menu_files = g_slist_append(config_menu_files,
obt_paths_expand_tilde(c));
g_free(c);
- node = node->next;
}
}
translate_key("C-g", &config_keyboard_reset_state,
&config_keyboard_reset_keycode);
+ config_keyboard_rebind_on_mapping_notify = TRUE;
bind_default_keyboard();