forked from enlightenment/enlightenment
e now supports scaling based on screen dpi (or on a custom scaling factor you
can select yourself as a user). also any scaling either calculated from dpi or set by the user is limited to the min/max values a user can impose (thus even if you have very low dpi, e doesn't go below a scaling factor you set - eg 1.0 or 0.5, and same for upscaling). this should 1. keep all the people who want scalable UI's happy (enable scaling). 2. make e able to (if u want) to adapt to pretty much any dpi screen and selectively scale just what u want it to. 3. allw you - the user, to be the final controller of just how much to scale - if you like scaling but think it scales too much - then limit it or set your own. right now this will onyl work if your theme supports it... the b&w one does (mostly). so try that and test. other bits of e need to adapt to this too (shelf, icon sizes, etc. etc.) as they are not done via edje but code sets them. SVN revision: 36211
This commit is contained in:
parent
06e4a1df97
commit
071ba50d45
|
@ -1,5 +1,5 @@
|
||||||
group "E_Config" struct {
|
group "E_Config" struct {
|
||||||
value "config_version" int: 65830;
|
value "config_version" int: 65831;
|
||||||
value "show_splash" int: 1;
|
value "show_splash" int: 1;
|
||||||
value "init_default_theme" string: "default.edj";
|
value "init_default_theme" string: "default.edj";
|
||||||
value "desktop_default_name" string: "Desktop %i, %i";
|
value "desktop_default_name" string: "Desktop %i, %i";
|
||||||
|
@ -31,7 +31,7 @@ group "E_Config" struct {
|
||||||
value "evas_engine_drag" int: 0;
|
value "evas_engine_drag" int: 0;
|
||||||
value "evas_engine_win" int: 0;
|
value "evas_engine_win" int: 0;
|
||||||
value "evas_engine_zone" int: 0;
|
value "evas_engine_zone" int: 0;
|
||||||
value "use_composite" int: 0;
|
value "use_composite" int: 0;
|
||||||
group "modules" list {
|
group "modules" list {
|
||||||
group "E_Config_Module" struct {
|
group "E_Config_Module" struct {
|
||||||
value "name" string: "conf_interaction";
|
value "name" string: "conf_interaction";
|
||||||
|
@ -1985,4 +1985,10 @@ group "E_Config" struct {
|
||||||
value "border_keyboard.move.dy" uchar: 5;
|
value "border_keyboard.move.dy" uchar: 5;
|
||||||
value "border_keyboard.resize.dx" uchar: 5;
|
value "border_keyboard.resize.dx" uchar: 5;
|
||||||
value "border_keyboard.resize.dy" uchar: 5;
|
value "border_keyboard.resize.dy" uchar: 5;
|
||||||
|
value "scale.min" double: 1.0;
|
||||||
|
value "scale.max" double: 3.0;
|
||||||
|
value "scale.factor" double: 1.0;
|
||||||
|
value "scale.base_dpi" int: 142;
|
||||||
|
value "scale.use_dpi" uchar: 0;
|
||||||
|
value "scale.use_custom" uchar: 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -430,6 +430,8 @@ src/modules/conf_mime/Makefile
|
||||||
src/modules/conf_mime/module.desktop
|
src/modules/conf_mime/module.desktop
|
||||||
src/modules/conf_interaction/Makefile
|
src/modules/conf_interaction/Makefile
|
||||||
src/modules/conf_interaction/module.desktop
|
src/modules/conf_interaction/module.desktop
|
||||||
|
src/modules/conf_scale/Makefile
|
||||||
|
src/modules/conf_scale/module.desktop
|
||||||
src/modules/gadman/Makefile
|
src/modules/gadman/Makefile
|
||||||
src/modules/gadman/module.desktop
|
src/modules/gadman/module.desktop
|
||||||
src/modules/mixer/Makefile
|
src/modules/mixer/Makefile
|
||||||
|
|
|
@ -164,7 +164,8 @@ e_int_toolbar_config.h \
|
||||||
e_powersave.h \
|
e_powersave.h \
|
||||||
e_slidesel.h \
|
e_slidesel.h \
|
||||||
e_slidecore.h \
|
e_slidecore.h \
|
||||||
e_widget_flist.h
|
e_widget_flist.h \
|
||||||
|
e_scale.h
|
||||||
|
|
||||||
enlightenment_src = \
|
enlightenment_src = \
|
||||||
e_user.c \
|
e_user.c \
|
||||||
|
@ -300,6 +301,7 @@ e_powersave.c \
|
||||||
e_slidesel.c \
|
e_slidesel.c \
|
||||||
e_slidecore.c \
|
e_slidecore.c \
|
||||||
e_widget_flist.c \
|
e_widget_flist.c \
|
||||||
|
e_scale.c \
|
||||||
$(ENLIGHTENMENTHEADERS)
|
$(ENLIGHTENMENTHEADERS)
|
||||||
|
|
||||||
enlightenment_SOURCES = \
|
enlightenment_SOURCES = \
|
||||||
|
|
|
@ -53,7 +53,7 @@ e_config_init(void)
|
||||||
_e_config_profile = getenv("E_CONF_PROFILE");
|
_e_config_profile = getenv("E_CONF_PROFILE");
|
||||||
if (_e_config_profile)
|
if (_e_config_profile)
|
||||||
/* if environment var set - use this profile name */
|
/* if environment var set - use this profile name */
|
||||||
_e_config_profile = strdup(_e_config_profile);
|
_e_config_profile = strdup(_e_config_profile);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Eet_File *ef;
|
Eet_File *ef;
|
||||||
|
@ -622,6 +622,15 @@ e_config_init(void)
|
||||||
E_CONFIG_VAL(D, T, border_keyboard.resize.dx, UCHAR);
|
E_CONFIG_VAL(D, T, border_keyboard.resize.dx, UCHAR);
|
||||||
E_CONFIG_VAL(D, T, border_keyboard.resize.dy, UCHAR);
|
E_CONFIG_VAL(D, T, border_keyboard.resize.dy, UCHAR);
|
||||||
|
|
||||||
|
E_CONFIG_VAL(D, T, hal_desktop, INT);
|
||||||
|
|
||||||
|
E_CONFIG_VAL(D, T, scale.min, DOUBLE);
|
||||||
|
E_CONFIG_VAL(D, T, scale.max, DOUBLE);
|
||||||
|
E_CONFIG_VAL(D, T, scale.factor, DOUBLE);
|
||||||
|
E_CONFIG_VAL(D, T, scale.base_dpi, INT);
|
||||||
|
E_CONFIG_VAL(D, T, scale.use_dpi, UCHAR);
|
||||||
|
E_CONFIG_VAL(D, T, scale.use_custom, UCHAR);
|
||||||
|
|
||||||
e_config = e_config_domain_load("e", _e_config_edd);
|
e_config = e_config_domain_load("e", _e_config_edd);
|
||||||
if (e_config)
|
if (e_config)
|
||||||
{
|
{
|
||||||
|
@ -1557,6 +1566,14 @@ e_config_init(void)
|
||||||
e_config->border_keyboard.resize.dy = 5;
|
e_config->border_keyboard.resize.dy = 5;
|
||||||
IFCFGEND;
|
IFCFGEND;
|
||||||
|
|
||||||
|
IFCFG(0x0127);
|
||||||
|
e_config->scale.min = 1.0;
|
||||||
|
e_config->scale.max = 3.0;
|
||||||
|
e_config->scale.factor = 1.0;
|
||||||
|
e_config->scale.base_dpi = 142;
|
||||||
|
e_config->scale.use_dpi = 0;
|
||||||
|
e_config->scale.use_custom = 1;
|
||||||
|
IFCFGEND;
|
||||||
|
|
||||||
e_config->config_version = E_CONFIG_FILE_VERSION;
|
e_config->config_version = E_CONFIG_FILE_VERSION;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ typedef struct _E_Event_Config_Icon_Theme E_Event_Config_Icon_Theme;
|
||||||
/* increment this whenever a new set of config values are added but the users
|
/* increment this whenever a new set of config values are added but the users
|
||||||
* config doesn't need to be wiped - simply new values need to be put in
|
* config doesn't need to be wiped - simply new values need to be put in
|
||||||
*/
|
*/
|
||||||
#define E_CONFIG_FILE_GENERATION 0x0126
|
#define E_CONFIG_FILE_GENERATION 0x0127
|
||||||
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
|
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
|
||||||
|
|
||||||
#define E_EVAS_ENGINE_DEFAULT 0
|
#define E_EVAS_ENGINE_DEFAULT 0
|
||||||
|
@ -301,6 +301,15 @@ struct _E_Config
|
||||||
unsigned char dy;
|
unsigned char dy;
|
||||||
} resize;
|
} resize;
|
||||||
} border_keyboard;
|
} border_keyboard;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
double min;
|
||||||
|
double max;
|
||||||
|
double factor;
|
||||||
|
int base_dpi;
|
||||||
|
unsigned char use_dpi;
|
||||||
|
unsigned char use_custom;
|
||||||
|
} scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _E_Config_Module
|
struct _E_Config_Module
|
||||||
|
|
|
@ -9,6 +9,7 @@ EAPI Ecore_X_Atom _QTOPIA_SOFT_MENUS = 0;
|
||||||
static Ecore_X_Atom gnome_atom = 0;
|
static Ecore_X_Atom gnome_atom = 0;
|
||||||
static Ecore_X_Atom enlightenment_comms = 0;
|
static Ecore_X_Atom enlightenment_comms = 0;
|
||||||
static Ecore_X_Atom enlightenment_version = 0;
|
static Ecore_X_Atom enlightenment_version = 0;
|
||||||
|
static Ecore_X_Atom enlightenment_scale = 0;
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
e_hints_init(void)
|
e_hints_init(void)
|
||||||
|
@ -21,15 +22,17 @@ e_hints_init(void)
|
||||||
"GNOME_SM_PROXY",
|
"GNOME_SM_PROXY",
|
||||||
"ENLIGHTENMENT_COMMS",
|
"ENLIGHTENMENT_COMMS",
|
||||||
"ENLIGHTENMENT_VERSION",
|
"ENLIGHTENMENT_VERSION",
|
||||||
|
"ENLIGHTENMENT_SCALE"
|
||||||
};
|
};
|
||||||
Ecore_X_Atom atoms[5];
|
Ecore_X_Atom atoms[6];
|
||||||
|
|
||||||
ecore_x_atoms_get(atom_names, 5, atoms);
|
ecore_x_atoms_get(atom_names, 6, atoms);
|
||||||
_QTOPIA_SOFT_MENU = atoms[0];
|
_QTOPIA_SOFT_MENU = atoms[0];
|
||||||
_QTOPIA_SOFT_MENUS = atoms[1];
|
_QTOPIA_SOFT_MENUS = atoms[1];
|
||||||
gnome_atom = atoms[2];
|
gnome_atom = atoms[2];
|
||||||
enlightenment_comms = atoms[3];
|
enlightenment_comms = atoms[3];
|
||||||
enlightenment_version = atoms[4];
|
enlightenment_version = atoms[4];
|
||||||
|
enlightenment_scale = atoms[5];
|
||||||
|
|
||||||
roots = ecore_x_window_root_list(&num);
|
roots = ecore_x_window_root_list(&num);
|
||||||
if (roots)
|
if (roots)
|
||||||
|
@ -176,6 +179,7 @@ e_hints_init(void)
|
||||||
e_hints_openoffice_gnome_fake(roots[i]);
|
e_hints_openoffice_gnome_fake(roots[i]);
|
||||||
|
|
||||||
ecore_x_netwm_supported_set(roots[i], supported, supported_num);
|
ecore_x_netwm_supported_set(roots[i], supported, supported_num);
|
||||||
|
|
||||||
}
|
}
|
||||||
free(roots);
|
free(roots);
|
||||||
}
|
}
|
||||||
|
@ -525,7 +529,7 @@ e_hints_window_init(E_Border *bd)
|
||||||
}
|
}
|
||||||
if (bd->client.netwm.state.shaded)
|
if (bd->client.netwm.state.shaded)
|
||||||
{
|
{
|
||||||
if (!bd->lock_client_shade)
|
if (!bd->lock_client_shade)
|
||||||
e_border_shade(bd, e_hints_window_shade_direction_get(bd));
|
e_border_shade(bd, e_hints_window_shade_direction_get(bd));
|
||||||
else
|
else
|
||||||
e_hints_window_shaded_set(bd, 0);
|
e_hints_window_shaded_set(bd, 0);
|
||||||
|
@ -1414,3 +1418,18 @@ e_hints_openoffice_kde_fake(Ecore_X_Window root)
|
||||||
ecore_x_netwm_wm_identify(root, win2, "KWin");
|
ecore_x_netwm_wm_identify(root, win2, "KWin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void e_hints_scale_update(void)
|
||||||
|
{
|
||||||
|
Ecore_X_Window *roots = NULL;
|
||||||
|
int i, num;
|
||||||
|
int scale;
|
||||||
|
|
||||||
|
roots = ecore_x_window_root_list(&num);
|
||||||
|
if (roots)
|
||||||
|
{
|
||||||
|
scale = e_scale * 1000;
|
||||||
|
for (i = 0; i < num; i++)
|
||||||
|
ecore_x_window_prop_card32_set(roots[i], enlightenment_scale, &scale, 1);
|
||||||
|
free(roots);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ EAPI void e_hints_window_maximized_set(E_Border *bd, int horizontal, int vertica
|
||||||
EAPI void e_hints_window_fullscreen_set(E_Border *bd, int on);
|
EAPI void e_hints_window_fullscreen_set(E_Border *bd, int on);
|
||||||
EAPI void e_hints_window_sticky_set(E_Border *bd, int on);
|
EAPI void e_hints_window_sticky_set(E_Border *bd, int on);
|
||||||
EAPI void e_hints_window_stacking_set(E_Border *bd, E_Stacking stacking);
|
EAPI void e_hints_window_stacking_set(E_Border *bd, E_Stacking stacking);
|
||||||
|
|
||||||
EAPI void e_hints_window_desktop_set(E_Border *bd);
|
EAPI void e_hints_window_desktop_set(E_Border *bd);
|
||||||
|
|
||||||
EAPI void e_hints_window_e_state_set(E_Border *bd);
|
EAPI void e_hints_window_e_state_set(E_Border *bd);
|
||||||
|
@ -54,6 +53,8 @@ EAPI void e_hints_window_virtual_keyboard_get(E_Border *bd);
|
||||||
EAPI void e_hints_openoffice_gnome_fake(Ecore_X_Window root);
|
EAPI void e_hints_openoffice_gnome_fake(Ecore_X_Window root);
|
||||||
EAPI void e_hints_openoffice_kde_fake(Ecore_X_Window root);
|
EAPI void e_hints_openoffice_kde_fake(Ecore_X_Window root);
|
||||||
|
|
||||||
|
EAPI void e_hints_scale_update(void);
|
||||||
|
|
||||||
extern EAPI Ecore_X_Atom _QTOPIA_SOFT_MENU;
|
extern EAPI Ecore_X_Atom _QTOPIA_SOFT_MENU;
|
||||||
extern EAPI Ecore_X_Atom _QTOPIA_SOFT_MENUS;
|
extern EAPI Ecore_X_Atom _QTOPIA_SOFT_MENUS;
|
||||||
|
|
||||||
|
|
|
@ -136,3 +136,4 @@
|
||||||
#include "e_slidecore.h"
|
#include "e_slidecore.h"
|
||||||
#include "e_widget_flist.h"
|
#include "e_widget_flist.h"
|
||||||
#include "e_fm_op.h"
|
#include "e_fm_op.h"
|
||||||
|
#include "e_scale.h"
|
||||||
|
|
|
@ -59,6 +59,8 @@ int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char *s;
|
||||||
|
double scale;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +90,11 @@ main(int argc, char **argv)
|
||||||
evas_init();
|
evas_init();
|
||||||
ecore_evas_init();
|
ecore_evas_init();
|
||||||
edje_init();
|
edje_init();
|
||||||
edje_frametime_set(1.0 / 60.0);
|
edje_frametime_set(1.0 / 30.0);
|
||||||
|
s = getenv("E_SCALE");
|
||||||
|
scale = 1.0;
|
||||||
|
if (s) scale = atof(s);
|
||||||
|
edje_scale_set(scale);
|
||||||
ecore_file_init();
|
ecore_file_init();
|
||||||
ecore_ipc_init();
|
ecore_ipc_init();
|
||||||
|
|
||||||
|
|
|
@ -508,6 +508,15 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
_e_main_shutdown_push(e_config_shutdown);
|
_e_main_shutdown_push(e_config_shutdown);
|
||||||
|
|
||||||
|
TS("scale");
|
||||||
|
/* init config system */
|
||||||
|
if (!e_scale_init())
|
||||||
|
{
|
||||||
|
e_error_message_show(_("Enlightenment cannot set up its scale system."));
|
||||||
|
_e_main_shutdown(-1);
|
||||||
|
}
|
||||||
|
_e_main_shutdown_push(e_scale_shutdown);
|
||||||
|
|
||||||
TS("pointer");
|
TS("pointer");
|
||||||
if (!e_pointer_init())
|
if (!e_pointer_init())
|
||||||
{
|
{
|
||||||
|
@ -534,21 +543,6 @@ main(int argc, char **argv)
|
||||||
/* setup edje to animate @ e_config->framerate frames per sec. */
|
/* setup edje to animate @ e_config->framerate frames per sec. */
|
||||||
edje_frametime_set(1.0 / e_config->framerate);
|
edje_frametime_set(1.0 / e_config->framerate);
|
||||||
|
|
||||||
// FIXME: just a hack.
|
|
||||||
{
|
|
||||||
static scale = -1.0;
|
|
||||||
|
|
||||||
if (scale == -1.0)
|
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
s = getenv("E_SCALE");
|
|
||||||
if (s) scale = atof(s);
|
|
||||||
else scale = 1.0;
|
|
||||||
}
|
|
||||||
edje_scale_set(scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
TS("font");
|
TS("font");
|
||||||
/* init font system */
|
/* init font system */
|
||||||
if (!e_font_init())
|
if (!e_font_init())
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#include "e.h"
|
||||||
|
|
||||||
|
EAPI double e_scale = 1.0;
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
e_scale_init(void)
|
||||||
|
{
|
||||||
|
e_scale_update();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
e_scale_shutdown(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
e_scale_update(void)
|
||||||
|
{
|
||||||
|
int dpi;
|
||||||
|
char buf[128];
|
||||||
|
|
||||||
|
if (e_config->scale.use_dpi)
|
||||||
|
{
|
||||||
|
dpi = ecore_x_dpi_get();
|
||||||
|
e_scale = (double)dpi / (double)e_config->scale.base_dpi;
|
||||||
|
if (e_scale > e_config->scale.max) e_scale = e_config->scale.max;
|
||||||
|
else if (e_scale < e_config->scale.min) e_scale = e_config->scale.min;
|
||||||
|
}
|
||||||
|
else if (e_config->scale.use_custom)
|
||||||
|
{
|
||||||
|
e_scale = e_config->scale.factor;
|
||||||
|
if (e_scale > e_config->scale.max) e_scale = e_config->scale.max;
|
||||||
|
else if (e_scale < e_config->scale.min) e_scale = e_config->scale.min;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
edje_scale_set(e_scale);
|
||||||
|
snprintf(buf, sizeof(buf), "%1.3f", e_scale);
|
||||||
|
e_util_env_set("E_SCALE", buf);
|
||||||
|
e_hints_scale_update();
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#ifdef E_TYPEDEFS
|
||||||
|
#else
|
||||||
|
#ifndef E_SCALE_H
|
||||||
|
#define E_SCALE_H
|
||||||
|
|
||||||
|
EAPI int e_scale_init(void);
|
||||||
|
EAPI int e_scale_shutdown(void);
|
||||||
|
EAPI void e_scale_update(void);
|
||||||
|
|
||||||
|
extern EAPI double e_scale;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -53,6 +53,7 @@ conf_interaction \
|
||||||
gadman \
|
gadman \
|
||||||
mixer \
|
mixer \
|
||||||
conf_window_remembers \
|
conf_window_remembers \
|
||||||
|
conf_scale \
|
||||||
connman
|
connman
|
||||||
|
|
||||||
if HAVE_TEMPERATURE
|
if HAVE_TEMPERATURE
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
.deps
|
||||||
|
.libs
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
*.lo
|
||||||
|
module.la
|
||||||
|
module.desktop
|
|
@ -0,0 +1,31 @@
|
||||||
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
MODULE = conf_scale
|
||||||
|
|
||||||
|
# data files for the module
|
||||||
|
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
|
||||||
|
files_DATA = \
|
||||||
|
e-module-$(MODULE).edj module.desktop
|
||||||
|
|
||||||
|
EXTRA_DIST = $(files_DATA)
|
||||||
|
|
||||||
|
# the module .so file
|
||||||
|
INCLUDES = -I. \
|
||||||
|
-I$(top_srcdir) \
|
||||||
|
-I$(top_srcdir)/src/modules/$(MODULE) \
|
||||||
|
-I$(top_srcdir)/src/bin \
|
||||||
|
-I$(top_srcdir)/src/lib \
|
||||||
|
-I$(top_srcdir)/src/modules \
|
||||||
|
@e_cflags@
|
||||||
|
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
|
||||||
|
pkg_LTLIBRARIES = module.la
|
||||||
|
module_la_SOURCES = e_mod_main.c \
|
||||||
|
e_mod_main.h \
|
||||||
|
e_int_config_scale.c \
|
||||||
|
e_int_config_scale.h
|
||||||
|
|
||||||
|
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||||
|
module_la_LDFLAGS = -module -avoid-version
|
||||||
|
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
Binary file not shown.
|
@ -0,0 +1,193 @@
|
||||||
|
#include "e.h"
|
||||||
|
|
||||||
|
static void *_create_data(E_Config_Dialog *cfd);
|
||||||
|
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
|
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
|
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||||
|
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
|
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||||
|
|
||||||
|
struct _E_Config_Dialog_Data
|
||||||
|
{
|
||||||
|
int use_dpi;
|
||||||
|
|
||||||
|
/* Advanced */
|
||||||
|
double min;
|
||||||
|
double max;
|
||||||
|
double factor;
|
||||||
|
int use_mode;
|
||||||
|
|
||||||
|
int base_dpi;
|
||||||
|
int use_custom;
|
||||||
|
};
|
||||||
|
|
||||||
|
EAPI E_Config_Dialog *
|
||||||
|
e_int_config_scale(E_Container *con, const char *params __UNUSED__)
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
E_Config_Dialog_View *v;
|
||||||
|
|
||||||
|
if (e_config_dialog_find("E", "_config_scale_dialog")) return NULL;
|
||||||
|
v = E_NEW(E_Config_Dialog_View, 1);
|
||||||
|
|
||||||
|
v->create_cfdata = _create_data;
|
||||||
|
v->free_cfdata = _free_data;
|
||||||
|
v->basic.apply_cfdata = _basic_apply_data;
|
||||||
|
v->basic.create_widgets = _basic_create_widgets;
|
||||||
|
v->advanced.apply_cfdata = _advanced_apply_data;
|
||||||
|
v->advanced.create_widgets = _advanced_create_widgets;
|
||||||
|
|
||||||
|
cfd = e_config_dialog_new(con,
|
||||||
|
_("Scaling Settings"),
|
||||||
|
"E", "_config_scale_dialog",
|
||||||
|
"enlightenment/scale", 0, v, NULL);
|
||||||
|
return cfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
cfdata->use_dpi = e_config->scale.use_dpi;
|
||||||
|
cfdata->use_custom = e_config->scale.use_custom;
|
||||||
|
cfdata->use_mode = 0;
|
||||||
|
if (cfdata->use_dpi) cfdata->use_mode = 1;
|
||||||
|
if (cfdata->use_custom) cfdata->use_mode = 2;
|
||||||
|
cfdata->min = e_config->scale.min;
|
||||||
|
cfdata->max = e_config->scale.max;
|
||||||
|
cfdata->factor = e_config->scale.factor;
|
||||||
|
cfdata->base_dpi = e_config->scale.base_dpi;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_create_data(E_Config_Dialog *cfd)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||||
|
_fill_data(cfdata);
|
||||||
|
return cfdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
E_FREE(cfdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
cfdata->use_custom = 0;
|
||||||
|
if (cfdata->use_dpi) cfdata->use_mode = 1;
|
||||||
|
else cfdata->use_mode = 0;
|
||||||
|
|
||||||
|
e_config->scale.use_dpi = cfdata->use_dpi;
|
||||||
|
e_config->scale.use_custom = cfdata->use_custom;
|
||||||
|
e_config->scale.min = cfdata->min;
|
||||||
|
e_config->scale.max = cfdata->max;
|
||||||
|
e_config->scale.factor = cfdata->factor;
|
||||||
|
e_config->scale.base_dpi = cfdata->base_dpi;
|
||||||
|
|
||||||
|
e_scale_update();
|
||||||
|
e_canvas_recache();
|
||||||
|
e_config_save_queue();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
Evas_Object *o, *of, *ob;
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
|
|
||||||
|
ob = e_widget_check_add(evas, _("Scale with DPI"), &(cfdata->use_dpi));
|
||||||
|
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, _("Relative"), 0);
|
||||||
|
ob = e_widget_label_add(evas, _("Base DPI to scale relative to"));
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f DPI"), 30, 1200, 1, 0, NULL, &(cfdata->base_dpi), 150);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
snprintf(buf, sizeof(buf), _("Currently %i DPI"), ecore_x_dpi_get());
|
||||||
|
ob = e_widget_label_add(evas, buf);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
if (cfdata->use_mode == 0)
|
||||||
|
{
|
||||||
|
cfdata->use_dpi = 0;
|
||||||
|
cfdata->use_custom = 0;
|
||||||
|
}
|
||||||
|
else if (cfdata->use_mode == 1)
|
||||||
|
{
|
||||||
|
cfdata->use_dpi = 1;
|
||||||
|
cfdata->use_custom = 0;
|
||||||
|
}
|
||||||
|
else if (cfdata->use_mode == 2)
|
||||||
|
{
|
||||||
|
cfdata->use_dpi = 0;
|
||||||
|
cfdata->use_custom = 1;
|
||||||
|
}
|
||||||
|
e_config->scale.use_dpi = cfdata->use_dpi;
|
||||||
|
e_config->scale.use_custom = cfdata->use_custom;
|
||||||
|
e_config->scale.min = cfdata->min;
|
||||||
|
e_config->scale.max = cfdata->max;
|
||||||
|
e_config->scale.factor = cfdata->factor;
|
||||||
|
e_config->scale.base_dpi = cfdata->base_dpi;
|
||||||
|
|
||||||
|
e_scale_update();
|
||||||
|
e_canvas_recache();
|
||||||
|
e_config_save_queue();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
Evas_Object *o, *ob, *of;
|
||||||
|
E_Radio_Group *rg;
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, _("Policy"), 0);
|
||||||
|
rg = e_widget_radio_group_new(&(cfdata->use_mode));
|
||||||
|
ob = e_widget_radio_add(evas, _("Don't Scale"), 0, rg);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_radio_add(evas, _("Scale relative to screen DPI"), 1, rg);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_radio_add(evas, _("Custom scaling factor"), 2, rg);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_label_add(evas, _("Minimum"));
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f times"), 0.25, 8.0, 0.05, 0, &(cfdata->min), NULL, 150);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_label_add(evas, _("Maximum"));
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f times"), 0.25, 8.0, 0.05, 0, &(cfdata->max), NULL, 150);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, _("Scaling Factors"), 0);
|
||||||
|
snprintf(buf, sizeof(buf), _("Base DPI (Currently %i DPI)"), ecore_x_dpi_get());
|
||||||
|
ob = e_widget_label_add(evas, buf);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f DPI"), 30, 1200, 1, 0, NULL, &(cfdata->base_dpi), 150);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_label_add(evas, _("Personal scaling factor"));
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f times"), 0.25, 8.0, 0.05, 0, &(cfdata->factor), NULL, 150);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
#ifdef E_TYPEDEFS
|
||||||
|
#else
|
||||||
|
#ifndef E_INT_CONFIG_SCALE_H
|
||||||
|
#define E_INT_CONFIG_SCALE_H
|
||||||
|
|
||||||
|
EAPI E_Config_Dialog *e_int_config_scale(E_Container *con, const char *params __UNUSED__);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#include "e.h"
|
||||||
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/**/
|
||||||
|
/* actual module specifics */
|
||||||
|
|
||||||
|
static E_Module *conf_module = NULL;
|
||||||
|
|
||||||
|
/**/
|
||||||
|
/***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/**/
|
||||||
|
|
||||||
|
/**/
|
||||||
|
/***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/**/
|
||||||
|
/* module setup */
|
||||||
|
EAPI E_Module_Api e_modapi =
|
||||||
|
{
|
||||||
|
E_MODULE_API_VERSION,
|
||||||
|
"Configuration - Scaling"
|
||||||
|
};
|
||||||
|
|
||||||
|
EAPI void *
|
||||||
|
e_modapi_init(E_Module *m)
|
||||||
|
{
|
||||||
|
e_configure_registry_category_add("appearance", 10, _("Appearance"), NULL, "enlightenment/appearance");
|
||||||
|
e_configure_registry_item_add("appearance/scale", 90, _("Scaling"), NULL, "enlightenment/scale", e_int_config_scale);
|
||||||
|
conf_module = m;
|
||||||
|
e_module_delayed_set(m, 1);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
e_modapi_shutdown(E_Module *m)
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
while ((cfd = e_config_dialog_get("E", "_config_scale_dialog"))) e_object_del(E_OBJECT(cfd));
|
||||||
|
e_configure_registry_item_del("appearance/scale");
|
||||||
|
e_configure_registry_category_del("appearance");
|
||||||
|
conf_module = NULL;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
e_modapi_save(E_Module *m)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#ifndef E_MOD_MAIN_H
|
||||||
|
#define E_MOD_MAIN_H
|
||||||
|
|
||||||
|
#define E_TYPEDEFS 1
|
||||||
|
#include "e_int_config_scale.h"
|
||||||
|
|
||||||
|
#undef E_TYPEDEFS
|
||||||
|
#include "e_int_config_scale.h"
|
||||||
|
|
||||||
|
EAPI extern E_Module_Api e_modapi;
|
||||||
|
|
||||||
|
EAPI void *e_modapi_init (E_Module *m);
|
||||||
|
EAPI int e_modapi_shutdown (E_Module *m);
|
||||||
|
EAPI int e_modapi_save (E_Module *m);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,28 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Link
|
||||||
|
Name=Configuration - Scaling
|
||||||
|
Name[de]=
|
||||||
|
Name[eo]=
|
||||||
|
Name[es]=
|
||||||
|
Name[fr]=
|
||||||
|
Name[hu]=
|
||||||
|
Name[it]=
|
||||||
|
Name[ja]=
|
||||||
|
Name[pt]=
|
||||||
|
Name[pt_BR]=
|
||||||
|
Name[zh_CN]=
|
||||||
|
Name[zh_TW]=
|
||||||
|
Icon=e-module-conf_scale
|
||||||
|
Comment=<title>E17 Configuration Applet</title><br>Used to configure certain how Display scaling is handled.
|
||||||
|
Comment[de]=
|
||||||
|
Comment[eo]=
|
||||||
|
Comment[es]=
|
||||||
|
Comment[fr]=
|
||||||
|
Comment[hu]=
|
||||||
|
Comment[it]=
|
||||||
|
Comment[ja]=
|
||||||
|
Comment[pt]=
|
||||||
|
Comment[pt_BR]=
|
||||||
|
Comment[zh_CN]=
|
||||||
|
Comment[zh_TW]=
|
||||||
|
X-Enlightenment-ModuleType=config
|
Loading…
Reference in New Issue