Fix #31221: Multiple Monitors/Windows Double Click For Focus

Window might be focused by mouse click in configuration of window manager
when focus is not following mouse.
Click could have been done on a button and depending on window manager settings
click would be passed to blender or not, but in any case button under cursor
should be activated. Currently the easiest way to activate button is to
generate mouse move event.

Not sure about OSX, but on windows it worked fine because OS is generating
WM_MOUSEMOVE event "automatically" so nothing special from blender side was
needed.
This commit is contained in:
Sergey Sharybin 2012-05-10 15:34:23 +00:00
parent f3d721aa93
commit 591a091003
1 changed files with 18 additions and 0 deletions

View File

@ -672,6 +672,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
case GHOST_kEventWindowActivate:
{
GHOST_TEventKeyData kdata;
wmEvent event;
int cx, cy, wx, wy;
wm->winactive = win; /* no context change! c->wm->windrawable is drawable, or for area queues */
@ -711,6 +712,23 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
win->addmousemove = 1; /* enables highlighted buttons */
wm_window_make_drawable(C, win);
/* window might be focused by mouse click in configuration of window manager
* when focus is not following mouse
* click could have been done on a button and depending on window manager settings
* click would be passed to blender or not, but in any case button under cursor
* should be activated, so at max next click on button without moving mouse
* would trigger it's handle function
* currently it seems to be common practice to generate new event for, but probably
* we'll need utility function for this? (sergey)
*/
event = *(win->eventstate);
event.type = MOUSEMOVE;
event.prevx = event.x;
event.prevy = event.y;
wm_event_add(win, &event);
break;
}
case GHOST_kEventWindowClose: {