XQuartz: Make WarpPointer multithread safe in XQuartz.
This commit is contained in:
parent
2e45344870
commit
c1caeb52a4
|
@ -107,7 +107,7 @@ static pthread_t create_thread(void *func, void *arg) {
|
||||||
return tid;
|
return tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void darwinEvents_lock(void) {
|
void darwinEvents_lock(void) {
|
||||||
int err;
|
int err;
|
||||||
if((err = pthread_mutex_lock(&mieq_lock))) {
|
if((err = pthread_mutex_lock(&mieq_lock))) {
|
||||||
ErrorF("%s:%s:%d: Failed to lock mieq_lock: %d\n",
|
ErrorF("%s:%s:%d: Failed to lock mieq_lock: %d\n",
|
||||||
|
@ -119,7 +119,7 @@ static inline void darwinEvents_lock(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void darwinEvents_unlock(void) {
|
void darwinEvents_unlock(void) {
|
||||||
int err;
|
int err;
|
||||||
if((err = pthread_mutex_unlock(&mieq_lock))) {
|
if((err = pthread_mutex_unlock(&mieq_lock))) {
|
||||||
ErrorF("%s:%s:%d: Failed to unlock mieq_lock: %d\n",
|
ErrorF("%s:%s:%d: Failed to unlock mieq_lock: %d\n",
|
||||||
|
|
|
@ -486,6 +486,12 @@ miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
|
||||||
*y = miPointer.y;
|
*y = miPointer.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XQUARTZ
|
||||||
|
#include <pthread.h>
|
||||||
|
void darwinEvents_lock(void);
|
||||||
|
void darwinEvents_unlock(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time)
|
miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time)
|
||||||
{
|
{
|
||||||
|
@ -512,6 +518,12 @@ miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time)
|
||||||
nevents = GetPointerEvents(events, inputInfo.pointer, MotionNotify, 0,
|
nevents = GetPointerEvents(events, inputInfo.pointer, MotionNotify, 0,
|
||||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||||
|
|
||||||
|
#ifdef XQUARTZ
|
||||||
|
darwinEvents_lock();
|
||||||
|
#endif
|
||||||
for (i = 0; i < nevents; i++)
|
for (i = 0; i < nevents; i++)
|
||||||
mieqEnqueue(inputInfo.pointer, &events[i]);
|
mieqEnqueue(inputInfo.pointer, &events[i]);
|
||||||
|
#ifdef XQUARTZ
|
||||||
|
darwinEvents_unlock();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user