e/border: make keyboard move and resize actions configurable.

No GUI for that yet, but it's already exported in e_config so one can
write such in future.



SVN revision: 36134
This commit is contained in:
Gustavo Sverzut Barbieri 2008-09-20 15:53:28 +00:00
parent 712db0233f
commit 51cefe3402
3 changed files with 44 additions and 14 deletions

View File

@ -2677,7 +2677,7 @@ _e_border_action_timeout_add(void)
{ {
if (action_timer) if (action_timer)
ecore_timer_del(action_timer); ecore_timer_del(action_timer);
action_timer = ecore_timer_add(5.0, _e_border_action_timeout, NULL); action_timer = ecore_timer_add(e_config->border_keyboard.timeout, _e_border_action_timeout, NULL);
} }
static void static void
@ -2702,8 +2702,6 @@ _e_border_action_restore_orig(E_Border *bd)
e_border_move_resize(bd, action_orig.x, action_orig.y, action_orig.width, action_orig.height); e_border_move_resize(bd, action_orig.x, action_orig.y, action_orig.width, action_orig.height);
} }
#define E_BORDER_MOVE_KEY_DX 5
#define E_BORDER_MOVE_KEY_DY 5
static int static int
_e_border_move_key_down(void *data, int type, void *event) _e_border_move_key_down(void *data, int type, void *event)
{ {
@ -2722,13 +2720,13 @@ _e_border_move_key_down(void *data, int type, void *event)
y = action_border->y; y = action_border->y;
if (strcmp(ev->keysymbol, "Up") == 0) if (strcmp(ev->keysymbol, "Up") == 0)
y -= E_BORDER_MOVE_KEY_DY; y -= e_config->border_keyboard.move.dy;
else if (strcmp(ev->keysymbol, "Down") == 0) else if (strcmp(ev->keysymbol, "Down") == 0)
y += E_BORDER_MOVE_KEY_DY; y += e_config->border_keyboard.move.dy;
else if (strcmp(ev->keysymbol, "Left") == 0) else if (strcmp(ev->keysymbol, "Left") == 0)
x -= E_BORDER_MOVE_KEY_DX; x -= e_config->border_keyboard.move.dx;
else if (strcmp(ev->keysymbol, "Right") == 0) else if (strcmp(ev->keysymbol, "Right") == 0)
x += E_BORDER_MOVE_KEY_DX; x += e_config->border_keyboard.move.dx;
else if (strcmp(ev->keysymbol, "Return") == 0) else if (strcmp(ev->keysymbol, "Return") == 0)
goto stop; goto stop;
else if (strcmp(ev->keysymbol, "Escape") == 0) else if (strcmp(ev->keysymbol, "Escape") == 0)
@ -2790,8 +2788,6 @@ e_border_act_move_keyboard(E_Border *bd)
action_handler_mouse = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, _e_border_move_mouse_down, NULL); action_handler_mouse = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, _e_border_move_mouse_down, NULL);
} }
#define E_BORDER_RESIZE_KEY_DX 5
#define E_BORDER_RESIZE_KEY_DY 5
static int static int
_e_border_resize_key_down(void *data, int type, void *event) _e_border_resize_key_down(void *data, int type, void *event)
{ {
@ -2810,13 +2806,13 @@ _e_border_resize_key_down(void *data, int type, void *event)
h = action_border->h; h = action_border->h;
if (strcmp(ev->keysymbol, "Up") == 0) if (strcmp(ev->keysymbol, "Up") == 0)
h -= E_BORDER_RESIZE_KEY_DY; h -= e_config->border_keyboard.resize.dy;
else if (strcmp(ev->keysymbol, "Down") == 0) else if (strcmp(ev->keysymbol, "Down") == 0)
h += E_BORDER_RESIZE_KEY_DY; h += e_config->border_keyboard.resize.dy;
else if (strcmp(ev->keysymbol, "Left") == 0) else if (strcmp(ev->keysymbol, "Left") == 0)
w -= E_BORDER_RESIZE_KEY_DX; w -= e_config->border_keyboard.resize.dx;
else if (strcmp(ev->keysymbol, "Right") == 0) else if (strcmp(ev->keysymbol, "Right") == 0)
w += E_BORDER_RESIZE_KEY_DX; w += e_config->border_keyboard.resize.dx;
else if (strcmp(ev->keysymbol, "Return") == 0) else if (strcmp(ev->keysymbol, "Return") == 0)
goto stop; goto stop;
else if (strcmp(ev->keysymbol, "Escape") == 0) else if (strcmp(ev->keysymbol, "Escape") == 0)

View File

@ -616,6 +616,12 @@ e_config_init(void)
E_CONFIG_VAL(D, T, hal_desktop, INT); E_CONFIG_VAL(D, T, hal_desktop, INT);
E_CONFIG_VAL(D, T, border_keyboard.timeout, DOUBLE);
E_CONFIG_VAL(D, T, border_keyboard.move.dx, UCHAR);
E_CONFIG_VAL(D, T, border_keyboard.move.dy, UCHAR);
E_CONFIG_VAL(D, T, border_keyboard.resize.dx, UCHAR);
E_CONFIG_VAL(D, T, border_keyboard.resize.dy, 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)
{ {
@ -793,6 +799,13 @@ e_config_init(void)
e_config->display_res_rotation = 0; e_config->display_res_rotation = 0;
e_config->hal_desktop = 1; e_config->hal_desktop = 1;
e_config->border_keyboard.timeout = 5.0;
e_config->border_keyboard.move.dx = 5;
e_config->border_keyboard.move.dy = 5;
e_config->border_keyboard.resize.dx = 5;
e_config->border_keyboard.resize.dy = 5;
{ {
E_Config_Module *em; E_Config_Module *em;
@ -1536,6 +1549,15 @@ e_config_init(void)
e_config->mouse_hand = E_MOUSE_HAND_RIGHT; e_config->mouse_hand = E_MOUSE_HAND_RIGHT;
IFCFGEND; IFCFGEND;
IFCFG(0x0126);
e_config->border_keyboard.timeout = 5.0;
e_config->border_keyboard.move.dx = 5;
e_config->border_keyboard.move.dy = 5;
e_config->border_keyboard.resize.dx = 5;
e_config->border_keyboard.resize.dy = 5;
IFCFGEND;
e_config->config_version = E_CONFIG_FILE_VERSION; e_config->config_version = E_CONFIG_FILE_VERSION;
#if 0 /* example of new config */ #if 0 /* example of new config */

View File

@ -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 0x0125 #define E_CONFIG_FILE_GENERATION 0x0126
#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
@ -289,6 +289,18 @@ struct _E_Config
double thumbscroll_friction; double thumbscroll_friction;
int hal_desktop; int hal_desktop;
struct {
double timeout;
struct {
unsigned char dx;
unsigned char dy;
} move;
struct {
unsigned char dx;
unsigned char dy;
} resize;
} border_keyboard;
}; };
struct _E_Config_Module struct _E_Config_Module