edit to 55549, replace fake click event with call to uiButActiveOnly().

also make it more clear args are for rna buttons.
This commit is contained in:
Campbell Barton 2013-03-24 19:08:24 +00:00
parent d74cf43575
commit 8bf206ce4b
2 changed files with 10 additions and 16 deletions

@ -643,7 +643,8 @@ void uiBlockSetDrawExtraFunc(uiBlock *block,
void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect),
void *arg1, void *arg2);
void UI_textbutton_activate_event(const struct bContext *C, struct ARegion *ar, void *basepoin, const char *identifier);
void UI_textbutton_activate_event(const struct bContext *C, struct ARegion *ar,
const void *rna_poin_data, const char *rna_prop_id);
void uiButSetFocusOnEnter(struct wmWindow *win, uiBut *but);

@ -7456,18 +7456,20 @@ void UI_remove_popup_handlers(ListBase *handlers, uiPopupBlockHandle *popup)
WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, FALSE);
}
void UI_textbutton_activate_event(const bContext *C, ARegion *ar, void *basepoin, const char *identifier)
void UI_textbutton_activate_event(const bContext *C, ARegion *ar,
const void *rna_poin_data, const char *rna_prop_id)
{
uiBlock *block;
uiBut *but;
uiBut *but = NULL;
for (block = ar->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next) {
if (but->type == TEX) {
if (but->rnaprop && but->rnapoin.data == basepoin)
if (strcmp(RNA_property_identifier(but->rnaprop), identifier)==0)
if (but->rnaprop && but->rnapoin.data == rna_poin_data) {
if (STREQ(RNA_property_identifier(but->rnaprop), rna_prop_id)) {
break;
}
}
}
}
if (but)
@ -7475,16 +7477,7 @@ void UI_textbutton_activate_event(const bContext *C, ARegion *ar, void *basepoin
}
if (but) {
wmWindow *win = CTX_wm_window(C);
wmEvent event;
event = *(win->eventstate); /* XXX huh huh? make api call */
event.type = EVT_BUT_OPEN;
event.val = KM_PRESS;
event.customdata = but;
event.customdatafree = FALSE;
wm_event_add(win, &event);
uiButActiveOnly(C, block, but);
}
}