Small fix for repeat-last-operator:

- Context in WM wasn't set for regions yet, done now. So repeat works on
  per-region ops too.
- Debug print was printing the wrong repeated op.
  (repeat-op could show menu naming the op to repeat)
This commit is contained in:
Ton Roosendaal 2008-12-04 09:37:42 +00:00
parent cb92e781f4
commit 2e517db96a
2 changed files with 14 additions and 1 deletions

@ -1225,7 +1225,7 @@ static int repeat_last_exec(bContext *C, wmOperator *op)
wmOperator *lastop= C->wm->operators.last; wmOperator *lastop= C->wm->operators.last;
if(lastop) { if(lastop) {
printf("repeat %s\n", op->type->idname); printf("repeat %s\n", lastop->type->idname);
lastop->type->exec(C, lastop); lastop->type->exec(C, lastop);
} }

@ -505,6 +505,18 @@ static ScrArea *area_event_inside(bContext *C, wmEvent *event)
return NULL; return NULL;
} }
static ARegion *region_event_inside(bContext *C, wmEvent *event)
{
ARegion *ar;
if(C->screen && C->area)
for(ar= C->area->regionbase.first; ar; ar= ar->next)
if(BLI_in_rcti(&ar->winrct, event->x, event->y))
return ar;
return NULL;
}
/* called in main loop */ /* called in main loop */
/* goes over entire hierarchy: events -> window -> screen -> area -> region */ /* goes over entire hierarchy: events -> window -> screen -> area -> region */
void wm_event_do_handlers(bContext *C) void wm_event_do_handlers(bContext *C)
@ -523,6 +535,7 @@ void wm_event_do_handlers(bContext *C)
C->window= win; C->window= win;
C->screen= win->screen; C->screen= win->screen;
C->area= area_event_inside(C, event); C->area= area_event_inside(C, event);
C->region= region_event_inside(C, event);
/* MVC demands to not draw in event handlers... for now we leave it */ /* MVC demands to not draw in event handlers... for now we leave it */
wm_window_make_drawable(C, win); wm_window_make_drawable(C, win);