Part 2 of Ravenlock's mouse acceleration patch. This adds a config dialog
for setting the mouse accel threshold and the necessary mouse_init calls to setup accel when E launches. SVN revision: 28822
This commit is contained in:
parent
d8bff402b4
commit
fb9c90a631
|
@ -11,7 +11,8 @@ INCLUDES = -I$(top_srcdir) \
|
|||
-DPACKAGE_LIB_DIR=\"@PACKAGE_LIB_DIR@\" \
|
||||
-DPACKAGE_DATA_DIR=\"@PACKAGE_DATA_DIR@\" \
|
||||
-DLOCALE_DIR=\"@LOCALE_DIR@\" \
|
||||
-DPACKAGE_SYSCONF_DIR=\"@PACKAGE_SYSCONF_DIR@\"
|
||||
-DPACKAGE_SYSCONF_DIR=\"@PACKAGE_SYSCONF_DIR@\" \
|
||||
-Wno-unused
|
||||
|
||||
bin_PROGRAMS = \
|
||||
enlightenment \
|
||||
|
@ -187,7 +188,9 @@ e_widget_desk_preview.h \
|
|||
e_int_config_borders.h \
|
||||
e_int_config_desk.h \
|
||||
e_int_config_clientlist.h \
|
||||
e_fm_prop.h
|
||||
e_fm_prop.h \
|
||||
e_int_config_mouse.h \
|
||||
e_mouse.h
|
||||
|
||||
enlightenment_src = \
|
||||
e_user.c \
|
||||
|
@ -350,6 +353,8 @@ e_int_config_borders.c \
|
|||
e_int_config_desk.c \
|
||||
e_fm_prop.c \
|
||||
e_int_config_clientlist.c \
|
||||
e_int_config_mouse.c \
|
||||
e_mouse.c \
|
||||
$(ENLIGHTENMENTHEADERS)
|
||||
|
||||
enlightenment_SOURCES = \
|
||||
|
|
|
@ -512,6 +512,10 @@ e_config_init(void)
|
|||
E_CONFIG_VAL(D, T, clientlist_separate_iconified_apps, INT);
|
||||
E_CONFIG_VAL(D, T, clientlist_warp_to_iconified_desktop, INT);
|
||||
|
||||
E_CONFIG_VAL(D, T, mouse_accel_numerator, INT);
|
||||
E_CONFIG_VAL(D, T, mouse_accel_denominator, INT);
|
||||
E_CONFIG_VAL(D, T, mouse_accel_threshold, INT);
|
||||
|
||||
E_CONFIG_VAL(D, T, border_raise_on_mouse_action, INT);
|
||||
E_CONFIG_VAL(D, T, border_raise_on_focus, INT);
|
||||
E_CONFIG_VAL(D, T, desk_flip_wrap, INT);
|
||||
|
@ -1342,6 +1346,12 @@ e_config_init(void)
|
|||
e_config->clientlist_include_all_zones = 0;
|
||||
IFCFGEND;
|
||||
|
||||
IFCFG(0x0112);
|
||||
e_config->mouse_accel_numerator = 2;
|
||||
e_config->mouse_accel_denominator = 1;
|
||||
e_config->mouse_accel_threshold = 4;
|
||||
IFCFGEND;
|
||||
|
||||
e_config->config_version = E_CONFIG_FILE_VERSION;
|
||||
|
||||
#if 0 /* example of new config */
|
||||
|
@ -1461,6 +1471,10 @@ e_config_init(void)
|
|||
E_CONFIG_LIMIT(e_config->clientlist_separate_iconified_apps, 0, 2);
|
||||
E_CONFIG_LIMIT(e_config->clientlist_warp_to_iconified_desktop, 0, 1);
|
||||
|
||||
E_CONFIG_LIMIT(e_config->mouse_accel_numerator, 1, 10);
|
||||
E_CONFIG_LIMIT(e_config->mouse_accel_denominator, 1, 10);
|
||||
E_CONFIG_LIMIT(e_config->mouse_accel_threshold, 1, 10);
|
||||
|
||||
/* FIXME: disabled auto apply because it causes problems */
|
||||
e_config->cfgdlg_auto_apply = 0;
|
||||
/* FIXME: desklock personalized password id disabled for security reasons */
|
||||
|
|
|
@ -52,7 +52,7 @@ typedef Eet_Data_Descriptor E_Config_DD;
|
|||
/* 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
|
||||
*/
|
||||
#define E_CONFIG_FILE_GENERATION 0x0111
|
||||
#define E_CONFIG_FILE_GENERATION 0x0112
|
||||
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
|
||||
|
||||
#define E_EVAS_ENGINE_DEFAULT 0
|
||||
|
@ -254,6 +254,10 @@ struct _E_Config
|
|||
int clientlist_separate_iconified_apps;
|
||||
int clientlist_warp_to_iconified_desktop;
|
||||
|
||||
int mouse_accel_numerator;
|
||||
int mouse_accel_denominator;
|
||||
int mouse_accel_threshold;
|
||||
|
||||
int display_res_restore; // GUI
|
||||
int display_res_width; // GUI
|
||||
int display_res_height; // GUI
|
||||
|
|
|
@ -418,6 +418,7 @@ _e_configure_fill_cat_list(void *data)
|
|||
cat = _e_configure_category_add(eco, _("Keyboard & Mouse"), "enlightenment/behavior");
|
||||
_e_configure_item_add(cat, _("Key Bindings"), "enlightenment/keys", e_int_config_keybindings);
|
||||
_e_configure_item_add(cat, _("Mouse Bindings"), "enlightenment/mouse_clean", e_int_config_mousebindings);
|
||||
_e_configure_item_add(cat, _("Mouse Acceleration"), "enlightenment/mouse_clean", e_int_config_mouse);
|
||||
|
||||
cat = _e_configure_category_add(eco, _("Windows"), "enlightenment/windows");
|
||||
_e_configure_item_add(cat, _("Window Display"), "enlightenment/windows", e_int_config_window_display);
|
||||
|
|
|
@ -163,3 +163,5 @@
|
|||
#include "e_int_config_desk.h"
|
||||
#include "e_int_config_clientlist.h"
|
||||
#include "e_fm_prop.h"
|
||||
#include "e_mouse.h"
|
||||
#include "e_int_config_mouse.h"
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
#include "e.h"
|
||||
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas,
|
||||
E_Config_Dialog_Data *cfdata);
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
|
||||
double numerator;
|
||||
double denominator;
|
||||
double threshold;
|
||||
};
|
||||
|
||||
static E_Dialog *mouse_dialog = NULL;
|
||||
|
||||
static void
|
||||
_cb_mouse_dialog_ok(void *data, E_Dialog *dia)
|
||||
{
|
||||
e_object_del(E_OBJECT(mouse_dialog));
|
||||
mouse_dialog = NULL;
|
||||
}
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_mouse(E_Container *con)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "_config_mouse_dialog"))
|
||||
return NULL;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.apply_cfdata = _basic_apply_data;
|
||||
v->basic.create_widgets = _basic_create_widgets;
|
||||
v->override_auto_apply = 1;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Mouse Acceleration Settings"), "E",
|
||||
"_config_mouse_dialog",
|
||||
"enlightenment/mouse_clean", 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (!cfdata) return;
|
||||
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
/* advanced window */
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
e_config->mouse_accel_numerator = cfdata->numerator;
|
||||
// Force denominator to 1 for simplicity.
|
||||
e_config->mouse_accel_denominator = 1; //cfdata->denominator;
|
||||
e_config->mouse_accel_threshold = cfdata->threshold;
|
||||
|
||||
// Apply the above settings
|
||||
e_mouse_init();
|
||||
|
||||
e_config_save_queue();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o, *of, *ob;
|
||||
E_Radio_Group *rg;
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Mouse Acceleration"), 0);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Acceleration"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 1.0, 10.0, 1.0, 0,
|
||||
&(cfdata->numerator), NULL, 200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
/*ob = e_widget_label_add(evas, _("Denominator"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 1.0, 10.0, 1.0, 0,
|
||||
&(cfdata->denominator), NULL, 200);
|
||||
e_widget_framelist_object_append(of, ob);*/
|
||||
|
||||
ob = e_widget_label_add(evas, _("Threshold"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 1.0, 10.0, 1.0, 0,
|
||||
&(cfdata->threshold), NULL, 200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
e_dialog_resizable_set(cfd->dia, 0);
|
||||
return o;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
#ifndef E_INT_CONFIG_MOUSE_H
|
||||
#define E_INT_CONFIG_MOUSE_H
|
||||
|
||||
EAPI E_Config_Dialog *e_int_config_mouse(E_Container *con);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -792,6 +792,14 @@ main(int argc, char **argv)
|
|||
_e_main_shutdown(-1);
|
||||
}
|
||||
|
||||
TS("mouse");
|
||||
/* setup mouse accel */
|
||||
if (!e_mouse_init())
|
||||
{
|
||||
e_error_message_show(_("Enlightenment cannot configure the mouse acceleration settings."));
|
||||
_e_main_shutdown(-1);
|
||||
}
|
||||
|
||||
TS("desklock");
|
||||
/* setup desklock */
|
||||
if (!e_desklock_init())
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#include "e.h"
|
||||
|
||||
EAPI int
|
||||
e_mouse_init(void)
|
||||
{
|
||||
if (!ecore_x_pointer_control_set(e_config->mouse_accel_numerator,
|
||||
e_config->mouse_accel_denominator,
|
||||
e_config->mouse_accel_threshold))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
#ifndef E_MOUSE_H
|
||||
#define E_MOUSE_H
|
||||
|
||||
EAPI int e_mouse_init(void);
|
||||
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue