[Bf-blender-cvs] [0822af4c481] master: WM: init simulated event from win->eventstate

Campbell Barton noreply at git.blender.org
Fri Feb 8 09:02:07 CET 2019


Commit: 0822af4c4813f503dcd5de20facc588f67b1f9a6
Author: Campbell Barton
Date:   Fri Feb 8 19:00:51 2019 +1100
Branches: master
https://developer.blender.org/rB0822af4c4813f503dcd5de20facc588f67b1f9a6

WM: init simulated event from win->eventstate

Ghost event handling code works this way.

===================================================================

M	source/blender/makesrna/intern/rna_wm_api.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index 80d97b4acf2..c6196adc8ee 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -521,7 +521,7 @@ static wmEvent *rna_Window_event_add_simulate(
 		}
 	}
 
-	wmEvent e = {NULL};
+	wmEvent e = *win->eventstate;
 	e.type = type;
 	e.val = value;
 	e.x = x;
@@ -532,12 +532,13 @@ static wmEvent *rna_Window_event_add_simulate(
 	e.alt = alt;
 	e.oskey = oskey;
 
-	const wmEvent *evt = win->eventstate;
-	e.prevx = evt->x;
-	e.prevy = evt->y;
-	e.prevval = evt->val;
-	e.prevtype = evt->type;
+	e.prevx = win->eventstate->x;
+	e.prevy = win->eventstate->y;
+	e.prevval = win->eventstate->val;
+	e.prevtype = win->eventstate->type;
 
+	e.ascii = '\0';
+	e.utf8_buf[0] = '\0';
 	if (unicode != NULL) {
 		e.ascii = ascii;
 		STRNCPY(e.utf8_buf, unicode);



More information about the Bf-blender-cvs mailing list