available = get_property (device, "libinput Send Events Modes Available",
XA_INTEGER, 8, 2);
- if (!available)
- return;
switch (mode)
{
break;
}
+ change_property (device, "Synaptics Off", XA_INTEGER, 8, &values, 1);
+
+ if (!available)
+ return;
+
if ((values[0] && !available[0]) || (values[1] && !available[1]))
g_warning ("Device '%s' does not support sendevents mode %d\n",
clutter_input_device_get_device_name (device), mode);
{
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
- gfloat value = speed;
+ gfloat *accel = get_property (device, "libinput Accel Speed",
+ XInternAtom (xdisplay, "FLOAT", False), 32, 1);
- change_property (device, "libinput Accel Speed",
- XInternAtom (xdisplay, "FLOAT", False),
- 32, &value, 1);
+ if (accel)
+ {
+ *accel = speed; /* Sounds confused, but libinput is confused. */
+ change_property (device, "libinput Accel Speed",
+ XInternAtom (xdisplay, "FLOAT", False), 32, accel, 1);
+ meta_XFree (accel);
+ }
+ else
+ {
+ gfloat scale = (speed <= -1.0) ? 1.0 : (speed + 1.0) * 12.5;
+
+ change_property (device, "Device Accel Velocity Scaling",
+ XInternAtom (xdisplay, "FLOAT", False), 32, &scale, 1);
+ }
}
static void
change_property (device, "libinput Disable While Typing Enabled",
XA_INTEGER, 8, &value, 1);
+
+ change_property (device, "Synaptics Palm Detection",
+ XA_INTEGER, 8, &value, 1);
}
static void
gboolean enabled)
{
guchar value = (enabled) ? 1 : 0;
+ gint32 tap_time = (enabled) ? 180 : 0;
change_property (device, "libinput Tapping Enabled",
XA_INTEGER, 8, &value, 1);
+
+ change_property (device, "Synaptics Tap Time",
+ XA_INTEGER, 32, &tap_time, 1);
}
static void
change_property (device, "libinput Tapping Drag Enabled",
XA_INTEGER, 8, &value, 1);
+
+ change_property (device, "Synaptics Gestures",
+ XA_INTEGER, 8, &value, 1);
}
static void
ClutterInputDevice *device,
gboolean inverted)
{
- guchar value = (inverted) ? 1 : 0;
+ gint32 *scroll_dist = get_property (device, "Synaptics Scrolling Distance",
+ XA_INTEGER, 32, 2);
+ if (scroll_dist)
+ {
+ scroll_dist[0] = inverted ? -ABS (scroll_dist[0]) : ABS (scroll_dist[0]);
+ change_property (device, "Synaptics Scrolling Distance",
+ XA_INTEGER, 32, scroll_dist, 2);
+ meta_XFree (scroll_dist);
+ }
+ else
+ {
+ guchar value = (inverted) ? 1 : 0;
- change_property (device, "libinput Natural Scrolling Enabled",
- XA_INTEGER, 8, &value, 1);
+ change_property (device, "libinput Natural Scrolling Enabled",
+ XA_INTEGER, 8, &value, 1);
+ }
}
static void
guchar *current = NULL;
guchar *available = NULL;
+ current = get_property (device, "Synaptics Edge Scrolling",
+ XA_INTEGER, 8, 3);
+ if (current)
+ {
+ current[0] = current[1] = !!edge_scroll_enabled;
+ change_property (device, "Synaptics Edge Scrolling",
+ XA_INTEGER, 8, current, 3);
+ goto out;
+ }
+
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_EDGE])
guchar *current = NULL;
guchar *available = NULL;
+ current = get_property (device, "Synaptics Two-Finger Scrolling",
+ XA_INTEGER, 8, 2);
+ if (current)
+ {
+ current[0] = current[1] = !!two_finger_scroll_enabled;
+ change_property (device, "Synaptics Two-Finger Scrolling",
+ XA_INTEGER, 8, current, 2);
+ goto out;
+ }
+
available = get_property (device, "libinput Scroll Methods Available",
XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
if (!available || !available[SCROLL_METHOD_FIELD_2FG])
guchar *available = NULL;
gboolean has_two_finger = TRUE;
- available = get_property (device, "libinput Scroll Methods Available",
- XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
- if (!available || !available[SCROLL_METHOD_FIELD_2FG])
- has_two_finger = FALSE;
+ available = get_property (device, "Synaptics Two-Finger Scrolling",
+ XA_INTEGER, 8, 2);
+ if (available)
+ {
+ has_two_finger = available[0] || available[1];
+ }
+ else
+ {
+ available = get_property (device, "libinput Scroll Methods Available",
+ XA_INTEGER, 8, SCROLL_METHOD_NUM_FIELDS);
+ if (!available || !available[SCROLL_METHOD_FIELD_2FG])
+ has_two_finger = FALSE;
+ }
meta_XFree (available);
return has_two_finger;
XA_INTEGER, 32, &button, 1);
}
+static void
+meta_input_settings_x11_set_click_method_synaptics (MetaInputSettings *settings,
+ ClutterInputDevice *device,
+ GDesktopTouchpadClickMethod mode)
+{
+ /* { RT corner, RB, LT, LB, 1 finger, 2 fingers, 3 fingers } */
+ guchar tap_action_default[7] = { 2, 3, 0, 0, 1, 3, 0 };
+ guchar tap_action_areas[7] = { 2, 3, 0, 0, 1, 0, 0 };
+ guchar tap_action_fingers[7] = { 0, 0, 0, 0, 1, 3, 2 };
+ guchar tap_action_none[7] = { 0, 0, 0, 0, 1, 0, 0 };
+ guchar *tap_action = tap_action_default;
+
+ /* TODO On startup save the default value of 'Synaptics Soft Button Areas',
+ but save it where? */
+ gint32 zero_button_areas[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ gint32 *button_areas_known = NULL;
+
+ switch (mode)
+ {
+ case G_DESKTOP_TOUCHPAD_CLICK_METHOD_DEFAULT:
+ tap_action = tap_action_default;
+ /* Doing nothing right now will give the correct default, unless changed
+ during the session */
+ break;
+ case G_DESKTOP_TOUCHPAD_CLICK_METHOD_NONE:
+ tap_action = tap_action_none;
+ button_areas_known = zero_button_areas;
+ break;
+ case G_DESKTOP_TOUCHPAD_CLICK_METHOD_AREAS:
+ tap_action = tap_action_areas;
+ /* Doing nothing right now will give the correct default, unless changed
+ during the session */
+ break;
+ case G_DESKTOP_TOUCHPAD_CLICK_METHOD_FINGERS:
+ tap_action = tap_action_fingers;
+ button_areas_known = zero_button_areas;
+ break;
+ default:
+ g_assert_not_reached ();
+ return;
+ }
+
+ change_property (device, "Synaptics Tap Action",
+ XA_INTEGER, 8, tap_action, 7);
+ change_property (device, "Synaptics Click Action",
+ XA_INTEGER, 8, tap_action + 4, 3);
+
+ if (button_areas_known)
+ change_property (device, "Synaptics Soft Button Areas",
+ XA_INTEGER, 32, button_areas_known, 8);
+}
+
static void
meta_input_settings_x11_set_click_method (MetaInputSettings *settings,
ClutterInputDevice *device,
available = get_property (device, "libinput Click Methods Available",
XA_INTEGER, 8, 2);
if (!available)
- return;
+ {
+ meta_input_settings_x11_set_click_method_synaptics (settings, device,
+ mode);
+ return;
+ }
switch (mode)
{