formatting cleanup
(cherry picked from commit 769acd29348abf9e5b0bebfca6ae695d345f3077)
This commit is contained in:
parent
700e14c226
commit
0bd1c369cc
|
@ -324,16 +324,12 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
|
||||||
*/
|
*/
|
||||||
void ProcessInputEvents(void) {
|
void ProcessInputEvents(void) {
|
||||||
xEvent xe;
|
xEvent xe;
|
||||||
// button number and modifier mask of currently pressed fake button
|
int x = sizeof(xe);
|
||||||
input_check_flag=0;
|
|
||||||
|
|
||||||
// ErrorF("calling mieqProcessInputEvents\n");
|
|
||||||
mieqProcessInputEvents();
|
mieqProcessInputEvents();
|
||||||
|
|
||||||
// Empty the signaling pipe
|
// Empty the signaling pipe
|
||||||
int x = sizeof(xe);
|
|
||||||
while (x == sizeof(xe)) {
|
while (x == sizeof(xe)) {
|
||||||
// DEBUG_LOG("draining pipe\n");
|
|
||||||
x = read(darwinEventReadFD, &xe, sizeof(xe));
|
x = read(darwinEventReadFD, &xe, sizeof(xe));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,23 +337,23 @@ void ProcessInputEvents(void) {
|
||||||
/* Sends a null byte down darwinEventWriteFD, which will cause the
|
/* Sends a null byte down darwinEventWriteFD, which will cause the
|
||||||
Dispatch() event loop to check out event queue */
|
Dispatch() event loop to check out event queue */
|
||||||
void DarwinPokeEQ(void) {
|
void DarwinPokeEQ(void) {
|
||||||
char nullbyte=0;
|
char nullbyte=0;
|
||||||
input_check_flag++;
|
input_check_flag++;
|
||||||
// <daniels> bushing: oh, i ... er ... christ.
|
// <daniels> oh, i ... er ... christ.
|
||||||
write(darwinEventWriteFD, &nullbyte, 1);
|
write(darwinEventWriteFD, &nullbyte, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
|
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
|
||||||
float pressure, float tilt_x, float tilt_y) {
|
float pressure, float tilt_x, float tilt_y) {
|
||||||
static int darwinFakeMouseButtonDown = 0;
|
static int darwinFakeMouseButtonDown = 0;
|
||||||
static int darwinFakeMouseButtonMask = 0;
|
static int darwinFakeMouseButtonMask = 0;
|
||||||
int i, num_events;
|
int i, num_events;
|
||||||
|
|
||||||
if(!darwinEvents) {
|
if(!darwinEvents) {
|
||||||
ErrorF("DarwinSendPointerEvents called before darwinEvents was initialized\n");
|
ErrorF("DarwinSendPointerEvents called before darwinEvents was initialized\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* I can't find a spec for this, but at least GTK expects that tablets are
|
/* I can't find a spec for this, but at least GTK expects that tablets are
|
||||||
just like mice, except they have either one or three extra valuators, in this
|
just like mice, except they have either one or three extra valuators, in this
|
||||||
order:
|
order:
|
||||||
|
|
||||||
|
@ -366,91 +362,92 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
|
||||||
we can't do that. Again, GTK seems to record the min/max of each valuator,
|
we can't do that. Again, GTK seems to record the min/max of each valuator,
|
||||||
and then perform scaling back to float itself using that info. Soo.... */
|
and then perform scaling back to float itself using that info. Soo.... */
|
||||||
|
|
||||||
int valuators[5] = {pointer_x, pointer_y,
|
int valuators[5] = {pointer_x, pointer_y,
|
||||||
pressure * INT32_MAX * 1.0f,
|
pressure * INT32_MAX * 1.0f,
|
||||||
tilt_x * INT32_MAX * 1.0f,
|
tilt_x * INT32_MAX * 1.0f,
|
||||||
tilt_y * INT32_MAX * 1.0f};
|
tilt_y * INT32_MAX * 1.0f};
|
||||||
|
|
||||||
if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
|
if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
|
||||||
// Mimic multi-button mouse with modifier-clicks
|
// Mimic multi-button mouse with modifier-clicks
|
||||||
// If both sets of modifiers are pressed,
|
// If both sets of modifiers are pressed,
|
||||||
// button 2 is clicked.
|
// button 2 is clicked.
|
||||||
if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
|
if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
|
||||||
DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
|
DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
|
||||||
tilt_x, tilt_y, 2, darwinFakeMouse2Mask);
|
tilt_x, tilt_y, 2, darwinFakeMouse2Mask);
|
||||||
darwinFakeMouseButtonDown = 2;
|
darwinFakeMouseButtonDown = 2;
|
||||||
darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
|
darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
|
||||||
return;
|
return;
|
||||||
} else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
|
} else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
|
||||||
DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
|
DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
|
||||||
tilt_x, tilt_y, 3, darwinFakeMouse3Mask);
|
tilt_x, tilt_y, 3, darwinFakeMouse3Mask);
|
||||||
darwinFakeMouseButtonDown = 3;
|
darwinFakeMouseButtonDown = 3;
|
||||||
darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
|
darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
|
|
||||||
// If last mousedown was a fake click, don't check for
|
|
||||||
// mouse modifiers here. The user may have released the
|
|
||||||
// modifiers before the mouse button.
|
|
||||||
ev_button = darwinFakeMouseButtonDown;
|
|
||||||
darwinFakeMouseButtonDown = 0;
|
|
||||||
// Bring modifiers back up to date
|
|
||||||
DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
|
|
||||||
darwinFakeMouseButtonMask = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
|
if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
|
||||||
|
// If last mousedown was a fake click, don't check for
|
||||||
|
// mouse modifiers here. The user may have released the
|
||||||
|
// modifiers before the mouse button.
|
||||||
|
ev_button = darwinFakeMouseButtonDown;
|
||||||
|
darwinFakeMouseButtonDown = 0;
|
||||||
|
// Bring modifiers back up to date
|
||||||
|
DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
|
||||||
|
darwinFakeMouseButtonMask = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
|
||||||
POINTER_ABSOLUTE, 0, 5, valuators);
|
POINTER_ABSOLUTE, 0, 5, valuators);
|
||||||
|
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
|
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
|
||||||
DarwinPokeEQ();
|
DarwinPokeEQ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
|
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
|
||||||
int i, num_events;
|
int i, num_events;
|
||||||
if(!darwinEvents) {
|
if(!darwinEvents) {
|
||||||
ErrorF("DarwinSendKeyboardEvents called before darwinEvents was initialized\n");
|
ErrorF("DarwinSendKeyboardEvents called before darwinEvents was initialized\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
|
if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
|
||||||
/* See if keymap has changed. */
|
/* See if keymap has changed. */
|
||||||
|
|
||||||
static unsigned int last_seed;
|
static unsigned int last_seed;
|
||||||
unsigned int this_seed;
|
unsigned int this_seed;
|
||||||
|
|
||||||
this_seed = QuartzSystemKeymapSeed();
|
this_seed = QuartzSystemKeymapSeed();
|
||||||
if (this_seed != last_seed) {
|
if (this_seed != last_seed) {
|
||||||
last_seed = this_seed;
|
last_seed = this_seed;
|
||||||
DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
|
DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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]);
|
for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
|
||||||
DarwinPokeEQ();
|
DarwinPokeEQ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
|
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
|
||||||
float pressure, float tilt_x, float tilt_y) {
|
float pressure, float tilt_x, float tilt_y) {
|
||||||
int i, num_events;
|
int i, num_events;
|
||||||
int valuators[5] = {pointer_x, pointer_y,
|
int valuators[5] = {pointer_x, pointer_y,
|
||||||
pressure * INT32_MAX * 1.0f,
|
pressure * INT32_MAX * 1.0f,
|
||||||
tilt_x * INT32_MAX * 1.0f,
|
tilt_x * INT32_MAX * 1.0f,
|
||||||
tilt_y * INT32_MAX * 1.0f};
|
tilt_y * INT32_MAX * 1.0f};
|
||||||
|
|
||||||
if(!darwinEvents) {
|
if(!darwinEvents) {
|
||||||
ErrorF("DarwinSendProximityvents called before darwinEvents was initialized\n");
|
ErrorF("DarwinSendProximityvents called before darwinEvents was initialized\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type,
|
num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type,
|
||||||
0, 5, valuators);
|
0, 5, valuators);
|
||||||
|
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
|
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
|
||||||
DarwinPokeEQ();
|
DarwinPokeEQ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -485,9 +482,9 @@ void DarwinSendScrollEvents(float count_x, float count_y,
|
||||||
/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
|
/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
|
||||||
reflect changing modifier flags (alt, control, meta, etc) */
|
reflect changing modifier flags (alt, control, meta, etc) */
|
||||||
void DarwinUpdateModKeys(int flags) {
|
void DarwinUpdateModKeys(int flags) {
|
||||||
DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
|
DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
|
||||||
DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
|
DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
|
||||||
old_flags = flags;
|
old_flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue