summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Houston <stephen@localhost.localdomain>2018-02-13 09:12:01 -0600
committerStephen Houston <stephen@localhost.localdomain>2018-02-13 09:12:01 -0600
commitda104d9d514660dd110e0cbbb369eb37766d2733 (patch)
tree7c1105ccbeb6c619e300da5e4bbe90d748d0e0cd
parentd905001ddf98405f3586255da5f264006846dd1a (diff)
Cpumonitor: Fix aspect handling.
-rw-r--r--cpumonitor/src/cpumonitor.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/cpumonitor/src/cpumonitor.c b/cpumonitor/src/cpumonitor.c
index 9ec619d..1d5a1a4 100644
--- a/cpumonitor/src/cpumonitor.c
+++ b/cpumonitor/src/cpumonitor.c
@@ -113,12 +113,19 @@ _cpumonitor_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *e
113{ 113{
114 Evas_Coord w = 1, h = 1; 114 Evas_Coord w = 1, h = 1;
115 Instance *inst = data; 115 Instance *inst = data;
116 int num_cores = inst->cfg->cpumonitor.cores;
116 117
117 edje_object_parts_extends_calc(elm_layout_edje_get(obj), 0, 0, &w, &h); 118 edje_object_parts_extends_calc(elm_layout_edje_get(obj), 0, 0, &w, &h);
119 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, _cpumonitor_resize_cb, inst);
120 w *= num_cores;
118 if (w < 1) w = 1; 121 if (w < 1) w = 1;
119 if (h < 1) h = 1; 122 if (h < 1) h = 1;
123 evas_object_size_hint_aspect_set(inst->cfg->cpumonitor.o_gadget_box, EVAS_ASPECT_CONTROL_BOTH, w, h);
120 if (inst->cfg->esm == E_SYSINFO_MODULE_CPUMONITOR) 124 if (inst->cfg->esm == E_SYSINFO_MODULE_CPUMONITOR)
121 evas_object_size_hint_aspect_set(inst->win, EVAS_ASPECT_CONTROL_BOTH, w, h); 125 {
126 evas_object_size_hint_aspect_set(inst->win, EVAS_ASPECT_CONTROL_BOTH, w, h);
127 evas_object_size_hint_aspect_set(inst->box, EVAS_ASPECT_CONTROL_BOTH, w, h);
128 }
122 else 129 else
123 evas_object_size_hint_aspect_set(inst->cfg->cpumonitor.o_gadget, EVAS_ASPECT_CONTROL_BOTH, w, h); 130 evas_object_size_hint_aspect_set(inst->cfg->cpumonitor.o_gadget, EVAS_ASPECT_CONTROL_BOTH, w, h);
124} 131}
@@ -188,6 +195,8 @@ _cpumonitor_config_updated(Instance *inst)
188 { 195 {
189 core = calloc(1, sizeof(CPU_Core)); 196 core = calloc(1, sizeof(CPU_Core));
190 core->layout = _cpumonitor_add_layout(inst); 197 core->layout = _cpumonitor_add_layout(inst);
198 if (i == 0)
199 evas_object_event_callback_add(core->layout, EVAS_CALLBACK_RESIZE, _cpumonitor_resize_cb, inst);
191 core->percent = percent; 200 core->percent = percent;
192 core->total = 0; 201 core->total = 0;
193 core->idle = 0; 202 core->idle = 0;
@@ -230,6 +239,8 @@ _cpumonitor_config_updated(Instance *inst)
230 { 239 {
231 core = calloc(1, sizeof(CPU_Core)); 240 core = calloc(1, sizeof(CPU_Core));
232 core->layout = _cpumonitor_add_layout(inst); 241 core->layout = _cpumonitor_add_layout(inst);
242 if (i == 0)
243 evas_object_event_callback_add(core->layout, EVAS_CALLBACK_RESIZE, _cpumonitor_resize_cb, inst);
233 core->percent = 0; 244 core->percent = 0;
234 core->total = 0; 245 core->total = 0;
235 core->idle = 0; 246 core->idle = 0;
@@ -289,7 +300,6 @@ sysinfo_cpumonitor_create(Evas_Object *parent, Instance *inst)
289 evas_object_size_hint_align_set(inst->cfg->cpumonitor.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL); 300 evas_object_size_hint_align_set(inst->cfg->cpumonitor.o_gadget, EVAS_HINT_FILL, EVAS_HINT_FILL);
290 evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, 301 evas_object_event_callback_add(inst->cfg->cpumonitor.o_gadget, EVAS_CALLBACK_MOUSE_DOWN,
291 _cpumonitor_mouse_down_cb, inst); 302 _cpumonitor_mouse_down_cb, inst);
292 evas_object_event_callback_add(inst->cfg->cpuclock.o_gadget, EVAS_CALLBACK_RESIZE, _cpumonitor_resize_cb, inst);
293 evas_object_show(inst->cfg->cpumonitor.o_gadget); 303 evas_object_show(inst->cfg->cpumonitor.o_gadget);
294 304
295 inst->cfg->cpumonitor.o_gadget_box = elm_box_add(inst->cfg->cpumonitor.o_gadget); 305 inst->cfg->cpumonitor.o_gadget_box = elm_box_add(inst->cfg->cpumonitor.o_gadget);