use x/y root coord adjustments

desksanity-1.0
Mike Blumenkrantz 9 years ago
parent 775c90012d
commit 4c83676a74
  1. 2
      src/magnify.c
  2. 28
      src/pip.c

@ -55,7 +55,7 @@ _magnify_update(int x, int y)
static Eina_Bool
_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;
}

@ -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) ||
(pip->resize_mode == E_POINTER_RESIZE_BL) ||
(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) ||
(pip->resize_mode == E_POINTER_RESIZE_TL) ||
(pip->resize_mode == E_POINTER_RESIZE_TR))
{
h = MAX((y + h) - (ev->root.y - pip->down.y), 5);
y = ev->root.y - pip->down.y;
h = MAX((y + h) - (e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y) - pip->down.y), 5);
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) ||
(pip->resize_mode == E_POINTER_RESIZE_TR) ||
(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) ||
(pip->resize_mode == E_POINTER_RESIZE_TL) ||
(pip->resize_mode == E_POINTER_RESIZE_BL))
{
w = MAX((x + w) - (ev->root.x - pip->down.x), 5);
x = ev->root.x - pip->down.x;
w = MAX((x + w) - (e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x) - pip->down.x), 5);
x = e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x) - pip->down.x;
}
{
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_BR:
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;
else
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);
evas_object_move(pip->pip,
E_CLAMP(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_x_root_adjust(e_comp_get(NULL), ev->root.x) - pip->down.x, 0, comp->man->w - (w / 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)
{
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;
else
cx = ev->root.x;
if (y + pip->down.y < ev->root.y)
cx = e_comp_canvas_x_root_adjust(e_comp_get(NULL), ev->root.x);
if (y + pip->down.y < e_comp_canvas_y_root_adjust(e_comp_get(NULL), ev->root.y))
cy = y + pip->down.y;
else
cy = ev->root.y;
evas_object_geometry_set(pip->clip, cx, cy, abs(cx - ev->root.x), abs(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 - 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;
}

Loading…
Cancel
Save