Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-05-20 11:40:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-20 11:40:05 +0400
commit9f766c71b0a98801600c775dfc46faee84ddf49e (patch)
treee8d933e20df512eb836062e0f8cf9191f32c1141
parent2338765726a5aa6b8870d573d685218720864583 (diff)
use event->mval rather then subtracting ar->winrct.x / y from event->x / y
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c8
-rw-r--r--source/blender/editors/animation/anim_ops.c9
-rw-r--r--source/blender/editors/armature/editarmature.c25
-rw-r--r--source/blender/editors/curve/editcurve.c15
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c11
-rw-r--r--source/blender/editors/interface/interface_handlers.c9
-rw-r--r--source/blender/editors/interface/view2d_ops.c13
-rw-r--r--source/blender/editors/physics/particle_edit.c12
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c35
-rw-r--r--source/blender/editors/space_action/action_select.c21
-rw-r--r--source/blender/editors/space_file/file_ops.c4
-rw-r--r--source/blender/editors/space_graph/graph_ops.c11
-rw-r--r--source/blender/editors/space_graph/graph_select.c35
-rw-r--r--source/blender/editors/space_image/image_ops.c5
-rw-r--r--source/blender/editors/space_nla/nla_channels.c8
-rw-r--r--source/blender/editors/space_nla/nla_select.c21
-rw-r--r--source/blender/editors/space_node/node_edit.c17
-rw-r--r--source/blender/editors/space_node/node_select.c22
-rw-r--r--source/blender/editors/space_node/node_state.c10
-rw-r--r--source/blender/editors/space_outliner/outliner.c8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c15
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c7
-rw-r--r--source/blender/editors/transform/transform.c3
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_generics.c4
-rw-r--r--source/blender/editors/transform/transform_input.c5
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c29
30 files changed, 106 insertions, 285 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 4edcca46935..f755df79986 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -2148,7 +2148,7 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
bAnimContext ac;
ARegion *ar;
View2D *v2d;
- int mval[2], channel_index;
+ int channel_index;
int notifierFlags = 0;
short selectmode;
float x, y;
@@ -2162,10 +2162,6 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
ar= ac.ar;
v2d= &ar->v2d;
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -2179,7 +2175,7 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
* so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use
* ACHANNEL_HEIGHT_HALF.
*/
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP, 0, (float)ACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
/* handle mouse-click in the relevant channel then */
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index ff9521f1ebd..93d99c59a0e 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -107,14 +107,9 @@ static int frame_from_event(bContext *C, wmEvent *event)
{
ARegion *region= CTX_wm_region(C);
float viewx;
- int x, y;
-
- /* convert screen coordinates to region coordinates */
- x= event->x - region->winrct.xmin;
- y= event->y - region->winrct.ymin;
-
+
/* convert from region coordinates to View2D 'tot' space */
- UI_view2d_region_to_view(&region->v2d, x, y, &viewx, NULL);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, NULL);
/* round result to nearest int (frames are ints!) */
return (int)floor(viewx+0.5f);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index a2301540f1b..f82290333d0 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -1522,22 +1522,17 @@ static void selectconnected_posebonechildren (Object *ob, Bone *bone, int extend
/* within active object context */
/* previously known as "selectconnected_posearmature" */
static int pose_select_connected_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- ARegion *ar= CTX_wm_region(C);
+{
Object *ob= CTX_data_edit_object(C);
Bone *bone, *curBone, *next= NULL;
int extend= RNA_boolean_get(op->ptr, "extend");
- int x, y;
-
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
view3d_operator_needs_opengl(C);
if (extend)
- bone= get_nearest_bone(C, 0, x, y);
+ bone= get_nearest_bone(C, 0, event->mval[0], event->mval[1]);
else
- bone= get_nearest_bone(C, 1, x, y);
+ bone= get_nearest_bone(C, 1, event->mval[0], event->mval[1]);
if (!bone)
return OPERATOR_CANCELLED;
@@ -1606,21 +1601,17 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, wmEvent *e
bArmature *arm;
EditBone *bone, *curBone, *next;
int extend= RNA_boolean_get(op->ptr, "extend");
- int x, y;
ARegion *ar;
Object *obedit= CTX_data_edit_object(C);
arm= obedit->data;
ar= CTX_wm_region(C);
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
-
view3d_operator_needs_opengl(C);
if (extend)
- bone= get_nearest_bone(C, 0, x, y);
+ bone= get_nearest_bone(C, 0, event->mval[0], event->mval[1]);
else
- bone= get_nearest_bone(C, 1, x, y);
+ bone= get_nearest_bone(C, 1, event->mval[0], event->mval[1]);
if (!bone)
return OPERATOR_CANCELLED;
@@ -2499,7 +2490,6 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e
View3D *v3d;
RegionView3D *rv3d;
float *fp = NULL, tvec[3], oldcurs[3];
- int mx, my;
int retv;
scene= CTX_data_scene(C);
@@ -2510,11 +2500,8 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e
fp= give_cursor(scene, v3d);
copy_v3_v3(oldcurs, fp);
-
- mx= event->x - ar->winrct.xmin;
- my= event->y - ar->winrct.ymin;
- window_to_3d(ar, tvec, fp, mx, my);
+ window_to_3d(ar, tvec, fp, event->mval[0], event->mval[1]);
copy_v3_v3(fp, tvec);
/* extrude to the where new cursor is and store the operation result */
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 1bfd910523e..64dc640d6e1 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -3309,7 +3309,7 @@ static void findnearestNurbvert__doClosest(void *userData, Nurb *nu, BPoint *bp,
}
}
-static short findnearestNurbvert(ViewContext *vc, short sel, int mval[2], Nurb **nurb, BezTriple **bezt, BPoint **bp)
+static short findnearestNurbvert(ViewContext *vc, short sel, const int mval[2], Nurb **nurb, BezTriple **bezt, BPoint **bp)
{
/* sel==1: selected gets a disadvantage */
/* in nurb and bezt or bp the nearest is written */
@@ -4666,7 +4666,6 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
Curve *cu;
ViewContext vc;
float location[3];
- int mval[2];
Nurb *nu;
BezTriple *bezt;
@@ -4688,10 +4687,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
copy_v3_v3(location, give_cursor(vc.scene, vc.v3d));
}
- mval[0]= event->x - vc.ar->winrct.xmin;
- mval[1]= event->y - vc.ar->winrct.ymin;
-
- view3d_get_view_aligned_coordinate(&vc, location, mval, TRUE);
+ view3d_get_view_aligned_coordinate(&vc, location, event->mval, TRUE);
RNA_float_set_array(op->ptr, "location", location);
}
@@ -4987,21 +4983,18 @@ void CURVE_OT_select_linked(wmOperatorType *ot)
static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Object *obedit= CTX_data_edit_object(C);
- ARegion *ar= CTX_wm_region(C);
ViewContext vc;
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
- int a, location[2], deselect;
+ int a, deselect;
deselect= RNA_boolean_get(op->ptr, "deselect");
- location[0]= event->x - ar->winrct.xmin;
- location[1]= event->y - ar->winrct.ymin;
view3d_operator_needs_opengl(C);
view3d_set_viewcontext(C, &vc);
- findnearestNurbvert(&vc, 1, location, &nu, &bezt, &bp);
+ findnearestNurbvert(&vc, 1, event->mval, &nu, &bezt, &bp);
if(bezt) {
a= nu->pntsu;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 7db18eaedf4..2cbc6555fef 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -210,7 +210,7 @@ static void gp_get_3d_reference (tGPsdata *p, float *vec)
/* Stroke Editing ---------------------------- */
/* check if the current mouse position is suitable for adding a new point */
-static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2])
+static short gp_stroke_filtermval (tGPsdata *p, const int mval[2], int pmval[2])
{
int dx= abs(mval[0] - pmval[0]);
int dy= abs(mval[1] - pmval[1]);
@@ -315,7 +315,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], flo
}
/* add current stroke-point to buffer (returns whether point was successfully added) */
-static short gp_stroke_addpoint (tGPsdata *p, int mval[2], float pressure)
+static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure)
{
bGPdata *gpd= p->gpd;
tGPspoint *pt;
@@ -1416,16 +1416,15 @@ static void gpencil_draw_apply (wmOperator *op, tGPsdata *p)
static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event)
{
tGPsdata *p= op->customdata;
- ARegion *ar= p->ar;
PointerRNA itemptr;
float mousef[2];
int tablet=0;
/* convert from window-space to area-space mouse coordintes */
// NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
- p->mval[0]= event->x - ar->winrct.xmin + 1;
- p->mval[1]= event->y - ar->winrct.ymin + 1;
-
+ p->mval[0]= event->mval[0] + 1;
+ p->mval[1]= event->mval[1] + 1;
+
/* handle pressure sensitivity (which is supplied by tablets) */
if (event->custom == EVT_DATA_TABLET) {
wmTabletData *wmtab= event->customdata;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 5f8f3d05346..be46a7c7b85 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4022,12 +4022,9 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
-{
- ARegion *ar= CTX_wm_region(C);
-
- but->linkto[0]= event->x-ar->winrct.xmin;
- but->linkto[1]= event->y-ar->winrct.ymin;
-
+{
+ VECCOPY2D(but->linkto, event->mval);
+
if(data->state == BUTTON_STATE_HIGHLIGHT) {
if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 4cb67994704..f7bff168a33 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -702,7 +702,7 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d,
- event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ event->mval[0], event->mval[1],
&vzd->mx_2d, &vzd->my_2d);
}
@@ -759,7 +759,7 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d,
- event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ event->mval[0], event->mval[1],
&vzd->mx_2d, &vzd->my_2d);
}
@@ -936,7 +936,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d,
- event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ event->mval[0], event->mval[1],
&vzd->mx_2d, &vzd->my_2d);
}
@@ -1286,7 +1286,6 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
ARegion *ar= CTX_wm_region(C);
View2D *v2d= &ar->v2d;
float mask_size;
- int x, y;
/* set custom-data for operator */
vsm= MEM_callocN(sizeof(v2dScrollerMove), "v2dScrollerMove");
@@ -1300,8 +1299,6 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
/* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */
vsm->lastx = event->x;
vsm->lasty = event->y;
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
/* 'zone' depends on where mouse is relative to bubble
* - zooming must be allowed on this axis, otherwise, default to pan
@@ -1313,7 +1310,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
vsm->fac= (v2d->tot.xmax - v2d->tot.xmin) / mask_size;
/* get 'zone' (i.e. which part of scroller is activated) */
- vsm->zone= mouse_in_scroller_handle(x, v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
+ vsm->zone= mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */
@@ -1328,7 +1325,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
vsm->fac= (v2d->tot.ymax - v2d->tot.ymin) / mask_size;
/* get 'zone' (i.e. which part of scroller is activated) */
- vsm->zone= mouse_in_scroller_handle(y, v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
+ vsm->zone= mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index f4f66c17459..8c3a5c46c04 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1505,13 +1505,7 @@ static int select_linked_exec(bContext *C, wmOperator *op)
static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int location[2];
-
- location[0]= event->x - ar->winrct.xmin;
- location[1]= event->y - ar->winrct.ymin;
- RNA_int_set_array(op->ptr, "location", location);
-
+ RNA_int_set_array(op->ptr, "location", event->mval);
return select_linked_exec(C, op);
}
@@ -3682,12 +3676,10 @@ static int brush_edit_exec(bContext *C, wmOperator *op)
static void brush_edit_apply_event(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
PointerRNA itemptr;
float mouse[2];
- mouse[0]= event->x - ar->winrct.xmin;
- mouse[1]= event->y - ar->winrct.ymin;
+ VECCOPY2D(mouse, event->mval);
/* fill in stroke */
RNA_collection_add(op->ptr, "stroke", &itemptr);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index db575907b49..1408647d1cb 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -4858,7 +4858,6 @@ static int paint_exec(bContext *C, wmOperator *op)
static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
PaintOperation *pop= op->customdata;
wmTabletData *wmtab;
PointerRNA itemptr;
@@ -4868,8 +4867,8 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event)
// XXX +1 matches brush location better but
// still not exact, find out why and fix ..
- mouse[0]= event->x - ar->winrct.xmin + 1;
- mouse[1]= event->y - ar->winrct.ymin + 1;
+ mouse[0]= event->mval[0] + 1;
+ mouse[1]= event->mval[1] + 1;
time= PIL_check_seconds_timer();
@@ -5185,16 +5184,8 @@ static int sample_color_exec(bContext *C, wmOperator *op)
static int sample_color_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int location[2];
-
- if(ar) {
- location[0]= event->x - ar->winrct.xmin;
- location[1]= event->y - ar->winrct.ymin;
- RNA_int_set_array(op->ptr, "location", location);
-
- sample_color_exec(C, op);
- }
+ RNA_int_set_array(op->ptr, "location", event->mval);
+ sample_color_exec(C, op);
WM_event_add_modal_handler(C, op);
@@ -5203,21 +5194,13 @@ static int sample_color_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int sample_color_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int location[2];
-
switch(event->type) {
case LEFTMOUSE:
case RIGHTMOUSE: // XXX hardcoded
return OPERATOR_FINISHED;
case MOUSEMOVE:
- if(ar) {
- location[0]= event->x - ar->winrct.xmin;
- location[1]= event->y - ar->winrct.ymin;
- RNA_int_set_array(op->ptr, "location", location);
-
- sample_color_exec(C, op);
- }
+ RNA_int_set_array(op->ptr, "location", event->mval);
+ sample_color_exec(C, op);
break;
}
@@ -5284,14 +5267,10 @@ static int set_clone_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
View3D *v3d= CTX_wm_view3d(C);
ARegion *ar= CTX_wm_region(C);
float location[3];
- int mval[2];
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
view3d_operator_needs_opengl(C);
- if(!view_autodist(scene, ar, v3d, mval, location))
+ if(!view_autodist(scene, ar, v3d, event->mval, location))
return OPERATOR_CANCELLED;
RNA_float_set_array(op->ptr, "location", location);
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 6637e7004d5..be8547afa23 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -847,16 +847,10 @@ static int actkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
Scene *scene= ac.scene;
ARegion *ar= ac.ar;
View2D *v2d= &ar->v2d;
-
- int mval[2];
float x;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* determine which side of the current frame mouse is on */
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, NULL);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
if (x < CFRA)
RNA_enum_set(op->ptr, "mode", ACTKEYS_LRSEL_LEFT);
else
@@ -974,7 +968,7 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se
/* ------------------- */
-static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode, short column)
+static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select_mode, short column)
{
ListBase anim_data = {NULL, NULL};
DLRBT_Tree anim_keys;
@@ -1159,7 +1153,6 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
bAnimContext ac;
ARegion *ar;
short selectmode, column;
- int mval[2];
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -1167,11 +1160,7 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
/* get useful pointers from animation context data */
ar= ac.ar;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -1182,7 +1171,7 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
column= RNA_boolean_get(op->ptr, "column");
/* select keyframe(s) based upon mouse position*/
- mouse_action_keys(&ac, mval, selectmode, column);
+ mouse_action_keys(&ac, event->mval, selectmode, column);
/* set notifier that keyframe selection (and channels too) have changed */
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|ND_ANIMCHAN|NA_SELECTED, NULL);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 5d786c1d00b..9662b4b401f 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -318,8 +318,8 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
if(ar->regiontype != RGN_TYPE_WINDOW)
return OPERATOR_CANCELLED;
- rect.xmin = rect.xmax = event->x - ar->winrct.xmin;
- rect.ymin = rect.ymax = event->y - ar->winrct.ymin;
+ rect.xmin = rect.xmax = event->mval[0];
+ rect.ymin = rect.ymax = event->mval[1];
if(!BLI_in_rcti(&ar->v2d.mask, rect.xmin, rect.ymin))
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 8510446768d..03cc8bb9e80 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -102,18 +102,13 @@ static void graphview_cursor_setprops(bContext *C, wmOperator *op, wmEvent *even
{
ARegion *ar= CTX_wm_region(C);
float viewx, viewy;
- int x, y;
-
+
/* abort if not active region (should not really be possible) */
if (ar == NULL)
return;
-
- /* convert screen coordinates to region coordinates */
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
-
+
/* convert from region coordinates to View2D 'tot' space */
- UI_view2d_region_to_view(&ar->v2d, x, y, &viewx, &viewy);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
/* store the values in the operator properties */
/* frame is rounded to the nearest int, since frames are ints */
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 47b3a71a9ea..daae0ad6625 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -817,16 +817,10 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve
Scene *scene= ac.scene;
ARegion *ar= ac.ar;
View2D *v2d= &ar->v2d;
-
- int mval[2];
float x;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* determine which side of the current frame mouse is on */
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, NULL);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
if (x < CFRA)
RNA_int_set(op->ptr, "mode", GRAPHKEYS_LRSEL_LEFT);
else
@@ -905,7 +899,7 @@ static int fcurve_handle_sel_check(SpaceIpo *sipo, BezTriple *bezt)
/* check if the given vertex is within bounds or not */
// TODO: should we return if we hit something?
-static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *fcu, BezTriple *bezt, FPoint *fpt, short hpoint, int mval[2])
+static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *fcu, BezTriple *bezt, FPoint *fpt, short hpoint, const int mval[2])
{
/* Keyframes or Samples? */
if (bezt) {
@@ -957,7 +951,7 @@ static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *f
}
/* helper for find_nearest_fcurve_vert() - build the list of nearest matches */
-static void get_nearest_fcurve_verts_list (bAnimContext *ac, int mval[2], ListBase *matches)
+static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2], ListBase *matches)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -1074,7 +1068,7 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches)
/* Find the nearest vertices (either a handle or the keyframe) that are nearest to the mouse cursor (in area coordinates)
* NOTE: the match info found must still be freed
*/
-static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, int mval[2])
+static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, const int mval[2])
{
ListBase matches = {NULL, NULL};
tNearestVertInfo *nvi;
@@ -1094,7 +1088,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, int mval[2]
/* ------------------- */
/* option 1) select keyframe directly under mouse */
-static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, short curves_only)
+static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_mode, short curves_only)
{
SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
tNearestVertInfo *nvi;
@@ -1217,7 +1211,7 @@ static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, s
/* (see graphkeys_select_leftright) */
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
-static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short select_mode)
+static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short select_mode)
{
ListBase anim_data= {NULL, NULL};
bAnimListElem *ale;
@@ -1299,19 +1293,14 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
bAnimContext ac;
ARegion *ar;
short selectmode;
- int mval[2];
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* get useful pointers from animation context data */
ar= ac.ar;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -1321,15 +1310,15 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
/* figure out action to take */
if (RNA_boolean_get(op->ptr, "column")) {
/* select all keyframes in the same frame as the one that was under the mouse */
- graphkeys_mselect_column(&ac, mval, selectmode);
+ graphkeys_mselect_column(&ac, event->mval, selectmode);
}
else if (RNA_boolean_get(op->ptr, "curves")) {
/* select all keyframes in the same F-Curve as the one under the mouse */
- mouse_graph_keys(&ac, mval, selectmode, 1);
+ mouse_graph_keys(&ac, event->mval, selectmode, 1);
}
else {
/* select keyframe under mouse */
- mouse_graph_keys(&ac, mval, selectmode, 0);
+ mouse_graph_keys(&ac, event->mval, selectmode, 0);
}
/* set notifier that keyframe selection (and also channel selection in some cases) has changed */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index c4d52e3b836..f48daa39c59 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1653,16 +1653,13 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
ImageSampleInfo *info= op->customdata;
float fx, fy;
- int mx, my;
if(ibuf == NULL) {
ED_space_image_release_buffer(sima, lock);
return;
}
- mx= event->x - ar->winrct.xmin;
- my= event->y - ar->winrct.ymin;
- UI_view2d_region_to_view(&ar->v2d, mx, my, &fx, &fy);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
float *fp;
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 265616020d5..38f680fff07 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -303,7 +303,7 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
bAnimContext ac;
ARegion *ar;
View2D *v2d;
- int mval[2], channel_index;
+ int channel_index;
int notifierFlags = 0;
short selectmode;
float x, y;
@@ -316,10 +316,6 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
ar= ac.ar;
v2d= &ar->v2d;
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -331,7 +327,7 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
* so that the tops of channels get caught ok. Since NLACHANNEL_FIRST is really NLACHANNEL_HEIGHT, we simply use
* NLACHANNEL_HEIGHT_HALF.
*/
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP, 0, (float)NLACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
/* handle mouse-click in the relevant channel then */
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index 188042ad1d1..0f0a4c0ad4c 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -459,16 +459,10 @@ static int nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
Scene *scene= ac.scene;
ARegion *ar= ac.ar;
View2D *v2d= &ar->v2d;
-
- int mval[2];
float x;
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
/* determine which side of the current frame mouse is on */
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, NULL);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
if (x < CFRA)
RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_LEFT);
else
@@ -503,7 +497,7 @@ void NLA_OT_select_leftright (wmOperatorType *ot)
/* ******************** Mouse-Click Select Operator *********************** */
/* select strip directly under mouse */
-static void mouse_nla_strips (bContext *C, bAnimContext *ac, int mval[2], short select_mode)
+static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2], short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale = NULL;
@@ -614,8 +608,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
ARegion *ar;
// View2D *v2d; /*UNUSED*/
short selectmode;
- int mval[2];
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
@@ -624,11 +617,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
scene= ac.scene;
ar= ac.ar;
// v2d= &ar->v2d;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -636,7 +625,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
selectmode= SELECT_REPLACE;
/* select strips based upon mouse position */
- mouse_nla_strips(C, &ac, mval, selectmode);
+ mouse_nla_strips(C, &ac, event->mval, selectmode);
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_SELECTED, NULL);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 19a9bfb224b..d967e2240e6 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1166,7 +1166,6 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
Image *ima;
ImBuf *ibuf;
float fx, fy, bufx, bufy;
- int mx, my;
ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
@@ -1181,13 +1180,11 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
IMB_rect_from_float(ibuf);
}
- mx= event->x - ar->winrct.xmin;
- my= event->y - ar->winrct.ymin;
/* map the mouse coords to the backdrop image space */
bufx = ibuf->x * snode->zoom;
bufy = ibuf->y * snode->zoom;
- fx = (bufx > 0.0f ? ((float)mx - 0.5f*ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
- fy = (bufy > 0.0f ? ((float)my - 0.5f*ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f*ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
+ fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f*ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
float *fp;
@@ -1317,7 +1314,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event)
switch (event->type) {
case MOUSEMOVE:
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&mx, &my);
if (node) {
@@ -1358,7 +1355,7 @@ static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event)
rctf totr;
/* convert mouse coordinates to v2d space */
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&snode->mx, &snode->my);
/* rect we're interested in is just the bottom right corner */
@@ -2094,7 +2091,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
sock= nldrag->sock;
link= nldrag->link;
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&snode->mx, &snode->my);
switch (event->type) {
@@ -2244,7 +2241,7 @@ static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
bNodeLinkDrag *nldrag= MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata");
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&snode->mx, &snode->my);
ED_preview_kill_jobs(C);
@@ -2928,7 +2925,7 @@ static int node_add_file_invoke(bContext *C, wmOperator *op, wmEvent *event)
SpaceNode *snode= CTX_wm_space_node(C);
/* convert mouse coordinates to v2d space */
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&snode->mx, &snode->my);
if (RNA_property_is_set(op->ptr, "filepath") || RNA_property_is_set(op->ptr, "name"))
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 6bda47e5c8f..a1ef75f3976 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -124,14 +124,8 @@ static int node_select_exec(bContext *C, wmOperator *op)
static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int mval[2];
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- RNA_int_set(op->ptr, "mouse_x", mval[0]);
- RNA_int_set(op->ptr, "mouse_y", mval[1]);
+ RNA_int_set(op->ptr, "mouse_x", event->mval[0]);
+ RNA_int_set(op->ptr, "mouse_y", event->mval[1]);
return node_select_exec(C,op);
}
@@ -199,17 +193,9 @@ static int node_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event
/* this allows border select on empty space, but drag-translate on nodes */
SpaceNode *snode= CTX_wm_space_node(C);
ARegion *ar= CTX_wm_region(C);
- int mval[2];
float mx, my;
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- /* get mouse coordinates in view2d space */
- mx= (float)mval[0];
- my= (float)mval[1];
-
- UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &mx, &my);
+
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &mx, &my);
if (node_under_mouse(snode->edittree, mx, my))
return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index 9665a152970..601ffbd313d 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -201,14 +201,8 @@ static int node_toggle_visibility_exec(bContext *C, wmOperator *op)
static int node_toggle_visibility_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int mval[2];
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- RNA_int_set(op->ptr, "mouse_x", mval[0]);
- RNA_int_set(op->ptr, "mouse_y", mval[1]);
+ RNA_int_set(op->ptr, "mouse_x", event->mval[0]);
+ RNA_int_set(op->ptr, "mouse_y", event->mval[1]);
return node_toggle_visibility_exec(C,op);
}
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 32e6424f709..5810f750f19 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -2580,7 +2580,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
float fmval[2];
int extend= RNA_boolean_get(op->ptr, "extend");
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
if(!ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) && !(soops->flag & SO_HIDE_RESTRICTCOLS) && fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX)
return OPERATOR_CANCELLED;
@@ -2664,7 +2664,7 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event)
float fmval[2];
int all= RNA_boolean_get(op->ptr, "all");
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_item_openclose(C, soops, te, all, fmval))
@@ -2736,7 +2736,7 @@ static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
TreeElement *te;
float fmval[2];
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_item_rename(C, ar, soops, te, fmval)) break;
@@ -3791,7 +3791,7 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *even
TreeElement *te;
float fmval[2];
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break;
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index ad0d0048388..6d50913dfd4 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -117,17 +117,11 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag)
{
- ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
- int mval[2];
float mval_v2d[2];
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &mval_v2d[0], &mval_v2d[1]);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mval_v2d[0], &mval_v2d[1]);
RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
RNA_int_set(op->ptr, "frame_start", (int)mval_v2d[0]);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 880f285c3e3..4b9f87f67d8 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1573,14 +1573,13 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
int cut_side= SEQ_SIDE_BOTH;
int cut_frame= CFRA;
if (ED_operator_sequencer_active(C) && v2d)
- cut_side= mouse_frame_side(v2d, event->x - ar->winrct.xmin, cut_frame);
+ cut_side= mouse_frame_side(v2d, event->mval[0], cut_frame);
RNA_int_set(op->ptr, "frame", cut_frame);
RNA_enum_set(op->ptr, "side", cut_side);
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 2cae2d17a33..8440a107f31 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -298,7 +298,6 @@ void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot)
static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -318,10 +317,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
marker=find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- seq= find_nearest_seq(scene, v2d, &hand, mval);
+ seq= find_nearest_seq(scene, v2d, &hand, event->mval);
// XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip
if(seq && linked_time && left_right)
@@ -652,20 +648,15 @@ void SEQUENCER_OT_select_less(wmOperatorType *ot)
static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Scene *scene= CTX_data_scene(C);
- ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
short extend= RNA_boolean_get(op->ptr, "extend");
- int mval[2];
Sequence *mouse_seq;
int selected, hand;
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
+
/* this works like UV, not mesh */
- mouse_seq= find_nearest_seq(scene, v2d, &hand, mval);
+ mouse_seq= find_nearest_seq(scene, v2d, &hand, event->mval);
if (!mouse_seq)
return OPERATOR_FINISHED; /* user error as with mesh?? */
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 897114b5a3f..f79a8a55045 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -2781,7 +2781,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3];
- int mx, my, mval[2];
+ int mval[2];
// short ctrl= 0; // XXX
int flip;
fp= give_cursor(scene, v3d);
@@ -2789,9 +2789,6 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
// if(obedit && ctrl) lr_click= 1;
copy_v3_v3(oldcurs, fp);
- mx= event->x - ar->winrct.xmin;
- my= event->y - ar->winrct.ymin;
-
project_int_noclip(ar, fp, mval);
flip= initgrabz(rv3d, fp[0], fp[1], fp[2]);
@@ -2808,23 +2805,20 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
short depth_used = 0;
if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */
- int mval_depth[2];
- mval_depth[0]= mx;
- mval_depth[1]= my;
view3d_operator_needs_opengl(C);
- if (view_autodist(scene, ar, v3d, mval_depth, fp))
+ if (view_autodist(scene, ar, v3d, event->mval, fp))
depth_used= 1;
}
if(depth_used==0) {
- window_to_3d_delta(ar, dvec, mval[0]-mx, mval[1]-my);
+ window_to_3d_delta(ar, dvec, mval[0]-event->mval[0], mval[1]-event->mval[1]);
sub_v3_v3(fp, dvec);
}
}
else {
- dx= ((float)(mx-(ar->winx/2)))*rv3d->zfac/(ar->winx/2);
- dy= ((float)(my-(ar->winy/2)))*rv3d->zfac/(ar->winy/2);
+ dx= ((float)(event->mval[0]-(ar->winx/2)))*rv3d->zfac/(ar->winx/2);
+ dy= ((float)(event->mval[1]-(ar->winy/2)))*rv3d->zfac/(ar->winy/2);
fz= rv3d->persmat[0][3]*fp[0]+ rv3d->persmat[1][3]*fp[1]+ rv3d->persmat[2][3]*fp[2]+ rv3d->persmat[3][3];
fz= fz/rv3d->zfac;
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index e37361fbc54..962bd5c7080 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -287,9 +287,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
fly->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
- fly->mval[0] = event->x - fly->ar->winrct.xmin;
- fly->mval[1] = event->y - fly->ar->winrct.ymin;
-
+ VECCOPY2D(fly->mval, event->mval)
fly->time_lastdraw= fly->time_lastwheel= PIL_check_seconds_timer();
@@ -418,8 +416,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
fly->redraw = 1;
}
else if (event->type == MOUSEMOVE) {
- fly->mval[0] = event->x - fly->ar->winrct.xmin;
- fly->mval[1] = event->y - fly->ar->winrct.ymin;
+ VECCOPY2D(fly->mval, event->mval);
} /* handle modal keymap first */
else if (event->type == EVT_MODAL_MAP) {
switch (event->val) {
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 4ea1e8742f5..3643b183b31 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -567,8 +567,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
if (t->modifiers & MOD_CONSTRAINT_SELECT)
t->con.mode |= CON_SELECT;
- t->mval[0] = event->x - t->ar->winrct.xmin;
- t->mval[1] = event->y - t->ar->winrct.ymin;
+ VECCOPY2D(t->mval, event->mval);
// t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */
t->redraw |= TREDRAW_HARD;
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index b55435fd0cf..0e0d452a9e6 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -648,7 +648,7 @@ typedef enum {
void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], int mval[2]);
void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode);
int handleMouseInput(struct TransInfo *t, struct MouseInput *mi, struct wmEvent *event);
-void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, int mval[2], float output[3]);
+void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, const int mval[2], float output[3]);
void setCustomPoints(TransInfo *t, MouseInput *mi, int start[2], int end[2]);
void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3]));
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 67e04bbd34e..8699eb1cc2d 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -920,9 +920,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
if (event)
{
- t->imval[0] = event->x - t->ar->winrct.xmin;
- t->imval[1] = event->y - t->ar->winrct.ymin;
-
+ VECCOPY2D(t->imval, event->mval);
t->event_type = event->type;
}
else
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 7a16e25302c..b3608305a7a 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -372,7 +372,7 @@ void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3])
mi->post = post;
}
-void applyMouseInput(TransInfo *t, MouseInput *mi, int mval[2], float output[3])
+void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float output[3])
{
if (mi->apply != NULL)
{
@@ -398,8 +398,7 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event)
t->modifiers |= MOD_PRECISION;
/* shift is modifier for higher precision transform
* store the mouse position where the normal movement ended */
- mi->precision_mval[0] = event->x - t->ar->winrct.xmin;
- mi->precision_mval[1] = event->y - t->ar->winrct.ymin;
+ VECCOPY2D(mi->precision_mval, event->mval);
mi->precision = 1;
}
else
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 20d7ea21d5c..1ea2db4c237 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1715,12 +1715,8 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
float co[2];
- int x, y;
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
-
- UI_view2d_region_to_view(&ar->v2d, x, y, &co[0], &co[1]);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
return select_exec(C, op);
@@ -1764,12 +1760,8 @@ static int select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
float co[2];
- int x, y;
-
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
- UI_view2d_region_to_view(&ar->v2d, x, y, &co[0], &co[1]);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
return select_loop_exec(C, op);
@@ -1825,12 +1817,8 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i
if(event) {
/* invoke */
ARegion *ar= CTX_wm_region(C);
- int x, y;
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
-
- UI_view2d_region_to_view(&ar->v2d, x, y, &co[0], &co[1]);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
}
else {
@@ -3036,12 +3024,9 @@ static int set_2d_cursor_exec(bContext *C, wmOperator *op)
static int set_2d_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
- int x, y;
float location[2];
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
- UI_view2d_region_to_view(&ar->v2d, x, y, &location[0], &location[1]);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
RNA_float_set_array(op->ptr, "location", location);
return set_2d_cursor_exec(C, op);
@@ -3092,14 +3077,12 @@ static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event)
Image *ima= CTX_data_edit_image(C);
ARegion *ar= CTX_wm_region(C);
float fx, fy;
- int x, y, tile[2];
+ int tile[2];
if(!ima || !(ima->tpageflag & IMA_TILES))
return OPERATOR_CANCELLED;
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
- UI_view2d_region_to_view(&ar->v2d, x, y, &fx, &fy);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
if(fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
fx= fx*ima->xrep;