Fixed pointer events in Xquartz -- Keyboard events work, but
the keycodes are incorrect.
This commit is contained in:
parent
39ecd6fff4
commit
2dafc46e3d
|
@ -867,7 +867,8 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
int valuators[2];
|
int valuators[2];
|
||||||
float count;
|
float count;
|
||||||
xEvent xe;
|
xEvent xe;
|
||||||
|
char nullbyte=0;
|
||||||
|
|
||||||
bzero(&xe, sizeof(xe));
|
bzero(&xe, sizeof(xe));
|
||||||
input_check_flag++;
|
input_check_flag++;
|
||||||
|
|
||||||
|
@ -886,10 +887,10 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
pointer_y = (screen.origin.y + screen.size.height) - location.y;
|
pointer_y = (screen.origin.y + screen.size.height) - location.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorF("send_nsevent: type=%d pointer=(%d,%d)\n", type, pointer_x, pointer_y);
|
// ErrorF("send_nsevent: type=%d pointer=(%d,%d)\n", type, pointer_x, pointer_y);
|
||||||
|
|
||||||
valuators[0] = pointer_x;
|
valuators[0] = pointer_x;
|
||||||
valuators[1] = pointer_y;
|
valuators[1] = pointer_y - aquaMenuBarHeight;
|
||||||
state = convert_flags ([e modifierFlags]);
|
state = convert_flags ([e modifierFlags]);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -916,12 +917,8 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
num_events = GetPointerEvents(quartzEvents, darwinPointer, ev_type, ev_button,
|
num_events = GetPointerEvents(quartzEvents, darwinPointer, ev_type, ev_button,
|
||||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||||
|
|
||||||
ErrorF("GetPointerEvents returned %d events\n", num_events);
|
for(i=0; i<num_events; i++)
|
||||||
for(i=0; i<num_events; i++) {
|
|
||||||
ErrorF("qe[%d].u.u.type=%d\n", i, quartzEvents[i].u.u.type);
|
|
||||||
// quartzEvents[i].u.keyButtonPointer.state = state;
|
|
||||||
mieqEnqueue (darwinPointer,&quartzEvents[i]);
|
mieqEnqueue (darwinPointer,&quartzEvents[i]);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case NSScrollWheel:
|
case NSScrollWheel:
|
||||||
count = [e deltaY];
|
count = [e deltaY];
|
||||||
|
@ -929,28 +926,23 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
|
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
|
||||||
num_events = GetPointerEvents(quartzEvents, darwinPointer, ButtonPress, ev_button,
|
num_events = GetPointerEvents(quartzEvents, darwinPointer, ButtonPress, ev_button,
|
||||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||||
for(i=0; i<num_events; i++) {
|
for(i=0; i<num_events; i++)
|
||||||
// quartzEvents[i].u.keyButtonPointer.state = state;
|
|
||||||
mieqEnqueue(darwinPointer,&quartzEvents[i]);
|
mieqEnqueue(darwinPointer,&quartzEvents[i]);
|
||||||
}
|
|
||||||
num_events = GetPointerEvents(quartzEvents, darwinPointer, ButtonRelease, ev_button,
|
num_events = GetPointerEvents(quartzEvents, darwinPointer, ButtonRelease, ev_button,
|
||||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||||
for(i=0; i<num_events; i++) {
|
for(i=0; i<num_events; i++)
|
||||||
// quartzEvents[i].u.keyButtonPointer.state = state;
|
|
||||||
mieqEnqueue(darwinPointer,&quartzEvents[i]);
|
mieqEnqueue(darwinPointer,&quartzEvents[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSKeyDown:
|
case NSKeyDown: // do we need to translate these keyCodes?
|
||||||
case NSKeyUp:
|
case NSKeyUp:
|
||||||
num_events = GetKeyboardEvents(quartzEvents, darwinKeyboard,
|
num_events = GetKeyboardEvents(quartzEvents, darwinKeyboard,
|
||||||
(type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
|
(type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
|
||||||
for(i=0; i<num_events; i++) {
|
for(i=0; i<num_events; i++)
|
||||||
// quartzEvents[i].u.keyButtonPointer.state = state;
|
|
||||||
mieqEnqueue(darwinKeyboard,&quartzEvents[i]);
|
mieqEnqueue(darwinKeyboard,&quartzEvents[i]);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSFlagsChanged:
|
case NSFlagsChanged:
|
||||||
xe.u.u.type = kXDarwinUpdateModifiers;
|
xe.u.u.type = kXDarwinUpdateModifiers;
|
||||||
xe.u.clientMessage.u.l.longs0 = [e modifierFlags];
|
xe.u.clientMessage.u.l.longs0 = [e modifierFlags];
|
||||||
|
@ -958,5 +950,6 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
break;
|
break;
|
||||||
default: break; /* for gcc */
|
default: break; /* for gcc */
|
||||||
}
|
}
|
||||||
// UpdateCurrentTime();
|
// <daniels> bushing: oh, i ... er ... christ.
|
||||||
|
write(darwinEventWriteFD, &nullbyte, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,7 +446,11 @@ ProcAppleWMSetWindowMenu(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef INXQUARTZ
|
||||||
|
X11ApplicationSetWindowMenu (nitems, items, shortcuts);
|
||||||
|
#else
|
||||||
QuartzSetWindowMenu (nitems, items, shortcuts);
|
QuartzSetWindowMenu (nitems, items, shortcuts);
|
||||||
|
#endif
|
||||||
|
|
||||||
free(items);
|
free(items);
|
||||||
free(shortcuts);
|
free(shortcuts);
|
||||||
|
@ -462,10 +466,12 @@ ProcAppleWMSetWindowMenuCheck(
|
||||||
REQUEST(xAppleWMSetWindowMenuCheckReq);
|
REQUEST(xAppleWMSetWindowMenuCheckReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xAppleWMSetWindowMenuCheckReq);
|
REQUEST_SIZE_MATCH(xAppleWMSetWindowMenuCheckReq);
|
||||||
|
#ifdef INXQUARTZ
|
||||||
|
X11ApplicationSetWindowMenuCheck(stuff->index);
|
||||||
|
#else
|
||||||
QuartzMessageMainThread(kQuartzSetWindowMenuCheck, &stuff->index,
|
QuartzMessageMainThread(kQuartzSetWindowMenuCheck, &stuff->index,
|
||||||
sizeof(stuff->index));
|
sizeof(stuff->index));
|
||||||
|
#endif
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,9 +481,11 @@ ProcAppleWMSetFrontProcess(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
REQUEST_SIZE_MATCH(xAppleWMSetFrontProcessReq);
|
REQUEST_SIZE_MATCH(xAppleWMSetFrontProcessReq);
|
||||||
|
#ifdef INXQUARTZ
|
||||||
|
X11ApplicationSetFrontProcess();
|
||||||
|
#else
|
||||||
QuartzMessageMainThread(kQuartzSetFrontProcess, NULL, 0);
|
QuartzMessageMainThread(kQuartzSetFrontProcess, NULL, 0);
|
||||||
|
#endif
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,9 +524,12 @@ ProcAppleWMSetCanQuit(
|
||||||
REQUEST(xAppleWMSetCanQuitReq);
|
REQUEST(xAppleWMSetCanQuitReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xAppleWMSetCanQuitReq);
|
REQUEST_SIZE_MATCH(xAppleWMSetCanQuitReq);
|
||||||
|
#ifdef INXQUARTZ
|
||||||
|
X11ApplicationSetCanQuit(stuff->state);
|
||||||
|
#else
|
||||||
QuartzMessageMainThread(kQuartzSetCanQuit, &stuff->state,
|
QuartzMessageMainThread(kQuartzSetCanQuit, &stuff->state,
|
||||||
sizeof(stuff->state));
|
sizeof(stuff->state));
|
||||||
|
#endif
|
||||||
|
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,11 @@ void DarwinModeInitInput(
|
||||||
int argc,
|
int argc,
|
||||||
char **argv )
|
char **argv )
|
||||||
{
|
{
|
||||||
|
#ifdef INXQUARTZ
|
||||||
|
X11ApplicationServerReady();
|
||||||
|
#else
|
||||||
QuartzMessageMainThread(kQuartzServerStarted, NULL, 0);
|
QuartzMessageMainThread(kQuartzServerStarted, NULL, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Do final display mode specific initialization before handling events
|
// Do final display mode specific initialization before handling events
|
||||||
if (quartzProcs->InitInput)
|
if (quartzProcs->InitInput)
|
||||||
|
@ -274,7 +278,9 @@ static void QuartzHide(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
quartzServerVisible = FALSE;
|
quartzServerVisible = FALSE;
|
||||||
|
#ifndef INXQUARTZ
|
||||||
QuartzMessageMainThread(kQuartzServerHidden, NULL, 0);
|
QuartzMessageMainThread(kQuartzServerHidden, NULL, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,9 @@ static pthread_cond_t cursorCondition;
|
||||||
/* Acquire lock and tell the main thread to change cursor */ \
|
/* Acquire lock and tell the main thread to change cursor */ \
|
||||||
pthread_mutex_lock(&cursorMutex); \
|
pthread_mutex_lock(&cursorMutex); \
|
||||||
currentCursor = (CCrsrHandle) (cursorH); \
|
currentCursor = (CCrsrHandle) (cursorH); \
|
||||||
|
#ifndef INXQUARTZ
|
||||||
QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \
|
QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \
|
||||||
|
#endif
|
||||||
\
|
\
|
||||||
/* Wait for the main thread to change the cursor */ \
|
/* Wait for the main thread to change the cursor */ \
|
||||||
pthread_cond_wait(&cursorCondition, &cursorMutex); \
|
pthread_cond_wait(&cursorCondition, &cursorMutex); \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user