x - add xinput device watching and beginnings of configuring them

devs/bu5hm4n/mixerfun
Carsten Haitzler 2 years ago
parent e5bf0d66eb
commit 05b0ff59a8
  1. 12
      data/config/default/e.src
  2. 12
      data/config/standard/e.src
  3. 12
      data/config/tiling/e.src
  4. 18
      src/bin/e_comp_x.c
  5. 429
      src/bin/e_comp_x_devices.c
  6. 12
      src/bin/e_comp_x_devices.h
  7. 31
      src/bin/e_config.c
  8. 12
      src/bin/e_config.h
  9. 1
      src/bin/e_includes.h
  10. 38
      src/bin/e_mouse.c
  11. 2
      src/bin/meson.build
  12. 111
      src/modules/conf_interaction/e_int_config_mouse.c

@ -1,5 +1,5 @@
group "E_Config" struct {
value "config_version" int: 1000032;
value "config_version" int: 1000033;
value "config_type" uint: 0; // this profile seems to just be super minimalist
value "desktop_default_name" string: "%i-%i";
value "desktop_default_window_profile" string: "";
@ -137,9 +137,15 @@ group "E_Config" struct {
value "clientlist_limit_caption_len" int: 0;
value "clientlist_max_caption_len" int: 2;
value "mouse_hand" int: 1;
value "mouse_accel_numerator" int: 2;
value "mouse_accel_denominator" int: 1;
value "mouse_accel" double: 0.0;
value "mouse_accel_threshold" int: 4;
value "touch_tap_to_click" uchar: 0;
value "mouse_natural_scroll" uchar: 0;
value "mouse_emulate_middle_button" uchar: 1;
value "touch_clickpad" uchar: 1;
value "touch_scrolling_mode" uchar: 0;
value "touch_scrolling_horiz" uchar: 1;
value "touch_palm_detect" uchar: 1;
value "border_raise_on_mouse_action" int: 1;
value "desk_flip_wrap" int: 0;
value "fullscreen_flip" int: 1;

@ -1,5 +1,5 @@
group "E_Config" struct {
value "config_version" int: 1000032;
value "config_version" int: 1000033;
value "config_type" uint: 3;
value "desktop_default_name" string: "%i-%i";
value "desktop_default_window_profile" string: "standard";
@ -135,9 +135,15 @@ group "E_Config" struct {
value "clientlist_limit_caption_len" int: 0;
value "clientlist_max_caption_len" int: 2;
value "mouse_hand" int: 1;
value "mouse_accel_numerator" int: 2;
value "mouse_accel_denominator" int: 1;
value "mouse_accel" double: 0.0;
value "mouse_accel_threshold" int: 4;
value "touch_tap_to_click" uchar: 0;
value "mouse_natural_scroll" uchar: 0;
value "mouse_emulate_middle_button" uchar: 1;
value "touch_clickpad" uchar: 1;
value "touch_scrolling_mode" uchar: 0;
value "touch_scrolling_horiz" uchar: 1;
value "touch_palm_detect" uchar: 1;
value "border_raise_on_mouse_action" int: 1;
value "desk_flip_wrap" int: 0;
value "fullscreen_flip" int: 1;

@ -1,5 +1,5 @@
group "E_Config" struct {
value "config_version" int: 1000032;
value "config_version" int: 1000033;
value "config_type" uint: 3;
value "desktop_default_name" string: "%i-%i";
value "desktop_default_window_profile" string: "standard";
@ -135,9 +135,15 @@ group "E_Config" struct {
value "clientlist_limit_caption_len" int: 0;
value "clientlist_max_caption_len" int: 2;
value "mouse_hand" int: 1;
value "mouse_accel_numerator" int: 2;
value "mouse_accel_denominator" int: 1;
value "mouse_accel" double: 0.0;
value "mouse_accel_threshold" int: 4;
value "touch_tap_to_click" uchar: 0;
value "mouse_natural_scroll" uchar: 0;
value "mouse_emulate_middle_button" uchar: 1;
value "touch_clickpad" uchar: 1;
value "touch_scrolling_mode" uchar: 0;
value "touch_scrolling_horiz" uchar: 1;
value "touch_palm_detect" uchar: 1;
value "border_raise_on_mouse_action" int: 1;
value "desk_flip_wrap" int: 0;
value "fullscreen_flip" int: 1;

@ -5472,6 +5472,22 @@ _e_comp_x_randr_change(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev
return ECORE_CALLBACK_RENEW;
}
static Eina_Bool
_e_comp_x_devices_change_cb(void *data EINA_UNUSED, int t EINA_UNUSED, void *ev EINA_UNUSED)
{
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
// do nothing here
}
else
#endif
{
e_comp_x_devices_config_apply();
}
return ECORE_CALLBACK_RENEW;
}
static void
_e_comp_x_del(E_Comp *c)
{
@ -5999,6 +6015,7 @@ e_comp_x_init(void)
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_PING,
_e_comp_x_cb_ping, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, _e_comp_x_backlight_notify_cb, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_X_DEVICES_CHANGE, _e_comp_x_devices_change_cb, NULL);
if (ecore_x_randr_version_get() >= RANDR_VERSION_1_3)
backlight_atom = ecore_x_atom_get("Backlight");
@ -6036,6 +6053,7 @@ e_comp_x_init(void)
0,
e_config->screensaver_blanking,
e_config->screensaver_expose);
e_comp_x_devices_config_apply();
}
else
e_dnd_init();

@ -0,0 +1,429 @@
#define EXECUTIVE_MODE_ENABLED
#define E_COMP_X
#include "e.h"
static void
_handle_dev_prop(int dev_slot, const char *dev, const char *prop)
{
int num, size;
Ecore_X_Atom fmt;
///////////////////////////////////////////////////////////////////////////
// libinput devices
if (!strcmp(prop, "libinput Middle Emulation Enabled"))
{
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num == 1) &&
(e_config->mouse_emulate_middle_button) != (val[0]))
{
val[0] = e_config->mouse_emulate_middle_button;
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);
}
else if (!strcmp(prop, "libinput Accel Speed"))
{
float *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 32) && (num == 1) &&
(fabs(e_config->mouse_accel - val[0]) >= 0.01))
{
val[0] = e_config->mouse_accel;
printf("DEV: change [%s] [%s] -> %1.3f\n", dev, prop, val[0]);
ecore_x_input_device_property_set
(dev_slot, prop, val, num, fmt, size);
}
free(val);
}
else if (!strcmp(prop, "libinput Tapping Enabled"))
{
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num == 1) &&
(e_config->touch_tap_to_click) != (val[0]))
{
val[0] = e_config->touch_tap_to_click;
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);
}
// else if (!strcmp(prop, "libinput Tapping Button Mapping Enabled"))
// {
// // 1 bool, 0 = LRM, 1 = LMR
// }
else if (!strcmp(prop, "libinput Horizontal Scrolling Enabled"))
{
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num == 1) &&
(e_config->touch_scrolling_horiz) != (val[0]))
{
val[0] = e_config->touch_scrolling_horiz;
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);
}
else if (!strcmp(prop, "libinput Scroll Method Enabled"))
{
unsigned char cfval = 0;
Eina_Bool doit = EINA_TRUE;
if (e_config->touch_scrolling_mode == 0) cfval = 1;
else if (e_config->touch_scrolling_mode == 1) cfval = 0;
else if (e_config->touch_scrolling_mode == 2) cfval = 1;
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, "libinput Scroll Methods Available", &num, &fmt, &size);
if ((val) && (size == 8) && (num == 3))
{
if (!val[cfval]) doit = EINA_FALSE;
}
free(val);
if (doit)
{
// 1 bool, 0=2-finger, 1=edge, 2=button
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 Natural Scrolling Enabled"))
// {
// // 1 bool
// }
// not for now - default
// else if (!strcmp(prop, "libinput Accel Profile Enabled"))
// {
// // 1 bool, 0 = adaptive, 1 = flat
// }
// do via button mapping for now - not sure about this evdev can't do this
// else if (!strcmp(prop, "libinput Left Handed Enabled"))
// {
// // 1 bool
// }
// do via button mapping for now - not sure about this evdev can't do this
// else if (!strcmp(prop, "libinput Natural Scrolling Enabled"))
// {
// // 1 bool
// }
///////////////////////////////////////////////////////////////////////////
// synaptics devices
else if (!strcmp(prop, "Synaptics Middle Button Timeout"))
{
unsigned int *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 32) && (num == 1) &&
(e_config->mouse_emulate_middle_button && (val[0] != 50)))
{
val[0] = 50;
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);
}
else if (!strcmp(prop, "Synaptics Move Speed"))
{
float chval[4] = { 0.0 };
// 4 val float min, max, accel, unused
chval[0] = 1.0;
chval[1] = 1.75;
chval[2] = 0.15 + (e_config->mouse_accel * 0.15);
float *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 32) && (num == 4) &&
((fabs(chval[0] - val[0]) >= 0.01) ||
(fabs(chval[1] - val[1]) >= 0.01) ||
(fabs(chval[2] - val[2]) >= 0.01)))
{
val[0] = chval[0];
val[1] = chval[1];
val[2] = chval[2];
printf("DEV: change [%s] [%s] -> %1.3f %1.3f %1.3f %1.3f\n", dev, prop, val[1], val[1], val[2], val[3]);
ecore_x_input_device_property_set
(dev_slot, prop, val, num, fmt, size);
}
free(val);
}
else if (!strcmp(prop, "Synaptics Tap Action"))
{
// 7 val, 8 bit bit 0 = off, >0 mouse button reported
// TR, BR, TL, BL, F1, F2, F3
// 0, 0, 0, 0, 1, 2, 3 <- tap to click
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num >= 7) &&
(((e_config->touch_tap_to_click) &&
((val[4] != 1) || (val[5] != 2) || (val[6] != 3))) ||
((!e_config->touch_tap_to_click) &&
((val[4] != 0) || (val[5] != 0) || (val[6] != 0)))))
{
if (e_config->touch_tap_to_click)
{
val[4] = 1;
val[5] = 2;
val[6] = 3;
}
else
{
val[4] = 0;
val[5] = 0;
val[6] = 0;
}
printf("DEV: change [%s] [%s] -> %i %i %i\n", dev, prop, val[4], val[5], val[6]);
ecore_x_input_device_property_set
(dev_slot, prop, val, num, fmt, size);
}
free(val);
}
else if (!strcmp(prop, "Synaptics ClickPad"))
{
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num == 1) &&
(e_config->touch_clickpad) != (val[0]))
{
val[0] = e_config->touch_clickpad;
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);
}
else if (!strcmp(prop, "Synaptics Edge Scrolling"))
{
// 3 bool - v, h, corner
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num >= 2) &&
(((e_config->touch_scrolling_mode == 0) &&
((!val[0]) || (val[1] != e_config->touch_scrolling_horiz))) ||
((e_config->touch_scrolling_mode != 0) &&
((val[0]) || (val[1])))))
{
if (e_config->touch_scrolling_mode == 0)
{
val[0] = 1;
val[1] = e_config->touch_scrolling_horiz;
}
else
{
val[0] = 0;
val[1] = 0;
}
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, "Synaptics Two-Finger Scrolling"))
{
// 2 bool - h, v
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num >= 2) &&
(((e_config->touch_scrolling_mode == 1) &&
((!val[0]) || (val[1] != e_config->touch_scrolling_horiz))) ||
((e_config->touch_scrolling_mode != 1) &&
((val[0]) || (val[1])))))
{
if (e_config->touch_scrolling_mode == 1)
{
val[0] = 1;
val[1] = e_config->touch_scrolling_horiz;
}
else
{
val[0] = 0;
val[1] = 0;
}
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, "Synaptics Circular Scrolling"))
{
// 1 bool
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num == 1) &&
(((e_config->touch_scrolling_mode == 2) &&
(!val[0])) ||
((e_config->touch_scrolling_mode != 2) &&
(val[0]))))
{
if (e_config->touch_scrolling_mode == 2)
val[0] = 1;
else
val[0] = 0;
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);
}
else if (!strcmp(prop, "Synaptics Palm Detection"))
{
// 1 bool - always turn on
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num == 1) &&
(e_config->touch_palm_detect) != (val[0]))
{
val[0] = e_config->touch_palm_detect;
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);
}
// else if (!strcmp(prop, "Synaptics Off"))
// {
// // 8 bit 0 = on, 1 = off (except physical clicks), 2 =
// }
///////////////////////////////////////////////////////////////////////////
// evdev devices
else if (!strcmp(prop, "Evdev Middle Button Emulation"))
{
unsigned char *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 8) && (num == 1) &&
(e_config->mouse_emulate_middle_button) != (val[0]))
{
val[0] = e_config->mouse_emulate_middle_button;
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);
}
else if (!strcmp(prop, "Evdev Middle Button Timeout"))
{
unsigned short *val = ecore_x_input_device_property_get
(dev_slot, prop, &num, &fmt, &size);
if ((val) && (size == 16) && (num == 1) &&
(e_config->mouse_emulate_middle_button && (val[0] != 50)))
{
val[0] = 50;
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);
}
}
E_API void
e_comp_x_devices_config_apply(void)
{
// XXX: configure devices based on settings
// list devices - for each device, check properties
// if property does not match the config, set it to
// config val
int num_devs, i;
num_devs = ecore_x_input_device_num_get();
printf("DEV: CHANGES ... have %i devices\n", num_devs);
for (i = 0; i < num_devs; i++)
{
const char *name;
char **props;
int num_props, j;
name = ecore_x_input_device_name_get(i);
// printf("DEV: DEV=%i: [%s]\n", i, name);
props = ecore_x_input_device_properties_list(i, &num_props);
if (props)
{
for (j = 0; j < num_props; j++)
{
// printf("DEV: PROP=%i: [%s]\n", j, props[j]);
_handle_dev_prop(i, name, props[j]);
}
ecore_x_input_device_properties_free(props, num_props);
}
}
// generic accel - if synatics or evdev props found?
{
int accel_numerator, accel_denominator;
accel_numerator = 20 + (e_config->mouse_accel * 20.0);
accel_denominator = 10;
ecore_x_pointer_control_set(accel_numerator, accel_denominator,
e_config->mouse_accel_threshold);
}
// button mapping - for mouse hand and natural scroll
{
unsigned char map[256] = { 0 };
int n;
if (ecore_x_pointer_mapping_get(map, 256))
{
for (n = 0; n < 256; n++)
{
if (!map[n]) break;
}
if (n < 12)
{
map[0] = 1;
map[1] = 2;
map[2] = 3;
map[3] = 4;
map[4] = 5;
map[5] = 6;
map[6] = 7;
map[7] = 8;
map[8] = 9;
map[9] = 10;
map[10] = 11;
map[11] = 12;
n = 12;
}
if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
{
map[0] = 1;
map[2] = 3;
}
else if (e_config->mouse_hand == E_MOUSE_HAND_LEFT)
{
map[0] = 3;
map[2] = 1;
}
if (e_config->mouse_natural_scroll)
{
map[3] = 5;
map[4] = 4;
}
else
{
map[3] = 4;
map[4] = 5;
}
ecore_x_pointer_mapping_set(map, n);
}
}
}

