26,7 → 26,7 |
*/ |
|
#include <kernel/kern.h> |
#include <sem/sem/sem.h> |
#include <kernel/int_sem.h> |
|
#include "../include/drivers/shark_input26.h" |
#include "../include/drivers/shark_mouse26.h" |
41,7 → 41,8 |
extern MOUSE_HANDLER user_mouse_handler; |
|
/* a mutex semaphore */ |
static sem_t mutex=-1; |
static int mcur_mutex_init = 0; |
static internal_sem_t mutex; |
|
/* Setup function */ |
int _mouse_cursor_init(int cmd, void(*my_show_cursor)(int, int), void(*my_restore_cursor)(int, int)); |
80,7 → 81,7 |
if (user_mouse_handler != NULL) |
user_mouse_handler(event); |
|
sem_wait(&mutex); |
internal_sem_wait(&mutex); |
if ( (mouse_cursor_state < 0) && (event->x != saved_x || event->y != saved_y)) { |
restore_cursor(saved_x, saved_y); |
saved_x = event->x; |
87,7 → 88,7 |
saved_y = event->y; |
show_cursor(saved_x, saved_y); |
} |
sem_post(&mutex); |
internal_sem_post(&mutex); |
} |
|
/* with WITHOUTSEM flag*/ |
113,7 → 114,7 |
#ifdef CURTXT_DEBUG |
printk(KERN_DEBUG "mcurtxt.c: autocursor_mouse_handler_3\n"); |
#endif |
sem_wait(&mutex); |
internal_sem_wait(&mutex); |
|
if (mouse_cursor_state < 0) { |
restore_cursor(saved_x, saved_y); |
125,7 → 126,7 |
} else if (user_mouse_handler != NULL) |
user_mouse_handler(event); |
|
sem_post(&mutex); |
internal_sem_post(&mutex); |
} |
|
/* with WITHOUTSEM & AUTOOFF flags */ |
221,9 → 222,9 |
|
static void mouse_on_sem(void) |
{ |
sem_wait(&mutex); |
internal_sem_wait(&mutex); |
MOUSE_ON(); |
sem_post(&mutex); |
internal_sem_post(&mutex); |
} |
|
static void mouse_on_nosem(void) |
242,9 → 243,9 |
|
void mouse_off_sem(void) |
{ |
sem_wait(&mutex); |
internal_sem_wait(&mutex); |
MOUSE_OFF(); |
sem_post(&mutex); |
internal_sem_post(&mutex); |
} |
|
void mouse_off_nosem(void) |
275,9 → 276,9 |
|
int _mouse_cursor_init(int cmd, void(*my_show_cursor)(int, int), void(*my_restore_cursor)(int, int)) |
{ |
if (mutex == -1) { |
if (sem_init(&mutex, 0, 1) == -1) |
return -1; |
if (mcur_mutex_init == 0) { |
internal_sem_init(&mutex, 1); |
mcur_mutex_init = 1; |
} |
|
#ifdef CURTXT_DEBUG |