cpu: remember our sizing, remember the size.
This was annoying me...if the user sets a new size, remember it... Scaling and different and blah blah blah blah
This commit is contained in:
parent
0fb70fd7a8
commit
5f75b25ca2
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "ui/ui.h"
|
||||
|
||||
#define CONFIG_VERSION 0x0007
|
||||
#define CONFIG_VERSION 0x0008
|
||||
|
||||
typedef struct _Evisum_Config
|
||||
{
|
||||
|
@ -18,6 +18,11 @@ typedef struct _Evisum_Config
|
|||
Eina_Bool show_kthreads;
|
||||
Eina_Bool show_user;
|
||||
Eina_Bool show_desktop;
|
||||
struct
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
} cpu;
|
||||
} Evisum_Config;
|
||||
|
||||
void config_init(void);
|
||||
|
|
|
@ -40,6 +40,13 @@ evisum_ui_config_save(Ui *ui)
|
|||
|
||||
proc_info_kthreads_show_set(ui->settings.show_kthreads);
|
||||
|
||||
if (ui->cpu.win)
|
||||
{
|
||||
evas_object_geometry_get(ui->cpu.win, NULL, NULL, &w, &h);
|
||||
_evisum_config->cpu.width = ui->cpu.width = w;
|
||||
_evisum_config->cpu.height = ui->cpu.height = h;
|
||||
}
|
||||
|
||||
config_save(_evisum_config);
|
||||
}
|
||||
|
||||
|
@ -64,6 +71,9 @@ evisum_ui_config_load(Ui *ui)
|
|||
proc_info_kthreads_show_set(ui->settings.show_kthreads);
|
||||
ui->settings.show_user = _evisum_config->show_user;
|
||||
ui->settings.show_desktop = _evisum_config->show_desktop;
|
||||
|
||||
ui->cpu.width = _evisum_config->cpu.width;
|
||||
ui->cpu.height = _evisum_config->cpu.height;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -85,6 +85,8 @@ typedef struct Ui
|
|||
{
|
||||
Evas_Object *win;
|
||||
Ecore_Thread *thread;
|
||||
int width;
|
||||
int height;
|
||||
} cpu;
|
||||
|
||||
struct
|
||||
|
|
|
@ -652,6 +652,14 @@ _graph(Ui *ui, Evas_Object *parent)
|
|||
ad, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_win_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Ui *ui = data;
|
||||
|
||||
evisum_ui_config_save(ui);
|
||||
}
|
||||
|
||||
void
|
||||
ui_win_cpu_add(Ui *ui)
|
||||
{
|
||||
|
@ -672,11 +680,14 @@ ui_win_cpu_add(Ui *ui)
|
|||
evisum_ui_background_random_add(win, (evisum_ui_effects_enabled_get() ||
|
||||
evisum_ui_backgrounds_enabled_get()));
|
||||
|
||||
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE,
|
||||
_win_resize_cb, ui);
|
||||
|
||||
scroller = elm_scroller_add(win);
|
||||
evas_object_size_hint_weight_set(scroller, EXPAND, EXPAND);
|
||||
evas_object_size_hint_align_set(scroller, FILL, FILL);
|
||||
elm_scroller_policy_set(scroller,
|
||||
ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
|
||||
ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
|
||||
evas_object_show(scroller);
|
||||
|
||||
box = elm_box_add(win);
|
||||
|
@ -689,9 +700,13 @@ ui_win_cpu_add(Ui *ui)
|
|||
elm_object_content_set(scroller, box);
|
||||
elm_object_content_set(win, scroller);
|
||||
|
||||
if (ui->cpu.width > 0 && ui->cpu.height > 0)
|
||||
evas_object_resize(win, ui->cpu.width, ui->cpu.height);
|
||||
else
|
||||
evas_object_resize(win, UI_CHILD_WIN_WIDTH * 1.5, UI_CHILD_WIN_HEIGHT * 1.1);
|
||||
|
||||
if (ui->win)
|
||||
evas_object_geometry_get(ui->win, &x, &y, NULL, NULL);
|
||||
evas_object_resize(win, UI_CHILD_WIN_WIDTH * 1.5, UI_CHILD_WIN_HEIGHT * 1.1);
|
||||
if (x > 0 && y > 0)
|
||||
evas_object_move(win, x + 20, y + 20);
|
||||
evas_object_show(win);
|
||||
|
|
Loading…
Reference in New Issue