@ -0,0 +1,12 @@
#ifdef E_TYPEDEFS
#else
# ifndef E_COMP_X_DEVICES_H
# define E_COMP_X_DEVICES_H
# include <Ecore_X.h>
# include "e_atoms.h"
E_API void e_comp_x_devices_config_apply(void);
# endif
#endif

@ -833,11 +833,17 @@ _e_config_edd_init(Eina_Bool old)
E_CONFIG_VAL(D, T, clientlist_max_caption_len, INT);
E_CONFIG_VAL(D, T, mouse_hand, 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, DOUBLE);
E_CONFIG_VAL(D, T, mouse_accel_threshold, INT);
E_CONFIG_VAL(D, T, touch_tap_to_click, UCHAR);
E_CONFIG_VAL(D, T, mouse_natural_scroll, UCHAR);
E_CONFIG_VAL(D, T, mouse_emulate_middle_button, UCHAR);
E_CONFIG_VAL(D, T, touch_clickpad, UCHAR);
E_CONFIG_VAL(D, T, touch_scrolling_mode, UCHAR);
E_CONFIG_VAL(D, T, touch_scrolling_horiz, UCHAR);
E_CONFIG_VAL(D, T, touch_palm_detect, UCHAR);
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, raise_on_revert_focus, INT);
@ -1775,6 +1781,15 @@ e_config_load(void)
e_config->winlist_list_size = 0.3333;
e_config_save_queue();
}
CONFIG_VERSION_CHECK(33)
{
CONFIG_VERSION_UPDATE_INFO(33);
e_config->touch_clickpad = 1;
e_config->mouse_emulate_middle_button = 1;
e_config->touch_scrolling_horiz = 1;
e_config->touch_palm_detect = 1;
e_config_save_queue();
}
}
elm_config_profile_set(_e_config_profile);
if (!e_config->remember_internal_fm_windows)
@ -1910,10 +1925,16 @@ e_config_load(void)
E_CONFIG_LIMIT(e_config->clientlist_limit_caption_len, 0, 1);
E_CONFIG_LIMIT(e_config->clientlist_max_caption_len, 2, E_CLIENTLIST_MAX_CAPTION_LEN);
E_CONFIG_LIMIT(e_config->mouse_accel_numerator, 1, 30);
E_CONFIG_LIMIT(e_config->mouse_accel_denominator, 1, 10);
E_CONFIG_LIMIT(e_config->mouse_accel, -1.0, 1.0);
E_CONFIG_LIMIT(e_config->mouse_accel_threshold, 0, 10);
E_CONFIG_LIMIT(e_config->touch_tap_to_click, 0, 3);
E_CONFIG_LIMIT(e_config->touch_tap_to_click, 0, 1);
E_CONFIG_LIMIT(e_config->mouse_natural_scroll, 0, 1);
E_CONFIG_LIMIT(e_config->mouse_emulate_middle_button, 0, 1);
E_CONFIG_LIMIT(e_config->touch_clickpad, 0, 1);
E_CONFIG_LIMIT(e_config->touch_scrolling_mode, 0, 2);
E_CONFIG_LIMIT(e_config->touch_scrolling_horiz, 0, 1);
E_CONFIG_LIMIT(e_config->touch_palm_detect, 0, 1);
E_CONFIG_LIMIT(e_config->menu_favorites_show, 0, 1);
E_CONFIG_LIMIT(e_config->menu_apps_show, 0, 1);

