XQuartz: Avoid a race in initialization of darwinPointer
http://xquartz.macosforge.org/trac/ticket/579 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
parent
c495211373
commit
acdc4f54ee
|
@ -1329,6 +1329,11 @@ untrusted_str(NSEvent *e)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void
|
||||||
|
darwinEvents_lock(void);
|
||||||
|
extern void
|
||||||
|
darwinEvents_unlock(void);
|
||||||
|
|
||||||
- (void) sendX11NSEvent:(NSEvent *)e
|
- (void) sendX11NSEvent:(NSEvent *)e
|
||||||
{
|
{
|
||||||
NSPoint location = NSZeroPoint;
|
NSPoint location = NSZeroPoint;
|
||||||
|
@ -1341,18 +1346,15 @@ untrusted_str(NSEvent *e)
|
||||||
int modifierFlags;
|
int modifierFlags;
|
||||||
BOOL isMouseOrTabletEvent, isTabletEvent;
|
BOOL isMouseOrTabletEvent, isTabletEvent;
|
||||||
|
|
||||||
#ifdef HAVE_LIBDISPATCH
|
|
||||||
static dispatch_once_t once_pred;
|
|
||||||
dispatch_once(&once_pred, ^{
|
|
||||||
tilt = NSZeroPoint;
|
|
||||||
darwinTabletCurrent = darwinTabletStylus;
|
|
||||||
});
|
|
||||||
#else
|
|
||||||
if (!darwinTabletCurrent) {
|
if (!darwinTabletCurrent) {
|
||||||
|
/* Ensure that the event system is initialized */
|
||||||
|
darwinEvents_lock();
|
||||||
|
darwinEvents_unlock();
|
||||||
|
assert(darwinTabletStylus);
|
||||||
|
|
||||||
tilt = NSZeroPoint;
|
tilt = NSZeroPoint;
|
||||||
darwinTabletCurrent = darwinTabletStylus;
|
darwinTabletCurrent = darwinTabletStylus;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
isMouseOrTabletEvent = [e type] == NSLeftMouseDown ||
|
isMouseOrTabletEvent = [e type] == NSLeftMouseDown ||
|
||||||
[e type] == NSOtherMouseDown ||
|
[e type] == NSOtherMouseDown ||
|
||||||
|
|
Loading…
Reference in New Issue