2007-03-19 18:08:38 -07:00
|
|
|
#include "e.h"
|
|
|
|
|
|
|
|
static void *_create_data(E_Config_Dialog *cfd);
|
|
|
|
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2010-08-19 11:39:19 -07:00
|
|
|
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 _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2007-03-19 18:08:38 -07:00
|
|
|
|
|
|
|
struct _E_Config_Dialog_Data
|
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
2009-08-15 16:53:23 -07:00
|
|
|
|
2012-07-08 05:18:32 -07:00
|
|
|
int show_cursor;
|
|
|
|
int idle_cursor;
|
|
|
|
int use_e_cursor;
|
|
|
|
int cursor_size;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Object *idle_cursor;
|
|
|
|
} gui;
|
|
|
|
|
2008-09-19 19:23:51 -07:00
|
|
|
int mouse_hand;
|
2007-03-19 18:08:38 -07:00
|
|
|
double numerator;
|
|
|
|
double denominator;
|
|
|
|
double threshold;
|
|
|
|
};
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
E_Config_Dialog *
|
2015-03-18 15:09:09 -07:00
|
|
|
e_int_config_mouse(Evas_Object *parent EINA_UNUSED, const char *params EINA_UNUSED)
|
2007-03-19 18:08:38 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
E_Config_Dialog_View *v;
|
2009-08-15 16:53:23 -07:00
|
|
|
|
2009-12-04 14:37:18 -08:00
|
|
|
if (e_config_dialog_find("E", "keyboard_and_mouse/mouse_settings"))
|
2007-03-19 18:08:38 -07:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
v = E_NEW(E_Config_Dialog_View, 1);
|
2009-08-20 04:45:33 -07:00
|
|
|
if (!v) return NULL;
|
2007-03-19 18:08:38 -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;
|
2009-08-20 04:45:33 -07:00
|
|
|
v->basic.check_changed = _basic_check_changed;
|
2009-08-15 16:53:23 -07:00
|
|
|
|
2014-11-02 18:35:13 -08:00
|
|
|
cfd = e_config_dialog_new(NULL, _("Mouse Settings"), "E",
|
2009-12-04 14:37:18 -08:00
|
|
|
"keyboard_and_mouse/mouse_settings",
|
2009-03-08 16:09:48 -07:00
|
|
|
"preferences-desktop-mouse", 0, v, NULL);
|
2007-03-19 18:08:38 -07:00
|
|
|
return cfd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
2012-07-08 05:18:32 -07:00
|
|
|
cfdata->show_cursor = e_config->show_cursor;
|
|
|
|
cfdata->idle_cursor = e_config->idle_cursor;
|
|
|
|
cfdata->use_e_cursor = e_config->use_e_cursor;
|
|
|
|
cfdata->cursor_size = e_config->cursor_size;
|
|
|
|
|
2008-09-19 19:23:51 -07:00
|
|
|
cfdata->mouse_hand = e_config->mouse_hand;
|
2007-03-19 18:08:38 -07:00
|
|
|
cfdata->numerator = e_config->mouse_accel_numerator;
|
|
|
|
cfdata->denominator = e_config->mouse_accel_denominator;
|
|
|
|
cfdata->threshold = e_config->mouse_accel_threshold;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
_create_data(E_Config_Dialog *cfd)
|
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
|
|
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
|
|
|
cfdata->cfd = cfd;
|
|
|
|
|
|
|
|
_fill_data(cfdata);
|
|
|
|
return cfdata;
|
|
|
|
}
|
|
|
|
|
2009-08-20 04:45:33 -07:00
|
|
|
static int
|
2015-03-18 15:09:09 -07:00
|
|
|
_basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
2009-08-20 04:45:33 -07:00
|
|
|
{
|
2012-07-08 05:18:32 -07:00
|
|
|
return !((cfdata->show_cursor == e_config->show_cursor) &&
|
|
|
|
(cfdata->idle_cursor == e_config->idle_cursor) &&
|
|
|
|
(cfdata->use_e_cursor == e_config->use_e_cursor) &&
|
|
|
|
(cfdata->cursor_size == e_config->cursor_size) &&
|
|
|
|
(cfdata->mouse_hand == e_config->mouse_hand) &&
|
2009-08-20 04:45:33 -07:00
|
|
|
(cfdata->numerator == e_config->mouse_accel_numerator) &&
|
|
|
|
(cfdata->denominator == e_config->mouse_accel_denominator) &&
|
|
|
|
(cfdata->threshold == e_config->mouse_accel_threshold));
|
|
|
|
}
|
|
|
|
|
2007-03-19 18:08:38 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
2007-03-19 18:08:38 -07:00
|
|
|
{
|
|
|
|
E_FREE(cfdata);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* advanced window */
|
|
|
|
static int
|
2015-03-18 15:09:09 -07:00
|
|
|
_basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
|
2007-03-19 18:08:38 -07:00
|
|
|
{
|
2012-07-08 05:18:32 -07:00
|
|
|
e_config->use_e_cursor = cfdata->use_e_cursor;
|
|
|
|
e_config->show_cursor = cfdata->show_cursor;
|
|
|
|
e_config->idle_cursor = cfdata->idle_cursor;
|
|
|
|
e_config->cursor_size = cfdata->cursor_size;
|
|
|
|
|
2008-09-19 19:23:51 -07:00
|
|
|
e_config->mouse_hand = cfdata->mouse_hand;
|
2007-03-19 18:08:38 -07:00
|
|
|
e_config->mouse_accel_numerator = cfdata->numerator;
|
2009-08-20 04:45:33 -07:00
|
|
|
e_config->mouse_accel_denominator = cfdata->denominator;
|
2007-03-19 18:08:38 -07:00
|
|
|
e_config->mouse_accel_threshold = cfdata->threshold;
|
2012-07-08 05:18:32 -07:00
|
|
|
e_config_save_queue();
|
2007-03-19 18:08:38 -07:00
|
|
|
|
2007-03-25 15:45:00 -07:00
|
|
|
/* Apply the above settings */
|
2015-01-05 12:27:41 -08:00
|
|
|
if ((e_comp->comp_type == E_PIXMAP_TYPE_X) && (!e_config->show_cursor))
|
|
|
|
e_pointer_hide(e_comp->pointer);
|
|
|
|
else
|
|
|
|
e_pointers_size_set(e_config->cursor_size);
|
2012-07-08 05:18:32 -07:00
|
|
|
|
2010-11-22 07:23:15 -08:00
|
|
|
e_mouse_update();
|
2007-03-19 18:08:38 -07:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-07-08 05:18:32 -07:00
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_use_e_cursor_cb_change(void *data, Evas_Object *obj EINA_UNUSED)
|
2012-07-08 05:18:32 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata = data;
|
|
|
|
Eina_Bool disabled = ((!cfdata->use_e_cursor) || (!cfdata->show_cursor));
|
|
|
|
e_widget_disabled_set(cfdata->gui.idle_cursor, disabled);
|
|
|
|
}
|
|
|
|
|
2007-03-19 18:08:38 -07:00
|
|
|
static Evas_Object *
|
2015-03-18 15:09:09 -07:00
|
|
|
_basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2007-03-19 18:08:38 -07:00
|
|
|
{
|
2013-02-06 01:58:41 -08:00
|
|
|
Evas_Object *otb, *ol, *of, *ob, *oc;
|
2008-09-19 19:23:51 -07:00
|
|
|
E_Radio_Group *rg;
|
|
|
|
|
2012-07-08 05:18:32 -07:00
|
|
|
otb = e_widget_toolbook_add(evas, (24 * e_scale), (24 * e_scale));
|
|
|
|
|
|
|
|
/* Cursor */
|
|
|
|
ol = e_widget_list_add(evas, 0, 0);
|
|
|
|
|
2013-02-06 01:58:41 -08:00
|
|
|
oc = e_widget_check_add(evas, _("Show Cursor"), &(cfdata->show_cursor));
|
|
|
|
e_widget_list_object_append(ol, oc, 1, 0, 0.5);
|
2012-07-08 05:18:32 -07:00
|
|
|
|
|
|
|
of = e_widget_framelist_add(evas, _("Settings"), 0);
|
|
|
|
rg = e_widget_radio_group_new(&cfdata->use_e_cursor);
|
|
|
|
|
|
|
|
ob = e_widget_label_add(evas, _("Size"));
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
2013-02-06 01:58:41 -08:00
|
|
|
e_widget_check_widget_disable_on_unchecked_add(oc, ob);
|
2012-07-08 05:18:32 -07:00
|
|
|
|
|
|
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f pixels"),
|
|
|
|
8, 128, 4, 0, NULL, &(cfdata->cursor_size), 100);
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
2013-02-06 01:58:41 -08:00
|
|
|
e_widget_check_widget_disable_on_unchecked_add(oc, ob);
|
2012-07-08 05:18:32 -07:00
|
|
|
|
|
|
|
ob = e_widget_label_add(evas, _("Theme"));
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
2013-02-06 01:58:41 -08:00
|
|
|
e_widget_check_widget_disable_on_unchecked_add(oc, ob);
|
2012-07-08 05:18:32 -07:00
|
|
|
|
|
|
|
ob = e_widget_radio_add(evas, _("X"), 0, rg);
|
|
|
|
e_widget_on_change_hook_set(ob, _use_e_cursor_cb_change, cfdata);
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
2013-02-06 01:58:41 -08:00
|
|
|
e_widget_check_widget_disable_on_unchecked_add(oc, ob);
|
2012-07-08 05:18:32 -07:00
|
|
|
|
|
|
|
ob = e_widget_radio_add(evas, _("Enlightenment"), 1, rg);
|
|
|
|
e_widget_on_change_hook_set(ob, _use_e_cursor_cb_change, cfdata);
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
2013-02-06 01:58:41 -08:00
|
|
|
e_widget_check_widget_disable_on_unchecked_add(oc, ob);
|
|
|
|
e_widget_on_disable_hook_set(ob, _use_e_cursor_cb_change, cfdata);
|
2012-07-08 05:18:32 -07:00
|
|
|
|
|
|
|
ob = e_widget_check_add(evas, _("Idle effects"),
|
|
|
|
&(cfdata->idle_cursor));
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
|
|
|
cfdata->gui.idle_cursor = ob;
|
|
|
|
|
|
|
|
e_widget_list_object_append(ol, of, 1, 0, 0.5);
|
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Cursor"), ol,
|
|
|
|
1, 0, 1, 0, 0.5, 0.0);
|
|
|
|
|
|
|
|
/* Mouse */
|
|
|
|
/* TODO: Get all inputs and hide this tab if none is relative. */
|
|
|
|
ol = e_widget_list_add(evas, 0, 0);
|
2007-03-19 18:08:38 -07:00
|
|
|
|
2008-09-19 19:23:51 -07:00
|
|
|
of = e_widget_frametable_add(evas, _("Mouse Hand"), 0);
|
|
|
|
rg = e_widget_radio_group_new(&(cfdata->mouse_hand));
|
2009-03-08 16:09:48 -07:00
|
|
|
ob = e_widget_radio_icon_add(evas, NULL, "preferences-desktop-mouse-right", 48, 48, E_MOUSE_HAND_LEFT, rg);
|
2008-09-19 19:23:51 -07:00
|
|
|
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
|
2009-03-08 16:09:48 -07:00
|
|
|
ob = e_widget_radio_icon_add(evas, NULL, "preferences-desktop-mouse-left", 48, 48, E_MOUSE_HAND_RIGHT, rg);
|
2008-09-19 19:23:51 -07:00
|
|
|
e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 1, 1);
|
2012-07-08 05:18:32 -07:00
|
|
|
e_widget_list_object_append(ol, of, 1, 0, 0.5);
|
2008-09-19 19:23:51 -07:00
|
|
|
|
2007-03-19 18:08:38 -07:00
|
|
|
of = e_widget_framelist_add(evas, _("Mouse Acceleration"), 0);
|
|
|
|
|
|
|
|
ob = e_widget_label_add(evas, _("Acceleration"));
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
2012-07-24 17:34:44 -07:00
|
|
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 1.0, 30.0, 1.0, 0,
|
2007-12-17 17:29:26 -08:00
|
|
|
&(cfdata->numerator), NULL, 100);
|
2007-03-19 18:08:38 -07:00
|
|
|
e_widget_framelist_object_append(of, ob);
|
2009-08-15 16:53:23 -07:00
|
|
|
|
2007-03-19 18:08:38 -07:00
|
|
|
ob = e_widget_label_add(evas, _("Threshold"));
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
2015-10-16 13:29:19 -07:00
|
|
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 0.0, 10.0, 1.0, 0,
|
2007-12-17 17:29:26 -08:00
|
|
|
&(cfdata->threshold), NULL, 100);
|
2007-03-19 18:08:38 -07:00
|
|
|
e_widget_framelist_object_append(of, ob);
|
|
|
|
|
2012-07-08 05:18:32 -07:00
|
|
|
e_widget_list_object_append(ol, of, 1, 0, 0.5);
|
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Mouse"), ol,
|
|
|
|
1, 0, 1, 0, 0.5, 0.0);
|
2009-08-15 16:53:23 -07:00
|
|
|
|
2012-07-08 05:18:32 -07:00
|
|
|
e_widget_toolbook_page_show(otb, 0);
|
|
|
|
return otb;
|
2007-03-19 18:08:38 -07:00
|
|
|
}
|