diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 19 |
3 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 4bed8c7bb8c..ee7ff472c12 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -646,6 +646,9 @@ static wmEvent *rna_Window_event_add_simulate(wmWindow *win, STRNCPY(e.utf8_buf, unicode); } + /* Until we expose setting tablet values here. */ + WM_event_tablet_data_default_set(&e.tablet); + return WM_event_add_simulate(win, &e); } diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 2f540262a66..bd534c51c9a 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -66,6 +66,7 @@ struct wmJob; struct wmOperator; struct wmOperatorType; struct wmPaintCursor; +struct wmTabletData; #ifdef WITH_INPUT_NDOF struct wmNDOFMotionData; @@ -785,6 +786,8 @@ bool write_crash_blend(void); /* Lock the interface for any communication */ void WM_set_locked_interface(struct wmWindowManager *wm, bool lock); +void WM_event_tablet_data_default_set(struct wmTabletData *tablet_data); + /* For testing only 'G_FLAG_EVENT_SIMULATE' */ struct wmEvent *WM_event_add_simulate(struct wmWindow *win, const struct wmEvent *event_to_add); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index cb16550717b..e1a723f9f75 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -4167,6 +4167,19 @@ static void wm_eventemulation(wmEvent *event, bool test_only) } } +static const wmTabletData wm_event_tablet_data_default = { + .active = EVT_TABLET_NONE, + .pressure = 1.0f, + .x_tilt = 0.0f, + .y_tilt = 0.0f, + .is_motion_absolute = false, +}; + +void WM_event_tablet_data_default_set(wmTabletData *tablet_data) +{ + *tablet_data = wm_event_tablet_data_default; +} + void wm_tablet_data_from_ghost(const GHOST_TabletData *tablet_data, wmTabletData *wmtab) { if ((tablet_data != NULL) && tablet_data->Active != GHOST_kTabletModeNone) { @@ -4179,11 +4192,7 @@ void wm_tablet_data_from_ghost(const GHOST_TabletData *tablet_data, wmTabletData // printf("%s: using tablet %.5f\n", __func__, wmtab->pressure); } else { - wmtab->active = EVT_TABLET_NONE; - wmtab->pressure = 1.0f; - wmtab->x_tilt = 0.0f; - wmtab->y_tilt = 0.0f; - wmtab->is_motion_absolute = false; + *wmtab = wm_event_tablet_data_default; // printf("%s: not using tablet\n", __func__); } } |