X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fconfig.c;h=025a683377bfbc05e456a407134a030423d4e599;hb=d162451a0113da1e012e007f848e38f07348d9d2;hp=00309d8cbf47b6681e562f6b95876a55bbc71bd4;hpb=7a679dd1989ee0b5b36ab2d6b16af47be8a537ad;p=chaz%2Fopenbox diff --git a/openbox/config.c b/openbox/config.c index 00309d8c..025a6833 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -459,7 +459,7 @@ static void parse_mouse(xmlNodePtr node, gpointer d) { xmlNodePtr n, nbut, nact; gchar *buttonstr; - gchar *contextstr; + gchar *cxstr; ObMouseAction mact; mouse_unbind_all(); @@ -482,37 +482,57 @@ static void parse_mouse(xmlNodePtr node, gpointer d) n = obt_xml_find_node(node, "context"); while (n) { - if (!obt_xml_attr_string(n, "name", &contextstr)) + gchar *modcxstr; + ObFrameContext cx; + + if (!obt_xml_attr_string(n, "name", &cxstr)) goto next_n; - nbut = obt_xml_find_node(n->children, "mousebind"); - while (nbut) { - if (!obt_xml_attr_string(nbut, "button", &buttonstr)) - goto next_nbut; - if (obt_xml_attr_contains(nbut, "action", "press")) { - mact = OB_MOUSE_ACTION_PRESS; - } else if (obt_xml_attr_contains(nbut, "action", "release")) { - mact = OB_MOUSE_ACTION_RELEASE; - } else if (obt_xml_attr_contains(nbut, "action", "click")) { - mact = OB_MOUSE_ACTION_CLICK; - } else if (obt_xml_attr_contains(nbut, "action","doubleclick")) { - mact = OB_MOUSE_ACTION_DOUBLE_CLICK; - } else if (obt_xml_attr_contains(nbut, "action", "drag")) { - mact = OB_MOUSE_ACTION_MOTION; - } else - goto next_nbut; - nact = obt_xml_find_node(nbut->children, "action"); - while (nact) { - ObActionsAct *action; - - if ((action = actions_parse(nact))) - mouse_bind(buttonstr, contextstr, mact, action); - nact = obt_xml_find_node(nact->next, "action"); + + modcxstr = g_strdup(cxstr); /* make a copy to mutilate */ + while (frame_next_context_from_string(modcxstr, &cx)) { + if (!cx) { + gchar *s = strchr(modcxstr, ' '); + if (s) { + *s = '\0'; + g_message(_("Invalid context \"%s\" in mouse binding"), + modcxstr); + *s = ' '; + } + continue; } + + nbut = obt_xml_find_node(n->children, "mousebind"); + while (nbut) { + if (!obt_xml_attr_string(nbut, "button", &buttonstr)) + goto next_nbut; + if (obt_xml_attr_contains(nbut, "action", "press")) + mact = OB_MOUSE_ACTION_PRESS; + else if (obt_xml_attr_contains(nbut, "action", "release")) + mact = OB_MOUSE_ACTION_RELEASE; + else if (obt_xml_attr_contains(nbut, "action", "click")) + mact = OB_MOUSE_ACTION_CLICK; + else if (obt_xml_attr_contains(nbut, "action","doubleclick")) + mact = OB_MOUSE_ACTION_DOUBLE_CLICK; + else if (obt_xml_attr_contains(nbut, "action", "drag")) + mact = OB_MOUSE_ACTION_MOTION; + else + goto next_nbut; + + nact = obt_xml_find_node(nbut->children, "action"); + while (nact) { + ObActionsAct *action; + + if ((action = actions_parse(nact))) + mouse_bind(buttonstr, cx, mact, action); + nact = obt_xml_find_node(nact->next, "action"); + } g_free(buttonstr); - next_nbut: + next_nbut: nbut = obt_xml_find_node(nbut->next, "mousebind"); + } } - g_free(contextstr); + g_free(modcxstr); + g_free(cxstr); next_n: n = obt_xml_find_node(n->next, "context"); } @@ -959,8 +979,8 @@ static void bind_default_mouse(void) }; for (it = binds; it->button; ++it) - mouse_bind(it->button, it->context, it->mact, - actions_parse_string(it->actname)); + mouse_bind(it->button, frame_context_from_string(it->context), + it->mact, actions_parse_string(it->actname)); } void config_startup(ObtXmlInst *i)