diff options
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 77dfa015d68..03ad58e67d5 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -683,12 +683,22 @@ int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, PointerR } if(wrap) { + rcti *winrect= NULL; + ARegion *ar= CTX_wm_region(C); ScrArea *sa= CTX_wm_area(C); - if(sa) { - bounds[0]= sa->totrct.xmin; - bounds[1]= sa->totrct.ymax; - bounds[2]= sa->totrct.xmax; - bounds[3]= sa->totrct.ymin; + + if(ar && ar->regiontype == RGN_TYPE_WINDOW && BLI_in_rcti(&ar->winrct, event->x, event->y)) { + winrect= &ar->winrct; + } + else if(sa) { + winrect= &sa->totrct; + } + + if(winrect) { + bounds[0]= winrect->xmin; + bounds[1]= winrect->ymax; + bounds[2]= winrect->xmax; + bounds[3]= winrect->ymin; } } |