Cleanup: simplify wmEvent tablet data storage and naming
Removing meaningless distinction between NULL pointer and EVT_TABLET_NONE, and initialize pressure and tilt to 1.0 and 0.0 respectively when no tablet is used.
This commit is contained in:
@@ -460,14 +460,8 @@ static void curve_draw_event_add(wmOperator *op, const wmEvent *event)
|
||||
|
||||
ARRAY_SET_ITEMS(selem->mval, event->mval[0], event->mval[1]);
|
||||
|
||||
/* handle pressure sensitivity (which is supplied by tablets) */
|
||||
if (event->tablet_data) {
|
||||
const wmTabletData *wmtab = event->tablet_data;
|
||||
selem->pressure = wmtab->Pressure;
|
||||
}
|
||||
else {
|
||||
selem->pressure = 1.0f;
|
||||
}
|
||||
/* handle pressure sensitivity (which is supplied by tablets or otherwise 1.0) */
|
||||
selem->pressure = event->tablet.pressure;
|
||||
|
||||
bool is_depth_found = stroke_elem_project_fallback_elem(
|
||||
cdd, cdd->prev.location_world_valid, selem);
|
||||
|
||||
@@ -1461,12 +1461,7 @@ static void gpencil_draw_toggle_eraser_cursor(bContext *C, tGPsdata *p, short en
|
||||
/* Check if tablet eraser is being used (when processing events) */
|
||||
static bool gpencil_is_tablet_eraser_active(const wmEvent *event)
|
||||
{
|
||||
if (event->tablet_data) {
|
||||
const wmTabletData *wmtab = event->tablet_data;
|
||||
return (wmtab->Active == EVT_TABLET_ERASER);
|
||||
}
|
||||
|
||||
return false;
|
||||
return (event->tablet.active == EVT_TABLET_ERASER);
|
||||
}
|
||||
|
||||
/* ------------------------------- */
|
||||
@@ -1686,7 +1681,6 @@ static void annotation_draw_apply_event(
|
||||
tGPsdata *p = op->customdata;
|
||||
PointerRNA itemptr;
|
||||
float mousef[2];
|
||||
int tablet = 0;
|
||||
|
||||
/* convert from window-space to area-space mouse coordinates
|
||||
* add any x,y override position for fake events
|
||||
@@ -1720,29 +1714,20 @@ static void annotation_draw_apply_event(
|
||||
|
||||
p->curtime = PIL_check_seconds_timer();
|
||||
|
||||
/* handle pressure sensitivity (which is supplied by tablets) */
|
||||
if (event->tablet_data) {
|
||||
const wmTabletData *wmtab = event->tablet_data;
|
||||
/* handle pressure sensitivity (which is supplied by tablets or otherwise 1.0) */
|
||||
p->pressure = event->tablet.pressure;
|
||||
|
||||
tablet = (wmtab->Active != EVT_TABLET_NONE);
|
||||
p->pressure = wmtab->Pressure;
|
||||
|
||||
/* Hack for pressure sensitive eraser on D+RMB when using a tablet:
|
||||
* The pen has to float over the tablet surface, resulting in
|
||||
* zero pressure (T47101). Ignore pressure values if floating
|
||||
* (i.e. "effectively zero" pressure), and only when the "active"
|
||||
* end is the stylus (i.e. the default when not eraser)
|
||||
*/
|
||||
if (p->paintmode == GP_PAINTMODE_ERASER) {
|
||||
if ((wmtab->Active != EVT_TABLET_ERASER) && (p->pressure < 0.001f)) {
|
||||
p->pressure = 1.0f;
|
||||
}
|
||||
/* Hack for pressure sensitive eraser on D+RMB when using a tablet:
|
||||
* The pen has to float over the tablet surface, resulting in
|
||||
* zero pressure (T47101). Ignore pressure values if floating
|
||||
* (i.e. "effectively zero" pressure), and only when the "active"
|
||||
* end is the stylus (i.e. the default when not eraser)
|
||||
*/
|
||||
if (p->paintmode == GP_PAINTMODE_ERASER) {
|
||||
if ((event->tablet.active != EVT_TABLET_ERASER) && (p->pressure < 0.001f)) {
|
||||
p->pressure = 1.0f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* No tablet data -> No pressure info is available */
|
||||
p->pressure = 1.0f;
|
||||
}
|
||||
|
||||
/* special exception for start of strokes (i.e. maybe for just a dot) */
|
||||
if (p->flags & GP_PAINTFLAG_FIRSTRUN) {
|
||||
@@ -1758,7 +1743,7 @@ static void annotation_draw_apply_event(
|
||||
/* special exception here for too high pressure values on first touch in
|
||||
* windows for some tablets, then we just skip first touch...
|
||||
*/
|
||||
if (tablet && (p->pressure >= 0.99f)) {
|
||||
if ((event->tablet.active != EVT_TABLET_NONE) && (p->pressure >= 0.99f)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1976,7 +1976,6 @@ static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEven
|
||||
GP_Sculpt_Settings *gset = &ts->gp_sculpt;
|
||||
PointerRNA itemptr;
|
||||
float mouse[2];
|
||||
int tablet = 0;
|
||||
|
||||
mouse[0] = event->mval[0] + 1;
|
||||
mouse[1] = event->mval[1] + 1;
|
||||
@@ -1988,24 +1987,14 @@ static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEven
|
||||
RNA_boolean_set(&itemptr, "pen_flip", event->ctrl != false);
|
||||
RNA_boolean_set(&itemptr, "is_start", gso->first);
|
||||
|
||||
/* handle pressure sensitivity (which is supplied by tablets) */
|
||||
if (event->tablet_data) {
|
||||
const wmTabletData *wmtab = event->tablet_data;
|
||||
float pressure = wmtab->Pressure;
|
||||
|
||||
tablet = (wmtab->Active != EVT_TABLET_NONE);
|
||||
|
||||
/* special exception here for too high pressure values on first touch in
|
||||
* windows for some tablets: clamp the values to be sane
|
||||
*/
|
||||
if (tablet && (pressure >= 0.99f)) {
|
||||
pressure = 1.0f;
|
||||
}
|
||||
RNA_float_set(&itemptr, "pressure", pressure);
|
||||
}
|
||||
else {
|
||||
RNA_float_set(&itemptr, "pressure", 1.0f);
|
||||
/* handle pressure sensitivity (which is supplied by tablets and otherwise 1.0) */
|
||||
float pressure = event->tablet.pressure;
|
||||
/* special exception here for too high pressure values on first touch in
|
||||
* windows for some tablets: clamp the values to be sane */
|
||||
if (pressure >= 0.99f) {
|
||||
pressure = 1.0f;
|
||||
}
|
||||
RNA_float_set(&itemptr, "pressure", pressure);
|
||||
|
||||
if (!gso->is_weight_mode) {
|
||||
if (event->shift) {
|
||||
|
||||
@@ -2553,12 +2553,7 @@ static void gpencil_draw_toggle_eraser_cursor(bContext *C, tGPsdata *p, short en
|
||||
/* Check if tablet eraser is being used (when processing events) */
|
||||
static bool gpencil_is_tablet_eraser_active(const wmEvent *event)
|
||||
{
|
||||
if (event->tablet_data) {
|
||||
const wmTabletData *wmtab = event->tablet_data;
|
||||
return (wmtab->Active == EVT_TABLET_ERASER);
|
||||
}
|
||||
|
||||
return false;
|
||||
return (event->tablet.active == EVT_TABLET_ERASER);
|
||||
}
|
||||
|
||||
/* ------------------------------- */
|
||||
@@ -3020,7 +3015,6 @@ static void gpencil_draw_apply_event(bContext *C,
|
||||
GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
|
||||
PointerRNA itemptr;
|
||||
float mousef[2];
|
||||
int tablet = 0;
|
||||
bool is_speed_guide = ((guide->use_guide) &&
|
||||
(p->brush && (p->brush->gpencil_tool == GPAINT_TOOL_DRAW)));
|
||||
|
||||
@@ -3055,29 +3049,20 @@ static void gpencil_draw_apply_event(bContext *C,
|
||||
|
||||
p->curtime = PIL_check_seconds_timer();
|
||||
|
||||
/* handle pressure sensitivity (which is supplied by tablets) */
|
||||
if (event->tablet_data) {
|
||||
const wmTabletData *wmtab = event->tablet_data;
|
||||
/* handle pressure sensitivity (which is supplied by tablets or otherwise 1.0) */
|
||||
p->pressure = event->tablet.pressure;
|
||||
|
||||
tablet = (wmtab->Active != EVT_TABLET_NONE);
|
||||
p->pressure = wmtab->Pressure;
|
||||
|
||||
/* Hack for pressure sensitive eraser on D+RMB when using a tablet:
|
||||
* The pen has to float over the tablet surface, resulting in
|
||||
* zero pressure (T47101). Ignore pressure values if floating
|
||||
* (i.e. "effectively zero" pressure), and only when the "active"
|
||||
* end is the stylus (i.e. the default when not eraser)
|
||||
*/
|
||||
if (p->paintmode == GP_PAINTMODE_ERASER) {
|
||||
if ((wmtab->Active != EVT_TABLET_ERASER) && (p->pressure < 0.001f)) {
|
||||
p->pressure = 1.0f;
|
||||
}
|
||||
/* Hack for pressure sensitive eraser on D+RMB when using a tablet:
|
||||
* The pen has to float over the tablet surface, resulting in
|
||||
* zero pressure (T47101). Ignore pressure values if floating
|
||||
* (i.e. "effectively zero" pressure), and only when the "active"
|
||||
* end is the stylus (i.e. the default when not eraser)
|
||||
*/
|
||||
if (p->paintmode == GP_PAINTMODE_ERASER) {
|
||||
if ((event->tablet.active != EVT_TABLET_ERASER) && (p->pressure < 0.001f)) {
|
||||
p->pressure = 1.0f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* No tablet data -> No pressure info is available */
|
||||
p->pressure = 1.0f;
|
||||
}
|
||||
|
||||
/* special eraser modes */
|
||||
if (p->paintmode == GP_PAINTMODE_ERASER) {
|
||||
@@ -3101,7 +3086,7 @@ static void gpencil_draw_apply_event(bContext *C,
|
||||
/* special exception here for too high pressure values on first touch in
|
||||
* windows for some tablets, then we just skip first touch...
|
||||
*/
|
||||
if (tablet && (p->pressure >= 0.99f)) {
|
||||
if ((event->tablet.active != EVT_TABLET_NONE) && (p->pressure >= 0.99f)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -676,7 +676,7 @@ static void walkEvent(bContext *C, WalkInfo *walk, const wmEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((walk->is_cursor_absolute == false) && event->is_motion_absolute) {
|
||||
if ((walk->is_cursor_absolute == false) && event->tablet.is_motion_absolute) {
|
||||
walk->is_cursor_absolute = true;
|
||||
copy_v2_v2_int(walk->prev_mval, event->mval);
|
||||
copy_v2_v2_int(walk->center_mval, event->mval);
|
||||
|
||||
@@ -2185,7 +2185,7 @@ static void rna_def_event(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Is Tablet", "The event has tablet data");
|
||||
|
||||
prop = RNA_def_property(srna, "is_mouse_absolute", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "is_motion_absolute", 1);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "tablet.is_motion_absolute", 1);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Absolute Motion", "The last motion event was an absolute input");
|
||||
|
||||
|
||||
@@ -205,7 +205,6 @@ void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *ar);
|
||||
|
||||
void WM_cursor_warp(struct wmWindow *win, int x, int y);
|
||||
void WM_cursor_compatible_xy(wmWindow *win, int *x, int *y);
|
||||
float WM_cursor_pressure(const struct wmWindow *win);
|
||||
|
||||
/* handlers */
|
||||
|
||||
|
||||
@@ -505,6 +505,19 @@ typedef struct wmGesture {
|
||||
|
||||
/* ************** wmEvent ************************ */
|
||||
|
||||
typedef struct wmTabletData {
|
||||
/** 0=EVT_TABLET_NONE, 1=EVT_TABLET_STYLUS, 2=EVT_TABLET_ERASER. */
|
||||
int active;
|
||||
/** range 0.0 (not touching) to 1.0 (full pressure). */
|
||||
float pressure;
|
||||
/** range 0.0 (upright) to 1.0 (tilted fully against the tablet surface). */
|
||||
float x_tilt;
|
||||
/** as above. */
|
||||
float y_tilt;
|
||||
/** Interpret mouse motion as absolute as typical for tablets. */
|
||||
char is_motion_absolute;
|
||||
} wmTabletData;
|
||||
|
||||
/**
|
||||
* Each event should have full modifier state.
|
||||
* event comes from event manager and from keymap.
|
||||
@@ -546,10 +559,9 @@ typedef struct wmEvent {
|
||||
/** Set in case a #KM_PRESS went by unhandled. */
|
||||
char check_click;
|
||||
char check_drag;
|
||||
char is_motion_absolute;
|
||||
|
||||
/** Tablet info, only use when the tablet is active. */
|
||||
const struct wmTabletData *tablet_data;
|
||||
wmTabletData tablet;
|
||||
|
||||
/* custom data */
|
||||
/** Custom data type, stylus, 6dof, see wm_event_types.h */
|
||||
@@ -577,18 +589,6 @@ bool WM_event_cursor_click_drag_threshold_met(const wmEvent *event);
|
||||
*/
|
||||
#define WM_EVENT_CURSOR_MOTION_THRESHOLD ((float)U.move_threshold * U.dpi_fac)
|
||||
|
||||
/* ************** custom wmEvent data ************** */
|
||||
typedef struct wmTabletData {
|
||||
/** 0=EVT_TABLET_NONE, 1=EVT_TABLET_STYLUS, 2=EVT_TABLET_ERASER. */
|
||||
int Active;
|
||||
/** range 0.0 (not touching) to 1.0 (full pressure). */
|
||||
float Pressure;
|
||||
/** range 0.0 (upright) to 1.0 (tilted fully against the tablet surface). */
|
||||
float Xtilt;
|
||||
/** as above. */
|
||||
float Ytilt;
|
||||
} wmTabletData;
|
||||
|
||||
/** Motion progress, for modal handlers. */
|
||||
typedef enum {
|
||||
P_NOT_STARTED,
|
||||
|
||||
@@ -1088,7 +1088,7 @@ void wm_gizmomap_modal_set(
|
||||
gz->state |= WM_GIZMO_STATE_MODAL;
|
||||
gzmap->gzmap_context.modal = gz;
|
||||
|
||||
if ((gz->flag & WM_GIZMO_MOVE_CURSOR) && (event->is_motion_absolute == false)) {
|
||||
if ((gz->flag & WM_GIZMO_MOVE_CURSOR) && (event->tablet.is_motion_absolute == false)) {
|
||||
WM_cursor_grab_enable(win, WM_CURSOR_WRAP_XY, true, NULL);
|
||||
copy_v2_v2_int(gzmap->gzmap_context.event_xy, &event->x);
|
||||
gzmap->gzmap_context.event_grabcursor = win->grabcursor;
|
||||
|
||||
@@ -304,8 +304,7 @@ void WM_cursor_grab_enable(wmWindow *win, int wrap, bool hide, int bounds[4])
|
||||
|
||||
if ((G.debug & G_DEBUG) == 0) {
|
||||
if (win->ghostwin) {
|
||||
/* Note: There is no tabletdata on Windows if no tablet device is connected. */
|
||||
if (win->eventstate->is_motion_absolute == false) {
|
||||
if (win->eventstate->tablet.is_motion_absolute == false) {
|
||||
GHOST_SetCursorGrab(win->ghostwin, mode, mode_axis, bounds, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,13 +101,13 @@ void WM_event_print(const wmEvent *event)
|
||||
}
|
||||
#endif /* WITH_INPUT_NDOF */
|
||||
|
||||
if (event->tablet_data) {
|
||||
const wmTabletData *wmtab = event->tablet_data;
|
||||
if (event->tablet.active != EVT_TABLET_NONE) {
|
||||
const wmTabletData *wmtab = &event->tablet;
|
||||
printf(" tablet: active: %d, pressure %.4f, tilt: (%.4f %.4f)\n",
|
||||
wmtab->Active,
|
||||
wmtab->Pressure,
|
||||
wmtab->Xtilt,
|
||||
wmtab->Ytilt);
|
||||
wmtab->active,
|
||||
wmtab->pressure,
|
||||
wmtab->x_tilt,
|
||||
wmtab->y_tilt);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -392,36 +392,21 @@ float wm_pressure_curve(float pressure)
|
||||
* to 1 if the eraser tool is being used, 0 otherwise */
|
||||
float WM_event_tablet_data(const wmEvent *event, int *pen_flip, float tilt[2])
|
||||
{
|
||||
int erasor = 0;
|
||||
float pressure = 1;
|
||||
|
||||
if (tilt) {
|
||||
zero_v2(tilt);
|
||||
}
|
||||
|
||||
if (event->tablet_data) {
|
||||
const wmTabletData *wmtab = event->tablet_data;
|
||||
|
||||
erasor = (wmtab->Active == EVT_TABLET_ERASER);
|
||||
if (wmtab->Active != EVT_TABLET_NONE) {
|
||||
pressure = wmtab->Pressure;
|
||||
if (tilt) {
|
||||
tilt[0] = wmtab->Xtilt;
|
||||
tilt[1] = wmtab->Ytilt;
|
||||
}
|
||||
}
|
||||
tilt[0] = event->tablet.x_tilt;
|
||||
tilt[1] = event->tablet.y_tilt;
|
||||
}
|
||||
|
||||
if (pen_flip) {
|
||||
(*pen_flip) = erasor;
|
||||
(*pen_flip) = (event->tablet.active == EVT_TABLET_ERASER);
|
||||
}
|
||||
|
||||
return pressure;
|
||||
return event->tablet.pressure;
|
||||
}
|
||||
|
||||
bool WM_event_is_tablet(const struct wmEvent *event)
|
||||
{
|
||||
return (event->tablet_data) ? true : false;
|
||||
return (event->tablet.active != EVT_TABLET_NONE);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -127,12 +127,6 @@ wmEvent *wm_event_add_ex(wmWindow *win,
|
||||
|
||||
update_tablet_data(win, event);
|
||||
|
||||
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
|
||||
/* We could have a preference to support relative tablet motion (we can't detect that). */
|
||||
event->is_motion_absolute = ((event->tablet_data != NULL) &&
|
||||
(event->tablet_data->Active != GHOST_kTabletModeNone));
|
||||
}
|
||||
|
||||
if (event_to_add_after == NULL) {
|
||||
BLI_addtail(&win->queue, event);
|
||||
}
|
||||
@@ -176,10 +170,6 @@ void wm_event_free(wmEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
if (event->tablet_data) {
|
||||
MEM_freeN((void *)event->tablet_data);
|
||||
}
|
||||
|
||||
MEM_freeN(event);
|
||||
}
|
||||
|
||||
@@ -194,9 +184,6 @@ void wm_event_free_all(wmWindow *win)
|
||||
|
||||
void wm_event_init_from_window(wmWindow *win, wmEvent *event)
|
||||
{
|
||||
/* make sure we don't copy any owned pointers */
|
||||
BLI_assert(win->eventstate->tablet_data == NULL);
|
||||
|
||||
*event = *(win->eventstate);
|
||||
}
|
||||
|
||||
@@ -1793,19 +1780,16 @@ static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi)
|
||||
|
||||
if (kmitype != KM_ANY) {
|
||||
if (ELEM(kmitype, TABLET_STYLUS, TABLET_ERASER)) {
|
||||
const wmTabletData *wmtab = winevent->tablet_data;
|
||||
const wmTabletData *wmtab = &winevent->tablet;
|
||||
|
||||
if (wmtab == NULL) {
|
||||
return false;
|
||||
}
|
||||
else if (winevent->type != LEFTMOUSE) {
|
||||
if (winevent->type != LEFTMOUSE) {
|
||||
/* tablet events can occur on hover + keypress */
|
||||
return false;
|
||||
}
|
||||
else if ((kmitype == TABLET_STYLUS) && (wmtab->Active != EVT_TABLET_STYLUS)) {
|
||||
else if ((kmitype == TABLET_STYLUS) && (wmtab->active != EVT_TABLET_STYLUS)) {
|
||||
return false;
|
||||
}
|
||||
else if ((kmitype == TABLET_ERASER) && (wmtab->Active != EVT_TABLET_ERASER)) {
|
||||
else if ((kmitype == TABLET_ERASER) && (wmtab->active != EVT_TABLET_ERASER)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -4107,21 +4091,24 @@ static void wm_eventemulation(wmEvent *event, bool test_only)
|
||||
static void update_tablet_data(wmWindow *win, wmEvent *event)
|
||||
{
|
||||
const GHOST_TabletData *td = GHOST_GetTabletData(win->ghostwin);
|
||||
wmTabletData *wmtab = &event->tablet;
|
||||
|
||||
/* if there's tablet data from an active tablet device then add it */
|
||||
if ((td != NULL) && td->Active != GHOST_kTabletModeNone) {
|
||||
struct wmTabletData *wmtab = MEM_mallocN(sizeof(wmTabletData), "customdata tablet");
|
||||
|
||||
wmtab->Active = (int)td->Active;
|
||||
wmtab->Pressure = wm_pressure_curve(td->Pressure);
|
||||
wmtab->Xtilt = td->Xtilt;
|
||||
wmtab->Ytilt = td->Ytilt;
|
||||
|
||||
event->tablet_data = wmtab;
|
||||
// printf("%s: using tablet %.5f\n", __func__, wmtab->Pressure);
|
||||
wmtab->active = (int)td->Active;
|
||||
wmtab->pressure = wm_pressure_curve(td->Pressure);
|
||||
wmtab->x_tilt = td->Xtilt;
|
||||
wmtab->y_tilt = td->Ytilt;
|
||||
/* We could have a preference to support relative tablet motion (we can't detect that). */
|
||||
wmtab->is_motion_absolute = ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE);
|
||||
// printf("%s: using tablet %.5f\n", __func__, wmtab->pressure);
|
||||
}
|
||||
else {
|
||||
event->tablet_data = NULL;
|
||||
wmtab->active = EVT_TABLET_NONE;
|
||||
wmtab->pressure = 1.0f;
|
||||
wmtab->x_tilt = 0.0f;
|
||||
wmtab->y_tilt = 0.0f;
|
||||
wmtab->is_motion_absolute = false;
|
||||
// printf("%s: not using tablet\n", __func__);
|
||||
}
|
||||
}
|
||||
@@ -4280,7 +4267,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
|
||||
{
|
||||
wmEvent *event_new = wm_event_add_mousemove(win, &event);
|
||||
copy_v2_v2_int(&evt->x, &event_new->x);
|
||||
evt->is_motion_absolute = event_new->is_motion_absolute;
|
||||
evt->tablet.is_motion_absolute = event_new->tablet.is_motion_absolute;
|
||||
}
|
||||
|
||||
/* also add to other window if event is there, this makes overdraws disappear nicely */
|
||||
@@ -4298,7 +4285,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
|
||||
{
|
||||
wmEvent *event_new = wm_event_add_mousemove(owin, &oevent);
|
||||
copy_v2_v2_int(&oevt->x, &event_new->x);
|
||||
oevt->is_motion_absolute = event_new->is_motion_absolute;
|
||||
oevt->tablet.is_motion_absolute = event_new->tablet.is_motion_absolute;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2100,21 +2100,6 @@ void WM_cursor_compatible_xy(wmWindow *win, int *x, int *y)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cursor pressure, in most cases you'll want to use wmTabletData from the event
|
||||
*/
|
||||
float WM_cursor_pressure(const struct wmWindow *win)
|
||||
{
|
||||
const GHOST_TabletData *td = GHOST_GetTabletData(win->ghostwin);
|
||||
/* if there's tablet data from an active tablet device then add it */
|
||||
if ((td != NULL) && td->Active != GHOST_kTabletModeNone) {
|
||||
return wm_pressure_curve(td->Pressure);
|
||||
}
|
||||
else {
|
||||
return -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user