aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz/winFang.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-05 04:58:31 +1000
committerDavid Walter Seikel2014-05-05 04:58:31 +1000
commit811750155227279ae09dc4258f411687f659f690 (patch)
treef977323dadf1e249e83c3da640d35cb88633113e /src/extantz/winFang.c
parentwinFang no longer depends on ourGlobals. (diff)
downloadSledjHamr-811750155227279ae09dc4258f411687f659f690.zip
SledjHamr-811750155227279ae09dc4258f411687f659f690.tar.gz
SledjHamr-811750155227279ae09dc4258f411687f659f690.tar.bz2
SledjHamr-811750155227279ae09dc4258f411687f659f690.tar.xz
Merge winFangComplete into winFangAdd.
Diffstat (limited to '')
-rw-r--r--src/extantz/winFang.c67
1 files changed, 32 insertions, 35 deletions
diff --git a/src/extantz/winFang.c b/src/extantz/winFang.c
index 830b84e..07fdaa7 100644
--- a/src/extantz/winFang.c
+++ b/src/extantz/winFang.c
@@ -67,14 +67,21 @@ void winFangShow(winFang *win)
67 evas_object_show(win->hand[i]); 67 evas_object_show(win->hand[i]);
68} 68}
69 69
70winFang *winFangAdd(Evas_Object *parent) 70winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h)
71{ 71{
72 winFang *result; 72 winFang *result;
73 Evas_Object *bg; 73 Evas_Object *obj, *obj2, *bg;
74 char buf[PATH_MAX];
75 int i;
74 76
75 result = calloc(1, sizeof(winFang)); 77 result = calloc(1, sizeof(winFang));
76 eina_clist_init(&result->widgets); 78 eina_clist_init(&result->widgets);
77 79
80 result->x = x;
81 result->y = y;
82 result->w = w;
83 result->h = h;
84
78 // In theory this should create an EWS window, in practice, I'm not seeing any difference. 85 // In theory this should create an EWS window, in practice, I'm not seeing any difference.
79 // Guess I'll have to implement my own internal window manager. I don't think a basic one will be that hard. Famous last words. 86 // Guess I'll have to implement my own internal window manager. I don't think a basic one will be that hard. Famous last words.
80// elm_config_engine_set("ews"); 87// elm_config_engine_set("ews");
@@ -92,61 +99,51 @@ winFang *winFangAdd(Evas_Object *parent)
92 elm_win_resize_object_add(result->win, bg); 99 elm_win_resize_object_add(result->win, bg);
93 evas_object_show(bg); 100 evas_object_show(bg);
94 101
95 return result; 102 obj = elm_win_inlined_image_object_get(result->win);
96} 103 obj2 = evas_object_evas_get(obj);
97
98void winFangComplete(winFang *win, int x, int y, int w, int h)
99{
100 Evas_Object *obj = elm_win_inlined_image_object_get(win->win);
101 Evas_Object *obj2 = evas_object_evas_get(obj);
102 char buf[PATH_MAX];
103 int i;
104
105 win->x = x;
106 win->y = y;
107 win->w = w;
108 win->h = h;
109 // image object for win is unlinked to its pos/size - so manual control 104 // image object for win is unlinked to its pos/size - so manual control
110 // this allows also for using map and other things with it. 105 // this allows also for using map and other things with it.
111 evas_object_move(obj, x, y); 106 evas_object_move(obj, result->x, result->y);
112 // Odd, it needs to be resized twice. WTF? 107 // Odd, it needs to be resized twice. WTF?
113 evas_object_resize(win->win, w, h); 108 evas_object_resize(result->win, result->w, result->h);
114 evas_object_resize(obj, w, h); 109 evas_object_resize(obj, result->w, result->h);
115 evas_object_show(win->win); 110 evas_object_show(result->win);
116 111
117 // Create corner handles. 112 // Create corner handles.
118 snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get()); 113 snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get());
119 for (i = 0; i < 4; i++) 114 for (i = 0; i < 4; i++)
120 { 115 {
121 char key[32]; 116 char key[32];
122 int cx = x, cy = y; 117 int cx = result->x, cy = result->y;
123 118
124 if (i == 1) cx += w; 119 if (i == 1) cx += result->w;
125 else if (i == 2) {cx += w; cy += h;} 120 else if (i == 2) {cx += result->w; cy += result->h;}
126 else if (i == 3) cy += h; 121 else if (i == 3) cy += result->h;
127 snprintf(key, sizeof(key), "h-%i\n", i); 122 snprintf(key, sizeof(key), "h-%i\n", i);
128#if 1 123#if 1
129 win->hand[i] = evas_object_image_filled_add(obj2); 124 result->hand[i] = evas_object_image_filled_add(obj2);
130 evas_object_image_file_set(win->hand[i], buf, NULL); 125 evas_object_image_file_set(result->hand[i], buf, NULL);
131 evas_object_resize(win->hand[i], 31, 31); 126 evas_object_resize(result->hand[i], 31, 31);
132 evas_object_move(win->hand[i], cx - 15, cy - 15); 127 evas_object_move(result->hand[i], cx - 15, cy - 15);
133 evas_object_data_set(obj, key, win->hand[i]); 128 evas_object_data_set(obj, key, result->hand[i]);
134 evas_object_show(win->hand[i]); 129 evas_object_show(result->hand[i]);
135 evas_object_event_callback_add(win->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj); 130 evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj);
136#else 131#else
137// TODO - No idea why, but using this version makes the window vanish when you click on a handle. 132// TODO - No idea why, but using this version makes the window vanish when you click on a handle.
138 win->hand[i] = eo_add(EVAS_OBJ_IMAGE_CLASS, obj2, 133 result->hand[i] = eo_add(EVAS_OBJ_IMAGE_CLASS, obj2,
139 evas_obj_image_filled_set(EINA_TRUE), 134 evas_obj_image_filled_set(EINA_TRUE),
140 evas_obj_image_file_set(buf, NULL), 135 evas_obj_image_file_set(buf, NULL),
141 evas_obj_size_set(31, 31), 136 evas_obj_size_set(31, 31),
142 evas_obj_position_set(cx - 15, cy - 15), 137 evas_obj_position_set(cx - 15, cy - 15),
143 eo_key_data_set(key, win->hand[i], NULL), 138 eo_key_data_set(key, result->hand[i], NULL),
144 evas_obj_visibility_set(EINA_TRUE) 139 evas_obj_visibility_set(EINA_TRUE)
145 ); 140 );
146 evas_object_event_callback_add(win->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj); 141 evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj);
147 eo_unref(win->hand[i]); 142 eo_unref(result->hand[i]);
148#endif 143#endif
149 } 144 }
145
146 return result;
150} 147}
151 148
152void winFangDel(winFang *win) 149void winFangDel(winFang *win)