From 591a0910037d3ca2de511c6e2790d5585a3991fc Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 10 May 2012 15:34:23 +0000 Subject: [PATCH] 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. --- .../blender/windowmanager/intern/wm_window.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 8d962c828ca..5f6b15dee02 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -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: {