XQuartz: Transition from xEvent based mieq to InternalEvent
(cherry picked from commit a3dbde2de8
)
This commit is contained in:
parent
0c2731596f
commit
226b1033b4
|
@ -33,7 +33,6 @@ libXquartz_la_SOURCES = \
|
||||||
quartzAudio.c \
|
quartzAudio.c \
|
||||||
quartzCocoa.m \
|
quartzCocoa.m \
|
||||||
quartzKeyboard.c \
|
quartzKeyboard.c \
|
||||||
quartzPasteboard.c \
|
|
||||||
quartzStartup.c \
|
quartzStartup.c \
|
||||||
threadSafety.c
|
threadSafety.c
|
||||||
|
|
||||||
|
@ -50,7 +49,6 @@ EXTRA_DIST = \
|
||||||
quartzAudio.h \
|
quartzAudio.h \
|
||||||
quartzCommon.h \
|
quartzCommon.h \
|
||||||
quartzKeyboard.h \
|
quartzKeyboard.h \
|
||||||
quartzPasteboard.h \
|
|
||||||
sanitizedCarbon.h \
|
sanitizedCarbon.h \
|
||||||
sanitizedCocoa.h \
|
sanitizedCocoa.h \
|
||||||
threadSafety.h
|
threadSafety.h
|
||||||
|
|
|
@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group.
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
#include "pixmapstr.h"
|
#include "pixmapstr.h"
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
|
#include "eventstr.h"
|
||||||
#include "mi.h"
|
#include "mi.h"
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "mipointer.h"
|
#include "mipointer.h"
|
||||||
|
@ -71,7 +72,7 @@ in this Software without prior written authorization from The Open Group.
|
||||||
#include "applewmExt.h"
|
#include "applewmExt.h"
|
||||||
|
|
||||||
/* FIXME: Abstract this better */
|
/* FIXME: Abstract this better */
|
||||||
void QuartzModeEQInit(void);
|
extern Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev);
|
||||||
|
|
||||||
int darwin_all_modifier_flags = 0; // last known modifier state
|
int darwin_all_modifier_flags = 0; // last known modifier state
|
||||||
int darwin_all_modifier_mask = 0;
|
int darwin_all_modifier_mask = 0;
|
||||||
|
@ -84,7 +85,7 @@ static pthread_mutex_t fd_add_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static pthread_cond_t fd_add_ready_cond = PTHREAD_COND_INITIALIZER;
|
static pthread_cond_t fd_add_ready_cond = PTHREAD_COND_INITIALIZER;
|
||||||
static pthread_t fd_add_tid = NULL;
|
static pthread_t fd_add_tid = NULL;
|
||||||
|
|
||||||
static EventList *darwinEvents = NULL;
|
static EventListPtr darwinEvents = NULL;
|
||||||
|
|
||||||
static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static pthread_cond_t mieq_ready_cond = PTHREAD_COND_INITIALIZER;
|
static pthread_cond_t mieq_ready_cond = PTHREAD_COND_INITIALIZER;
|
||||||
|
@ -190,89 +191,98 @@ static void DarwinUpdateModifiers(
|
||||||
be moved into their own individual functions and set as handlers using
|
be moved into their own individual functions and set as handlers using
|
||||||
mieqSetHandler. */
|
mieqSetHandler. */
|
||||||
|
|
||||||
static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
|
static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr dev) {
|
||||||
int i;
|
XQuartzEvent *e = &(ie->xquartz_event);
|
||||||
|
|
||||||
TA_SERVER();
|
TA_SERVER();
|
||||||
|
|
||||||
// DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
|
switch(e->subtype) {
|
||||||
for (i=0; i<nevents; i++) {
|
case kXquartzControllerNotify:
|
||||||
switch(xe[i].u.u.type) {
|
DEBUG_LOG("kXquartzControllerNotify\n");
|
||||||
case kXquartzControllerNotify:
|
AppleWMSendEvent(AppleWMControllerNotify,
|
||||||
DEBUG_LOG("kXquartzControllerNotify\n");
|
AppleWMControllerNotifyMask,
|
||||||
AppleWMSendEvent(AppleWMControllerNotify,
|
e->data[0],
|
||||||
AppleWMControllerNotifyMask,
|
e->data[1]);
|
||||||
xe[i].u.clientMessage.u.l.longs0,
|
break;
|
||||||
xe[i].u.clientMessage.u.l.longs1);
|
|
||||||
break;
|
case kXquartzPasteboardNotify:
|
||||||
|
DEBUG_LOG("kXquartzPasteboardNotify\n");
|
||||||
case kXquartzPasteboardNotify:
|
AppleWMSendEvent(AppleWMPasteboardNotify,
|
||||||
DEBUG_LOG("kXquartzPasteboardNotify\n");
|
AppleWMPasteboardNotifyMask,
|
||||||
AppleWMSendEvent(AppleWMPasteboardNotify,
|
e->data[0],
|
||||||
AppleWMPasteboardNotifyMask,
|
e->data[1]);
|
||||||
xe[i].u.clientMessage.u.l.longs0,
|
break;
|
||||||
xe[i].u.clientMessage.u.l.longs1);
|
|
||||||
break;
|
case kXquartzActivate:
|
||||||
|
DEBUG_LOG("kXquartzActivate\n");
|
||||||
case kXquartzActivate:
|
QuartzShow();
|
||||||
DEBUG_LOG("kXquartzActivate\n");
|
AppleWMSendEvent(AppleWMActivationNotify,
|
||||||
QuartzShow(xe[i].u.keyButtonPointer.rootX,
|
AppleWMActivationNotifyMask,
|
||||||
xe[i].u.keyButtonPointer.rootY);
|
AppleWMIsActive, 0);
|
||||||
AppleWMSendEvent(AppleWMActivationNotify,
|
break;
|
||||||
AppleWMActivationNotifyMask,
|
|
||||||
AppleWMIsActive, 0);
|
case kXquartzDeactivate:
|
||||||
break;
|
DEBUG_LOG("kXquartzDeactivate\n");
|
||||||
|
AppleWMSendEvent(AppleWMActivationNotify,
|
||||||
case kXquartzDeactivate:
|
AppleWMActivationNotifyMask,
|
||||||
DEBUG_LOG("kXquartzDeactivate\n");
|
AppleWMIsInactive, 0);
|
||||||
AppleWMSendEvent(AppleWMActivationNotify,
|
QuartzHide();
|
||||||
AppleWMActivationNotifyMask,
|
break;
|
||||||
AppleWMIsInactive, 0);
|
|
||||||
|
case kXquartzReloadPreferences:
|
||||||
|
DEBUG_LOG("kXquartzReloadPreferences\n");
|
||||||
|
AppleWMSendEvent(AppleWMActivationNotify,
|
||||||
|
AppleWMActivationNotifyMask,
|
||||||
|
AppleWMReloadPreferences, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kXquartzToggleFullscreen:
|
||||||
|
DEBUG_LOG("kXquartzToggleFullscreen\n");
|
||||||
|
if (quartzEnableRootless)
|
||||||
|
QuartzSetFullscreen(!quartzHasRoot);
|
||||||
|
else if (quartzHasRoot)
|
||||||
QuartzHide();
|
QuartzHide();
|
||||||
break;
|
else
|
||||||
|
QuartzShow();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kXquartzSetRootless:
|
||||||
|
DEBUG_LOG("kXquartzSetRootless\n");
|
||||||
|
QuartzSetRootless(e->data[0]);
|
||||||
|
if (!quartzEnableRootless && !quartzHasRoot)
|
||||||
|
QuartzHide();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kXquartzSetRootClip:
|
||||||
|
QuartzSetRootClip((Bool)e->data[0]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kXquartzQuit:
|
||||||
|
GiveUp(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kXquartzSpaceChanged:
|
||||||
|
DEBUG_LOG("kXquartzSpaceChanged\n");
|
||||||
|
QuartzSpaceChanged(e->data[0]);
|
||||||
|
break;
|
||||||
|
|
||||||
case kXquartzReloadPreferences:
|
case kXquartzListenOnOpenFD:
|
||||||
DEBUG_LOG("kXquartzReloadPreferences\n");
|
ErrorF("Calling ListenOnOpenFD() for new fd: %d\n", (int)e->data[0]);
|
||||||
AppleWMSendEvent(AppleWMActivationNotify,
|
ListenOnOpenFD((int)e->data[0], 1);
|
||||||
AppleWMActivationNotifyMask,
|
break;
|
||||||
AppleWMReloadPreferences, 0);
|
|
||||||
break;
|
case kXquartzReloadKeymap:
|
||||||
|
DarwinKeyboardReloadHandler();
|
||||||
case kXquartzToggleFullscreen:
|
break;
|
||||||
DEBUG_LOG("kXquartzToggleFullscreen\n");
|
|
||||||
if (quartzEnableRootless)
|
case kXquartzDisplayChanged:
|
||||||
QuartzSetFullscreen(!quartzHasRoot);
|
QuartzUpdateScreens();
|
||||||
else if (quartzHasRoot)
|
break;
|
||||||
QuartzHide();
|
|
||||||
else
|
default:
|
||||||
QuartzShow(xe[i].u.keyButtonPointer.rootX,
|
if(!QuartzModeEventHandler(screenNum, e, dev))
|
||||||
xe[i].u.keyButtonPointer.rootY);
|
ErrorF("Unknown application defined event type %d.\n", e->subtype);
|
||||||
break;
|
}
|
||||||
|
|
||||||
case kXquartzSetRootless:
|
|
||||||
DEBUG_LOG("kXquartzSetRootless\n");
|
|
||||||
QuartzSetRootless(xe[i].u.clientMessage.u.l.longs0);
|
|
||||||
if (!quartzEnableRootless && !quartzHasRoot)
|
|
||||||
QuartzHide();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kXquartzSetRootClip:
|
|
||||||
QuartzSetRootClip((Bool)xe[i].u.clientMessage.u.l.longs0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kXquartzQuit:
|
|
||||||
GiveUp(0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kXquartzSpaceChanged:
|
|
||||||
DEBUG_LOG("kXquartzSpaceChanged\n");
|
|
||||||
QuartzSpaceChanged(xe[i].u.clientMessage.u.l.longs0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ErrorF("Unknown application defined event type %d.\n", xe[i].u.u.type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DarwinListenOnOpenFD(int fd) {
|
void DarwinListenOnOpenFD(int fd) {
|
||||||
|
@ -298,16 +308,6 @@ static void DarwinProcessFDAdditionQueue_thread(void *args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kXquartzListenOnOpenFDHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
|
|
||||||
size_t i;
|
|
||||||
TA_SERVER();
|
|
||||||
|
|
||||||
for (i=0; i<nevents; i++) {
|
|
||||||
ErrorF("Calling ListenOnOpenFD() for new fd: %d\n", (int)xe[i].u.clientMessage.u.l.longs0);
|
|
||||||
ListenOnOpenFD((int)xe[i].u.clientMessage.u.l.longs0, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool DarwinEQInit(void) {
|
Bool DarwinEQInit(void) {
|
||||||
int *p;
|
int *p;
|
||||||
|
|
||||||
|
@ -320,23 +320,7 @@ Bool DarwinEQInit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mieqInit();
|
mieqInit();
|
||||||
mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler);
|
mieqSetHandler(ET_XQuartz, DarwinEventHandler);
|
||||||
mieqSetHandler(kXquartzActivate, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzDeactivate, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzReloadPreferences, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzQuit, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard);
|
|
||||||
mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard);
|
|
||||||
mieqSetHandler(kXquartzToggleFullscreen, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzSetRootless, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzSpaceChanged, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzControllerNotify, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzPasteboardNotify, DarwinEventHandler);
|
|
||||||
mieqSetHandler(kXquartzDisplayChanged, QuartzDisplayChangedHandler);
|
|
||||||
mieqSetHandler(kXquartzListenOnOpenFD, kXquartzListenOnOpenFDHandler);
|
|
||||||
|
|
||||||
QuartzModeEQInit();
|
|
||||||
|
|
||||||
/* Note that this *could* cause a potential async issue, since we're checking
|
/* Note that this *could* cause a potential async issue, since we're checking
|
||||||
* darwinEvents without holding the lock, but darwinEvents is only ever set
|
* darwinEvents without holding the lock, but darwinEvents is only ever set
|
||||||
|
@ -364,16 +348,16 @@ Bool DarwinEQInit(void) {
|
||||||
* Read and process events from the event queue until it is empty.
|
* Read and process events from the event queue until it is empty.
|
||||||
*/
|
*/
|
||||||
void ProcessInputEvents(void) {
|
void ProcessInputEvents(void) {
|
||||||
xEvent xe;
|
char nullbyte;
|
||||||
int x = sizeof(xe);
|
int x = sizeof(nullbyte);
|
||||||
|
|
||||||
TA_SERVER();
|
TA_SERVER();
|
||||||
|
|
||||||
mieqProcessInputEvents();
|
mieqProcessInputEvents();
|
||||||
|
|
||||||
// Empty the signaling pipe
|
// Empty the signaling pipe
|
||||||
while (x == sizeof(xe)) {
|
while (x == sizeof(nullbyte)) {
|
||||||
x = read(darwinEventReadFD, &xe, sizeof(xe));
|
x = read(darwinEventReadFD, &nullbyte, sizeof(nullbyte));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +366,7 @@ void ProcessInputEvents(void) {
|
||||||
static void DarwinPokeEQ(void) {
|
static void DarwinPokeEQ(void) {
|
||||||
char nullbyte=0;
|
char nullbyte=0;
|
||||||
// <daniels> oh, i ... er ... christ.
|
// <daniels> oh, i ... er ... christ.
|
||||||
write(darwinEventWriteFD, &nullbyte, 1);
|
write(darwinEventWriteFD, &nullbyte, sizeof(nullbyte));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert from Appkit pointer input values to X input values:
|
/* Convert from Appkit pointer input values to X input values:
|
||||||
|
@ -476,7 +460,7 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
|
||||||
darwinEvents_lock(); {
|
darwinEvents_lock(); {
|
||||||
num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button,
|
num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button,
|
||||||
POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators);
|
POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators);
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue (pDev, darwinEvents[i].event);
|
for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event);
|
||||||
if(num_events > 0) DarwinPokeEQ();
|
if(num_events > 0) DarwinPokeEQ();
|
||||||
} darwinEvents_unlock();
|
} darwinEvents_unlock();
|
||||||
}
|
}
|
||||||
|
@ -491,7 +475,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
|
||||||
|
|
||||||
darwinEvents_lock(); {
|
darwinEvents_lock(); {
|
||||||
num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
|
num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,darwinEvents[i].event);
|
for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard, (InternalEvent*)darwinEvents[i].event);
|
||||||
if(num_events > 0) DarwinPokeEQ();
|
if(num_events > 0) DarwinPokeEQ();
|
||||||
} darwinEvents_unlock();
|
} darwinEvents_unlock();
|
||||||
}
|
}
|
||||||
|
@ -519,7 +503,7 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
|
||||||
darwinEvents_lock(); {
|
darwinEvents_lock(); {
|
||||||
num_events = GetProximityEvents(darwinEvents, pDev, ev_type,
|
num_events = GetProximityEvents(darwinEvents, pDev, ev_type,
|
||||||
0, 5, valuators);
|
0, 5, valuators);
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue (pDev,darwinEvents[i].event);
|
for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event);
|
||||||
if(num_events > 0) DarwinPokeEQ();
|
if(num_events > 0) DarwinPokeEQ();
|
||||||
} darwinEvents_unlock();
|
} darwinEvents_unlock();
|
||||||
}
|
}
|
||||||
|
@ -566,27 +550,26 @@ void DarwinUpdateModKeys(int flags) {
|
||||||
* Send the X server thread a message by placing it on the event queue.
|
* Send the X server thread a message by placing it on the event queue.
|
||||||
*/
|
*/
|
||||||
void DarwinSendDDXEvent(int type, int argc, ...) {
|
void DarwinSendDDXEvent(int type, int argc, ...) {
|
||||||
xEvent xe;
|
XQuartzEvent e;
|
||||||
INT32 *argv;
|
int i;
|
||||||
int i, max_args;
|
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
memset(&xe, 0, sizeof(xe));
|
memset(&e, 0, sizeof(e));
|
||||||
xe.u.u.type = type;
|
e.header = ET_Internal;
|
||||||
xe.u.clientMessage.u.l.type = type;
|
e.type = ET_XQuartz;
|
||||||
|
e.length = sizeof(e);
|
||||||
|
e.time = GetTimeInMillis();
|
||||||
|
e.subtype = type;
|
||||||
|
|
||||||
argv = &xe.u.clientMessage.u.l.longs0;
|
if (argc > 0 && argc < XQUARTZ_EVENT_MAXARGS) {
|
||||||
max_args = 4;
|
|
||||||
|
|
||||||
if (argc > 0 && argc <= max_args) {
|
|
||||||
va_start (args, argc);
|
va_start (args, argc);
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
argv[i] = (int) va_arg (args, int);
|
e.data[i] = (uint32_t) va_arg (args, uint32_t);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
darwinEvents_lock(); {
|
darwinEvents_lock(); {
|
||||||
mieqEnqueue(NULL, &xe);
|
mieqEnqueue(NULL, (InternalEvent*)&e);
|
||||||
DarwinPokeEQ();
|
DarwinPokeEQ();
|
||||||
} darwinEvents_unlock();
|
} darwinEvents_unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,17 +45,14 @@ void DarwinUpdateModKeys(int flags);
|
||||||
void DarwinListenOnOpenFD(int fd);
|
void DarwinListenOnOpenFD(int fd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Special ddx events understood by the X server
|
* Subtypes for the ET_XQuartz event type
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
kXquartzReloadKeymap // Reload system keymap
|
kXquartzReloadKeymap, // Reload system keymap
|
||||||
= LASTEvent+1, // (from X.h list of event names)
|
|
||||||
kXquartzActivate, // restore X drawing and cursor
|
kXquartzActivate, // restore X drawing and cursor
|
||||||
kXquartzDeactivate, // clip X drawing and switch to Aqua cursor
|
kXquartzDeactivate, // clip X drawing and switch to Aqua cursor
|
||||||
kXquartzSetRootClip, // enable or disable drawing to the X screen
|
kXquartzSetRootClip, // enable or disable drawing to the X screen
|
||||||
kXquartzQuit, // kill the X server and release the display
|
kXquartzQuit, // kill the X server and release the display
|
||||||
kXquartzReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
|
|
||||||
kXquartzWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
|
|
||||||
kXquartzBringAllToFront, // bring all X windows to front
|
kXquartzBringAllToFront, // bring all X windows to front
|
||||||
kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
|
kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
|
||||||
kXquartzSetRootless, // Set rootless mode
|
kXquartzSetRootless, // Set rootless mode
|
||||||
|
|
|
@ -231,7 +231,7 @@ RREditConnectionInfo (ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void QuartzUpdateScreens(void) {
|
void QuartzUpdateScreens(void) {
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
WindowPtr pRoot;
|
WindowPtr pRoot;
|
||||||
int x, y, width, height, sx, sy;
|
int x, y, width, height, sx, sy;
|
||||||
|
@ -299,14 +299,6 @@ static void QuartzUpdateScreens(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* QuartzDisplayChangeHandler
|
|
||||||
* Adjust for screen arrangement changes.
|
|
||||||
*/
|
|
||||||
void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
|
|
||||||
QuartzUpdateScreens();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuartzSetFullscreen(Bool state) {
|
void QuartzSetFullscreen(Bool state) {
|
||||||
|
|
||||||
DEBUG_LOG("QuartzSetFullscreen: state=%d\n", state);
|
DEBUG_LOG("QuartzSetFullscreen: state=%d\n", state);
|
||||||
|
@ -374,10 +366,7 @@ void QuartzSetRootless(Bool state) {
|
||||||
* Calls mode specific screen resume to restore the X clip regions
|
* Calls mode specific screen resume to restore the X clip regions
|
||||||
* (if needed) and the X server cursor state.
|
* (if needed) and the X server cursor state.
|
||||||
*/
|
*/
|
||||||
void QuartzShow(
|
void QuartzShow() {
|
||||||
int x, // cursor location
|
|
||||||
int y )
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (quartzServerVisible)
|
if (quartzServerVisible)
|
||||||
|
@ -386,7 +375,7 @@ void QuartzShow(
|
||||||
quartzServerVisible = TRUE;
|
quartzServerVisible = TRUE;
|
||||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||||
if (screenInfo.screens[i]) {
|
if (screenInfo.screens[i]) {
|
||||||
quartzProcs->ResumeScreen(screenInfo.screens[i], x, y);
|
quartzProcs->ResumeScreen(screenInfo.screens[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
#ifndef _QUARTZ_H
|
#ifndef _QUARTZ_H
|
||||||
#define _QUARTZ_H
|
#define _QUARTZ_H
|
||||||
|
|
||||||
#include "quartzPasteboard.h"
|
|
||||||
|
|
||||||
#include "screenint.h"
|
#include "screenint.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
|
@ -59,7 +57,7 @@ typedef Bool (*InitCursorProc)(ScreenPtr pScreen);
|
||||||
* Suspend and resume X11 activity
|
* Suspend and resume X11 activity
|
||||||
*/
|
*/
|
||||||
typedef void (*SuspendScreenProc)(ScreenPtr pScreen);
|
typedef void (*SuspendScreenProc)(ScreenPtr pScreen);
|
||||||
typedef void (*ResumeScreenProc)(ScreenPtr pScreen, int x, int y);
|
typedef void (*ResumeScreenProc)(ScreenPtr pScreen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Screen state change support
|
* Screen state change support
|
||||||
|
@ -123,9 +121,9 @@ void QuartzInitInput(int argc, char **argv);
|
||||||
void QuartzInitServer(int argc, char **argv, char **envp);
|
void QuartzInitServer(int argc, char **argv, char **envp);
|
||||||
void QuartzGiveUp(void);
|
void QuartzGiveUp(void);
|
||||||
void QuartzProcessEvent(xEvent *xe);
|
void QuartzProcessEvent(xEvent *xe);
|
||||||
void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
|
void QuartzUpdateScreens(void);
|
||||||
|
|
||||||
void QuartzShow(int x, int y); // (x, y) = cursor loc
|
void QuartzShow(void);
|
||||||
void QuartzHide(void);
|
void QuartzHide(void);
|
||||||
void QuartzSetRootClip(BOOL enable);
|
void QuartzSetRootClip(BOOL enable);
|
||||||
void QuartzSpaceChanged(uint32_t space_id);
|
void QuartzSpaceChanged(uint32_t space_id);
|
||||||
|
|
|
@ -40,66 +40,9 @@
|
||||||
|
|
||||||
#include "quartzCommon.h"
|
#include "quartzCommon.h"
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
#include "quartzPasteboard.h"
|
|
||||||
|
|
||||||
#include "darwin.h"
|
#include "darwin.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* QuartzWriteCocoaPasteboard
|
|
||||||
* Write text to the Mac OS X pasteboard.
|
|
||||||
*/
|
|
||||||
void QuartzWriteCocoaPasteboard(
|
|
||||||
char *text)
|
|
||||||
{
|
|
||||||
NSPasteboard *pasteboard;
|
|
||||||
NSArray *pasteboardTypes;
|
|
||||||
NSString *string;
|
|
||||||
|
|
||||||
if (! text) return;
|
|
||||||
pasteboard = [NSPasteboard generalPasteboard];
|
|
||||||
if (! pasteboard) return;
|
|
||||||
string = [NSString stringWithCString:text];
|
|
||||||
if (! string) return;
|
|
||||||
pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType];
|
|
||||||
|
|
||||||
// nil owner because we don't provide type translations
|
|
||||||
[pasteboard declareTypes:pasteboardTypes owner:nil];
|
|
||||||
[pasteboard setString:string forType:NSStringPboardType];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* QuartzReadCocoaPasteboard
|
|
||||||
* Read text from the Mac OS X pasteboard and return it as a heap string.
|
|
||||||
* The caller must free the string.
|
|
||||||
*/
|
|
||||||
char *QuartzReadCocoaPasteboard(void)
|
|
||||||
{
|
|
||||||
NSPasteboard *pasteboard;
|
|
||||||
NSArray *pasteboardTypes;
|
|
||||||
NSString *existingType;
|
|
||||||
char *text = NULL;
|
|
||||||
|
|
||||||
pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType];
|
|
||||||
pasteboard = [NSPasteboard generalPasteboard];
|
|
||||||
if (! pasteboard) return NULL;
|
|
||||||
|
|
||||||
existingType = [pasteboard availableTypeFromArray:pasteboardTypes];
|
|
||||||
if (existingType) {
|
|
||||||
NSString *string = [pasteboard stringForType:existingType];
|
|
||||||
char *buffer;
|
|
||||||
|
|
||||||
if (! string) return NULL;
|
|
||||||
buffer = (char *) [string UTF8String];
|
|
||||||
text = (char *) malloc(strlen(buffer)+1);
|
|
||||||
if (text)
|
|
||||||
strcpy(text, buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* QuartzFSUseQDCursor
|
* QuartzFSUseQDCursor
|
||||||
* Return whether the screen should use a QuickDraw cursor.
|
* Return whether the screen should use a QuickDraw cursor.
|
||||||
|
|
|
@ -354,7 +354,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
|
||||||
CopyKeyClass(pDev, inputInfo.keyboard);
|
CopyKeyClass(pDev, inputInfo.keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) {
|
void DarwinKeyboardReloadHandler(void) {
|
||||||
KeySymsRec keySyms;
|
KeySymsRec keySyms;
|
||||||
|
|
||||||
DEBUG_LOG("DarwinKeyboardReloadHandler\n");
|
DEBUG_LOG("DarwinKeyboardReloadHandler\n");
|
||||||
|
|
|
@ -53,7 +53,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
|
||||||
/* Provided for darwinEvents.c */
|
/* Provided for darwinEvents.c */
|
||||||
extern darwinKeyboardInfo keyInfo;
|
extern darwinKeyboardInfo keyInfo;
|
||||||
extern pthread_mutex_t keyInfo_mutex;
|
extern pthread_mutex_t keyInfo_mutex;
|
||||||
void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
|
void DarwinKeyboardReloadHandler(void);
|
||||||
int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
|
int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
|
||||||
int DarwinModifierNXKeyToNXKeycode(int key, int side);
|
int DarwinModifierNXKeyToNXKeycode(int key, int side);
|
||||||
int DarwinModifierNXKeyToNXMask(int key);
|
int DarwinModifierNXKeyToNXMask(int key);
|
||||||
|
|
|
@ -1,147 +0,0 @@
|
||||||
/**************************************************************
|
|
||||||
* quartzPasteboard.c
|
|
||||||
*
|
|
||||||
* Aqua pasteboard <-> X cut buffer
|
|
||||||
* Greg Parker gparker@cs.stanford.edu March 8, 2001
|
|
||||||
**************************************************************/
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001 Greg Parker. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
||||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
||||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
* Except as contained in this notice, the name(s) of the above copyright
|
|
||||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
|
||||||
* use or other dealings in this Software without prior written authorization.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "misc.h"
|
|
||||||
#include "inputstr.h"
|
|
||||||
#include "quartzPasteboard.h"
|
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "propertyst.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "selection.h"
|
|
||||||
#include "globals.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Helper function to read the X11 cut buffer
|
|
||||||
// FIXME: What about multiple screens? Currently, this reads the first
|
|
||||||
// CUT_BUFFER0 from the first screen where the buffer content is a string.
|
|
||||||
// Returns a string on the heap that the caller must free.
|
|
||||||
// Returns NULL if there is no cut text or there is not enough memory.
|
|
||||||
static char * QuartzReadCutBuffer(void)
|
|
||||||
{
|
|
||||||
int rc, i;
|
|
||||||
char *text = NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
|
||||||
ScreenPtr pScreen = screenInfo.screens[i];
|
|
||||||
PropertyPtr pProp;
|
|
||||||
|
|
||||||
rc = dixLookupProperty(&pProp, WindowTable[pScreen->myNum],
|
|
||||||
XA_CUT_BUFFER0, serverClient, DixReadAccess);
|
|
||||||
if (rc != Success) continue;
|
|
||||||
if (pProp->type != XA_STRING) continue;
|
|
||||||
if (pProp->format != 8) continue;
|
|
||||||
|
|
||||||
text = xalloc(1 + pProp->size);
|
|
||||||
if (! text) continue;
|
|
||||||
memcpy(text, pProp->data, pProp->size);
|
|
||||||
text[pProp->size] = '\0';
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
// didn't find any text
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write X cut buffer to Mac OS X pasteboard
|
|
||||||
// Called by mieqProcessInputEvents() in response to request from X server thread.
|
|
||||||
void QuartzWritePasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
|
|
||||||
{
|
|
||||||
char *text;
|
|
||||||
text = QuartzReadCutBuffer();
|
|
||||||
if (text) {
|
|
||||||
QuartzWriteCocoaPasteboard(text);
|
|
||||||
free(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define strequal(a, b) (0 == strcmp((a), (b)))
|
|
||||||
|
|
||||||
// Read Mac OS X pasteboard into X cut buffer
|
|
||||||
// Called by mieqProcessInputEvents() in response to request from X server thread.
|
|
||||||
void QuartzReadPasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
|
|
||||||
{
|
|
||||||
char *oldText = QuartzReadCutBuffer();
|
|
||||||
char *text = QuartzReadCocoaPasteboard();
|
|
||||||
|
|
||||||
// Compare text with current cut buffer contents.
|
|
||||||
// Change the buffer if both exist and are different
|
|
||||||
// OR if there is new text but no old text.
|
|
||||||
// Otherwise, don't clear the selection unnecessarily.
|
|
||||||
|
|
||||||
if ((text && oldText && !strequal(text, oldText)) ||
|
|
||||||
(text && !oldText)) {
|
|
||||||
int scrn, rc;
|
|
||||||
Selection *pSel;
|
|
||||||
|
|
||||||
for (scrn = 0; scrn < screenInfo.numScreens; scrn++) {
|
|
||||||
ScreenPtr pScreen = screenInfo.screens[scrn];
|
|
||||||
// Set the cut buffers on each screen
|
|
||||||
// fixme really on each screen?
|
|
||||||
dixChangeWindowProperty(serverClient, WindowTable[pScreen->myNum],
|
|
||||||
XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace,
|
|
||||||
strlen(text), (pointer)text, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Undo any current X selection (similar to code in dispatch.c)
|
|
||||||
// FIXME: what about secondary selection?
|
|
||||||
// FIXME: only touch first XA_PRIMARY selection?
|
|
||||||
rc = dixLookupSelection(&pSel, XA_PRIMARY, serverClient,
|
|
||||||
DixSetAttrAccess);
|
|
||||||
if (rc == Success) {
|
|
||||||
// Notify client if necessary
|
|
||||||
if (pSel->client) {
|
|
||||||
xEvent event;
|
|
||||||
|
|
||||||
event.u.u.type = SelectionClear;
|
|
||||||
event.u.selectionClear.time = GetTimeInMillis();
|
|
||||||
event.u.selectionClear.window = pSel->window;
|
|
||||||
event.u.selectionClear.atom = pSel->selection;
|
|
||||||
TryClientEvents(pSel->client, dev, &event, 1, NoEventMask,
|
|
||||||
NoEventMask /*CantBeFiltered*/, NullGrab);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Erase it
|
|
||||||
pSel->pWin = NullWindow;
|
|
||||||
pSel->window = None;
|
|
||||||
pSel->client = NullClient;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (text) free(text);
|
|
||||||
if (oldText) free(oldText);
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
QuartzPasteboard.h
|
|
||||||
|
|
||||||
Mac OS X pasteboard <-> X cut buffer
|
|
||||||
Greg Parker gparker@cs.stanford.edu March 8, 2001
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001 Greg Parker. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
||||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
||||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
* Except as contained in this notice, the name(s) of the above copyright
|
|
||||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
|
||||||
* use or other dealings in this Software without prior written authorization.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _QUARTZPASTEBOARD_H
|
|
||||||
#define _QUARTZPASTEBOARD_H
|
|
||||||
|
|
||||||
// Aqua->X
|
|
||||||
void QuartzReadPasteboard(int, xEventPtr, DeviceIntPtr, int);
|
|
||||||
char * QuartzReadCocoaPasteboard(void); // caller must free string
|
|
||||||
|
|
||||||
// X->Aqua
|
|
||||||
void QuartzWritePasteboard(int, xEventPtr, DeviceIntPtr, int);
|
|
||||||
void QuartzWriteCocoaPasteboard(char *text);
|
|
||||||
|
|
||||||
#endif /* _QUARTZPASTEBOARD_H */
|
|
|
@ -45,7 +45,7 @@ void xprHideWindows(Bool hide);
|
||||||
|
|
||||||
Bool QuartzInitCursor(ScreenPtr pScreen);
|
Bool QuartzInitCursor(ScreenPtr pScreen);
|
||||||
void QuartzSuspendXCursor(ScreenPtr pScreen);
|
void QuartzSuspendXCursor(ScreenPtr pScreen);
|
||||||
void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
|
void QuartzResumeXCursor(ScreenPtr pScreen);
|
||||||
|
|
||||||
/* If we are rooted, we need the root window and desktop levels to be below
|
/* If we are rooted, we need the root window and desktop levels to be below
|
||||||
* the menubar (24) but above native windows. Normal window level is 0.
|
* the menubar (24) but above native windows. Normal window level is 0.
|
||||||
|
|
|
@ -212,7 +212,7 @@ QuartzUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
||||||
* Set the cursor sprite and position.
|
* Set the cursor sprite and position.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
|
QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
||||||
{
|
{
|
||||||
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
|
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ QuartzSuspendXCursor(ScreenPtr pScreen)
|
||||||
* X server is showing. Restore the X cursor.
|
* X server is showing. Restore the X cursor.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
QuartzResumeXCursor(ScreenPtr pScreen, int x, int y)
|
QuartzResumeXCursor(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
CursorPtr pCursor;
|
CursorPtr pCursor;
|
||||||
|
@ -407,5 +407,5 @@ QuartzResumeXCursor(ScreenPtr pScreen, int x, int y)
|
||||||
if (pCursor == NULL)
|
if (pCursor == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QuartzSetCursor(darwinPointer, pScreen, pCursor, x, y);
|
QuartzSetCursor(darwinPointer, pScreen, pCursor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
#include "pixmapstr.h"
|
#include "pixmapstr.h"
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
|
#include "eventstr.h"
|
||||||
#include "mi.h"
|
#include "mi.h"
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "mipointer.h"
|
#include "mipointer.h"
|
||||||
|
@ -55,36 +56,26 @@
|
||||||
#include "rootlessWindow.h"
|
#include "rootlessWindow.h"
|
||||||
#include "xprEvent.h"
|
#include "xprEvent.h"
|
||||||
|
|
||||||
static void xprEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
|
Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) {
|
||||||
int i;
|
|
||||||
|
|
||||||
TA_SERVER();
|
TA_SERVER();
|
||||||
|
|
||||||
DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
|
switch(e->subtype) {
|
||||||
for (i=0; i<nevents; i++) {
|
case kXquartzWindowState:
|
||||||
switch(xe[i].u.u.type) {
|
DEBUG_LOG("kXquartzWindowState\n");
|
||||||
|
RootlessNativeWindowStateChanged(xprGetXWindow(e->data[0]),
|
||||||
case kXquartzWindowState:
|
e->data[1]);
|
||||||
DEBUG_LOG("kXquartzWindowState\n");
|
return TRUE;
|
||||||
RootlessNativeWindowStateChanged(xprGetXWindow(xe[i].u.clientMessage.u.l.longs0),
|
|
||||||
xe[i].u.clientMessage.u.l.longs1);
|
case kXquartzWindowMoved:
|
||||||
break;
|
DEBUG_LOG("kXquartzWindowMoved\n");
|
||||||
|
RootlessNativeWindowMoved(xprGetXWindow(e->data[0]));
|
||||||
case kXquartzWindowMoved:
|
return TRUE;
|
||||||
DEBUG_LOG("kXquartzWindowMoved\n");
|
|
||||||
RootlessNativeWindowMoved(xprGetXWindow(xe[i].u.clientMessage.u.l.longs0));
|
case kXquartzBringAllToFront:
|
||||||
break;
|
DEBUG_LOG("kXquartzBringAllToFront\n");
|
||||||
|
RootlessOrderAllWindows();
|
||||||
case kXquartzBringAllToFront:
|
return TRUE;
|
||||||
DEBUG_LOG("kXquartzBringAllToFront\n");
|
default:
|
||||||
RootlessOrderAllWindows();
|
return FALSE;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuartzModeEQInit(void) {
|
|
||||||
mieqSetHandler(kXquartzWindowState, xprEventHandler);
|
|
||||||
mieqSetHandler(kXquartzWindowMoved, xprEventHandler);
|
|
||||||
mieqSetHandler(kXquartzBringAllToFront, xprEventHandler);
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,6 +29,6 @@
|
||||||
#ifndef __XPR_EVENT_H__
|
#ifndef __XPR_EVENT_H__
|
||||||
#define __XPR_EVENT_H__
|
#define __XPR_EVENT_H__
|
||||||
|
|
||||||
void QuartzModeEQInit(void);
|
Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,9 @@ typedef struct _DeviceChangedEvent DeviceChangedEvent;
|
||||||
typedef struct _DGAEvent DGAEvent;
|
typedef struct _DGAEvent DGAEvent;
|
||||||
#endif
|
#endif
|
||||||
typedef struct _RawDeviceEvent RawDeviceEvent;
|
typedef struct _RawDeviceEvent RawDeviceEvent;
|
||||||
|
#ifdef XQUARTZ
|
||||||
|
typedef struct _XQuartzEvent XQuartzEvent;
|
||||||
|
#endif
|
||||||
typedef union _InternalEvent InternalEvent;
|
typedef union _InternalEvent InternalEvent;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,6 +66,9 @@ enum EventType {
|
||||||
ET_RawButtonPress,
|
ET_RawButtonPress,
|
||||||
ET_RawButtonRelease,
|
ET_RawButtonRelease,
|
||||||
ET_RawMotion,
|
ET_RawMotion,
|
||||||
|
#ifdef XQUARTZ
|
||||||
|
ET_XQuartz,
|
||||||
|
#endif
|
||||||
ET_Internal = 0xFF /* First byte */
|
ET_Internal = 0xFF /* First byte */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -210,6 +213,18 @@ struct _RawDeviceEvent
|
||||||
} valuators;
|
} valuators;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef XQUARTZ
|
||||||
|
#define XQUARTZ_EVENT_MAXARGS 5
|
||||||
|
struct _XQuartzEvent {
|
||||||
|
unsigned char header; /**< Always ET_Internal */
|
||||||
|
enum EventType type; /**< Always ET_XQuartz */
|
||||||
|
int length; /**< Length in bytes */
|
||||||
|
Time time; /**< Time in ms. */
|
||||||
|
int subtype; /**< Subtype defined by XQuartz DDX */
|
||||||
|
uint32_t data[XQUARTZ_EVENT_MAXARGS]; /**< Up to 5 32bit values passed to handler */
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event type used inside the X server for input event
|
* Event type used inside the X server for input event
|
||||||
* processing.
|
* processing.
|
||||||
|
@ -227,6 +242,9 @@ union _InternalEvent {
|
||||||
DGAEvent dga_event;
|
DGAEvent dga_event;
|
||||||
#endif
|
#endif
|
||||||
RawDeviceEvent raw_event;
|
RawDeviceEvent raw_event;
|
||||||
|
#ifdef XQUARTZ
|
||||||
|
XQuartzEvent xquartz_event;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user