Motion sync loaded in UI, support in g-wolves

This commit is contained in:
2023-09-30 23:50:33 +02:00
parent a12e682eda
commit 22cb968b64
3 changed files with 41 additions and 1 deletions
+12
View File
@@ -9,6 +9,7 @@ struct _MousePanel
GtkLabel* mouse_name;
AdwPreferencesGroup* dpi_preference_group;
AdwButtonContent* dpi_stage_add_button;
AdwSwitchRow* motion_sync_switchrow;
};
G_DEFINE_TYPE (MousePanel, mouse_panel, panel_get_type())
@@ -25,6 +26,7 @@ mouse_panel_class_init(MousePanelClass* klass)
gtk_widget_class_bind_template_child(widget_class, MousePanel, mouse_name);
gtk_widget_class_bind_template_child(widget_class, MousePanel, dpi_preference_group);
gtk_widget_class_bind_template_child(widget_class, MousePanel, dpi_stage_add_button);
gtk_widget_class_bind_template_child(widget_class, MousePanel, motion_sync_switchrow);
}
static void
@@ -95,4 +97,14 @@ void mouse_panel_set_device(MousePanel* self, device_t* device)
adw_preferences_group_add(self->dpi_preference_group, GTK_WIDGET(row));
}
}
// Set mouse 'motion sync' feature
bool motion_sync = false;
int (*driver_mouse_motion_sync_get)(void*, bool*) = dlsym(device_driver(device), "driver_mouse_motion_sync_get");
int motionsync_res = driver_mouse_motion_sync_get(device_handle(device), &motion_sync);
if(!motionsync_res)
{
adw_switch_row_set_active(self->motion_sync_switchrow, motion_sync);
}
}