Skip to content

Commit

Permalink
2006-07-20 Matthew Allum <[email protected]>
Browse files Browse the repository at this point in the history
        * layouts/keyboard-ru.xml:
        * src/config-parser.c: (config_handle_key_subtag),
        (config_handle_layout_tag), (config_xml_start_cb),
        (mb_kbd_config_load):
        Apply patches from Paul Sokolovsky for Russian layout
        improvements and more error messages from config parser.



git-svn-id: https://svn.o-hand.com/repos/matchbox/trunk/matchbox-keyboard@1362 b067294f-1dea-0310-9683-c47a78595994
  • Loading branch information
mallum committed Jul 20, 2006
1 parent 85527ca commit 2294c4a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2006-07-20 Matthew Allum <[email protected]>

* layouts/keyboard-ru.xml:
* src/config-parser.c: (config_handle_key_subtag),
(config_handle_layout_tag), (config_xml_start_cb),
(mb_kbd_config_load):
Apply patches from Paul Sokolovsky for Russian layout
improvements and more error messages from config parser.

2006-05-22 Matthew Allum <[email protected]>

* src/matchbox-keyboard-ui.c: (mb_kdb_ui_unit_key_size):
Expand Down
2 changes: 1 addition & 1 deletion layouts/keyboard-ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
<default display="äëö" action="modifier:mod1"/>
</key>
<key>
<default display="EN" action="modifier:layout1"/>
<default display="EN" action="modifier:mod2"/>
</key>

<key fill="true">
Expand Down
33 changes: 23 additions & 10 deletions src/config-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
fill="true" // Set width to available space
>
<defualt
<default
display="a"
display="image:"
action="utf8char" // optional, action defulats to this
action="utf8char" // optional, action defaults to this
action="string" // from lookup below
action="modifier:Shift|Alt|ctrl|mod1|mod2|mod3|caps"
action="xkeysym:XK_BLAH"
Expand Down Expand Up @@ -124,9 +124,19 @@ typedef struct MBKeyboardConfigState
MBKeyboardKey *current_key;
Bool error;
char *error_msg;
int error_lineno;
XML_Parser parser;
}
MBKeyboardConfigState;

void
set_error(MBKeyboardConfigState *state, char *msg)
{
state->error = True;
state->error_lineno = XML_GetCurrentLineNumber(state->parser);
state->error_msg = msg;
}

KeySym
config_str_to_keysym(const char* str)
{
Expand Down Expand Up @@ -331,13 +341,13 @@ config_handle_key_subtag(MBKeyboardConfigState *state,
}
else
{
state->error = True;
set_error(state, "Unknown key subtag");
return;
}

if ((val = attr_get_val("display", attr)) == NULL)
{
state->error = True;
set_error(state, "Attribute 'display' is required");
return;
}

Expand Down Expand Up @@ -399,7 +409,7 @@ config_handle_key_subtag(MBKeyboardConfigState *state,
}
else
{
state->error = True;
set_error(state, "Unknown modifier");
return;
}

Expand All @@ -419,7 +429,7 @@ config_handle_key_subtag(MBKeyboardConfigState *state,
else
{
/* Should this error really be terminal */
state->error = True;
set_error(state, "Unknown keysym");
return;
}
}
Expand Down Expand Up @@ -463,7 +473,7 @@ config_handle_layout_tag(MBKeyboardConfigState *state, const char **attr)

if ((val = attr_get_val("id", attr)) == NULL)
{
state->error = True;
set_error(state, "Attribute 'id' is required");
return;
}

Expand Down Expand Up @@ -548,6 +558,8 @@ config_xml_start_cb(void *data, const char *tag, const char **attr)

if (state->error)
{
fprintf(stderr, "matchbox-keyboard:%s:%d: %s\n", state->keyboard->config_file,
state->error_lineno, state->error_msg);
util_fatal_error("Error parsing\n");
}
}
Expand Down Expand Up @@ -577,6 +589,7 @@ mb_kbd_config_load(MBKeyboard *kbd, char *variant)
state = util_malloc0(sizeof(MBKeyboardConfigState));

state->keyboard = kbd;
state->parser = p;

XML_SetElementHandler(p, config_xml_start_cb, NULL);

Expand All @@ -586,10 +599,10 @@ mb_kbd_config_load(MBKeyboard *kbd, char *variant)

if (! XML_Parse(p, data, strlen(data), 1)) {
fprintf(stderr,
"matchbox-keyboard: XML Parse error at line %d:\n%s\n of %s",
"matchbox-keyboard:%s:%d: XML Parse error:%s\n",
kbd->config_file,
XML_GetCurrentLineNumber(p),
XML_ErrorString(XML_GetErrorCode(p)),
kbd->config_file);
XML_ErrorString(XML_GetErrorCode(p)));
util_fatal_error("XML Parse failed.\n");
}

Expand Down

0 comments on commit 2294c4a

Please sign in to comment.