use x/y root coord adjustments

This commit is contained in:
Mike Blumenkrantz 2014-09-01 13:42:57 -04:00
parent 775c90012d
commit 4c83676a74
2 changed files with 15 additions and 15 deletions

View File

@ -55,7 +55,7 @@ _magnify_update(int x, int y)
static Eina_Bool static Eina_Bool
_magnify_move(void *data EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev) _magnify_move(void *data EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev)
{ {
_magnify_update(ev->root.x, ev->root.y); _magnify_update(e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x), e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y));
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
} }

View File

@ -81,24 +81,24 @@ _pip_mouse_move(Pip *pip, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev)
if ((pip->resize_mode == E_POINTER_RESIZE_B) || if ((pip->resize_mode == E_POINTER_RESIZE_B) ||
(pip->resize_mode == E_POINTER_RESIZE_BL) || (pip->resize_mode == E_POINTER_RESIZE_BL) ||
(pip->resize_mode == E_POINTER_RESIZE_BR)) (pip->resize_mode == E_POINTER_RESIZE_BR))
h = MAX(ev->root.y - y, 5); h = MAX(e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y) - y, 5);
else if ((pip->resize_mode == E_POINTER_RESIZE_T) || else if ((pip->resize_mode == E_POINTER_RESIZE_T) ||
(pip->resize_mode == E_POINTER_RESIZE_TL) || (pip->resize_mode == E_POINTER_RESIZE_TL) ||
(pip->resize_mode == E_POINTER_RESIZE_TR)) (pip->resize_mode == E_POINTER_RESIZE_TR))
{ {
h = MAX((y + h) - (ev->root.y - pip->down.y), 5); h = MAX((y + h) - (e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y) - pip->down.y), 5);
y = ev->root.y - pip->down.y; y = e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y) - pip->down.y;
} }
if ((pip->resize_mode == E_POINTER_RESIZE_R) || if ((pip->resize_mode == E_POINTER_RESIZE_R) ||
(pip->resize_mode == E_POINTER_RESIZE_TR) || (pip->resize_mode == E_POINTER_RESIZE_TR) ||
(pip->resize_mode == E_POINTER_RESIZE_BR)) (pip->resize_mode == E_POINTER_RESIZE_BR))
w = MAX(ev->root.x - x, 5); w = MAX(e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x) - x, 5);
else if ((pip->resize_mode == E_POINTER_RESIZE_L) || else if ((pip->resize_mode == E_POINTER_RESIZE_L) ||
(pip->resize_mode == E_POINTER_RESIZE_TL) || (pip->resize_mode == E_POINTER_RESIZE_TL) ||
(pip->resize_mode == E_POINTER_RESIZE_BL)) (pip->resize_mode == E_POINTER_RESIZE_BL))
{ {
w = MAX((x + w) - (ev->root.x - pip->down.x), 5); w = MAX((x + w) - (e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x) - pip->down.x), 5);
x = ev->root.x - pip->down.x; x = e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x) - pip->down.x;
} }
{ {
E_Client *ec; E_Client *ec;
@ -110,7 +110,7 @@ _pip_mouse_move(Pip *pip, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev)
case E_POINTER_RESIZE_TR: case E_POINTER_RESIZE_TR:
case E_POINTER_RESIZE_BR: case E_POINTER_RESIZE_BR:
case E_POINTER_RESIZE_BL: case E_POINTER_RESIZE_BL:
if (abs(ev->root.x - pip->down.x) > abs(ev->root.y - pip->down.y)) if (abs(e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x) - pip->down.x) > abs(e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y) - pip->down.y))
h = (ec->h * w) / ec->w; h = (ec->h * w) / ec->w;
else else
w = (ec->w * h) / ec->h; w = (ec->w * h) / ec->h;
@ -134,22 +134,22 @@ _pip_mouse_move(Pip *pip, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev)
{ {
E_Comp *comp = e_comp_util_evas_object_comp_get(pip->pip); E_Comp *comp = e_comp_util_evas_object_comp_get(pip->pip);
evas_object_move(pip->pip, evas_object_move(pip->pip,
E_CLAMP(ev->root.x - pip->down.x, 0, comp->man->w - (w / 2)), E_CLAMP(e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x) - pip->down.x, 0, comp->man->w - (w / 2)),
E_CLAMP(ev->root.y - pip->down.y, 0, comp->man->h - (h / 2))); E_CLAMP(e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y) - pip->down.y, 0, comp->man->h - (h / 2)));
} }
else if (pip->crop) else if (pip->crop)
{ {
int cx, cy; int cx, cy;
if (x + pip->down.x < ev->root.x) if (x + pip->down.x < e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x))
cx = x + pip->down.x; cx = x + pip->down.x;
else else
cx = ev->root.x; cx = e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x);
if (y + pip->down.y < ev->root.y) if (y + pip->down.y < e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y))
cy = y + pip->down.y; cy = y + pip->down.y;
else else
cy = ev->root.y; cy = e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y);
evas_object_geometry_set(pip->clip, cx, cy, abs(cx - ev->root.x), abs(cy - ev->root.y)); evas_object_geometry_set(pip->clip, cx, cy, abs(cx - e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x)), abs(cy - e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y)));
} }
return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_RENEW;
} }