Sun Sep 12 23:36:21 2010 Michael Jennings (mej)
Fix merge error and additional LibAST updates. ---------------------------------------------------------------------- SVN revision: 52177
This commit is contained in:
parent
dba393060d
commit
c262cddf04
|
@ -5767,3 +5767,7 @@ Sun Sep 12 23:20:09 2010 Michael Jennings (mej)
|
||||||
|
|
||||||
Merge changes from 0.9.6 branch.
|
Merge changes from 0.9.6 branch.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
Sun Sep 12 23:36:21 2010 Michael Jennings (mej)
|
||||||
|
|
||||||
|
Fix merge error and additional LibAST updates.
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
|
@ -81,7 +81,7 @@ spif_eterm_action_new(void)
|
||||||
self = SPIF_ALLOC(eterm_action);
|
self = SPIF_ALLOC(eterm_action);
|
||||||
if (!spif_eterm_action_init(self)) {
|
if (!spif_eterm_action_init(self)) {
|
||||||
SPIF_DEALLOC(self);
|
SPIF_DEALLOC(self);
|
||||||
self = SPIF_NULL_TYPE(eterm_action);
|
self = (spif_eterm_action_t) NULL;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ spif_eterm_action_new_from_data(spif_eterm_action_type_t type, spif_ushort_t mod
|
||||||
self = SPIF_ALLOC(eterm_action);
|
self = SPIF_ALLOC(eterm_action);
|
||||||
if (!spif_eterm_action_init_from_data(self, type, modifiers, button, keysym, param)) {
|
if (!spif_eterm_action_init_from_data(self, type, modifiers, button, keysym, param)) {
|
||||||
SPIF_DEALLOC(self);
|
SPIF_DEALLOC(self);
|
||||||
self = SPIF_NULL_TYPE(eterm_action);
|
self = (spif_eterm_action_t) NULL;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -117,8 +117,8 @@ spif_eterm_action_init(spif_eterm_action_t self)
|
||||||
self->modifiers = ETERM_MOD_NONE;
|
self->modifiers = ETERM_MOD_NONE;
|
||||||
self->button = ETERM_BUTTON_NONE;
|
self->button = ETERM_BUTTON_NONE;
|
||||||
self->keysym = ETERM_KEYSYM_NONE;
|
self->keysym = ETERM_KEYSYM_NONE;
|
||||||
self->handler = SPIF_NULL_TYPE(eterm_action_handler);
|
self->handler = (spif_eterm_action_handler_t) NULL;
|
||||||
self->parameter = SPIF_NULL_TYPE(eterm_action_parameter);
|
self->parameter = (spif_eterm_action_parameter_t) NULL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,28 +135,28 @@ spif_eterm_action_init_from_data(spif_eterm_action_t self, spif_eterm_action_typ
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ETERM_ACTION_STRING:
|
case ETERM_ACTION_STRING:
|
||||||
self->handler = SPIF_CAST(eterm_action_handler) action_handle_string;
|
self->handler = (spif_eterm_action_handler_t) action_handle_string;
|
||||||
self->parameter = SPIF_CAST(obj) spif_str_new_from_ptr(param);
|
self->parameter = (spif_obj_t) spif_str_new_from_ptr(param);
|
||||||
/*parse_escaped_string(self->parameter.string); */
|
/*parse_escaped_string(self->parameter.string); */
|
||||||
break;
|
break;
|
||||||
case ETERM_ACTION_ECHO:
|
case ETERM_ACTION_ECHO:
|
||||||
self->handler = SPIF_CAST(eterm_action_handler) action_handle_echo;
|
self->handler = (spif_eterm_action_handler_t) action_handle_echo;
|
||||||
self->parameter = SPIF_CAST(obj) spif_str_new_from_ptr(param);
|
self->parameter = (spif_obj_t) spif_str_new_from_ptr(param);
|
||||||
/*parse_escaped_string(self->parameter.string); */
|
/*parse_escaped_string(self->parameter.string); */
|
||||||
break;
|
break;
|
||||||
case ETERM_ACTION_SCRIPT:
|
case ETERM_ACTION_SCRIPT:
|
||||||
self->handler = SPIF_CAST(eterm_action_handler) action_handle_script;
|
self->handler = (spif_eterm_action_handler_t) action_handle_script;
|
||||||
self->parameter = SPIF_CAST(obj) spif_str_new_from_ptr(param);
|
self->parameter = (spif_obj_t) spif_str_new_from_ptr(param);
|
||||||
break;
|
break;
|
||||||
case ETERM_ACTION_MENU:
|
case ETERM_ACTION_MENU:
|
||||||
self->handler = SPIF_CAST(eterm_action_handler) action_handle_menu;
|
self->handler = (spif_eterm_action_handler_t) action_handle_menu;
|
||||||
/*self->parameter.menu = (menu_t *) param; */
|
/*self->parameter.menu = (menu_t *) param; */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
D_ACTIONS(("Added action. modifiers == 0x%08x, button == %d, keysym == 0x%08x\n",
|
D_ACTIONS(("Added action. modifiers == 0x%08x, button == %d, keysym == 0x%08x\n",
|
||||||
self->modifiers, self->button, SPIF_CAST_C(unsigned) self->keysym));
|
self->modifiers, self->button, (unsigned) self->keysym));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -175,8 +175,8 @@ spif_eterm_action_done(spif_eterm_action_t self)
|
||||||
self->modifiers = ETERM_MOD_NONE;
|
self->modifiers = ETERM_MOD_NONE;
|
||||||
self->button = ETERM_BUTTON_NONE;
|
self->button = ETERM_BUTTON_NONE;
|
||||||
self->keysym = ETERM_KEYSYM_NONE;
|
self->keysym = ETERM_KEYSYM_NONE;
|
||||||
self->handler = SPIF_NULL_TYPE(eterm_action_handler);
|
self->handler = (spif_eterm_action_handler_t) NULL;
|
||||||
self->parameter = SPIF_NULL_TYPE(eterm_action_parameter);
|
self->parameter = (spif_eterm_action_parameter_t) NULL;
|
||||||
spif_obj_done(SPIF_OBJ(self));
|
spif_obj_done(SPIF_OBJ(self));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ spif_eterm_action_show(spif_eterm_action_t self, spif_charptr_t name, spif_str_t
|
||||||
spif_str_append_from_ptr(buff, tmp);
|
spif_str_append_from_ptr(buff, tmp);
|
||||||
snprintf(tmp + indent, sizeof(tmp) - indent, " (spif_uchar_t) button: %d\n", self->button);
|
snprintf(tmp + indent, sizeof(tmp) - indent, " (spif_uchar_t) button: %d\n", self->button);
|
||||||
spif_str_append_from_ptr(buff, tmp);
|
spif_str_append_from_ptr(buff, tmp);
|
||||||
snprintf(tmp + indent, sizeof(tmp) - indent, " (KeySym) keysym: %04x\n", SPIF_CAST_C(unsigned) self->keysym);
|
snprintf(tmp + indent, sizeof(tmp) - indent, " (KeySym) keysym: %04x\n", (unsigned) self->keysym);
|
||||||
|
|
||||||
spif_str_append_from_ptr(buff, tmp);
|
spif_str_append_from_ptr(buff, tmp);
|
||||||
snprintf(tmp + indent, sizeof(tmp) - indent, " (spif_eterm_action_handler_t) handler: %10p\n", self->handler);
|
snprintf(tmp + indent, sizeof(tmp) - indent, " (spif_eterm_action_handler_t) handler: %10p\n", self->handler);
|
||||||
|
@ -224,22 +224,22 @@ spif_eterm_action_comp(spif_eterm_action_t self, spif_eterm_action_t other)
|
||||||
spif_cmp_t c;
|
spif_cmp_t c;
|
||||||
|
|
||||||
SPIF_OBJ_COMP_CHECK_NULL(self, other);
|
SPIF_OBJ_COMP_CHECK_NULL(self, other);
|
||||||
c = SPIF_CMP_FROM_INT(SPIF_CAST_C(int) (self->type) - SPIF_CAST_C(int) (other->type));
|
c = SPIF_CMP_FROM_INT((int) (self->type) - (int) (other->type));
|
||||||
|
|
||||||
if (!SPIF_CMP_IS_EQUAL(c)) {
|
if (!SPIF_CMP_IS_EQUAL(c)) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
c = SPIF_CMP_FROM_INT(SPIF_CAST_C(int) (self->button) - SPIF_CAST_C(int) (other->button));
|
c = SPIF_CMP_FROM_INT((int) (self->button) - (int) (other->button));
|
||||||
|
|
||||||
if (!SPIF_CMP_IS_EQUAL(c)) {
|
if (!SPIF_CMP_IS_EQUAL(c)) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
c = SPIF_CMP_FROM_INT(SPIF_CAST_C(int) (self->keysym) - SPIF_CAST_C(int) (other->keysym));
|
c = SPIF_CMP_FROM_INT((int) (self->keysym) - (int) (other->keysym));
|
||||||
|
|
||||||
if (!SPIF_CMP_IS_EQUAL(c)) {
|
if (!SPIF_CMP_IS_EQUAL(c)) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
return SPIF_CMP_FROM_INT(SPIF_CAST_C(int) (self->modifiers) - SPIF_CAST_C(int) (other->modifiers));
|
return SPIF_CMP_FROM_INT((int) (self->modifiers) - (int) (other->modifiers));
|
||||||
}
|
}
|
||||||
|
|
||||||
spif_eterm_action_t
|
spif_eterm_action_t
|
||||||
|
@ -247,7 +247,7 @@ spif_eterm_action_dup(spif_eterm_action_t self)
|
||||||
{
|
{
|
||||||
spif_eterm_action_t tmp;
|
spif_eterm_action_t tmp;
|
||||||
|
|
||||||
REQUIRE_RVAL(!SPIF_ETERM_ACTION_ISNULL(self), SPIF_NULL_TYPE(eterm_action));
|
REQUIRE_RVAL(!SPIF_ETERM_ACTION_ISNULL(self), (spif_eterm_action_t) NULL);
|
||||||
tmp = spif_eterm_action_new();
|
tmp = spif_eterm_action_new();
|
||||||
tmp->type = self->type;
|
tmp->type = self->type;
|
||||||
tmp->modifiers = self->modifiers;
|
tmp->modifiers = self->modifiers;
|
||||||
|
@ -423,14 +423,14 @@ eterm_action_dispatch(event_t *ev)
|
||||||
ASSERT_RVAL(ev != NULL, FALSE);
|
ASSERT_RVAL(ev != NULL, FALSE);
|
||||||
ASSERT_RVAL(ev->xany.type == ButtonPress || ev->xany.type == KeyPress, FALSE);
|
ASSERT_RVAL(ev->xany.type == ButtonPress || ev->xany.type == KeyPress, FALSE);
|
||||||
D_ACTIONS(("Event %8p: Button %d, Keycode %d, Key State 0x%08x (modifiers %c%c%c%c)\n",
|
D_ACTIONS(("Event %8p: Button %d, Keycode %d, Key State 0x%08x (modifiers %c%c%c%c)\n",
|
||||||
ev, ev->xbutton.button, SPIF_CAST_C(int) ev->xkey.keycode, ev->xkey.state, SHOW_X_MODS(ev->xkey.state)));
|
ev, ev->xbutton.button, (int) ev->xkey.keycode, ev->xkey.state, SHOW_X_MODS(ev->xkey.state)));
|
||||||
D_ACTIONS(("Searching %d actions to find match.\n", SPIF_VECTOR_COUNT(actions)));
|
D_ACTIONS(("Searching %d actions to find match.\n", SPIF_VECTOR_COUNT(actions)));
|
||||||
|
|
||||||
for (iter = SPIF_VECTOR_ITERATOR(actions); SPIF_ITERATOR_HAS_NEXT(iter);) {
|
for (iter = SPIF_VECTOR_ITERATOR(actions); SPIF_ITERATOR_HAS_NEXT(iter);) {
|
||||||
action = SPIF_CAST(eterm_action) SPIF_ITERATOR_NEXT(iter);
|
action = (spif_eterm_action_t) SPIF_ITERATOR_NEXT(iter);
|
||||||
if (action_matches_event(action, ev)) {
|
if (action_matches_event(action, ev)) {
|
||||||
D_ACTIONS(("Spawning handler for action object %10p.\n", action));
|
D_ACTIONS(("Spawning handler for action object %10p.\n", action));
|
||||||
return SPIF_CAST(bool) ((SPIF_CAST(eterm_action_handler) (action->handler)) (ev, action));
|
return (spif_bool_t) (((spif_eterm_action_handler_t) (action->handler)) (ev, action));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -439,12 +439,18 @@ eterm_action_dispatch(event_t *ev)
|
||||||
static spif_bool_t
|
static spif_bool_t
|
||||||
action_matches_event(spif_eterm_action_t action, event_t *ev)
|
action_matches_event(spif_eterm_action_t action, event_t *ev)
|
||||||
{
|
{
|
||||||
action_t *action;
|
/* The very first thing we do is match the event type to the type
|
||||||
|
of the current action. This means that we'll only run through
|
||||||
if (!action_list || !(action = action_find_match(mod, button, keysym))) {
|
the modifier checks below if we absolutely have to. */
|
||||||
action = (action_t *) MALLOC(sizeof(action_t));
|
D_ACTIONS(("Checking action %10p for match to event %10p.\n", action, ev));
|
||||||
action->next = action_list;
|
if (ev->xany.type == ButtonPress) {
|
||||||
action_list = action;
|
if (!action_check_button(action->button, ev->xbutton.button)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
} else if (ev->xany.type == KeyPress) {
|
||||||
|
if (!action_check_keysym(action->keysym, XKeycodeToKeysym(Xdisplay, ev->xkey.keycode, 0))) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ASSERT_NOTREACHED_RVAL(FALSE);
|
ASSERT_NOTREACHED_RVAL(FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2002,7 +2002,7 @@ parse_image(char *buff, void *state)
|
||||||
static void *
|
static void *
|
||||||
parse_actions(char *buff, void *state)
|
parse_actions(char *buff, void *state)
|
||||||
{
|
{
|
||||||
spif_eterm_action_t new_action = SPIF_NULL_TYPE(eterm_action);
|
spif_eterm_action_t new_action = (spif_eterm_action_t) NULL;
|
||||||
unsigned short mod = ETERM_MOD_NONE;
|
unsigned short mod = ETERM_MOD_NONE;
|
||||||
unsigned char button = ETERM_BUTTON_NONE;
|
unsigned char button = ETERM_BUTTON_NONE;
|
||||||
KeySym keysym = 0;
|
KeySym keysym = 0;
|
||||||
|
@ -2060,22 +2060,22 @@ parse_actions(char *buff, void *state)
|
||||||
str = spiftool_get_pword(i, buff);
|
str = spiftool_get_pword(i, buff);
|
||||||
if (!BEG_STRCASECMP(str, "string")) {
|
if (!BEG_STRCASECMP(str, "string")) {
|
||||||
str = spiftool_get_word(i + 1, buff);
|
str = spiftool_get_word(i + 1, buff);
|
||||||
new_action = spif_eterm_action_new_from_data(ETERM_ACTION_STRING, mod, button, keysym, SPIF_CAST(ptr) str);
|
new_action = spif_eterm_action_new_from_data(ETERM_ACTION_STRING, mod, button, keysym, (spif_ptr_t) str);
|
||||||
FREE(str);
|
FREE(str);
|
||||||
} else if (!BEG_STRCASECMP(str, "echo")) {
|
} else if (!BEG_STRCASECMP(str, "echo")) {
|
||||||
str = spiftool_get_word(i + 1, buff);
|
str = spiftool_get_word(i + 1, buff);
|
||||||
new_action = spif_eterm_action_new_from_data(ETERM_ACTION_ECHO, mod, button, keysym, SPIF_CAST(ptr) str);
|
new_action = spif_eterm_action_new_from_data(ETERM_ACTION_ECHO, mod, button, keysym, (spif_ptr_t) str);
|
||||||
FREE(str);
|
FREE(str);
|
||||||
} else if (!BEG_STRCASECMP(str, "menu")) {
|
} else if (!BEG_STRCASECMP(str, "menu")) {
|
||||||
/*menu_t *menu; */
|
/*menu_t *menu; */
|
||||||
|
|
||||||
str = spiftool_get_word(i + 1, buff);
|
str = spiftool_get_word(i + 1, buff);
|
||||||
/*menu = find_menu_by_title(menu_list, str); */
|
/*menu = find_menu_by_title(menu_list, str); */
|
||||||
new_action = spif_eterm_action_new_from_data(ETERM_ACTION_MENU, mod, button, keysym, SPIF_NULL_TYPE(ptr));
|
new_action = spif_eterm_action_new_from_data(ETERM_ACTION_MENU, mod, button, keysym, (spif_ptr_t) NULL);
|
||||||
FREE(str);
|
FREE(str);
|
||||||
} else if (!BEG_STRCASECMP(str, "script")) {
|
} else if (!BEG_STRCASECMP(str, "script")) {
|
||||||
str = spiftool_get_word(i + 1, buff);
|
str = spiftool_get_word(i + 1, buff);
|
||||||
new_action = spif_eterm_action_new_from_data(ETERM_ACTION_SCRIPT, mod, button, keysym, SPIF_CAST(ptr) str);
|
new_action = spif_eterm_action_new_from_data(ETERM_ACTION_SCRIPT, mod, button, keysym, (spif_ptr_t) str);
|
||||||
FREE(str);
|
FREE(str);
|
||||||
} else {
|
} else {
|
||||||
libast_print_error("Parse error in file %s, line %lu: No valid action type found. Valid types are "
|
libast_print_error("Parse error in file %s, line %lu: No valid action type found. Valid types are "
|
||||||
|
@ -3687,7 +3687,7 @@ save_config(char *path, unsigned char save_theme)
|
||||||
for (iter = SPIF_VECTOR_ITERATOR(actions); SPIF_ITERATOR_HAS_NEXT(iter);) {
|
for (iter = SPIF_VECTOR_ITERATOR(actions); SPIF_ITERATOR_HAS_NEXT(iter);) {
|
||||||
spif_eterm_action_t action;
|
spif_eterm_action_t action;
|
||||||
|
|
||||||
action = SPIF_CAST(eterm_action) SPIF_ITERATOR_NEXT(iter);
|
action = (spif_eterm_action_t) SPIF_ITERATOR_NEXT(iter);
|
||||||
fprintf(fp, " bind ");
|
fprintf(fp, " bind ");
|
||||||
if (action->modifiers != ETERM_MOD_NONE) {
|
if (action->modifiers != ETERM_MOD_NONE) {
|
||||||
if (action->modifiers & ETERM_MOD_ANY) {
|
if (action->modifiers & ETERM_MOD_ANY) {
|
||||||
|
|
Loading…
Reference in New Issue