forked from enlightenment/enlightenment
xinput: Add support for flat mouse acceleration and Hi-Res scrolling
Flat mouse accel is fairly obvious. Hi-Res scrolling is an option that is useful on certain mice that technically support 'pixel-perfect' scrolling, but still 'click' like regular mice would when you scroll. Some mice are designed to use pixel-perfect scrolling, so keeping it optional is useful.
This commit is contained in:
parent
7baf84c1dc
commit
98a9609f8c
|
@ -139,6 +139,8 @@ group "E_Config" struct {
|
|||
value "clientlist_max_caption_len" int: 2;
|
||||
value "mouse_hand" int: 1;
|
||||
value "mouse_accel" double: 0.0;
|
||||
value "mouse_flat_accel" uchar: 0;
|
||||
value "mouse_hires_scroll" uchar: 1;
|
||||
value "mouse_accel_threshold" int: 4;
|
||||
value "mouse_natural_scroll" uchar: 0;
|
||||
value "mouse_emulate_middle_button" uchar: 1;
|
||||
|
@ -146,6 +148,7 @@ group "E_Config" struct {
|
|||
value "touch_natural_scroll" uchar: 0;
|
||||
value "touch_emulate_middle_button" uchar: 1;
|
||||
value "touch_tap_to_click" uchar: 0;
|
||||
value "touch_flat_accel" uchar: 0;
|
||||
value "touch_clickpad" uchar: 1;
|
||||
value "touch_scrolling_2finger" uchar: 1;
|
||||
value "touch_scrolling_edge" uchar: 0;
|
||||
|
|
|
@ -137,6 +137,8 @@ group "E_Config" struct {
|
|||
value "clientlist_max_caption_len" int: 2;
|
||||
value "mouse_hand" int: 1;
|
||||
value "mouse_accel" double: 0.0;
|
||||
value "mouse_flat_accel" uchar: 0;
|
||||
value "mouse_hires_scroll" uchar: 1;
|
||||
value "mouse_accel_threshold" int: 4;
|
||||
value "mouse_natural_scroll" uchar: 0;
|
||||
value "mouse_emulate_middle_button" uchar: 1;
|
||||
|
@ -144,6 +146,7 @@ group "E_Config" struct {
|
|||
value "touch_natural_scroll" uchar: 0;
|
||||
value "touch_emulate_middle_button" uchar: 1;
|
||||
value "touch_tap_to_click" uchar: 0;
|
||||
value "touch_flat_accel" uchar: 0;
|
||||
value "touch_clickpad" uchar: 1;
|
||||
value "touch_scrolling_2finger" uchar: 1;
|
||||
value "touch_scrolling_edge" uchar: 0;
|
||||
|
|
|
@ -138,12 +138,15 @@ group "E_Config" struct {
|
|||
value "mouse_hand" int: 1;
|
||||
value "mouse_accel" double: 0.0;
|
||||
value "mouse_accel_threshold" int: 4;
|
||||
value "mouse_flat_accel" uchar: 0;
|
||||
value "mouse_hires_scroll" uchar: 1;
|
||||
value "mouse_natural_scroll" uchar: 0;
|
||||
value "mouse_emulate_middle_button" uchar: 1;
|
||||
value "touch_accel" double: 0.0;
|
||||
value "touch_natural_scroll" uchar: 0;
|
||||
value "touch_emulate_middle_button" uchar: 1;
|
||||
value "touch_tap_to_click" uchar: 0;
|
||||
value "touch_flat_accel" uchar: 0;
|
||||
value "touch_clickpad" uchar: 1;
|
||||
value "touch_scrolling_2finger" uchar: 1;
|
||||
value "touch_scrolling_edge" uchar: 0;
|
||||
|
|
|
@ -144,11 +144,44 @@ _handle_dev_prop(int dev_slot, const char *dev, const char *prop, Device_Flags d
|
|||
}
|
||||
free(val);
|
||||
}
|
||||
// not for now - default
|
||||
// else if (!strcmp(prop, "libinput Accel Profile Enabled"))
|
||||
// {
|
||||
// // 1 bool, 0 = adaptive, 1 = flat
|
||||
// }
|
||||
else if (!strcmp(prop, "libinput Accel Profile Enabled"))
|
||||
{
|
||||
// 1 bool, 0 = adaptive, 1 = flat
|
||||
unsigned char cfval = 0;
|
||||
unsigned char *val = ecore_x_input_device_property_get
|
||||
(dev_slot, prop, &num, &fmt, &size);
|
||||
if (dev_flags == DEVICE_FLAG_TOUCHPAD)
|
||||
cfval = e_config->touch_flat_accel;
|
||||
else
|
||||
cfval = e_config->mouse_flat_accel;
|
||||
|
||||
if ((val) && (size == 8) && (num == 2) && ((cfval == 1 && val[0] == 1) ||
|
||||
(cfval == 0 && val[0] == 0)))
|
||||
{
|
||||
// Does a little flip-flop for each variable
|
||||
val[0] = !cfval;
|
||||
val[1] = cfval;
|
||||
printf("DEV: change [%s] [%s] -> %i, %i\n", dev, prop, val[0], val[1]);
|
||||
ecore_x_input_device_property_set
|
||||
(dev_slot, prop, val, num, fmt, size);
|
||||
}
|
||||
free(val);
|
||||
}
|
||||
else if (!strcmp(prop, "libinput High Resolution Wheel Scroll Enabled"))
|
||||
{
|
||||
unsigned char cfval = e_config->mouse_hires_scroll;
|
||||
unsigned char *val = ecore_x_input_device_property_get
|
||||
(dev_slot, prop, &num, &fmt, &size);
|
||||
|
||||
if ((val) && (size == 8) && (num == 1) && ((cfval != val[0]))
|
||||
{
|
||||
val[0] = cfval;
|
||||
printf("DEV: change [%s] [%s] -> %i\n", dev, prop, val[0]);
|
||||
ecore_x_input_device_property_set
|
||||
(dev_slot, prop, val, num, fmt, size);
|
||||
}
|
||||
free(val);
|
||||
}
|
||||
// do via button mapping for now - not sure about this evdev can't do this
|
||||
// else if (!strcmp(prop, "libinput Left Handed Enabled"))
|
||||
// {
|
||||
|
|
|
@ -855,8 +855,10 @@ _e_config_edd_init(Eina_Bool old)
|
|||
E_CONFIG_VAL(D, T, mouse_hand, INT);
|
||||
|
||||
E_CONFIG_VAL(D, T, mouse_accel, DOUBLE);
|
||||
E_CONFIG_VAL(D, T, mouse_flat_accel, UCHAR);
|
||||
E_CONFIG_VAL(D, T, mouse_accel_threshold, INT);
|
||||
E_CONFIG_VAL(D, T, mouse_natural_scroll, UCHAR);
|
||||
E_CONFIG_VAL(D, T, mouse_hires_scroll, UCHAR);
|
||||
E_CONFIG_VAL(D, T, mouse_emulate_middle_button, UCHAR);
|
||||
|
||||
E_CONFIG_VAL(D, T, touch_accel, DOUBLE);
|
||||
|
@ -864,6 +866,7 @@ _e_config_edd_init(Eina_Bool old)
|
|||
E_CONFIG_VAL(D, T, touch_emulate_middle_button, UCHAR);
|
||||
E_CONFIG_VAL(D, T, touch_tap_to_click, UCHAR);
|
||||
E_CONFIG_VAL(D, T, touch_clickpad, UCHAR);
|
||||
E_CONFIG_VAL(D, T, touch_flat_accel, UCHAR);
|
||||
E_CONFIG_VAL(D, T, touch_scrolling_2finger, UCHAR);
|
||||
E_CONFIG_VAL(D, T, touch_scrolling_edge, UCHAR);
|
||||
E_CONFIG_VAL(D, T, touch_scrolling_circular, UCHAR);
|
||||
|
|
|
@ -245,12 +245,15 @@ struct _E_Config
|
|||
int mouse_hand; //GUI
|
||||
double mouse_accel; // GUI
|
||||
int mouse_accel_threshold; // GUI
|
||||
unsigned char mouse_flat_accel; // GUI
|
||||
unsigned char mouse_natural_scroll; // GUI
|
||||
unsigned char mouse_hires_scroll; // GUI
|
||||
unsigned char mouse_emulate_middle_button; // GUI
|
||||
|
||||
double touch_accel; // GUI
|
||||
unsigned char touch_natural_scroll; // GUI
|
||||
unsigned char touch_emulate_middle_button; // GUI
|
||||
unsigned char touch_flat_accel; // GUI
|
||||
unsigned char touch_tap_to_click; // GUI
|
||||
unsigned char touch_clickpad; // GUI
|
||||
unsigned char touch_scrolling_2finger; // GUI
|
||||
|
|
|
@ -10,10 +10,10 @@ struct _E_Config_Dialog_Data
|
|||
{
|
||||
E_Config_Dialog *cfd;
|
||||
|
||||
int show_cursor;
|
||||
int idle_cursor;
|
||||
int use_e_cursor;
|
||||
int cursor_size;
|
||||
int show_cursor;
|
||||
int idle_cursor;
|
||||
int use_e_cursor;
|
||||
int cursor_size;
|
||||
|
||||
struct
|
||||
{
|
||||
|
@ -24,12 +24,15 @@ struct _E_Config_Dialog_Data
|
|||
|
||||
double mouse_accel;
|
||||
double mouse_accel_threshold;
|
||||
int mouse_flat_accel;
|
||||
int mouse_natural_scroll;
|
||||
int mouse_hires_scroll;
|
||||
int mouse_emulate_middle_button;
|
||||
|
||||
double touch_accel;
|
||||
int touch_natural_scroll;
|
||||
int touch_emulate_middle_button;
|
||||
int touch_flat_accel;
|
||||
int touch_tap_to_click;
|
||||
int touch_clickpad;
|
||||
int touch_scrolling_2finger;
|
||||
|
@ -73,12 +76,15 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->mouse_hand = e_config->mouse_hand;
|
||||
|
||||
cfdata->mouse_accel = e_config->mouse_accel;
|
||||
cfdata->mouse_flat_accel = e_config->mouse_flat_accel;
|
||||
cfdata->mouse_accel_threshold = e_config->mouse_accel_threshold;
|
||||
cfdata->mouse_natural_scroll = e_config->mouse_natural_scroll;
|
||||
cfdata->mouse_hires_scroll = e_config->mouse_hires_scroll;
|
||||
cfdata->mouse_emulate_middle_button = e_config->mouse_emulate_middle_button;
|
||||
|
||||
cfdata->touch_accel = e_config->touch_accel;
|
||||
cfdata->touch_natural_scroll = e_config->touch_natural_scroll;
|
||||
cfdata->touch_flat_accel = e_config->touch_flat_accel;
|
||||
cfdata->touch_emulate_middle_button = e_config->touch_emulate_middle_button;
|
||||
cfdata->touch_tap_to_click = e_config->touch_tap_to_click;
|
||||
cfdata->touch_clickpad = e_config->touch_clickpad;
|
||||
|
@ -112,9 +118,12 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd
|
|||
EINA_DBL_EQ(cfdata->mouse_accel_threshold, e_config->mouse_accel_threshold) &&
|
||||
(cfdata->mouse_natural_scroll == e_config->mouse_natural_scroll) &&
|
||||
(cfdata->mouse_emulate_middle_button == e_config->mouse_emulate_middle_button) &&
|
||||
(cfdata->mouse_hires_scroll == e_config->mouse_hires_scroll) &&
|
||||
(cfdata->mouse_flat_accel == e_config->mouse_flat_accel) &&
|
||||
EINA_DBL_EQ(cfdata->touch_accel, e_config->touch_accel) &&
|
||||
(cfdata->touch_natural_scroll == e_config->touch_natural_scroll) &&
|
||||
(cfdata->touch_emulate_middle_button == e_config->touch_emulate_middle_button) &&
|
||||
(cfdata->touch_flat_accel == e_config->touch_flat_accel) &&
|
||||
(cfdata->touch_tap_to_click == e_config->touch_tap_to_click) &&
|
||||
(cfdata->touch_clickpad == e_config->touch_clickpad) &&
|
||||
(cfdata->touch_scrolling_2finger == e_config->touch_scrolling_2finger) &&
|
||||
|
@ -144,11 +153,14 @@ _basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata
|
|||
|
||||
e_config->mouse_accel = cfdata->mouse_accel;
|
||||
e_config->mouse_accel_threshold = cfdata->mouse_accel_threshold;
|
||||
e_config->mouse_flat_accel = cfdata->mouse_flat_accel;
|
||||
e_config->mouse_hires_scroll = cfdata->mouse_hires_scroll;
|
||||
e_config->mouse_natural_scroll = cfdata->mouse_natural_scroll;
|
||||
e_config->mouse_emulate_middle_button = cfdata->mouse_emulate_middle_button;
|
||||
|
||||
e_config->touch_accel = cfdata->touch_accel;
|
||||
e_config->touch_natural_scroll = cfdata->touch_natural_scroll;
|
||||
e_config->touch_flat_accel = cfdata->touch_flat_accel;
|
||||
e_config->touch_emulate_middle_button = cfdata->touch_emulate_middle_button;
|
||||
e_config->touch_tap_to_click = cfdata->touch_tap_to_click;
|
||||
e_config->touch_clickpad = cfdata->touch_clickpad;
|
||||
|
@ -255,6 +267,8 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dia
|
|||
e_widget_list_object_append(ol, of, 1, 0, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Acceleration"), 0);
|
||||
ob = e_widget_check_add(evas, _("Flat acceleration"), &(cfdata->mouse_flat_accel));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f"), -1.0, 1.0, 0.1, 0,
|
||||
&(cfdata->mouse_accel), NULL, 100);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
@ -278,6 +292,8 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dia
|
|||
|
||||
oc = e_widget_check_add(evas, _("Natural scrolling"), &(cfdata->mouse_natural_scroll));
|
||||
e_widget_framelist_object_append(of, oc);
|
||||
oc = e_widget_check_add(evas, _("Hi-Res scrolling"), &(cfdata->mouse_hires_scroll));
|
||||
e_widget_framelist_object_append(of, oc);
|
||||
|
||||
e_widget_list_object_append(ol, of, 1, 0, 0.5);
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Mouse"), ol,
|
||||
|
@ -289,6 +305,8 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dia
|
|||
|
||||
of = e_widget_framelist_add(evas, _("Acceleration"), 0);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Flat acceleration"), &(cfdata->touch_flat_accel));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f"), -1.0, 1.0, 0.1, 0,
|
||||
&(cfdata->touch_accel), NULL, 100);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
|
Loading…
Reference in New Issue