mouse: Offer a separate option for edge scrolling
When a touchpad supports it. When the option is set, it will automatically disable two-finger scrolling. The scrolling method used by each individual touchpad is implemented in mutter, not here. https://bugzilla.gnome.org/show_bug.cgi?id=761461
This commit is contained in:
parent
f7fad92c3e
commit
f01277fb48
3 changed files with 86 additions and 3 deletions
|
@ -97,7 +97,7 @@ NETWORK_MANAGER_APPLET_REQUIRED_VERSION=1.2.0
|
||||||
MODEM_MANAGER_REQUIRED_VERSION=0.7
|
MODEM_MANAGER_REQUIRED_VERSION=0.7
|
||||||
LIBNOTIFY_REQUIRED_VERSION=0.7.3
|
LIBNOTIFY_REQUIRED_VERSION=0.7.3
|
||||||
GNOME_DESKTOP_REQUIRED_VERSION=3.21.2
|
GNOME_DESKTOP_REQUIRED_VERSION=3.21.2
|
||||||
SCHEMAS_REQUIRED_VERSION=3.19.3
|
SCHEMAS_REQUIRED_VERSION=3.21.4
|
||||||
LIBWACOM_REQUIRED_VERSION=0.7
|
LIBWACOM_REQUIRED_VERSION=0.7
|
||||||
CLUTTER_REQUIRED_VERSION=1.11.3
|
CLUTTER_REQUIRED_VERSION=1.11.3
|
||||||
GOA_REQUIRED_VERSION=3.15.1
|
GOA_REQUIRED_VERSION=3.15.1
|
||||||
|
|
|
@ -76,6 +76,7 @@ static void
|
||||||
setup_touchpad_options (CcMousePropertiesPrivate *d)
|
setup_touchpad_options (CcMousePropertiesPrivate *d)
|
||||||
{
|
{
|
||||||
gboolean edge_scroll_enabled;
|
gboolean edge_scroll_enabled;
|
||||||
|
gboolean two_finger_scroll_enabled;
|
||||||
gboolean have_two_finger_scrolling;
|
gboolean have_two_finger_scrolling;
|
||||||
gboolean have_edge_scrolling;
|
gboolean have_edge_scrolling;
|
||||||
gboolean have_tap_to_click;
|
gboolean have_tap_to_click;
|
||||||
|
@ -92,15 +93,37 @@ setup_touchpad_options (CcMousePropertiesPrivate *d)
|
||||||
|
|
||||||
gtk_widget_show_all (WID ("touchpad-frame"));
|
gtk_widget_show_all (WID ("touchpad-frame"));
|
||||||
|
|
||||||
gtk_widget_set_visible (WID ("edge-scrolling-row"), have_edge_scrolling && !have_two_finger_scrolling);
|
gtk_widget_set_visible (WID ("two-finger-scrolling-row"), have_two_finger_scrolling);
|
||||||
|
gtk_widget_set_visible (WID ("edge-scrolling-row"), have_edge_scrolling);
|
||||||
gtk_widget_set_visible (WID ("tap-to-click-row"), have_tap_to_click);
|
gtk_widget_set_visible (WID ("tap-to-click-row"), have_tap_to_click);
|
||||||
|
|
||||||
edge_scroll_enabled = g_settings_get_boolean (d->touchpad_settings, "edge-scrolling-enabled");
|
edge_scroll_enabled = g_settings_get_boolean (d->touchpad_settings, "edge-scrolling-enabled");
|
||||||
|
two_finger_scroll_enabled = g_settings_get_boolean (d->touchpad_settings, "two-finger-scrolling-enabled");
|
||||||
d->changing_scroll = TRUE;
|
d->changing_scroll = TRUE;
|
||||||
gtk_switch_set_active (GTK_SWITCH (WID ("edge-scrolling-switch")), edge_scroll_enabled);
|
gtk_switch_set_active (GTK_SWITCH (WID ("edge-scrolling-switch")), edge_scroll_enabled);
|
||||||
|
gtk_switch_set_active (GTK_SWITCH (WID ("two-finger-scrolling-switch")), two_finger_scroll_enabled);
|
||||||
d->changing_scroll = FALSE;
|
d->changing_scroll = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
two_finger_scrolling_changed_event (GtkSwitch *button,
|
||||||
|
gboolean state,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
CcMousePropertiesPrivate *d = user_data;
|
||||||
|
|
||||||
|
if (d->changing_scroll)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_settings_set_boolean (d->touchpad_settings, "two-finger-scrolling-enabled", state);
|
||||||
|
gtk_switch_set_state (button, state);
|
||||||
|
|
||||||
|
if (state && gtk_widget_get_visible (WID ("edge-scrolling-row"))) {
|
||||||
|
/* Disable edge scrolling if two-finger scrolling is enabled */
|
||||||
|
gtk_switch_set_state (GTK_SWITCH (WID ("edge-scrolling-switch")), FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edge_scrolling_changed_event (GtkSwitch *button,
|
edge_scrolling_changed_event (GtkSwitch *button,
|
||||||
gboolean state,
|
gboolean state,
|
||||||
|
@ -111,8 +134,13 @@ edge_scrolling_changed_event (GtkSwitch *button,
|
||||||
if (d->changing_scroll)
|
if (d->changing_scroll)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_settings_set_boolean (d->touchpad_settings, "edge-scrolling-switch", state);
|
g_settings_set_boolean (d->touchpad_settings, "edge-scrolling-enabled", state);
|
||||||
gtk_switch_set_state (button, state);
|
gtk_switch_set_state (button, state);
|
||||||
|
|
||||||
|
if (state && gtk_widget_get_visible (WID ("two-finger-scrolling-row"))) {
|
||||||
|
/* Disable two-finger scrolling if edge scrolling is enabled */
|
||||||
|
gtk_switch_set_state (GTK_SWITCH (WID ("two-finger-scrolling-switch")), FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -254,6 +282,8 @@ setup_dialog (CcMousePropertiesPrivate *d)
|
||||||
|
|
||||||
g_signal_connect (WID ("edge-scrolling-switch"), "state-set",
|
g_signal_connect (WID ("edge-scrolling-switch"), "state-set",
|
||||||
G_CALLBACK (edge_scrolling_changed_event), d);
|
G_CALLBACK (edge_scrolling_changed_event), d);
|
||||||
|
g_signal_connect (WID ("two-finger-scrolling-switch"), "state-set",
|
||||||
|
G_CALLBACK (two_finger_scrolling_changed_event), d);
|
||||||
|
|
||||||
gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("touchpad-options-listbox")), cc_list_box_update_header_func, NULL, NULL);
|
gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("touchpad-options-listbox")), cc_list_box_update_header_func, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -615,6 +615,59 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBoxRow" id="two-finger-scrolling-row">
|
||||||
|
<property name="visible">False</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="no_show_all">True</property>
|
||||||
|
<property name="activatable">false</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="two-finger-scrolling-grid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="row_spacing">0</property>
|
||||||
|
<property name="column_spacing">32</property>
|
||||||
|
<property name="margin_start">12</property>
|
||||||
|
<property name="margin_end">6</property>
|
||||||
|
<property name="margin_top">6</property>
|
||||||
|
<property name="margin_bottom">6</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="two-finger-scrolling-label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="valign">end</property>
|
||||||
|
<property name="label" translatable="yes">Two-finger Scrolling</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="mnemonic_widget">two-finger-scrolling-switch</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="width">1</property>
|
||||||
|
<property name="height">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="two-finger-scrolling-switch">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="width">1</property>
|
||||||
|
<property name="height">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBoxRow" id="edge-scrolling-row">
|
<object class="GtkListBoxRow" id="edge-scrolling-row">
|
||||||
<property name="visible">False</property>
|
<property name="visible">False</property>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue