[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46505] trunk/blender/source/blender/ windowmanager/intern/wm_window.c: Fix #31221: Multiple Monitors/ Windows Double Click For Focus

Sergey Sharybin sergey.vfx at gmail.com
Thu May 10 17:34:23 CEST 2012


Revision: 46505
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46505
Author:   nazgul
Date:     2012-05-10 15:34:23 +0000 (Thu, 10 May 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/intern/wm_window.c

Modified: trunk/blender/source/blender/windowmanager/intern/wm_window.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_window.c	2012-05-10 15:32:01 UTC (rev 46504)
+++ trunk/blender/source/blender/windowmanager/intern/wm_window.c	2012-05-10 15:34:23 UTC (rev 46505)
@@ -672,6 +672,7 @@
 			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 @@
 				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: {




More information about the Bf-blender-cvs mailing list