2006-08-23 05:49:11 -07:00
|
|
|
#include "e.h"
|
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
#define TEXT_NO_PARAMS _("<None>")
|
|
|
|
#define EXAMPLE_STRING "example : "
|
|
|
|
|
|
|
|
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);
|
2006-08-23 05:49:11 -07:00
|
|
|
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
static void _fill_data(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _fill_actions_list(E_Config_Dialog_Data *cfdata);
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
/******************* Callbacks *************/
|
2012-06-08 02:48:19 -07:00
|
|
|
static void _binding_change_cb(void *data);
|
|
|
|
static void _action_change_cb(void *data);
|
|
|
|
static void _delete_mouse_binding_cb(void *data, void *data2);
|
|
|
|
static void _delete_all_mouse_binding_cb(void *data, void *data2);
|
|
|
|
static void _restore_mouse_binding_defaults_cb(void *data, void *data2);
|
|
|
|
static void _add_mouse_binding_cb(void *data, void *data2);
|
|
|
|
static void _modify_mouse_binding_cb(void *data, void *data2);
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
/******************* Updates *****************/
|
2012-06-08 02:48:19 -07:00
|
|
|
static void _update_action_list(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _update_action_params(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _update_mouse_binding_list(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _update_buttons(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _update_binding_context(E_Config_Dialog_Data *cfdata);
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
/****************** Helper *****************/
|
2012-06-08 02:48:19 -07:00
|
|
|
static void _find_key_binding_action(const char *action, const char *params, int *g, int *a, int *n);
|
|
|
|
static char *_helper_button_name_get(E_Config_Binding_Mouse *eb);
|
|
|
|
static char *_helper_wheel_name_get(E_Config_Binding_Wheel *bw);
|
|
|
|
static char *_helper_modifier_name_get(int mod);
|
|
|
|
static void _auto_apply_changes(E_Config_Dialog_Data *cfdata);
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
/********* Sorting ***************/
|
2012-06-08 02:48:19 -07:00
|
|
|
static int _mouse_binding_sort_cb(const void *d1, const void *d2);
|
|
|
|
static int _wheel_binding_sort_cb(const void *d1, const void *d2);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
/********* grab window **********/
|
2012-06-08 02:48:19 -07:00
|
|
|
static void _grab_wnd_show(E_Config_Dialog_Data *cfdata);
|
|
|
|
static Eina_Bool _grab_mouse_down_cb(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _grab_mouse_wheel_cb(void *data, int type, void *event);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
|
|
|
struct _E_Config_Dialog_Data
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
|
|
|
|
Evas *evas;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Eina_List *mouse;
|
|
|
|
Eina_List *wheel;
|
|
|
|
} binding;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
const char *binding;
|
|
|
|
const char *action;
|
|
|
|
char *params;
|
|
|
|
int context;
|
|
|
|
|
|
|
|
const char *cur;
|
|
|
|
int add; /*just to distinguesh among two buttons add/modify */
|
|
|
|
|
2012-08-20 01:36:43 -07:00
|
|
|
E_Grab_Dialog *eg;
|
2012-06-08 02:48:19 -07:00
|
|
|
} locals;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Object *o_binding_list;
|
|
|
|
Evas_Object *o_action_list;
|
|
|
|
Evas_Object *o_params;
|
|
|
|
Evas_Object *o_del;
|
|
|
|
Evas_Object *o_mod;
|
|
|
|
Evas_Object *o_del_all;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Object *o_any, *o_window, *o_menu, *o_winlist, *o_popup, *o_zone,
|
|
|
|
*o_container, *o_manager, *o_none;
|
|
|
|
} context;
|
|
|
|
} gui;
|
2006-08-23 05:49:11 -07:00
|
|
|
};
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
E_Config_Dialog *
|
2015-03-18 15:09:09 -07:00
|
|
|
e_int_config_mousebindings(Evas_Object *parent EINA_UNUSED, const char *params EINA_UNUSED)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-10-08 01:04:18 -07:00
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
E_Config_Dialog_View *v;
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2009-12-04 14:37:18 -08:00
|
|
|
if (e_config_dialog_find("E", "keyboard_and_mouse/mouse_bindings")) return NULL;
|
2006-10-08 01:04:18 -07:00
|
|
|
v = E_NEW(E_Config_Dialog_View, 1);
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-10-08 01:04:18 -07:00
|
|
|
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->override_auto_apply = 0;
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2014-11-02 18:35:13 -08:00
|
|
|
cfd = e_config_dialog_new(NULL,
|
2012-06-08 02:48:19 -07:00
|
|
|
_("Mouse Bindings Settings"),
|
|
|
|
"E", "keyboard_and_mouse/mouse_bindings",
|
|
|
|
"preferences-desktop-mouse", 0, v, NULL);
|
2006-10-08 01:04:18 -07:00
|
|
|
return cfd;
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2006-08-23 05:49:11 -07:00
|
|
|
E_Config_Binding_Mouse *eb, *eb2;
|
|
|
|
E_Config_Binding_Wheel *bw, *bw2;
|
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
cfdata->locals.binding = eina_stringshare_add("");
|
|
|
|
cfdata->locals.action = eina_stringshare_add("");
|
2006-08-30 21:16:43 -07:00
|
|
|
cfdata->locals.params = strdup("");
|
|
|
|
cfdata->locals.context = E_BINDING_CONTEXT_ANY;
|
|
|
|
cfdata->binding.mouse = NULL;
|
|
|
|
cfdata->binding.wheel = NULL;
|
2012-08-20 01:36:43 -07:00
|
|
|
cfdata->locals.eg = NULL;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2013-02-01 02:21:54 -08:00
|
|
|
EINA_LIST_FOREACH(e_bindings->mouse_bindings, l, eb)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
eb2 = E_NEW(E_Config_Binding_Mouse, 1);
|
|
|
|
eb2->context = eb->context;
|
|
|
|
eb2->button = eb->button;
|
|
|
|
eb2->modifiers = eb->modifiers;
|
|
|
|
eb2->any_mod = eb->any_mod;
|
|
|
|
eb2->action = !eb->action ? NULL : eina_stringshare_add(eb->action);
|
|
|
|
eb2->params = !eb->params ? NULL : eina_stringshare_add(eb->params);
|
|
|
|
|
|
|
|
cfdata->binding.mouse = eina_list_append(cfdata->binding.mouse, eb2);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
2013-02-01 02:21:54 -08:00
|
|
|
EINA_LIST_FOREACH(e_bindings->wheel_bindings, l, bw)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
bw2 = E_NEW(E_Config_Binding_Wheel, 1);
|
|
|
|
bw2->context = bw->context;
|
|
|
|
bw2->direction = bw->direction;
|
|
|
|
bw2->z = bw->z;
|
|
|
|
bw2->modifiers = bw->modifiers;
|
|
|
|
bw2->any_mod = bw->any_mod;
|
|
|
|
bw2->action = !bw->action ? NULL : eina_stringshare_add(bw->action);
|
|
|
|
bw2->params = !bw->params ? NULL : eina_stringshare_add(bw->params);
|
|
|
|
|
|
|
|
cfdata->binding.wheel = eina_list_append(cfdata->binding.wheel, bw2);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
_create_data(E_Config_Dialog *cfd)
|
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-08-23 05:49:11 -07:00
|
|
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-08-23 05:49:11 -07:00
|
|
|
_fill_data(cfdata);
|
|
|
|
cfdata->cfd = cfd;
|
|
|
|
return cfdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-08-30 21:16:43 -07:00
|
|
|
E_Config_Binding_Mouse *eb;
|
2006-08-23 05:49:11 -07:00
|
|
|
E_Config_Binding_Wheel *bw;
|
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FREE(cfdata->binding.mouse, eb)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
eina_stringshare_del(eb->action);
|
|
|
|
eina_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FREE(cfdata->binding.wheel, bw)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
eina_stringshare_del(bw->action);
|
|
|
|
eina_stringshare_del(bw->params);
|
|
|
|
E_FREE(bw);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
eina_stringshare_del(cfdata->locals.binding);
|
|
|
|
eina_stringshare_del(cfdata->locals.action);
|
|
|
|
eina_stringshare_del(cfdata->locals.cur);
|
|
|
|
|
2012-12-21 13:31:13 -08:00
|
|
|
free(cfdata->locals.params);
|
2007-01-15 09:43:19 -08:00
|
|
|
E_FREE(cfdata);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-03-18 15:09:09 -07:00
|
|
|
_basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
2012-06-08 02:48:19 -07:00
|
|
|
{
|
2012-06-08 04:00:20 -07:00
|
|
|
Eina_List *l, *l2;
|
2006-08-30 21:16:43 -07:00
|
|
|
E_Config_Binding_Mouse *eb, *eb2;
|
2006-08-23 05:49:11 -07:00
|
|
|
E_Config_Binding_Wheel *bw, *bw2;
|
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
_auto_apply_changes(cfdata);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
e_comp_button_bindings_ungrab_all();
|
2015-03-19 13:03:51 -07:00
|
|
|
e_comp_canvas_keys_ungrab();
|
2012-06-12 03:16:40 -07:00
|
|
|
|
2013-02-01 02:21:54 -08:00
|
|
|
EINA_LIST_FREE(e_bindings->mouse_bindings, eb)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
e_bindings_mouse_del(eb->context, eb->button, eb->modifiers, eb->any_mod,
|
|
|
|
eb->action, eb->params);
|
|
|
|
eina_stringshare_del(eb->action);
|
|
|
|
eina_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FOREACH(cfdata->binding.mouse, l, eb)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
eb2 = E_NEW(E_Config_Binding_Mouse, 1);
|
|
|
|
eb2->context = eb->context;
|
|
|
|
eb2->button = eb->button;
|
|
|
|
eb2->modifiers = eb->modifiers;
|
|
|
|
eb2->any_mod = eb->any_mod;
|
|
|
|
eb2->action = !eb->action ? NULL : eina_stringshare_add(eb->action);
|
|
|
|
eb2->params = !eb->params ? NULL : eina_stringshare_add(eb->params);
|
|
|
|
|
2013-02-01 02:21:54 -08:00
|
|
|
e_bindings->mouse_bindings = eina_list_append(e_bindings->mouse_bindings, eb2);
|
2012-06-08 02:48:19 -07:00
|
|
|
e_bindings_mouse_add(eb2->context, eb2->button, eb2->modifiers, eb2->any_mod,
|
|
|
|
eb2->action, eb2->params);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
2013-02-01 02:21:54 -08:00
|
|
|
EINA_LIST_FREE(e_bindings->wheel_bindings, bw)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
e_bindings_wheel_del(bw->context, bw->direction, bw->z, bw->modifiers, bw->any_mod,
|
|
|
|
bw->action, bw->params);
|
|
|
|
eina_stringshare_del(bw->action);
|
|
|
|
eina_stringshare_del(bw->params);
|
|
|
|
E_FREE(bw);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
2012-06-08 04:00:20 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(cfdata->binding.wheel, l, l2, bw)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 04:00:20 -07:00
|
|
|
if ((!bw->modifiers) && ((bw->context == E_BINDING_CONTEXT_WINDOW) || (bw->context == E_BINDING_CONTEXT_ANY)))
|
|
|
|
{
|
2017-08-21 07:16:30 -07:00
|
|
|
const char *msg = _("Unable to set a mouse wheel binding without modifiers<ps/>"
|
|
|
|
"on a window: conflict with existing edje signal bindings.<ps/>"
|
2012-06-08 04:00:20 -07:00
|
|
|
"FIXME!!!");
|
|
|
|
e_util_dialog_internal(_("Mouse Binding Error"), msg);
|
|
|
|
cfdata->binding.wheel = eina_list_remove_list(cfdata->binding.wheel, l);
|
|
|
|
eina_stringshare_del(bw->action);
|
|
|
|
eina_stringshare_del(bw->params);
|
|
|
|
E_FREE(bw);
|
|
|
|
_update_mouse_binding_list(cfdata);
|
|
|
|
continue;
|
|
|
|
}
|
2012-06-08 02:48:19 -07:00
|
|
|
bw2 = E_NEW(E_Config_Binding_Wheel, 1);
|
|
|
|
bw2->context = bw->context;
|
|
|
|
bw2->direction = bw->direction;
|
|
|
|
bw2->z = bw->z;
|
|
|
|
bw2->modifiers = bw->modifiers;
|
|
|
|
bw2->any_mod = bw->any_mod;
|
|
|
|
bw2->action = !bw->action ? NULL : eina_stringshare_add(bw->action);
|
|
|
|
bw2->params = !bw->params ? NULL : eina_stringshare_add(bw->params);
|
|
|
|
|
2013-02-01 02:21:54 -08:00
|
|
|
e_bindings->wheel_bindings = eina_list_append(e_bindings->wheel_bindings, bw2);
|
2012-06-08 02:48:19 -07:00
|
|
|
e_bindings_wheel_add(bw2->context, bw2->direction, bw2->z, bw2->modifiers,
|
|
|
|
bw2->any_mod, bw2->action, bw2->params);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
e_comp_button_bindings_grab_all();
|
2015-03-19 13:03:51 -07:00
|
|
|
e_comp_canvas_keys_grab();
|
2006-08-23 05:49:11 -07:00
|
|
|
|
|
|
|
e_config_save_queue();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2015-01-11 09:20:38 -08:00
|
|
|
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-12-16 12:21:12 -08:00
|
|
|
Evas_Object *o, *of, *ot, *ob;
|
2006-08-23 05:49:11 -07:00
|
|
|
E_Radio_Group *rg;
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-08-23 05:49:11 -07:00
|
|
|
cfdata->evas = evas;
|
2006-12-16 12:21:12 -08:00
|
|
|
o = e_widget_list_add(evas, 0, 1);
|
|
|
|
ot = e_widget_frametable_add(evas, _("Mouse Bindings"), 0);
|
|
|
|
ob = e_widget_ilist_add(evas, 32, 32, &(cfdata->locals.binding));
|
|
|
|
cfdata->gui.o_binding_list = ob;
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_set(ob, 200, 200);
|
2006-12-16 12:21:12 -08:00
|
|
|
e_widget_frametable_object_append(ot, ob, 0, 0, 2, 1, 1, 1, 1, 1);
|
|
|
|
|
2012-12-16 11:58:23 -08:00
|
|
|
ob = e_widget_button_add(evas, _("Add"), "list-add", _add_mouse_binding_cb, cfdata, NULL);
|
2006-12-16 12:32:40 -08:00
|
|
|
e_widget_frametable_object_append(ot, ob, 0, 1, 1, 1, 1, 0, 1, 0);
|
2012-06-26 16:20:24 -07:00
|
|
|
ob = e_widget_button_add(evas, _("Delete"), "list-remove", _delete_mouse_binding_cb, cfdata, NULL);
|
2006-12-16 12:21:12 -08:00
|
|
|
cfdata->gui.o_del = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-12-16 12:32:40 -08:00
|
|
|
e_widget_frametable_object_append(ot, ob, 1, 1, 1, 1, 1, 0, 1, 0);
|
2012-06-26 16:20:24 -07:00
|
|
|
ob = e_widget_button_add(evas, _("Modify"), NULL, _modify_mouse_binding_cb, cfdata, NULL);
|
2006-12-16 12:21:12 -08:00
|
|
|
cfdata->gui.o_mod = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-12-16 12:32:40 -08:00
|
|
|
e_widget_frametable_object_append(ot, ob, 0, 2, 1, 1, 1, 0, 1, 0);
|
2012-06-26 16:20:24 -07:00
|
|
|
ob = e_widget_button_add(evas, _("Delete All"), "edit-clear", _delete_all_mouse_binding_cb, cfdata, NULL);
|
2006-12-16 12:21:12 -08:00
|
|
|
cfdata->gui.o_del_all = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-12-16 12:32:40 -08:00
|
|
|
e_widget_frametable_object_append(ot, ob, 1, 2, 1, 1, 1, 0, 1, 0);
|
2010-05-03 13:14:08 -07:00
|
|
|
ob = e_widget_button_add(evas, _("Restore Default Bindings"), "enlightenment",
|
2012-06-08 02:48:19 -07:00
|
|
|
_restore_mouse_binding_defaults_cb, cfdata, NULL);
|
2006-12-16 12:32:40 -08:00
|
|
|
e_widget_frametable_object_append(ot, ob, 0, 3, 2, 1, 1, 0, 1, 0);
|
2006-12-16 12:21:12 -08:00
|
|
|
e_widget_list_object_append(o, ot, 1, 1, 0.5);
|
|
|
|
|
2015-01-15 00:04:42 -08:00
|
|
|
ot = e_widget_table_add(e_win_evas_win_get(evas), 0);
|
2006-08-30 21:16:43 -07:00
|
|
|
of = e_widget_framelist_add(evas, _("Action"), 0);
|
2006-12-16 12:21:12 -08:00
|
|
|
ob = e_widget_ilist_add(evas, 24, 24, &(cfdata->locals.action));
|
|
|
|
cfdata->gui.o_action_list = ob;
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_set(ob, 200, 200);
|
2006-12-16 12:21:12 -08:00
|
|
|
e_widget_framelist_object_append(of, ob);
|
|
|
|
e_widget_table_object_append(ot, of, 0, 0, 3, 1, 1, 1, 1, 1);
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
of = e_widget_framelist_add(evas, _("Action Params"), 0);
|
2015-01-11 09:20:38 -08:00
|
|
|
ob = e_widget_entry_add(cfd->dia->win, &(cfdata->locals.params), NULL, NULL, NULL);
|
2006-12-16 12:21:12 -08:00
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
cfdata->gui.o_params = ob;
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
2007-04-17 03:14:53 -07:00
|
|
|
e_widget_table_object_append(ot, of, 0, 1, 3, 1, 1, 1, 1, 0);
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-12-16 12:21:12 -08:00
|
|
|
of = e_widget_frametable_add(evas, _("Action Context"), 1);
|
2006-08-30 21:16:43 -07:00
|
|
|
rg = e_widget_radio_group_new(&(cfdata->locals.context));
|
2006-12-16 12:21:12 -08:00
|
|
|
ob = e_widget_radio_add(evas, _("Any"), E_BINDING_CONTEXT_ANY, rg);
|
|
|
|
cfdata->gui.context.o_any = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
|
2012-06-08 03:10:16 -07:00
|
|
|
ob = e_widget_radio_add(evas, _("Window"), E_BINDING_CONTEXT_WINDOW, rg);
|
2012-06-08 02:47:09 -07:00
|
|
|
cfdata->gui.context.o_window = ob;
|
2006-12-16 12:21:12 -08:00
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 1, 1);
|
|
|
|
ob = e_widget_radio_add(evas, _("Menu"), E_BINDING_CONTEXT_MENU, rg);
|
|
|
|
cfdata->gui.context.o_menu = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 1, 1, 1);
|
|
|
|
ob = e_widget_radio_add(evas, _("Win List"), E_BINDING_CONTEXT_WINLIST, rg);
|
|
|
|
cfdata->gui.context.o_winlist = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 1, 1);
|
|
|
|
ob = e_widget_radio_add(evas, _("Popup"), E_BINDING_CONTEXT_POPUP, rg);
|
|
|
|
cfdata->gui.context.o_popup = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 1);
|
|
|
|
ob = e_widget_radio_add(evas, _("Zone"), E_BINDING_CONTEXT_ZONE, rg);
|
|
|
|
cfdata->gui.context.o_zone = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 1, 1, 1);
|
2015-03-19 14:14:09 -07:00
|
|
|
ob = e_widget_radio_add(evas, _("Compositor"), E_BINDING_CONTEXT_COMPOSITOR, rg);
|
2006-12-16 12:21:12 -08:00
|
|
|
cfdata->gui.context.o_container = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 2, 0, 1, 1, 1, 1, 1, 1);
|
|
|
|
ob = e_widget_radio_add(evas, _("Manager"), E_BINDING_CONTEXT_MANAGER, rg);
|
|
|
|
cfdata->gui.context.o_manager = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 2, 1, 1, 1, 1, 1, 1, 1);
|
|
|
|
ob = e_widget_radio_add(evas, _("None"), E_BINDING_CONTEXT_NONE, rg);
|
|
|
|
cfdata->gui.context.o_none = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 2, 2, 1, 1, 1, 1, 1, 1);
|
2007-04-17 03:14:53 -07:00
|
|
|
e_widget_table_object_append(ot, of, 0, 2, 3, 1, 1, 1, 1, 0);
|
2006-12-16 12:21:12 -08:00
|
|
|
e_widget_list_object_append(o, ot, 1, 1, 0.5);
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
_update_mouse_binding_list(cfdata);
|
2006-08-30 21:16:43 -07:00
|
|
|
_fill_actions_list(cfdata);
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2014-12-22 06:02:05 -08:00
|
|
|
e_dialog_resizable_set(cfd->dia, 1);
|
2006-12-16 12:21:12 -08:00
|
|
|
return o;
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-08-30 21:16:43 -07:00
|
|
|
_fill_actions_list(E_Config_Dialog_Data *cfdata)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-08-30 21:16:43 -07:00
|
|
|
char buf[1024];
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l, *l2;
|
2006-10-23 13:43:11 -07:00
|
|
|
E_Action_Group *actg;
|
|
|
|
E_Action_Description *actd;
|
|
|
|
int g, a;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-11-27 08:05:37 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get(cfdata->gui.o_action_list));
|
|
|
|
edje_freeze();
|
|
|
|
e_widget_ilist_freeze(cfdata->gui.o_action_list);
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_ilist_clear(cfdata->gui.o_action_list);
|
|
|
|
for (l = e_action_groups_get(), g = 0; l; l = l->next, g++)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
actg = l->data;
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
if (!actg->acts) continue;
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
e_widget_ilist_header_append(cfdata->gui.o_action_list, NULL, _(actg->act_grp));
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
for (l2 = actg->acts, a = 0; l2; l2 = l2->next, a++)
|
|
|
|
{
|
|
|
|
actd = l2->data;
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%d %d", g, a);
|
|
|
|
e_widget_ilist_append(cfdata->gui.o_action_list, NULL, _(actd->act_name),
|
|
|
|
_action_change_cb, cfdata, buf);
|
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
2006-08-30 21:16:43 -07:00
|
|
|
e_widget_ilist_go(cfdata->gui.o_action_list);
|
2006-11-27 08:05:37 -08:00
|
|
|
e_widget_ilist_thaw(cfdata->gui.o_action_list);
|
|
|
|
edje_thaw();
|
|
|
|
evas_event_thaw(evas_object_evas_get(cfdata->gui.o_action_list));
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
/******************* Callbacks *************/
|
2006-08-30 21:16:43 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_add_mouse_binding_cb(void *data, void *data2 EINA_UNUSED)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-10-23 13:43:11 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata = data;
|
|
|
|
_auto_apply_changes(cfdata);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata->locals.add = 1;
|
|
|
|
_grab_wnd_show(cfdata);
|
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_modify_mouse_binding_cb(void *data, void *data2 EINA_UNUSED)
|
2006-10-23 13:43:11 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata = data;
|
|
|
|
_auto_apply_changes(cfdata);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata->locals.add = 0;
|
|
|
|
_grab_wnd_show(cfdata);
|
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
static void
|
|
|
|
_action_change_cb(void *data)
|
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata = data;
|
|
|
|
_update_action_params(cfdata);
|
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
static void
|
|
|
|
_binding_change_cb(void *data)
|
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata = data;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
_auto_apply_changes(cfdata);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
eina_stringshare_del(cfdata->locals.cur);
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata->locals.cur = NULL;
|
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
if (cfdata->locals.binding[0])
|
2009-03-11 08:13:42 -07:00
|
|
|
cfdata->locals.cur = eina_stringshare_ref(cfdata->locals.binding);
|
2006-10-23 13:43:11 -07:00
|
|
|
|
|
|
|
_update_buttons(cfdata);
|
|
|
|
_update_action_list(cfdata);
|
|
|
|
_update_binding_context(cfdata);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_delete_all_mouse_binding_cb(void *data, void *data2 EINA_UNUSED)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-10-23 13:43:11 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-08-23 05:49:11 -07:00
|
|
|
E_Config_Binding_Mouse *eb;
|
|
|
|
E_Config_Binding_Wheel *bw;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata = data;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2007-03-25 15:45:00 -07:00
|
|
|
/* FIXME: need confirmation dialog */
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FREE(cfdata->binding.mouse, eb)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
eina_stringshare_del(eb->action);
|
|
|
|
eina_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FREE(cfdata->binding.wheel, bw)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
eina_stringshare_del(bw->action);
|
|
|
|
eina_stringshare_del(bw->params);
|
|
|
|
E_FREE(bw);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
eina_stringshare_del(cfdata->locals.cur);
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata->locals.cur = NULL;
|
|
|
|
|
|
|
|
e_widget_ilist_clear(cfdata->gui.o_binding_list);
|
|
|
|
e_widget_ilist_go(cfdata->gui.o_binding_list);
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.o_action_list);
|
|
|
|
e_widget_entry_clear(cfdata->gui.o_params);
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
|
|
|
|
|
|
|
_update_buttons(cfdata);
|
|
|
|
_update_binding_context(cfdata);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-08-23 05:49:11 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_delete_mouse_binding_cb(void *data, void *data2 EINA_UNUSED)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2006-10-23 13:43:11 -07:00
|
|
|
int sel, n;
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-08-23 05:49:11 -07:00
|
|
|
E_Config_Binding_Mouse *eb;
|
|
|
|
E_Config_Binding_Wheel *bw;
|
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata = data;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
sel = e_widget_ilist_selected_get(cfdata->gui.o_binding_list);
|
|
|
|
if (cfdata->locals.binding[0] == 'm')
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.binding, "m%d", &n);
|
|
|
|
l = eina_list_nth_list(cfdata->binding.mouse, n);
|
|
|
|
if (l)
|
|
|
|
{
|
|
|
|
eb = eina_list_data_get(l);
|
|
|
|
eina_stringshare_del(eb->action);
|
|
|
|
eina_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
|
|
|
|
|
|
|
cfdata->binding.mouse = eina_list_remove_list(cfdata->binding.mouse, l);
|
|
|
|
}
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
else if (cfdata->locals.binding[0] == 'w')
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.binding, "w%d", &n);
|
|
|
|
l = eina_list_nth_list(cfdata->binding.wheel, n);
|
|
|
|
if (l)
|
|
|
|
{
|
|
|
|
bw = eina_list_data_get(l);
|
|
|
|
eina_stringshare_del(bw->action);
|
|
|
|
eina_stringshare_del(bw->params);
|
|
|
|
E_FREE(bw);
|
|
|
|
|
|
|
|
cfdata->binding.wheel = eina_list_remove_list(cfdata->binding.wheel, l);
|
|
|
|
}
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
else
|
|
|
|
return;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
_update_mouse_binding_list(cfdata);
|
|
|
|
if (sel >= e_widget_ilist_count(cfdata->gui.o_binding_list))
|
|
|
|
sel = e_widget_ilist_count(cfdata->gui.o_binding_list) - 1;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
eina_stringshare_del(cfdata->locals.cur);
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata->locals.cur = NULL;
|
2009-03-11 08:13:42 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (!e_widget_ilist_count(cfdata->gui.o_binding_list))
|
2009-03-11 08:13:42 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
_update_binding_context(cfdata);
|
|
|
|
_update_buttons(cfdata);
|
|
|
|
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.o_action_list);
|
|
|
|
e_widget_entry_clear(cfdata->gui.o_params);
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
2012-06-08 02:48:19 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (e_widget_ilist_nth_is_header(cfdata->gui.o_binding_list, sel)) sel++;
|
|
|
|
e_widget_ilist_selected_set(cfdata->gui.o_binding_list, sel);
|
|
|
|
e_widget_ilist_nth_show(cfdata->gui.o_binding_list, sel, 0);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-08-23 05:49:11 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_restore_mouse_binding_defaults_cb(void *data, void *data2 EINA_UNUSED)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2013-02-01 04:27:07 -08:00
|
|
|
E_Config_Bindings *ecb;
|
|
|
|
Eina_Stringshare *prof;
|
|
|
|
E_Config_Dialog_Data *cfdata = data;
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2013-02-01 04:27:07 -08:00
|
|
|
ecb = e_config_domain_system_load("e_bindings", e_config_descriptor_find("E_Config_Bindings"));
|
|
|
|
if (!ecb)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2014-01-27 08:25:24 -08:00
|
|
|
const char *type;
|
|
|
|
|
2013-02-01 04:27:07 -08:00
|
|
|
prof = eina_stringshare_ref(e_config_profile_get());
|
2014-01-27 08:25:24 -08:00
|
|
|
switch (e_config->config_type)
|
|
|
|
{
|
|
|
|
case E_CONFIG_PROFILE_TYPE_DESKTOP:
|
|
|
|
type = "standard";
|
|
|
|
break;
|
|
|
|
case E_CONFIG_PROFILE_TYPE_MOBILE:
|
|
|
|
type = "mobile";
|
|
|
|
break;
|
|
|
|
//case E_CONFIG_PROFILE_TYPE_TABLET: FIXME - not used
|
|
|
|
default:
|
|
|
|
type = "default";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
e_config_profile_set(type);
|
2013-02-01 04:27:07 -08:00
|
|
|
ecb = e_config_domain_system_load("e_bindings", e_config_descriptor_find("E_Config_Bindings"));
|
|
|
|
e_config_profile_set(prof);
|
|
|
|
eina_stringshare_del(prof);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2013-02-01 04:27:07 -08:00
|
|
|
if (!ecb) return;
|
|
|
|
E_FREE_LIST(cfdata->binding.mouse, e_config_binding_mouse_free);
|
|
|
|
E_FREE_LIST(cfdata->binding.wheel, e_config_binding_wheel_free);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2013-02-01 04:27:07 -08:00
|
|
|
cfdata->binding.mouse = ecb->mouse_bindings, ecb->mouse_bindings = NULL;
|
|
|
|
cfdata->binding.wheel = ecb->wheel_bindings, ecb->wheel_bindings = NULL;
|
|
|
|
e_config_bindings_free(ecb);
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
eina_stringshare_del(cfdata->locals.cur);
|
2006-10-23 13:43:11 -07:00
|
|
|
cfdata->locals.cur = NULL;
|
|
|
|
|
|
|
|
_update_mouse_binding_list(cfdata);
|
|
|
|
_update_buttons(cfdata);
|
|
|
|
_update_binding_context(cfdata);
|
|
|
|
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.o_action_list);
|
|
|
|
e_widget_entry_clear(cfdata->gui.o_params);
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
|
|
|
|
/******************* Updates *****************/
|
2006-08-23 05:49:11 -07:00
|
|
|
static void
|
2006-10-23 13:43:11 -07:00
|
|
|
_update_action_list(E_Config_Dialog_Data *cfdata)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
|
|
|
E_Config_Binding_Mouse *eb;
|
|
|
|
E_Config_Binding_Wheel *bw;
|
2006-10-23 13:43:11 -07:00
|
|
|
const char *action, *params;
|
|
|
|
int j = -1, i, n;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
|
|
|
if (!cfdata->locals.cur) return;
|
|
|
|
|
|
|
|
if (cfdata->locals.cur[0] == 'm')
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.cur, "m%d", &n);
|
|
|
|
eb = eina_list_nth(cfdata->binding.mouse, n);
|
|
|
|
if (!eb)
|
|
|
|
{
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.o_action_list);
|
|
|
|
e_widget_entry_clear(cfdata->gui.o_params);
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
action = eb->action;
|
|
|
|
params = eb->params;
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
else if (cfdata->locals.cur[0] == 'w')
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.cur, "w%d", &n);
|
|
|
|
bw = eina_list_nth(cfdata->binding.wheel, n);
|
|
|
|
if (!bw)
|
|
|
|
{
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.o_action_list);
|
|
|
|
e_widget_entry_clear(cfdata->gui.o_params);
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
action = bw->action;
|
|
|
|
params = bw->params;
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
else
|
|
|
|
return;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
_find_key_binding_action(action, params, NULL, NULL, &j);
|
|
|
|
if (j >= 0)
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
for (i = 0; i < e_widget_ilist_count(cfdata->gui.o_action_list); i++)
|
|
|
|
{
|
|
|
|
if (i > j) break;
|
|
|
|
if (e_widget_ilist_nth_is_header(cfdata->gui.o_action_list, i)) j++;
|
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if (j == e_widget_ilist_selected_get(cfdata->gui.o_action_list))
|
|
|
|
_update_action_params(cfdata);
|
|
|
|
else
|
|
|
|
e_widget_ilist_selected_set(cfdata->gui.o_action_list, j);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
e_widget_ilist_unselect(cfdata->gui.o_action_list);
|
|
|
|
eina_stringshare_del(cfdata->locals.action);
|
|
|
|
cfdata->locals.action = eina_stringshare_add("");
|
|
|
|
e_widget_entry_clear(cfdata->gui.o_params);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
static void
|
2006-10-23 13:43:11 -07:00
|
|
|
_update_mouse_binding_list(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
char *icon = NULL, *button, *mods;
|
2017-08-03 22:58:33 -07:00
|
|
|
char label[1024], val[16];
|
2009-03-11 08:13:42 -07:00
|
|
|
int i = 0;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2006-08-30 21:16:43 -07:00
|
|
|
E_Config_Binding_Mouse *eb;
|
|
|
|
E_Config_Binding_Wheel *bw;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-11-27 08:05:37 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get(cfdata->gui.o_binding_list));
|
|
|
|
edje_freeze();
|
|
|
|
e_widget_ilist_freeze(cfdata->gui.o_binding_list);
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_ilist_clear(cfdata->gui.o_binding_list);
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
if (cfdata->binding.mouse)
|
|
|
|
{
|
|
|
|
cfdata->binding.mouse = eina_list_sort(cfdata->binding.mouse,
|
|
|
|
eina_list_count(cfdata->binding.mouse), _mouse_binding_sort_cb);
|
|
|
|
|
2012-10-25 10:47:03 -07:00
|
|
|
e_widget_ilist_header_append(cfdata->gui.o_binding_list, NULL, _("Mouse Buttons"));
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FOREACH(cfdata->binding.mouse, l, eb)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
Evas_Object *ic;
|
|
|
|
|
|
|
|
button = _helper_button_name_get(eb);
|
|
|
|
mods = _helper_modifier_name_get(eb->modifiers);
|
|
|
|
|
|
|
|
if (mods && mods[0])
|
|
|
|
snprintf(label, sizeof(label), "%s + %s", button ? button : "", mods);
|
|
|
|
else
|
|
|
|
snprintf(label, sizeof(label), "%s", button ? button : "");
|
2012-12-21 13:31:13 -08:00
|
|
|
free(button);
|
|
|
|
free(mods);
|
2012-06-08 02:48:19 -07:00
|
|
|
|
|
|
|
switch (eb->button)
|
|
|
|
{
|
|
|
|
case 1:
|
2012-12-16 11:55:10 -08:00
|
|
|
if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
|
|
|
|
icon = "preferences-desktop-mouse-left";
|
|
|
|
else if (e_config->mouse_hand == E_MOUSE_HAND_LEFT)
|
|
|
|
icon = "preferences-desktop-mouse-right";
|
|
|
|
else
|
|
|
|
icon = "preferences-desktop-mouse-extra";
|
2012-06-08 02:48:19 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
icon = "preferences-desktop-mouse-middle";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2012-12-16 11:55:10 -08:00
|
|
|
if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
|
|
|
|
icon = "preferences-desktop-mouse-right";
|
|
|
|
else if (e_config->mouse_hand == E_MOUSE_HAND_LEFT)
|
|
|
|
icon = "preferences-desktop-mouse-left";
|
|
|
|
else
|
|
|
|
icon = "preferences-desktop-mouse-extra";
|
2012-06-08 02:48:19 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
icon = "preferences-desktop-mouse-extra";
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(val, sizeof(val), "m%d", i);
|
|
|
|
|
|
|
|
ic = e_icon_add(cfdata->evas);
|
|
|
|
e_util_icon_theme_set(ic, icon);
|
|
|
|
e_widget_ilist_append(cfdata->gui.o_binding_list, ic, label, _binding_change_cb,
|
|
|
|
cfdata, val);
|
|
|
|
|
|
|
|
i++;
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
if (cfdata->binding.wheel)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
cfdata->binding.wheel = eina_list_sort(cfdata->binding.wheel,
|
|
|
|
eina_list_count(cfdata->binding.wheel), _wheel_binding_sort_cb);
|
|
|
|
|
2012-10-25 10:47:03 -07:00
|
|
|
e_widget_ilist_header_append(cfdata->gui.o_binding_list, NULL, _("Mouse Wheels"));
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
i = 0;
|
|
|
|
EINA_LIST_FOREACH(cfdata->binding.wheel, l, bw)
|
2006-10-23 13:43:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
Evas_Object *ic;
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
button = _helper_wheel_name_get(bw);
|
|
|
|
mods = _helper_modifier_name_get(bw->modifiers);
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
if (mods && mods[0])
|
|
|
|
snprintf(label, sizeof(label), "%s + %s", button ? button : "", mods);
|
|
|
|
else
|
|
|
|
snprintf(label, sizeof(label), "%s", button ? button : "");
|
2012-12-21 13:31:13 -08:00
|
|
|
free(button);
|
|
|
|
free(mods);
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
snprintf(val, sizeof(val), "w%d", i);
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
ic = e_icon_add(cfdata->evas);
|
|
|
|
e_util_icon_theme_set(ic, "preferences-desktop-mouse-wheel");
|
|
|
|
e_widget_ilist_append(cfdata->gui.o_binding_list, ic, label, _binding_change_cb,
|
|
|
|
cfdata, val);
|
2009-03-11 08:13:42 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
i++;
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
|
|
|
|
e_widget_ilist_go(cfdata->gui.o_binding_list);
|
2006-11-27 08:05:37 -08:00
|
|
|
e_widget_ilist_thaw(cfdata->gui.o_binding_list);
|
|
|
|
edje_thaw();
|
|
|
|
evas_event_thaw(evas_object_evas_get(cfdata->gui.o_binding_list));
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2008-10-22 04:49:33 -07:00
|
|
|
if (eina_list_count(cfdata->binding.mouse) + eina_list_count(cfdata->binding.wheel))
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.o_del_all, 0);
|
2006-08-30 21:16:43 -07:00
|
|
|
else
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.o_del_all, 1);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-08-23 05:49:11 -07:00
|
|
|
static void
|
2006-10-23 13:43:11 -07:00
|
|
|
_update_action_params(E_Config_Dialog_Data *cfdata)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-10-23 13:43:11 -07:00
|
|
|
int g, a, b;
|
|
|
|
E_Action_Group *actg;
|
|
|
|
E_Action_Description *actd;
|
2006-08-30 21:16:43 -07:00
|
|
|
E_Config_Binding_Mouse *eb;
|
|
|
|
E_Config_Binding_Wheel *bw;
|
2006-10-23 13:43:11 -07:00
|
|
|
const char *action, *params;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
#define MB_EXAMPLE_PARAMS \
|
|
|
|
if ((!actd->param_example) || (!actd->param_example[0])) \
|
|
|
|
e_widget_entry_text_set(cfdata->gui.o_params, TEXT_NO_PARAMS); \
|
|
|
|
else \
|
|
|
|
e_widget_entry_text_set(cfdata->gui.o_params, actd->param_example)
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if ((!cfdata->locals.action) || (!cfdata->locals.action[0]))
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
|
|
|
e_widget_entry_clear(cfdata->gui.o_params);
|
2014-03-13 10:06:08 -07:00
|
|
|
return;
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
sscanf(cfdata->locals.action, "%d %d", &g, &a);
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2008-10-22 04:49:33 -07:00
|
|
|
actg = eina_list_nth(e_action_groups_get(), g);
|
2006-10-23 13:43:11 -07:00
|
|
|
if (!actg) return;
|
2008-10-22 04:49:33 -07:00
|
|
|
actd = eina_list_nth(actg->acts, a);
|
2006-10-23 13:43:11 -07:00
|
|
|
if (!actd) return;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (actd->act_params)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
|
|
|
e_widget_entry_text_set(cfdata->gui.o_params, actd->act_params);
|
|
|
|
return;
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((!cfdata->locals.cur) || (!cfdata->locals.cur[0]))
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
|
|
|
MB_EXAMPLE_PARAMS;
|
|
|
|
return;
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (!actd->editable)
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
|
|
|
else
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 0);
|
|
|
|
|
|
|
|
if (cfdata->locals.cur[0] == 'm')
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.cur, "m%d", &b);
|
|
|
|
eb = eina_list_nth(cfdata->binding.mouse, b);
|
|
|
|
if (!eb)
|
|
|
|
{
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
|
|
|
MB_EXAMPLE_PARAMS;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
action = eb->action;
|
|
|
|
params = eb->params;
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2006-12-14 07:36:09 -08:00
|
|
|
else if (cfdata->locals.cur[0] == 'w')
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.cur, "w%d", &b);
|
|
|
|
bw = eina_list_nth(cfdata->binding.wheel, b);
|
|
|
|
if (!bw)
|
|
|
|
{
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
|
|
|
MB_EXAMPLE_PARAMS;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
action = bw->action;
|
|
|
|
params = bw->params;
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
else
|
2012-06-08 02:48:19 -07:00
|
|
|
{
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
2006-10-23 13:43:11 -07:00
|
|
|
MB_EXAMPLE_PARAMS;
|
2012-06-08 02:48:19 -07:00
|
|
|
return;
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (action)
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if (!strcmp(action, actd->act_cmd))
|
|
|
|
{
|
|
|
|
if ((!params) || (!params[0]))
|
|
|
|
MB_EXAMPLE_PARAMS;
|
|
|
|
else
|
|
|
|
e_widget_entry_text_set(cfdata->gui.o_params, params);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
MB_EXAMPLE_PARAMS;
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
else
|
2006-12-10 07:35:13 -08:00
|
|
|
MB_EXAMPLE_PARAMS;
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-10-23 13:43:11 -07:00
|
|
|
_update_buttons(E_Config_Dialog_Data *cfdata)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-10-23 13:43:11 -07:00
|
|
|
if (e_widget_ilist_count(cfdata->gui.o_binding_list))
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_del_all, 0);
|
|
|
|
else
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_del_all, 1);
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (!cfdata->locals.cur)
|
2012-06-08 02:48:19 -07:00
|
|
|
{
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_mod, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_del, 1);
|
|
|
|
return;
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.o_mod, 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_del, 0);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
static void
|
2006-10-23 13:43:11 -07:00
|
|
|
_update_binding_context(E_Config_Dialog_Data *cfdata)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2006-10-23 13:43:11 -07:00
|
|
|
int n;
|
2006-08-30 21:16:43 -07:00
|
|
|
E_Config_Binding_Mouse *eb;
|
|
|
|
E_Config_Binding_Wheel *bw;
|
2006-10-23 13:43:11 -07:00
|
|
|
E_Binding_Context ctxt;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2007-03-25 15:45:00 -07:00
|
|
|
/* disable all the radios. */
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_any, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_any, 1);
|
2012-06-08 02:47:09 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_window, 1);
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_menu, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_winlist, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_popup, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_zone, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_container, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_manager, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_none, 1);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (!cfdata->locals.cur) return;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (cfdata->locals.cur[0] == 'm')
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.cur, "m%d", &n);
|
|
|
|
eb = eina_list_nth(cfdata->binding.mouse, n);
|
|
|
|
if (!eb) return;
|
|
|
|
ctxt = eb->context;
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
else if (cfdata->locals.cur[0] == 'w')
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.cur, "w%d", &n);
|
|
|
|
bw = eina_list_nth(cfdata->binding.wheel, n);
|
|
|
|
if (!bw) return;
|
|
|
|
ctxt = bw->context;
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
else
|
|
|
|
return;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_any, 0);
|
2012-06-08 02:47:09 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_window, 0);
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_menu, 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_winlist, 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_popup, 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_zone, 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_container, 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_manager, 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.context.o_none, 0);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
if (ctxt == E_BINDING_CONTEXT_ANY)
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_any, 1);
|
2012-06-08 03:10:16 -07:00
|
|
|
else if (ctxt == E_BINDING_CONTEXT_WINDOW)
|
2012-06-08 02:47:09 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_window, 1);
|
2006-10-23 13:43:11 -07:00
|
|
|
else if (ctxt == E_BINDING_CONTEXT_MENU)
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_menu, 1);
|
|
|
|
else if (ctxt == E_BINDING_CONTEXT_WINLIST)
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_winlist, 1);
|
|
|
|
else if (ctxt == E_BINDING_CONTEXT_POPUP)
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_popup, 1);
|
|
|
|
else if (ctxt == E_BINDING_CONTEXT_ZONE)
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_zone, 1);
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
else if (ctxt == E_BINDING_CONTEXT_COMPOSITOR)
|
2006-10-23 13:43:11 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_container, 1);
|
|
|
|
else if (ctxt == E_BINDING_CONTEXT_MANAGER)
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_manager, 1);
|
|
|
|
else if (ctxt == E_BINDING_CONTEXT_NONE)
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.context.o_none, 1);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
/****************** Helper *****************/
|
2006-08-23 05:49:11 -07:00
|
|
|
static void
|
2006-10-23 13:43:11 -07:00
|
|
|
_auto_apply_changes(E_Config_Dialog_Data *cfdata)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-10-23 13:43:11 -07:00
|
|
|
int n, g, a;
|
2007-09-13 14:13:39 -07:00
|
|
|
E_Config_Binding_Mouse *eb = NULL;
|
|
|
|
E_Config_Binding_Wheel *bw = NULL;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
E_Action_Group *actg;
|
|
|
|
E_Action_Description *actd;
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
const char **action = NULL, **params = NULL;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if ((!cfdata->locals.cur) || (!cfdata->locals.cur[0])) return;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (cfdata->locals.cur[0] == 'm')
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.cur, "m%d", &n);
|
|
|
|
eb = eina_list_nth(cfdata->binding.mouse, n);
|
|
|
|
if (!eb) return;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
eb->context = cfdata->locals.context;
|
|
|
|
action = &(eb->action);
|
|
|
|
params = &(eb->params);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
else if (cfdata->locals.cur[0] == 'w')
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
sscanf(cfdata->locals.cur, "w%d", &n);
|
|
|
|
bw = eina_list_nth(cfdata->binding.wheel, n);
|
|
|
|
if (!bw) return;
|
|
|
|
|
|
|
|
bw->context = cfdata->locals.context;
|
|
|
|
action = &(bw->action);
|
|
|
|
params = &(bw->params);
|
|
|
|
}
|
2011-11-07 14:50:54 -08:00
|
|
|
else return;
|
2012-06-08 02:48:19 -07:00
|
|
|
|
|
|
|
if (action && *action) eina_stringshare_del(*action);
|
|
|
|
if (params && *params) eina_stringshare_del(*params);
|
|
|
|
if (action) *action = NULL;
|
2011-01-15 17:33:00 -08:00
|
|
|
if (params) *params = NULL;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if ((!cfdata->locals.action) || (!cfdata->locals.action[0])) return;
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
sscanf(cfdata->locals.action, "%d %d", &g, &a);
|
2006-08-23 05:49:11 -07:00
|
|
|
|
2008-10-22 04:49:33 -07:00
|
|
|
actg = eina_list_nth(e_action_groups_get(), g);
|
2006-10-23 13:43:11 -07:00
|
|
|
if (!actg) return;
|
2008-10-22 04:49:33 -07:00
|
|
|
actd = eina_list_nth(actg->acts, a);
|
2006-10-23 13:43:11 -07:00
|
|
|
if (!actd) return;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2008-10-15 08:12:56 -07:00
|
|
|
if (actd->act_cmd) *action = eina_stringshare_add(actd->act_cmd);
|
2012-06-08 02:48:19 -07:00
|
|
|
if (actd->act_params)
|
2008-10-15 08:12:56 -07:00
|
|
|
*params = eina_stringshare_add(actd->act_params);
|
2006-08-30 21:16:43 -07:00
|
|
|
else
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
int ok = 1;
|
|
|
|
if (cfdata->locals.params)
|
|
|
|
{
|
|
|
|
if (!strcmp(cfdata->locals.params, TEXT_NO_PARAMS)) ok = 0;
|
|
|
|
|
|
|
|
if ((actd->param_example) && (!strcmp(cfdata->locals.params, actd->param_example)))
|
|
|
|
ok = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ok = 0;
|
|
|
|
|
|
|
|
if (ok)
|
|
|
|
*params = eina_stringshare_add(cfdata->locals.params);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
static void
|
|
|
|
_find_key_binding_action(const char *action, const char *params, int *g, int *a, int *n)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l, *l2;
|
2006-10-23 13:43:11 -07:00
|
|
|
int gg = -1, aa = -1, nn = -1, found;
|
|
|
|
E_Action_Group *actg;
|
|
|
|
E_Action_Description *actd;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (g) *g = -1;
|
|
|
|
if (a) *a = -1;
|
|
|
|
if (n) *n = -1;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
found = 0;
|
|
|
|
for (l = e_action_groups_get(), gg = 0, nn = 0; l; l = l->next, gg++)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
actg = l->data;
|
|
|
|
|
|
|
|
for (l2 = actg->acts, aa = 0; l2; l2 = l2->next, aa++)
|
|
|
|
{
|
|
|
|
actd = l2->data;
|
|
|
|
|
|
|
|
if (!strcmp((!action ? "" : action), (!actd->act_cmd ? "" : actd->act_cmd)))
|
|
|
|
{
|
|
|
|
if (!params || !params[0])
|
|
|
|
{
|
|
|
|
if ((!actd->act_params) || (!actd->act_params[0]))
|
|
|
|
{
|
|
|
|
if (g) *g = gg;
|
|
|
|
if (a) *a = aa;
|
|
|
|
if (n) *n = nn;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((!actd->act_params) || (!actd->act_params[0]))
|
|
|
|
{
|
|
|
|
if (g) *g = gg;
|
|
|
|
if (a) *a = aa;
|
|
|
|
if (n) *n = nn;
|
|
|
|
found = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!strcmp(params, actd->act_params))
|
|
|
|
{
|
|
|
|
if (g) *g = gg;
|
|
|
|
if (a) *a = aa;
|
|
|
|
if (n) *n = nn;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nn++;
|
|
|
|
}
|
|
|
|
if (found) break;
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (!found)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if (g) *g = -1;
|
|
|
|
if (a) *a = -1;
|
|
|
|
if (n) *n = -1;
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
static char *
|
|
|
|
_helper_button_name_get(E_Config_Binding_Mouse *eb)
|
|
|
|
{
|
|
|
|
char *name = NULL;
|
2012-12-16 11:55:10 -08:00
|
|
|
char buf[1024];
|
2006-08-30 21:16:43 -07:00
|
|
|
|
|
|
|
switch (eb->button)
|
2012-06-08 02:48:19 -07:00
|
|
|
{
|
2006-08-30 21:16:43 -07:00
|
|
|
case 1:
|
2012-12-16 11:55:10 -08:00
|
|
|
if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
|
|
|
|
name = strdup(_("Left button"));
|
|
|
|
else if (e_config->mouse_hand == E_MOUSE_HAND_LEFT)
|
|
|
|
name = strdup(_("Right button"));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), _("Button %i"), eb->button);
|
|
|
|
name = strdup(buf);
|
|
|
|
}
|
2012-06-08 02:48:19 -07:00
|
|
|
break;
|
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
case 2:
|
2012-12-16 11:55:10 -08:00
|
|
|
name = strdup(_("Middle button"));
|
2012-06-08 02:48:19 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2012-12-16 11:55:10 -08:00
|
|
|
if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
|
|
|
|
name = strdup(_("Right button"));
|
|
|
|
else if (e_config->mouse_hand == E_MOUSE_HAND_LEFT)
|
|
|
|
name = strdup(_("Left button"));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), _("Button %i"), eb->button);
|
|
|
|
name = strdup(buf);
|
|
|
|
}
|
2012-06-08 02:48:19 -07:00
|
|
|
break;
|
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
2012-06-08 02:48:19 -07:00
|
|
|
break;
|
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
default:
|
2012-12-16 11:55:10 -08:00
|
|
|
snprintf(buf, sizeof(buf), _("Extra button (%d)"), eb->button);
|
2012-06-08 02:48:19 -07:00
|
|
|
name = strdup(buf);
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
|
|
|
return name;
|
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
static char *
|
|
|
|
_helper_wheel_name_get(E_Config_Binding_Wheel *bw)
|
|
|
|
{
|
|
|
|
char *name = NULL;
|
|
|
|
char buf[1024] = "";
|
|
|
|
|
|
|
|
switch (bw->direction)
|
2006-08-23 05:49:11 -07:00
|
|
|
{
|
2006-08-30 21:16:43 -07:00
|
|
|
case 0:
|
2012-06-08 04:18:52 -07:00
|
|
|
if (bw->z < 0)
|
2012-10-25 10:47:03 -07:00
|
|
|
name = strdup(_("Mouse Wheel Up"));
|
2012-06-08 04:18:52 -07:00
|
|
|
else
|
2012-10-25 10:47:03 -07:00
|
|
|
name = strdup(_("Mouse Wheel Down"));
|
2012-06-08 04:18:52 -07:00
|
|
|
break;
|
2006-08-30 21:16:43 -07:00
|
|
|
default:
|
2012-06-08 04:18:52 -07:00
|
|
|
if (bw->z < 0)
|
2012-10-25 10:47:03 -07:00
|
|
|
snprintf(buf, sizeof(buf), _("Extra Wheel (%d) Up"), bw->direction);
|
2012-06-08 04:18:52 -07:00
|
|
|
else
|
2012-10-25 10:47:03 -07:00
|
|
|
snprintf(buf, sizeof(buf), _("Extra Wheel (%d) Down"), bw->direction);
|
2012-06-08 04:18:52 -07:00
|
|
|
name = strdup(buf);
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-08-30 21:16:43 -07:00
|
|
|
return name;
|
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
|
|
|
|
static char *
|
|
|
|
_helper_modifier_name_get(int mod)
|
|
|
|
{
|
2010-01-15 11:36:00 -08:00
|
|
|
char mods[1024] = "";
|
2006-10-23 13:43:11 -07:00
|
|
|
|
|
|
|
if (mod & E_BINDING_MODIFIER_SHIFT)
|
|
|
|
snprintf(mods, sizeof(mods), "SHIFT");
|
|
|
|
|
|
|
|
if (mod & E_BINDING_MODIFIER_CTRL)
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if (mods[0]) strcat(mods, " + ");
|
|
|
|
strcat(mods, "CTRL");
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mod & E_BINDING_MODIFIER_ALT)
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if (mods[0]) strcat(mods, " + ");
|
|
|
|
strcat(mods, "ALT");
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mod & E_BINDING_MODIFIER_WIN)
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if (mods[0]) strcat(mods, " + ");
|
|
|
|
strcat(mods, "WIN");
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return strdup(mods);
|
|
|
|
}
|
|
|
|
|
|
|
|
/********* Sorting ***************/
|
2006-08-30 21:16:43 -07:00
|
|
|
static int
|
2008-10-27 03:46:43 -07:00
|
|
|
_mouse_binding_sort_cb(const void *d1, const void *d2)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2008-10-27 03:46:43 -07:00
|
|
|
const E_Config_Binding_Mouse *eb, *eb2;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
|
|
|
eb = d1;
|
|
|
|
eb2 = d2;
|
|
|
|
|
|
|
|
if (eb->button < eb2->button) return -1;
|
2012-06-08 02:48:19 -07:00
|
|
|
else if (eb->button > eb2->button)
|
|
|
|
return 1;
|
2006-08-23 05:49:11 -07:00
|
|
|
else
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if (eb->modifiers < eb2->modifiers) return -1;
|
|
|
|
else if (eb->modifiers > eb2->modifiers)
|
|
|
|
return 1;
|
2006-08-30 21:16:43 -07:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2006-12-10 07:35:13 -08:00
|
|
|
|
2006-08-30 21:16:43 -07:00
|
|
|
static int
|
2008-10-27 03:46:43 -07:00
|
|
|
_wheel_binding_sort_cb(const void *d1, const void *d2)
|
2006-08-30 21:16:43 -07:00
|
|
|
{
|
2008-10-27 03:46:43 -07:00
|
|
|
const E_Config_Binding_Wheel *bw, *bw2;
|
2006-08-30 21:16:43 -07:00
|
|
|
|
|
|
|
bw = d1;
|
|
|
|
bw2 = d2;
|
|
|
|
|
2006-12-10 07:35:13 -08:00
|
|
|
if (bw->direction < bw2->direction) return -1;
|
2012-06-08 02:48:19 -07:00
|
|
|
else if (bw->direction > bw2->direction)
|
|
|
|
return 1;
|
2006-08-30 21:16:43 -07:00
|
|
|
else
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if ((bw->z < 0) && (bw2->z > 0)) return 1;
|
|
|
|
else if ((bw->z > 0) && (bw2->z < 0))
|
|
|
|
return -1;
|
|
|
|
else if (((bw->z < 0) && (bw2->z < 0)) ||
|
|
|
|
((bw->z > 0) && (bw2->z > 0)))
|
|
|
|
{
|
|
|
|
if (bw->modifiers < bw2->modifiers) return -1;
|
|
|
|
else if (bw->modifiers > bw2->modifiers)
|
|
|
|
return 1;
|
|
|
|
}
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-08-30 21:16:43 -07:00
|
|
|
return 0;
|
2006-08-23 05:49:11 -07:00
|
|
|
}
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-08-20 01:36:43 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
static void
|
2012-08-20 01:36:43 -07:00
|
|
|
_grab_wnd_hide(void *data)
|
2006-10-23 13:43:11 -07:00
|
|
|
{
|
2012-08-20 01:36:43 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-08-20 01:36:43 -07:00
|
|
|
cfdata = e_object_data_get(data);
|
|
|
|
cfdata->locals.eg = NULL;
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-20 01:36:43 -07:00
|
|
|
_grab_wnd_show(E_Config_Dialog_Data *cfdata)
|
2006-10-23 13:43:11 -07:00
|
|
|
{
|
2012-08-20 01:36:43 -07:00
|
|
|
if (cfdata->locals.eg) return;
|
|
|
|
cfdata->locals.eg = e_grab_dialog_show(cfdata->cfd->dia->win, EINA_TRUE, NULL, _grab_mouse_down_cb, _grab_mouse_wheel_cb, cfdata);
|
|
|
|
e_object_data_set(E_OBJECT(cfdata->locals.eg), cfdata);
|
|
|
|
e_object_del_attach_func_set(E_OBJECT(cfdata->locals.eg), _grab_wnd_hide);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_grab_mouse_down_cb(void *data, EINA_UNUSED int type, void *event)
|
2006-10-23 13:43:11 -07:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2006-10-23 13:43:11 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
E_Config_Binding_Mouse *eb = NULL;
|
2006-10-23 13:43:11 -07:00
|
|
|
E_Config_Binding_Wheel *bw;
|
|
|
|
int mod = E_BINDING_MODIFIER_NONE, n;
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Mouse_Button *ev;
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
ev = event;
|
|
|
|
cfdata = data;
|
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
2006-10-23 13:43:11 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_SHIFT;
|
2009-03-16 09:24:43 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
|
2006-10-23 13:43:11 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_CTRL;
|
2009-03-16 09:24:43 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)
|
2006-10-23 13:43:11 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_ALT;
|
2009-03-16 09:24:43 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN)
|
2012-06-08 02:48:19 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_WIN;
|
|
|
|
|
|
|
|
if (cfdata->locals.add)
|
|
|
|
{
|
|
|
|
eb = E_NEW(E_Config_Binding_Mouse, 1);
|
|
|
|
eb->context = E_BINDING_CONTEXT_ANY;
|
|
|
|
eb->button = ev->buttons;
|
|
|
|
eb->modifiers = mod;
|
|
|
|
eb->any_mod = 0;
|
|
|
|
eb->action = NULL;
|
|
|
|
eb->params = NULL;
|
|
|
|
|
|
|
|
cfdata->binding.mouse = eina_list_append(cfdata->binding.mouse, eb);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if (cfdata->locals.cur[0] == 'm')
|
|
|
|
{
|
|
|
|
sscanf(cfdata->locals.cur, "m%d", &n);
|
|
|
|
eb = eina_list_nth(cfdata->binding.mouse, n);
|
|
|
|
if (eb)
|
|
|
|
{
|
|
|
|
eb->button = ev->buttons;
|
|
|
|
eb->modifiers = mod;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (cfdata->locals.cur[0] == 'w')
|
|
|
|
{
|
|
|
|
sscanf(cfdata->locals.cur, "w%d", &n);
|
|
|
|
l = eina_list_nth_list(cfdata->binding.wheel, n);
|
|
|
|
bw = eina_list_data_get(l);
|
|
|
|
|
|
|
|
eb = E_NEW(E_Config_Binding_Mouse, 1);
|
|
|
|
eb->context = bw->context;
|
|
|
|
eb->button = ev->buttons;
|
|
|
|
eb->modifiers = mod;
|
|
|
|
eb->any_mod = 0;
|
|
|
|
eb->action = bw->action;
|
|
|
|
eb->params = bw->params;
|
|
|
|
|
|
|
|
cfdata->binding.mouse = eina_list_append(cfdata->binding.mouse, eb);
|
|
|
|
|
|
|
|
bw->action = NULL;
|
|
|
|
bw->params = NULL;
|
|
|
|
E_FREE(bw);
|
|
|
|
cfdata->binding.wheel = eina_list_remove_list(cfdata->binding.wheel, l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_update_mouse_binding_list(cfdata);
|
2006-10-23 13:43:11 -07:00
|
|
|
|
|
|
|
if (cfdata->locals.add)
|
2012-06-08 02:48:19 -07:00
|
|
|
{
|
|
|
|
for (l = cfdata->binding.mouse, n = 0; l; l = l->next, n++)
|
|
|
|
if (l->data == eb) break;
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
e_widget_ilist_selected_set(cfdata->gui.o_binding_list, n + 1);
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
eina_stringshare_del(cfdata->locals.action);
|
|
|
|
cfdata->locals.action = eina_stringshare_add("");
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.o_action_list);
|
|
|
|
e_widget_entry_clear(cfdata->gui.o_params);
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
else
|
2012-06-08 02:48:19 -07:00
|
|
|
{
|
|
|
|
for (l = cfdata->binding.mouse, n = 0; l; l = l->next, n++)
|
|
|
|
if (l->data == eb) break;
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
eina_stringshare_del(cfdata->locals.cur);
|
|
|
|
cfdata->locals.cur = NULL;
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2012-06-08 02:48:19 -07:00
|
|
|
e_widget_ilist_selected_set(cfdata->gui.o_binding_list, n + 1);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
_update_buttons(cfdata);
|
2012-08-20 01:36:43 -07:00
|
|
|
e_object_del(E_OBJECT(cfdata->locals.eg));
|
2006-10-23 13:43:11 -07:00
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_grab_mouse_wheel_cb(void *data, int type EINA_UNUSED, void *event)
|
2006-10-23 13:43:11 -07:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2007-09-13 14:13:39 -07:00
|
|
|
E_Config_Binding_Wheel *bw = NULL;
|
|
|
|
E_Config_Binding_Mouse *eb = NULL;
|
2006-10-23 13:43:11 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
2012-06-08 02:48:19 -07:00
|
|
|
Ecore_Event_Mouse_Wheel *ev;
|
2006-10-23 13:43:11 -07:00
|
|
|
int mod = E_BINDING_MODIFIER_NONE, n;
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
cfdata = data;
|
|
|
|
|
2009-03-16 09:24:43 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
2006-10-23 13:43:11 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_SHIFT;
|
2009-03-16 09:24:43 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
|
2006-10-23 13:43:11 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_CTRL;
|
2009-03-16 09:24:43 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)
|
2006-10-23 13:43:11 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_ALT;
|
2009-03-16 09:24:43 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN)
|
2012-06-08 04:18:52 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_WIN;
|
2012-06-08 02:48:19 -07:00
|
|
|
|
2006-10-23 13:43:11 -07:00
|
|
|
if (cfdata->locals.add)
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
bw = E_NEW(E_Config_Binding_Wheel, 1);
|
|
|
|
bw->context = E_BINDING_CONTEXT_ANY;
|
|
|
|
bw->direction = ev->direction;
|
|
|
|
bw->z = ev->z;
|
|
|
|
bw->modifiers = mod;
|
|
|
|
bw->any_mod = 0;
|
|
|
|
bw->action = NULL;
|
|
|
|
bw->params = NULL;
|
|
|
|
|
|
|
|
cfdata->binding.wheel = eina_list_append(cfdata->binding.wheel, bw);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
2012-06-08 02:48:19 -07:00
|
|
|
else
|
2006-10-23 13:43:11 -07:00
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
if (cfdata->locals.cur[0] == 'm')
|
|
|
|
{
|
|
|
|
sscanf(cfdata->locals.cur, "m%d", &n);
|
|
|
|
l = eina_list_nth_list(cfdata->binding.mouse, n);
|
|
|
|
eb = eina_list_data_get(l);
|
|
|
|
|
|
|
|
bw = E_NEW(E_Config_Binding_Wheel, 1);
|
|
|
|
bw->context = eb->context;
|
|
|
|
bw->direction = ev->direction;
|
|
|
|
bw->z = ev->z;
|
|
|
|
bw->modifiers = mod;
|
|
|
|
bw->any_mod = 0;
|
|
|
|
bw->action = eb->action;
|
|
|
|
bw->params = eb->params;
|
|
|
|
|
|
|
|
cfdata->binding.wheel = eina_list_append(cfdata->binding.wheel, bw);
|
|
|
|
|
|
|
|
E_FREE(eb);
|
|
|
|
cfdata->binding.mouse = eina_list_remove_list(cfdata->binding.mouse, l);
|
|
|
|
}
|
|
|
|
else if (cfdata->locals.cur[0] == 'w')
|
|
|
|
{
|
|
|
|
sscanf(cfdata->locals.cur, "w%d", &n);
|
|
|
|
bw = eina_list_nth(cfdata->binding.wheel, n);
|
|
|
|
if (bw)
|
|
|
|
{
|
|
|
|
bw->direction = ev->direction;
|
|
|
|
bw->z = ev->z;
|
|
|
|
bw->modifiers = mod;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_update_mouse_binding_list(cfdata);
|
2006-10-23 13:43:11 -07:00
|
|
|
|
|
|
|
if (cfdata->locals.add)
|
2012-06-08 02:48:19 -07:00
|
|
|
{
|
|
|
|
for (l = cfdata->binding.wheel, n = 0; l; l = l->next, n++)
|
|
|
|
if (l->data == bw) break;
|
|
|
|
|
|
|
|
if (eina_list_count(cfdata->binding.mouse))
|
|
|
|
{
|
|
|
|
n += eina_list_count(cfdata->binding.mouse) + 2;
|
|
|
|
e_widget_ilist_selected_set(cfdata->gui.o_binding_list, n);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e_widget_ilist_selected_set(cfdata->gui.o_binding_list, n + 1);
|
|
|
|
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.o_action_list);
|
|
|
|
eina_stringshare_del(cfdata->locals.action);
|
|
|
|
cfdata->locals.action = eina_stringshare_add("");
|
|
|
|
e_widget_entry_clear(cfdata->gui.o_params);
|
|
|
|
e_widget_disabled_set(cfdata->gui.o_params, 1);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-08 02:48:19 -07:00
|
|
|
for (l = cfdata->binding.wheel, n = 0; l; l = l->next, n++)
|
|
|
|
if (l->data == bw) break;
|
|
|
|
|
|
|
|
eina_stringshare_del(cfdata->locals.cur);
|
|
|
|
cfdata->locals.cur = NULL;
|
|
|
|
|
|
|
|
if (eina_list_count(cfdata->binding.mouse))
|
|
|
|
{
|
|
|
|
n += eina_list_count(cfdata->binding.mouse) + 2;
|
|
|
|
e_widget_ilist_selected_set(cfdata->gui.o_binding_list, n);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e_widget_ilist_selected_set(cfdata->gui.o_binding_list, n + 1);
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|
|
|
|
_update_buttons(cfdata);
|
|
|
|
|
2012-08-20 01:36:43 -07:00
|
|
|
e_object_del(E_OBJECT(cfdata->locals.eg));
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2006-10-23 13:43:11 -07:00
|
|
|
}
|