14 #include "../include/tscope5/mouse_internal.h"
15 #include "../include/tscope5/system_internal.h"
16 #include "../include/tscope5/timer_internal.h"
17 #include "../include/tscope5/graphics_internal.h"
38 ts5_log(TS5_LOGLEVEL_6,
"%s: ts5_check_mouse\n", calling_function);
41 ts5_fatal(
"%s: Tscope5 not installed\n", calling_function);
44 if (_ts5_status.active_display == -1) {
45 ts5_fatal(
"%s: no active display available\n", calling_function);
71 ts5_log(TS5_LOGLEVEL_1,
"%s: Installing Tscope5 mouse\n",
74 if (!al_install_mouse()) {
75 ts5_fatal(
"%s: could not install Tscope5 mouse\n",
79 al_register_event_source(_ts5_data.timer.response_queue,
80 al_get_mouse_event_source());
82 _ts5_status.timer.mouse.num_buttons = al_get_mouse_num_buttons();
83 _ts5_status.timer.mouse.num_defined_buttons = 0;
84 _ts5_status.timer.mouse.num_active_buttons = 0;
86 _ts5_status.timer.mouse.button_press_defined =
87 (
int *)al_malloc(
sizeof(
int)*_ts5_status.timer.mouse.num_buttons);
89 _ts5_status.timer.mouse.button_press_active =
90 (
int *)al_malloc(
sizeof(
int)*_ts5_status.timer.mouse.num_buttons);
92 _ts5_status.timer.mouse.button_release_defined =
93 (
int *)al_malloc(
sizeof(
int)*_ts5_status.timer.mouse.num_buttons);
95 _ts5_status.timer.mouse.button_release_active =
96 (
int *)al_malloc(
sizeof(
int)*_ts5_status.timer.mouse.num_buttons);
99 for (i=0; i<_ts5_status.timer.mouse.num_buttons; i++) {
100 _ts5_status.timer.mouse.button_press_defined[i] = 0;
101 _ts5_status.timer.mouse.button_press_active[i] = 0;
102 _ts5_status.timer.mouse.button_release_defined[i] = 0;
103 _ts5_status.timer.mouse.button_release_active[i] = 0;
120 ts5_log(TS5_LOGLEVEL_1,
"Uninstalling Tscope5 mouse\n");
122 _ts5_status.timer.mouse.num_buttons = 0;
123 _ts5_status.timer.mouse.num_defined_buttons = 0;
124 _ts5_status.timer.mouse.num_active_buttons = 0;
126 al_free(_ts5_status.timer.mouse.button_press_defined);
127 _ts5_status.timer.mouse.button_press_defined = NULL;
129 al_free(_ts5_status.timer.mouse.button_press_active);
130 _ts5_status.timer.mouse.button_press_active = NULL;
132 al_free(_ts5_status.timer.mouse.button_release_defined);
133 _ts5_status.timer.mouse.button_release_defined = NULL;
135 al_free(_ts5_status.timer.mouse.button_release_active);
136 _ts5_status.timer.mouse.button_release_active = NULL;
138 _ts5_status.timer.mouse_is_response_device = 0;
140 al_unregister_event_source(_ts5_data.timer.response_queue,
141 al_get_mouse_event_source());
143 al_uninstall_mouse();
int _ts5_is_tscope5_installed
Is Tscope5 installed?
int _ts5_is_timer_installed
Is the timer subsystem installed?
void ts5_install_mouse(char *calling_function)
Install the mouse subsystem.
int _ts5_is_mouse_installed
Is the mouse subsystem installed?
void ts5_install_timer(char *calling_function)
Install the timer subsystem.
void ts5_log(const unsigned int level, const char *format,...)
Send info to a logging window.
void ts5_check_mouse(char *calling_function)
Do some checks at the start of each mouse function.
void ts5_fatal(const char *format,...)
Exit safely with an error message.
void ts5_uninstall_mouse()
Uninstall the mouse subsystem.