@ -47,7 +47,7 @@ typedef enum
/* 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 32
#define E_CONFIG_FILE_GENERATION 33
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION)
#define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!!
@ -242,11 +242,17 @@ struct _E_Config
int clientlist_max_caption_len; // GUI
int mouse_hand; //GUI
int mouse_accel_numerator; // GUI
int mouse_accel_denominator; // GUI
double mouse_accel; // GUI
int mouse_accel_threshold; // GUI
unsigned char touch_tap_to_click; // GUI
unsigned char mouse_natural_scroll; // GUI
unsigned char mouse_emulate_middle_button; // GUI
unsigned char touch_clickpad; // GUI
unsigned char touch_scrolling_mode; // GUI 0=edge, 1=2finger, 2=circle
unsigned char touch_scrolling_horiz; // GUI
unsigned char touch_palm_detect; // GUI
int border_raise_on_mouse_action; // GUI
int border_raise_on_focus; // GUI
int raise_on_revert_focus; // GUI

@ -151,6 +151,7 @@
#include "e_comp_canvas.h"
#include "e_utils.h"
#include "e_hints.h"
#include "e_comp_x_devices.h"
#include "e_comp_x_randr.h"
#ifdef HAVE_WAYLAND

@ -8,41 +8,7 @@ e_mouse_update(void)
{
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
{
unsigned char map[256] = { 0 };
int n;
if (!ecore_x_pointer_control_set(e_config->mouse_accel_numerator,
e_config->mouse_accel_denominator,
e_config->mouse_accel_threshold))
return 0;
if (!ecore_x_pointer_mapping_get(map, 256)) return 0;
for (n = 0; n < 256; n++)
{
if (!map[n]) break;
}
if (n < 3)
{
map[0] = 1;
map[1] = 2;
map[2] = 3;
n = 3;
}
if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
{
map[0] = 1;
map[2] = 3;
}
else if (e_config->mouse_hand == E_MOUSE_HAND_LEFT)
{
map[0] = 3;
map[2] = 1;
}
if (!ecore_x_pointer_mapping_set(map, n)) return 0;
}
e_comp_x_devices_config_apply();
#endif
#ifdef USE_MODULE_WL_DRM
@ -54,7 +20,7 @@ e_mouse_update(void)
if (dev)
{
ecore_drm2_device_pointer_left_handed_set(dev, (Eina_Bool)!e_config->mouse_hand);
ecore_drm2_device_pointer_accel_speed_set(dev, e_config->mouse_accel_numerator);
ecore_drm2_device_pointer_accel_speed_set(dev, e_config->mouse_accel);
ecore_drm2_device_touch_tap_to_click_enabled_set(dev, e_config->touch_tap_to_click);
}
}

@ -255,6 +255,7 @@ hdr = [
'e_comp_cfdata.h',
'e_comp_object.h',
'e_comp_x.h',
'e_comp_x_devices.h',
'e_comp_x_randr.h',
'e_config_data.h',
'e_config_dialog.h',
@ -421,6 +422,7 @@ endif
if config_h.has('HAVE_WAYLAND_ONLY') == false
src += [
'e_comp_x.c',
'e_comp_x_devices.c',
'e_comp_x_randr.c',
'e_alert.c',
'e_xsettings.c'

@ -21,10 +21,16 @@ struct _E_Config_Dialog_Data
} gui;
int mouse_hand;
double numerator;
double denominator;
double accel;
double threshold;
int emulate_middle_button;
int natural_scroll;
int tap_to_click;
int clickpad;
int scrolling_mode;
int scrolling_horiz;
int palm_detect;
};
E_Config_Dialog *
@ -45,8 +51,8 @@ e_int_config_mouse(Evas_Object *parent EINA_UNUSED, const char *params EINA_UNUS
v->basic.check_changed = _basic_check_changed;
cfd = e_config_dialog_new(NULL, _("Mouse Settings"), "E",
"keyboard_and_mouse/mouse_settings",
"preferences-desktop-mouse", 0, v, NULL);
"keyboard_and_mouse/mouse_settings",
"preferences-desktop-mouse", 0, v, NULL);
return cfd;
}
@ -59,10 +65,15 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->cursor_size = e_config->cursor_size;
cfdata->mouse_hand = e_config->mouse_hand;
cfdata->numerator = e_config->mouse_accel_numerator;
cfdata->denominator = e_config->mouse_accel_denominator;
cfdata->accel = e_config->mouse_accel;
cfdata->threshold = e_config->mouse_accel_threshold;
cfdata->tap_to_click = e_config->touch_tap_to_click;
cfdata->emulate_middle_button = e_config->mouse_emulate_middle_button;
cfdata->natural_scroll = e_config->mouse_natural_scroll;
cfdata->clickpad = e_config->touch_clickpad;
cfdata->scrolling_mode = e_config->touch_scrolling_mode;
cfdata->scrolling_horiz = e_config->touch_scrolling_horiz;
cfdata->palm_detect = e_config->touch_palm_detect;
}
static void *
@ -81,14 +92,19 @@ static int
_basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
{
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) &&
(cfdata->tap_to_click == e_config->touch_tap_to_click) &&
EINA_DBL_EQ(cfdata->numerator, e_config->mouse_accel_numerator) &&
EINA_DBL_EQ(cfdata->denominator, e_config->mouse_accel_denominator) &&
EINA_DBL_EQ(cfdata->threshold, e_config->mouse_accel_threshold));
(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) &&
(cfdata->tap_to_click == e_config->touch_tap_to_click) &&
(cfdata->emulate_middle_button == e_config->mouse_emulate_middle_button) &&
(cfdata->natural_scroll == e_config->mouse_natural_scroll) &&
(cfdata->clickpad == e_config->touch_clickpad) &&
(cfdata->scrolling_mode == e_config->touch_scrolling_mode) &&
(cfdata->scrolling_horiz == e_config->touch_scrolling_horiz) &&
(cfdata->palm_detect == e_config->touch_palm_detect) &&
EINA_DBL_EQ(cfdata->accel, e_config->mouse_accel) &&
EINA_DBL_EQ(cfdata->threshold, e_config->mouse_accel_threshold));
}
static void
@ -108,10 +124,15 @@ _basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata
e_config->cursor_size = cfdata->cursor_size;
e_config->mouse_hand = cfdata->mouse_hand;
e_config->mouse_accel_numerator = cfdata->numerator;
e_config->mouse_accel_denominator = cfdata->denominator;
e_config->mouse_accel = cfdata->accel;
e_config->mouse_accel_threshold = cfdata->threshold;
e_config->touch_tap_to_click = cfdata->tap_to_click;
e_config->mouse_emulate_middle_button = cfdata->emulate_middle_button;
e_config->mouse_natural_scroll = cfdata->natural_scroll;
e_config->touch_clickpad = cfdata->clickpad;
e_config->touch_scrolling_mode = cfdata->scrolling_mode;
e_config->touch_scrolling_horiz = cfdata->scrolling_horiz;
e_config->touch_palm_detect = cfdata->palm_detect;
e_config_save_queue();
/* Apply the above settings */
@ -211,36 +232,50 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dia
ob = e_widget_label_add(evas, _("Acceleration"));
e_widget_framelist_object_append(of, ob);
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
{
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 1.0, 30.0, 1.0, 0,
&(cfdata->numerator), NULL, 100);
}
#endif
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f"), -1.0, 1.0, 0.2, 0,
&(cfdata->numerator), NULL, 100);
}
#endif
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f"), -1.0, 1.0, 0.1, 0,
&(cfdata->accel), NULL, 100);
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"), 0.0, 10.0, 1.0, 0,
&(cfdata->threshold), NULL, 100);
&(cfdata->threshold), NULL, 100);
e_widget_framelist_object_append(of, ob);
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
oc = e_widget_check_add(evas, _("Tap to click"), &(cfdata->tap_to_click));
e_widget_framelist_object_append(of, oc);
}
#endif
e_widget_list_object_append(ol, of, 1, 0, 0.5);
of = e_widget_framelist_add(evas, _("Clicks"), 0);
oc = e_widget_check_add(evas, _("Tap to click"), &(cfdata->tap_to_click));
e_widget_framelist_object_append(of, oc);
oc = e_widget_check_add(evas, _("Middle mouse button emulation"), &(cfdata->emulate_middle_button));
e_widget_framelist_object_append(of, oc);
oc = e_widget_check_add(evas, _("Clickpad"), &(cfdata->clickpad));
e_widget_framelist_object_append(of, oc);
oc = e_widget_check_add(evas, _("Palm detect"), &(cfdata->palm_detect));
e_widget_framelist_object_append(of, oc);
e_widget_list_object_append(ol, of, 1, 0, 0.5);
of = e_widget_framelist_add(evas, _("Scrolling"), 0);
oc = e_widget_check_add(evas, _("Natural scrolling"), &(cfdata->natural_scroll));
e_widget_framelist_object_append(of, oc);
oc = e_widget_check_add(evas, _("Horizontal scrolling"), &(cfdata->scrolling_horiz));
e_widget_framelist_object_append(of, oc);
rg = e_widget_radio_group_new(&(cfdata->scrolling_mode));
ob = e_widget_radio_add(evas, _("Edge scrolling"), 0, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Two finger scrolling"), 1, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Circular scrolling"), 2, rg);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(ol, of, 1, 0, 0.5);
e_widget_toolbook_page_append(otb, NULL, _("Mouse"), ol,

Loading…
Cancel
Save