Add suport for setting the Primary Output in the randr dialog....for
my German friend ;) Signed-off-by: Chris Michael <devilhorns@comcast.net>
This commit is contained in:
parent
9f95515926
commit
1b76632915
|
@ -2,13 +2,14 @@
|
||||||
#include "e_mod_main.h"
|
#include "e_mod_main.h"
|
||||||
#include "e_int_config_randr.h"
|
#include "e_int_config_randr.h"
|
||||||
#include "e_smart_randr.h"
|
#include "e_smart_randr.h"
|
||||||
|
#include "e_smart_monitor.h"
|
||||||
|
|
||||||
/* local structures */
|
/* local structures */
|
||||||
struct _E_Config_Dialog_Data
|
struct _E_Config_Dialog_Data
|
||||||
{
|
{
|
||||||
Evas_Object *o_randr;
|
Evas_Object *o_randr;
|
||||||
|
|
||||||
int restore;
|
int restore, primary;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
|
@ -63,6 +64,7 @@ _create_data(E_Config_Dialog *cfd EINA_UNUSED)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cfdata->restore = e_randr_cfg->restore;
|
cfdata->restore = e_randr_cfg->restore;
|
||||||
|
cfdata->primary = e_randr_cfg->primary;
|
||||||
|
|
||||||
return cfdata;
|
return cfdata;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +88,10 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Evas_Object *ow;
|
Evas_Object *ow;
|
||||||
Evas_Coord mw = 0, mh = 0, ch = 0;
|
Evas_Coord mw = 0, mh = 0, ch = 0, fh = 0;
|
||||||
|
E_Radio_Group *rg;
|
||||||
|
Eina_List *l;
|
||||||
|
Evas_Object *mon, *of;
|
||||||
|
|
||||||
/* create the base list widget */
|
/* create the base list widget */
|
||||||
o = e_widget_list_add(evas, 0, 0);
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
|
@ -111,12 +116,28 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
e_smart_randr_min_size_get(cfdata->o_randr, &mw, &mh);
|
e_smart_randr_min_size_get(cfdata->o_randr, &mw, &mh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, _("Primary Output"), 0);
|
||||||
|
rg = e_widget_radio_group_new(&(cfdata->primary));
|
||||||
|
EINA_LIST_FOREACH(e_smart_randr_monitors_get(cfdata->o_randr), l, mon)
|
||||||
|
{
|
||||||
|
int output;
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
name = e_smart_monitor_name_get(mon);
|
||||||
|
output = (int)e_smart_monitor_output_get(mon);
|
||||||
|
|
||||||
|
ow = e_widget_radio_add(evas, name, output, rg);
|
||||||
|
e_widget_framelist_object_append(of, ow);
|
||||||
|
}
|
||||||
|
e_widget_list_object_append(o, of, 1, 0, 0.5);
|
||||||
|
e_widget_size_min_get(of, NULL, &fh);
|
||||||
|
|
||||||
ow = e_widget_check_add(evas, _("Restore On Startup"), &(cfdata->restore));
|
ow = e_widget_check_add(evas, _("Restore On Startup"), &(cfdata->restore));
|
||||||
e_widget_list_object_append(o, ow, 1, 0, 0.5);
|
e_widget_list_object_append(o, ow, 1, 0, 0.5);
|
||||||
e_widget_size_min_get(ow, NULL, &ch);
|
e_widget_size_min_get(ow, NULL, &ch);
|
||||||
|
|
||||||
/* set min size of the list widget */
|
/* set min size of the list widget */
|
||||||
e_widget_size_min_set(o, mw, mh + ch);
|
e_widget_size_min_set(o, mw, mh + fh + ch);
|
||||||
|
|
||||||
e_util_win_auto_resize_fill(cfd->dia->win);
|
e_util_win_auto_resize_fill(cfd->dia->win);
|
||||||
e_win_centered_set(cfd->dia->win, 1);
|
e_win_centered_set(cfd->dia->win, 1);
|
||||||
|
@ -127,9 +148,18 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
static int
|
static int
|
||||||
_basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
_basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
|
Eina_Bool change_primary = EINA_FALSE;
|
||||||
|
|
||||||
|
change_primary = (e_randr_cfg->primary != cfdata->primary);
|
||||||
|
|
||||||
|
e_randr_cfg->primary = cfdata->primary;
|
||||||
e_randr_cfg->restore = cfdata->restore;
|
e_randr_cfg->restore = cfdata->restore;
|
||||||
e_randr_config_save();
|
e_randr_config_save();
|
||||||
|
|
||||||
|
if (change_primary)
|
||||||
|
ecore_x_randr_primary_output_set(ecore_x_window_root_first_get(),
|
||||||
|
(Ecore_X_Randr_Output)cfdata->primary);
|
||||||
|
|
||||||
e_smart_randr_changes_apply(cfdata->o_randr);
|
e_smart_randr_changes_apply(cfdata->o_randr);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -138,7 +168,8 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
||||||
static int
|
static int
|
||||||
_basic_check(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
_basic_check(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
return (e_randr_cfg->restore != cfdata->restore);
|
return ((e_randr_cfg->restore != cfdata->restore) ||
|
||||||
|
(e_randr_cfg->primary != cfdata->primary));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -54,6 +54,7 @@ struct _E_Smart_Data
|
||||||
|
|
||||||
/* output config */
|
/* output config */
|
||||||
Ecore_X_Randr_Output output;
|
Ecore_X_Randr_Output output;
|
||||||
|
Eina_Bool primary : 1;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -375,7 +376,8 @@ e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set if it's primary */
|
/* set if it's primary */
|
||||||
if (output == primary)
|
sd->primary = (output == primary);
|
||||||
|
if (sd->primary)
|
||||||
edje_object_signal_emit(sd->o_frame, "e,state,primary,on", "e");
|
edje_object_signal_emit(sd->o_frame, "e,state,primary,on", "e");
|
||||||
else
|
else
|
||||||
edje_object_signal_emit(sd->o_frame, "e,state,primary,off", "e");
|
edje_object_signal_emit(sd->o_frame, "e,state,primary,off", "e");
|
||||||
|
@ -743,7 +745,7 @@ e_smart_monitor_changes_apply(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
E_Smart_Data *sd;
|
E_Smart_Data *sd;
|
||||||
Ecore_X_Window root = 0;
|
Ecore_X_Window root = 0;
|
||||||
Ecore_X_Randr_Output *outputs;
|
Ecore_X_Randr_Output *outputs, primary = 0;
|
||||||
int noutputs = 0;
|
int noutputs = 0;
|
||||||
Ecore_X_Randr_Mode_Info *mode_info;
|
Ecore_X_Randr_Mode_Info *mode_info;
|
||||||
Ecore_X_Randr_Mode mode;
|
Ecore_X_Randr_Mode mode;
|
||||||
|
@ -755,6 +757,14 @@ e_smart_monitor_changes_apply(Evas_Object *obj)
|
||||||
/* try to get the objects smart data */
|
/* try to get the objects smart data */
|
||||||
if (!(sd = evas_object_smart_data_get(obj))) return EINA_FALSE;
|
if (!(sd = evas_object_smart_data_get(obj))) return EINA_FALSE;
|
||||||
|
|
||||||
|
primary = (Ecore_X_Randr_Output)e_randr_cfg->primary;
|
||||||
|
sd->primary = (sd->output == primary);
|
||||||
|
|
||||||
|
if (sd->primary)
|
||||||
|
edje_object_signal_emit(sd->o_frame, "e,state,primary,on", "e");
|
||||||
|
else
|
||||||
|
edje_object_signal_emit(sd->o_frame, "e,state,primary,off", "e");
|
||||||
|
|
||||||
/* if we have no changes to apply, get out */
|
/* if we have no changes to apply, get out */
|
||||||
if (sd->changes <= E_SMART_MONITOR_CHANGED_NONE) return EINA_FALSE;
|
if (sd->changes <= E_SMART_MONITOR_CHANGED_NONE) return EINA_FALSE;
|
||||||
|
|
||||||
|
@ -855,6 +865,28 @@ e_smart_monitor_changes_apply(Evas_Object *obj)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
e_smart_monitor_name_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Smart_Data *sd;
|
||||||
|
|
||||||
|
/* try to get the objects smart data */
|
||||||
|
if (!(sd = evas_object_smart_data_get(obj))) return NULL;
|
||||||
|
|
||||||
|
/* get output name */
|
||||||
|
return edje_object_part_text_get(sd->o_frame, "e.text.name");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ecore_X_Randr_Output
|
||||||
|
e_smart_monitor_output_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Smart_Data *sd;
|
||||||
|
|
||||||
|
/* try to get the objects smart data */
|
||||||
|
if (!(sd = evas_object_smart_data_get(obj))) return 0;
|
||||||
|
return sd->output;
|
||||||
|
}
|
||||||
|
|
||||||
/* smart functions */
|
/* smart functions */
|
||||||
static void
|
static void
|
||||||
_e_smart_add(Evas_Object *obj)
|
_e_smart_add(Evas_Object *obj)
|
||||||
|
|
|
@ -7,10 +7,11 @@ typedef enum _E_Smart_Monitor_Changes E_Smart_Monitor_Changes;
|
||||||
enum _E_Smart_Monitor_Changes
|
enum _E_Smart_Monitor_Changes
|
||||||
{
|
{
|
||||||
E_SMART_MONITOR_CHANGED_NONE = 0,
|
E_SMART_MONITOR_CHANGED_NONE = 0,
|
||||||
E_SMART_MONITOR_CHANGED_MODE = (1 << 0),
|
E_SMART_MONITOR_CHANGED_MODE = (1 << 0),
|
||||||
E_SMART_MONITOR_CHANGED_POSITION = (1 << 1),
|
E_SMART_MONITOR_CHANGED_POSITION = (1 << 1),
|
||||||
E_SMART_MONITOR_CHANGED_ORIENTATION = (1 << 2),
|
E_SMART_MONITOR_CHANGED_ORIENTATION = (1 << 2),
|
||||||
E_SMART_MONITOR_CHANGED_ENABLED = (1 << 3)
|
E_SMART_MONITOR_CHANGED_ENABLED = (1 << 3),
|
||||||
|
E_SMART_MONITOR_CHANGED_PRIMARY = (1 << 4)
|
||||||
};
|
};
|
||||||
|
|
||||||
Evas_Object *e_smart_monitor_add(Evas *evas);
|
Evas_Object *e_smart_monitor_add(Evas *evas);
|
||||||
|
@ -26,6 +27,8 @@ void e_smart_monitor_clone_set(Evas_Object *obj, Evas_Object *parent);
|
||||||
Evas_Object *e_smart_monitor_clone_parent_get(Evas_Object *obj);
|
Evas_Object *e_smart_monitor_clone_parent_get(Evas_Object *obj);
|
||||||
E_Smart_Monitor_Changes e_smart_monitor_changes_get(Evas_Object *obj);
|
E_Smart_Monitor_Changes e_smart_monitor_changes_get(Evas_Object *obj);
|
||||||
Eina_Bool e_smart_monitor_changes_apply(Evas_Object *obj);
|
Eina_Bool e_smart_monitor_changes_apply(Evas_Object *obj);
|
||||||
|
const char *e_smart_monitor_name_get(Evas_Object *obj);
|
||||||
|
Ecore_X_Randr_Output e_smart_monitor_output_get(Evas_Object *obj);
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -403,6 +403,16 @@ e_smart_randr_changes_apply(Evas_Object *obj)
|
||||||
ecore_x_randr_screen_reset(ecore_x_window_root_first_get());
|
ecore_x_randr_screen_reset(ecore_x_window_root_first_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eina_List *
|
||||||
|
e_smart_randr_monitors_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Smart_Data *sd;
|
||||||
|
|
||||||
|
/* try to get the objects smart data */
|
||||||
|
if (!(sd = evas_object_smart_data_get(obj))) return NULL;
|
||||||
|
return sd->monitors;
|
||||||
|
}
|
||||||
|
|
||||||
/* local functions */
|
/* local functions */
|
||||||
static void
|
static void
|
||||||
_e_smart_add(Evas_Object *obj)
|
_e_smart_add(Evas_Object *obj)
|
||||||
|
|
|
@ -9,6 +9,7 @@ void e_smart_randr_monitors_create(Evas_Object *obj);
|
||||||
void e_smart_randr_min_size_get(Evas_Object *obj, Evas_Coord *mw, Evas_Coord *mh);
|
void e_smart_randr_min_size_get(Evas_Object *obj, Evas_Coord *mw, Evas_Coord *mh);
|
||||||
Eina_Bool e_smart_randr_changed_get(Evas_Object *obj);
|
Eina_Bool e_smart_randr_changed_get(Evas_Object *obj);
|
||||||
void e_smart_randr_changes_apply(Evas_Object *obj);
|
void e_smart_randr_changes_apply(Evas_Object *obj);
|
||||||
|
Eina_List *e_smart_randr_monitors_get(Evas_Object *obj);
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue