aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-12 02:56:23 +1000
committerDavid Walter Seikel2014-05-12 02:56:23 +1000
commit8429c4858ff5dc70afe018c2a5a8d8eb302e2af3 (patch)
tree816150c3ddacf3cec1aa88b9c667a0abdec8e3f7 /src
parentFix up winFang move and resize. Still more to fix here though. (diff)
downloadSledjHamr-8429c4858ff5dc70afe018c2a5a8d8eb302e2af3.zip
SledjHamr-8429c4858ff5dc70afe018c2a5a8d8eb302e2af3.tar.gz
SledjHamr-8429c4858ff5dc70afe018c2a5a8d8eb302e2af3.tar.bz2
SledjHamr-8429c4858ff5dc70afe018c2a5a8d8eb302e2af3.tar.xz
A little more clean up of winFang move / resize.
Diffstat (limited to 'src')
-rw-r--r--src/libraries/winFang.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c
index cd83291..708f0cd 100644
--- a/src/libraries/winFang.c
+++ b/src/libraries/winFang.c
@@ -17,7 +17,7 @@ static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Co
17 overs[2][0] = x + padding + w; overs[2][1] = y + padding + h; 17 overs[2][0] = x + padding + w; overs[2][1] = y + padding + h;
18 overs[3][0] = x - padding; overs[3][1] = y + padding + h; 18 overs[3][0] = x - padding; overs[3][1] = y + padding + h;
19 19
20 // If we are over two or more windows, stop. 20 // If we are over other windows, stop.
21 objs = evas_objects_in_rectangle_get(win->e, overs[0][0], overs[0][1], w + (padding * 2), h + (padding * 2), EINA_TRUE, EINA_FALSE); 21 objs = evas_objects_in_rectangle_get(win->e, overs[0][0], overs[0][1], w + (padding * 2), h + (padding * 2), EINA_TRUE, EINA_FALSE);
22 EINA_LIST_FOREACH(objs, this, test) 22 EINA_LIST_FOREACH(objs, this, test)
23 { 23 {
@@ -56,20 +56,19 @@ static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Co
56 } 56 }
57} 57}
58 58
59static void cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info) 59static void _onHandleMove(void *data, Evas *evas, Evas_Object *obj, void *event_info)
60{ 60{
61 Evas_Event_Mouse_Move *ev = event_info; 61 Evas_Event_Mouse_Move *ev = event_info;
62 winFang *win = data; 62 winFang *win = data;
63 Evas_Coord x, y, w, h, dx = 0, dy = 0, dw = 0, dh = 0, mx, my; 63 Evas_Coord x, y, w, h, dx, dy;
64 Evas_Object *img = win->win; 64 Evas_Object *img = win->win;
65 int i; 65 int i;
66 66
67 if (!ev->buttons) return; 67 if (!ev->buttons) return;
68 68
69 mx = ev->cur.canvas.x - ev->prev.output.x; 69 dx = ev->cur.canvas.x - ev->prev.output.x;
70 my = ev->cur.canvas.y - ev->prev.output.y; 70 dy = ev->cur.canvas.y - ev->prev.output.y;
71 evas_object_geometry_get(img, &x, &y, &w, &h); 71 evas_object_geometry_get(img, &x, &y, &w, &h);
72
73 for (i = 0; i < 4; i++) 72 for (i = 0; i < 4; i++)
74 { 73 {
75 if (obj == win->hand[i]) 74 if (obj == win->hand[i])
@@ -78,26 +77,26 @@ static void cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_
78 { 77 {
79 case 0 : 78 case 0 :
80 { 79 {
81 dw -= mx; dh -= my; dx += mx; dy += my; 80 w -= dx; h -= dy; x += dx; y += dy;
82 break; 81 break;
83 } 82 }
84 case 1 : 83 case 1 :
85 { 84 {
86 dw += mx; dh -= my; dy += my; 85 w += dx; h -= dy; y += dy;
87 break; 86 break;
88 } 87 }
89 case 2 : 88 case 2 :
90 { 89 {
91 dw += mx; dh += my; 90 w += dx; h += dy;
92 break; 91 break;
93 } 92 }
94 case 3 : 93 case 3 :
95 { 94 {
96 dw -= mx; dh += my; dx += mx; 95 w -= dx; h += dy; x += dx;
97 break; 96 break;
98 } 97 }
99 } 98 }
100 _checkWindowBounds(win, x + dx, y + dy, w + dw, h + dh); 99 _checkWindowBounds(win, x, y, w, h);
101 return; 100 return;
102 } 101 }
103 } 102 }
@@ -115,9 +114,7 @@ static void _onBgMove(void *data, Evas *evas, Evas_Object *obj, void *event_info
115 // Looks like ePhysics wont cooperate about coords and other things, so plan B. 114 // Looks like ePhysics wont cooperate about coords and other things, so plan B.
116 115
117 evas_object_geometry_get(img, &x, &y, &w, &h); 116 evas_object_geometry_get(img, &x, &y, &w, &h);
118 x += ev->cur.canvas.x - ev->prev.output.x; 117 _checkWindowBounds(win, x + ev->cur.canvas.x - ev->prev.output.x, y + ev->cur.canvas.y - ev->prev.output.y, w, h);
119 y += ev->cur.canvas.y - ev->prev.output.y;
120 _checkWindowBounds(win, x, y, w, h);
121} 118}
122 119
123static void _onBgUnclick(void *data, Evas *evas, Evas_Object *obj, void *event_info) 120static void _onBgUnclick(void *data, Evas *evas, Evas_Object *obj, void *event_info)
@@ -126,6 +123,7 @@ static void _onBgUnclick(void *data, Evas *evas, Evas_Object *obj, void *event_i
126 123
127 if (1 == ev->button) 124 if (1 == ev->button)
128 { 125 {
126 // Stop moving the window.
129 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP, _onBgUnclick); 127 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP, _onBgUnclick);
130 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove); 128 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove);
131 } 129 }
@@ -137,6 +135,7 @@ static void _onBgClick(void *data, Evas *evas, Evas_Object *obj, void *event_inf
137 135
138 if (1 == ev->button) 136 if (1 == ev->button)
139 { 137 {
138 // Start moving the window.
140 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP, _onBgUnclick, data); 139 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP, _onBgUnclick, data);
141 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove, data); 140 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove, data);
142 } 141 }
@@ -264,7 +263,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
264 evas_obj_position_set(cx - 15, cy - 15), 263 evas_obj_position_set(cx - 15, cy - 15),
265 evas_obj_visibility_set(EINA_TRUE) 264 evas_obj_visibility_set(EINA_TRUE)
266 ); 265 );
267 evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, result); 266 evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, _onHandleMove, result);
268 eo_unref(result->hand[i]); 267 eo_unref(result->hand[i]);
269 } 268 }
270 } 269 }