mirror of https://github.com/nirenjan/libx52.git
rename mouse handler and remove all references to evdev
parent
d1bdafb46d
commit
874b98fcca
|
|
@ -330,7 +330,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
x52d_notify_init(notify_sock);
|
x52d_notify_init(notify_sock);
|
||||||
x52d_io_init();
|
x52d_io_init();
|
||||||
x52d_mouse_evdev_init();
|
x52d_mouse_handler_init();
|
||||||
|
|
||||||
// Re-enable signals
|
// Re-enable signals
|
||||||
rc = pthread_sigmask(SIG_UNBLOCK, &sigblockset, NULL);
|
rc = pthread_sigmask(SIG_UNBLOCK, &sigblockset, NULL);
|
||||||
|
|
@ -369,7 +369,7 @@ cleanup:
|
||||||
x52d_dev_exit();
|
x52d_dev_exit();
|
||||||
x52d_command_exit();
|
x52d_command_exit();
|
||||||
x52d_notify_exit();
|
x52d_notify_exit();
|
||||||
x52d_mouse_evdev_exit();
|
x52d_mouse_handler_exit();
|
||||||
x52d_io_exit();
|
x52d_io_exit();
|
||||||
|
|
||||||
// Remove the PID file
|
// Remove the PID file
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ void x52d_cfg_set_Mouse_Enabled(bool enabled)
|
||||||
{
|
{
|
||||||
PINELOG_DEBUG(_("Setting mouse enable to %s"),
|
PINELOG_DEBUG(_("Setting mouse enable to %s"),
|
||||||
enabled ? _("on") : _("off"));
|
enabled ? _("on") : _("off"));
|
||||||
x52d_mouse_evdev_thread_control(enabled);
|
x52d_mouse_thread_control(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void x52d_cfg_set_Mouse_Speed(int speed)
|
void x52d_cfg_set_Mouse_Speed(int speed)
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ extern volatile int mouse_scroll_dir;
|
||||||
|
|
||||||
#define MOUSE_MULT_FACTOR 4
|
#define MOUSE_MULT_FACTOR 4
|
||||||
|
|
||||||
void x52d_mouse_evdev_thread_control(bool enabled);
|
void x52d_mouse_thread_control(bool enabled);
|
||||||
void x52d_mouse_evdev_init(void);
|
void x52d_mouse_handler_init(void);
|
||||||
void x52d_mouse_evdev_exit(void);
|
void x52d_mouse_handler_exit(void);
|
||||||
void x52d_mouse_report_event(libx52io_report *report);
|
void x52d_mouse_report_event(libx52io_report *report);
|
||||||
|
|
||||||
#endif // !defined X52D_MOUSE_H
|
#endif // !defined X52D_MOUSE_H
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ static int report_button_change(vkm_mouse_button button, int index)
|
||||||
if (old_button != new_button) {
|
if (old_button != new_button) {
|
||||||
state = new_button ? VKM_BUTTON_PRESSED : VKM_BUTTON_RELEASED;
|
state = new_button ? VKM_BUTTON_PRESSED : VKM_BUTTON_RELEASED;
|
||||||
rc = vkm_mouse_click(mouse_context, button, state);
|
rc = vkm_mouse_click(mouse_context, button, state);
|
||||||
if (rc != VKM_SUCCESS) {
|
if (rc != VKM_SUCCESS && rc != VKM_ERROR_NO_CHANGE) {
|
||||||
PINELOG_ERROR(_("Error writing mouse button event (button %d, state %d)"),
|
PINELOG_ERROR(_("Error %d writing mouse button event (button %d, state %d)"),
|
||||||
button, (int)new_button);
|
rc, button, (int)new_button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,9 +116,9 @@ static int report_axis(void)
|
||||||
int dy = get_axis_val(LIBX52IO_AXIS_THUMBY);
|
int dy = get_axis_val(LIBX52IO_AXIS_THUMBY);
|
||||||
|
|
||||||
rc = vkm_mouse_move(mouse_context, dx, dy);
|
rc = vkm_mouse_move(mouse_context, dx, dy);
|
||||||
if (rc != VKM_SUCCESS) {
|
if (rc != VKM_SUCCESS && rc != VKM_ERROR_NO_CHANGE) {
|
||||||
PINELOG_ERROR(_("Error writing mouse axis event (dx %d, dy %d)"),
|
PINELOG_ERROR(_("Error %d writing mouse axis event (dx %d, dy %d)"),
|
||||||
dx, dy);
|
rc, dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (rc == VKM_SUCCESS);
|
return (rc == VKM_SUCCESS);
|
||||||
|
|
@ -178,7 +178,7 @@ static void x52d_mouse_thr_exit(void)
|
||||||
pthread_cancel(mouse_thr);
|
pthread_cancel(mouse_thr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void x52d_mouse_evdev_thread_control(bool enabled)
|
void x52d_mouse_thread_control(bool enabled)
|
||||||
{
|
{
|
||||||
if (!vkm_is_ready(mouse_context)) {
|
if (!vkm_is_ready(mouse_context)) {
|
||||||
PINELOG_INFO(_("Virtual mouse not created. Ignoring thread state change"));
|
PINELOG_INFO(_("Virtual mouse not created. Ignoring thread state change"));
|
||||||
|
|
@ -227,7 +227,7 @@ void x52d_mouse_report_event(libx52io_report *report)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void x52d_mouse_evdev_init(void)
|
void x52d_mouse_handler_init(void)
|
||||||
{
|
{
|
||||||
vkm_result rc;
|
vkm_result rc;
|
||||||
|
|
||||||
|
|
@ -245,9 +245,9 @@ void x52d_mouse_evdev_init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void x52d_mouse_evdev_exit(void)
|
void x52d_mouse_handler_exit(void)
|
||||||
{
|
{
|
||||||
x52d_mouse_evdev_thread_control(false);
|
x52d_mouse_thread_control(false);
|
||||||
vkm_exit(mouse_context);
|
vkm_exit(mouse_context);
|
||||||
mouse_context = NULL;
|
mouse_context = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
#include "x52d_const.h"
|
#include "x52d_const.h"
|
||||||
#include "x52d_mouse.h"
|
#include "x52d_mouse.h"
|
||||||
|
|
||||||
/* Stub for evdev */
|
/* Stub for handler */
|
||||||
void x52d_mouse_evdev_thread_control(bool enabled)
|
void x52d_mouse_thread_control(bool enabled)
|
||||||
{
|
{
|
||||||
function_called();
|
function_called();
|
||||||
check_expected(enabled);
|
check_expected(enabled);
|
||||||
|
|
@ -29,8 +29,8 @@ void x52d_mouse_evdev_thread_control(bool enabled)
|
||||||
static void test_mouse_thread_enabled(void **state)
|
static void test_mouse_thread_enabled(void **state)
|
||||||
{
|
{
|
||||||
(void)state;
|
(void)state;
|
||||||
expect_function_calls(x52d_mouse_evdev_thread_control, 1);
|
expect_function_calls(x52d_mouse_thread_control, 1);
|
||||||
expect_value(x52d_mouse_evdev_thread_control, enabled, true);
|
expect_value(x52d_mouse_thread_control, enabled, true);
|
||||||
|
|
||||||
x52d_cfg_set_Mouse_Enabled(true);
|
x52d_cfg_set_Mouse_Enabled(true);
|
||||||
}
|
}
|
||||||
|
|
@ -38,8 +38,8 @@ static void test_mouse_thread_enabled(void **state)
|
||||||
static void test_mouse_thread_disabled(void **state)
|
static void test_mouse_thread_disabled(void **state)
|
||||||
{
|
{
|
||||||
(void)state;
|
(void)state;
|
||||||
expect_function_calls(x52d_mouse_evdev_thread_control, 1);
|
expect_function_calls(x52d_mouse_thread_control, 1);
|
||||||
expect_value(x52d_mouse_evdev_thread_control, enabled, false);
|
expect_value(x52d_mouse_thread_control, enabled, false);
|
||||||
|
|
||||||
x52d_cfg_set_Mouse_Enabled(false);
|
x52d_cfg_set_Mouse_Enabled(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue