2011-11-05 23:41:39 -07:00
|
|
|
#include "e.h"
|
2012-09-27 02:22:05 -07:00
|
|
|
#include "e_mod_main.h"
|
2011-11-14 11:05:33 -08:00
|
|
|
#include "e_int_config_randr.h"
|
2012-09-27 02:22:05 -07:00
|
|
|
#include "e_smart_randr.h"
|
|
|
|
#include "e_smart_monitor.h"
|
2011-11-05 23:41:39 -07:00
|
|
|
|
2012-09-27 02:22:05 -07:00
|
|
|
/* local structures */
|
2012-10-08 00:56:18 -07:00
|
|
|
struct _E_Config_Dialog_Data
|
2011-11-05 23:41:39 -07:00
|
|
|
{
|
2012-09-27 02:22:05 -07:00
|
|
|
Evas_Object *o_scroll;
|
|
|
|
};
|
2011-11-05 23:41:39 -07:00
|
|
|
|
2012-09-27 02:22:05 -07:00
|
|
|
/* local function prototypes */
|
2012-10-08 00:56:18 -07:00
|
|
|
static void *_create_data(E_Config_Dialog *cfd __UNUSED__);
|
|
|
|
static void _fill_data(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
|
|
|
static int _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
|
2012-10-08 01:39:46 -07:00
|
|
|
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _randr_cb_changed(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__);
|
2012-02-18 08:49:17 -08:00
|
|
|
|
2012-09-27 02:22:05 -07:00
|
|
|
/* local variables */
|
2012-02-18 08:49:17 -08:00
|
|
|
|
2012-09-27 02:22:05 -07:00
|
|
|
E_Config_Dialog *
|
|
|
|
e_int_config_randr(E_Container *con, const char *params __UNUSED__)
|
2011-11-05 23:41:39 -07:00
|
|
|
{
|
2012-10-08 00:56:18 -07:00
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
E_Config_Dialog_View *v;
|
|
|
|
|
2012-09-27 02:22:05 -07:00
|
|
|
if (e_randr_screen_info.randr_version < ECORE_X_RANDR_1_2)
|
|
|
|
return NULL;
|
2011-11-05 23:41:39 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
if (e_config_dialog_find("E", "screen/screen_setup")) return NULL;
|
|
|
|
|
|
|
|
if (!(v = E_NEW(E_Config_Dialog_View, 1))) return NULL;
|
|
|
|
|
|
|
|
v->create_cfdata = _create_data;
|
|
|
|
v->free_cfdata = _free_data;
|
|
|
|
v->basic.create_widgets = _basic_create;
|
|
|
|
v->basic.apply_cfdata = _basic_apply;
|
2012-10-08 01:39:46 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
v->override_auto_apply = EINA_TRUE;
|
|
|
|
|
|
|
|
cfd = e_config_dialog_new(con, _("Screen Setup"),
|
|
|
|
"E", "screen/screen_setup",
|
|
|
|
"preferences-system-screen-setup", 0, v, NULL);
|
2011-11-05 23:41:39 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
/* NB: These are just arbitrary values I picked. Feel free to change */
|
|
|
|
e_win_size_min_set(cfd->dia->win, 180, 230);
|
|
|
|
e_dialog_resizable_set(cfd->dia, 1);
|
2011-11-05 23:41:39 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
return cfd;
|
2011-11-05 23:41:39 -07:00
|
|
|
}
|
|
|
|
|
2012-09-27 02:22:05 -07:00
|
|
|
/* local functions */
|
2012-10-08 00:56:18 -07:00
|
|
|
static void *
|
|
|
|
_create_data(E_Config_Dialog *cfd __UNUSED__)
|
2011-11-05 23:41:39 -07:00
|
|
|
{
|
2012-10-08 00:56:18 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
2012-02-18 08:49:17 -08:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
if (!(cfdata = E_NEW(E_Config_Dialog_Data, 1))) return NULL;
|
|
|
|
_fill_data(cfdata);
|
|
|
|
return cfdata;
|
|
|
|
}
|
2011-11-05 23:41:39 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
static void
|
2012-10-08 13:55:43 -07:00
|
|
|
_fill_data(E_Config_Dialog_Data *cfdata __UNUSED__)
|
2012-10-08 00:56:18 -07:00
|
|
|
{
|
|
|
|
}
|
2012-09-27 02:22:05 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
static void
|
|
|
|
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
2012-10-08 01:39:46 -07:00
|
|
|
evas_object_smart_callback_del(cfdata->o_scroll, "changed",
|
|
|
|
_randr_cb_changed);
|
|
|
|
evas_object_del(cfdata->o_scroll);
|
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
E_FREE(cfdata);
|
|
|
|
}
|
2012-09-27 02:22:05 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
static int
|
2012-10-08 13:55:43 -07:00
|
|
|
_basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata __UNUSED__)
|
2012-10-08 00:56:18 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2012-09-27 02:22:05 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
static Evas_Object *
|
2012-10-08 01:39:46 -07:00
|
|
|
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2012-10-08 00:56:18 -07:00
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
Eina_List *l;
|
|
|
|
E_Randr_Crtc_Info *crtc;
|
2012-09-27 02:22:05 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
o = e_widget_list_add(evas, 0, 0);
|
2012-09-27 02:22:05 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
cfdata->o_scroll = e_smart_randr_add(evas);
|
|
|
|
e_smart_randr_virtual_size_set(cfdata->o_scroll,
|
2012-09-27 02:22:05 -07:00
|
|
|
E_RANDR_12->max_size.width,
|
|
|
|
E_RANDR_12->max_size.height);
|
2012-10-08 00:56:18 -07:00
|
|
|
evas_object_show(cfdata->o_scroll);
|
2012-09-27 02:22:05 -07:00
|
|
|
|
2012-10-08 01:39:46 -07:00
|
|
|
evas_object_smart_callback_add(cfdata->o_scroll, "changed",
|
|
|
|
_randr_cb_changed, cfd);
|
|
|
|
|
2012-09-27 02:22:05 -07:00
|
|
|
/* create monitors based on 'CRTCS' */
|
|
|
|
EINA_LIST_FOREACH(E_RANDR_12->crtcs, l, crtc)
|
2011-11-05 23:41:39 -07:00
|
|
|
{
|
2012-09-27 02:22:05 -07:00
|
|
|
Evas_Object *m;
|
2011-11-05 23:41:39 -07:00
|
|
|
|
2012-09-27 02:22:05 -07:00
|
|
|
if (!crtc) continue;
|
2011-11-05 23:41:39 -07:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
/* printf("ADD CRTC %d\n", crtc->xid); */
|
2011-11-05 23:41:39 -07:00
|
|
|
|
2012-09-27 02:22:05 -07:00
|
|
|
if (!(m = e_smart_monitor_add(evas))) continue;
|
|
|
|
e_smart_monitor_crtc_set(m, crtc);
|
2012-10-08 00:56:18 -07:00
|
|
|
e_smart_randr_monitor_add(cfdata->o_scroll, m);
|
2012-09-27 02:22:05 -07:00
|
|
|
evas_object_show(m);
|
|
|
|
}
|
2011-12-14 09:37:38 -08:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
e_widget_list_object_append(o, cfdata->o_scroll, 1, 1, 0.5);
|
2011-12-14 09:37:38 -08:00
|
|
|
|
2012-10-08 00:56:18 -07:00
|
|
|
return o;
|
2011-11-05 23:41:39 -07:00
|
|
|
}
|
2012-10-08 01:39:46 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_randr_cb_changed(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
|
|
|
|
if (!(cfd = data)) return;
|
|
|
|
e_config_dialog_changed_set(cfd, EINA_TRUE);
|
|
|
|
}
|