Commit 3dc77a68 authored by Robert Ancell's avatar Robert Ancell

mouse: Connect signal handlers swapped

parent 41d98fdf
Pipeline #13705 passed with stages
in 3 minutes and 13 seconds
......@@ -131,17 +131,14 @@ setup_touchpad_options (CcMouseProperties *self)
}
static void
two_finger_scrolling_changed_event (GtkSwitch *button,
gboolean state,
gpointer user_data)
two_finger_scrolling_changed_event (CcMouseProperties *self,
gboolean state)
{
CcMouseProperties *self = user_data;
if (self->changing_scroll)
return;
g_settings_set_boolean (self->touchpad_settings, "two-finger-scrolling-enabled", state);
gtk_switch_set_state (button, state);
gtk_switch_set_state (GTK_SWITCH (self->two_finger_scrolling_switch), state);
if (state && gtk_widget_get_visible (self->edge_scrolling_row)) {
/* Disable edge scrolling if two-finger scrolling is enabled */
......@@ -150,17 +147,14 @@ two_finger_scrolling_changed_event (GtkSwitch *button,
}
static void
edge_scrolling_changed_event (GtkSwitch *button,
gboolean state,
gpointer user_data)
edge_scrolling_changed_event (CcMouseProperties *self,
gboolean state)
{
CcMouseProperties *self = user_data;
if (self->changing_scroll)
return;
g_settings_set_boolean (self->touchpad_settings, "edge-scrolling-enabled", state);
gtk_switch_set_state (button, state);
gtk_switch_set_state (GTK_SWITCH (self->edge_scrolling_switch), state);
if (state && gtk_widget_get_visible (self->two_finger_scrolling_row)) {
/* Disable two-finger scrolling if edge scrolling is enabled */
......@@ -329,17 +323,16 @@ device_changed (GsdDeviceManager *device_manager,
}
static void
on_content_size_changed (GtkWidget *widget,
GtkAllocation *allocation,
gpointer data)
on_content_size_changed (CcMouseProperties *self,
GtkAllocation *allocation)
{
if (allocation->height < 490) {
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
} else {
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (widget), 490);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (self->scrolled_window), 490);
}
}
......
......@@ -25,7 +25,7 @@
<property name="can_focus">True</property>
<property name="shadow_type">none</property>
<property name="hscrollbar_policy">never</property>
<signal name="size-allocate" handler="on_content_size_changed"/>
<signal name="size-allocate" handler="on_content_size_changed" object="CcMouseProperties" swapped="yes"/>
<child>
<object class="GtkBox" id="prefs_widget">
<property name="visible">True</property>
......@@ -653,7 +653,7 @@
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<signal name="state-set" handler="two_finger_scrolling_changed_event"/>
<signal name="state-set" handler="two_finger_scrolling_changed_event" object="CcMouseProperties" swapped="yes"/>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -707,7 +707,7 @@
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<signal name="state-set" handler="edge_scrolling_changed_event"/>
<signal name="state-set" handler="edge_scrolling_changed_event" object="CcMouseProperties" swapped="yes"/>
</object>
<packing>
<property name="left_attach">1</property>
......
......@@ -183,9 +183,7 @@ setup_scroll_image (CcMouseTest *self)
/* Callback issued when the user clicks the double click testing area. */
static gboolean
button_drawing_area_button_press_event (GtkWidget *widget,
GdkEventButton *event,
CcMouseTest *self)
button_drawing_area_button_press_event (CcMouseTest *self, GdkEventButton *event)
{
gint double_click_time;
......@@ -236,17 +234,16 @@ button_drawing_area_button_press_event (GtkWidget *widget,
}
static gboolean
button_drawing_area_draw_event (GtkWidget *widget,
cairo_t *cr,
CcMouseTest *self)
button_drawing_area_draw_event (CcMouseTest *self,
cairo_t *cr)
{
gdouble center_x, center_y, size;
GdkRGBA inner_color, outer_color;
cairo_pattern_t *pattern;
size = MAX (MIN (gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget)), 1);
center_x = gtk_widget_get_allocated_width (widget) / 2.0;
center_y = gtk_widget_get_allocated_height (widget) / 2.0;
size = MAX (MIN (gtk_widget_get_allocated_width (self->button_drawing_area), gtk_widget_get_allocated_height (self->button_drawing_area)), 1);
center_x = gtk_widget_get_allocated_width (self->button_drawing_area) / 2.0;
center_y = gtk_widget_get_allocated_height (self->button_drawing_area) / 2.0;
switch (self->double_click_state) {
case DOUBLE_CLICK_TEST_ON:
......
......@@ -76,8 +76,8 @@
<property name="margin_top">20</property>
<property name="margin_bottom">20</property>
<property name="hexpand">True</property>
<signal name="button_press_event" handler="button_drawing_area_button_press_event"/>
<signal name="draw" handler="button_drawing_area_draw_event"/>
<signal name="button_press_event" handler="button_drawing_area_button_press_event" object="CcMouseTest" swapped="yes"/>
<signal name="draw" handler="button_drawing_area_draw_event" object="CcMouseTest" swapped="yes"/>
</object>
<packing>
<property name="left_attach">0</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment