xserver: Branch 'master' - 5 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Wed Aug 5 16:17:53 PDT 2009
hw/xquartz/GL/indirect.c | 7 ++++
hw/xquartz/X11Application.m | 68 +++++++++++++++++++++++++-------------------
hw/xquartz/quartzAudio.c | 40 +++----------------------
hw/xquartz/quartzAudio.h | 3 -
hw/xquartz/quartzKeyboard.c | 2 -
5 files changed, 53 insertions(+), 67 deletions(-)
New commits:
commit 931160fcf378120e58849d801dbc62bed6e65a4b
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Aug 4 02:53:17 2009 -0700
XQuartz: AIGLX: Provide empty __glXAquaDrawableResize to avoid crashing in DoMakeCurrent
(cherry picked from commit 60a1d2c2764f2f02c0751940a264588717afce79)
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index de8b946..f080067 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -391,6 +391,12 @@ static int __glXAquaContextForceCurrent(__GLXcontext *baseContext)
/* Drawing surface notification callbacks */
+static GLboolean __glXAquaDrawableResize(__GLXdrawable *base) {
+ // Don't remove, <rdar://problem/7114913>
+ GLAQUA_DEBUG_MSG("unimplemented glAquaDrawableResize\n");
+ return GL_TRUE;
+}
+
static GLboolean __glXAquaDrawableSwapBuffers(__GLXdrawable *base) {
CGLError err;
__GLXAquaDrawable *drawable;
@@ -577,6 +583,7 @@ __glXAquaScreenCreateDrawable(__GLXscreen *screen,
}
glxPriv->base.destroy = __glXAquaDrawableDestroy;
+ glxPriv->base.resize = __glXAquaDrawableResize;
glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers;
glxPriv->base.copySubBuffer = NULL; /* __glXAquaDrawableCopySubBuffer; */
commit 0fe639a314de397516cf00d8100da8086abdd97a
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Aug 1 22:53:45 2009 -0700
XQuartz: Only save lastpt on mouse/tablet events
(cherry picked from commit 552be074e5be6492df3e290e8b7d9daff1a2cb34)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 5d28132..6ade527 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -990,55 +990,50 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
#endif
- (void) sendX11NSEvent:(NSEvent *)e {
- NSRect screen;
- NSPoint location, tilt;
- NSWindow *window;
+ NSPoint location = NSZeroPoint, tilt = NSZeroPoint;
int ev_button, ev_type;
- float pressure;
+ float pressure = 0.0;
DeviceIntPtr pDev;
int modifierFlags;
- BOOL isTabletEvent;
-
- static NSPoint lastpt;
-
- /* convert location to be relative to top-left of primary display */
- window = [e window];
-
- isTabletEvent = ([e type] == NSTabletPoint) ||
- (( [e type] == NSLeftMouseDown || [e type] == NSOtherMouseDown || [e type] == NSRightMouseDown ||
- [e type] == NSLeftMouseUp || [e type] == NSOtherMouseUp || [e type] == NSRightMouseUp ||
- [e type] == NSLeftMouseDragged || [e type] == NSOtherMouseDragged || [e type] == NSRightMouseDragged ||
- [e type] == NSMouseMoved ) && ([e subtype] == NSTabletPointEventSubtype || [e subtype] == NSTabletProximityEventSubtype));
-
- if (window != nil) {
- NSRect frame = [window frame];
- location = [e locationInWindow];
- location.x += frame.origin.x;
- location.y += frame.origin.y;
- lastpt = location;
- } else if(isTabletEvent) {
- // NSEvents for tablets are not consistent wrt deltaXY between events, so we cannot rely on that
- // Thus tablets will be subject to the warp-pointer bug worked around by the delta, but tablets
- // are not normally used in cases where that bug would present itself, so this is a fair tradeoff
- // <rdar://problem/7111003> deltaX and deltaY are incorrect for NSMouseMoved, NSTabletPointEventSubtype
- // http://xquartz.macosforge.org/trac/ticket/288
- location = [e locationInWindow];
- lastpt = location;
- } else {
- location.x = lastpt.x + [e deltaX];
- location.y = lastpt.y - [e deltaY];
- lastpt = [NSEvent mouseLocation]; // [e locationInWindow] gives us the "unfixed" location when our cursor is fixed. This bugs things like quake
+ BOOL isMouseOrTabletEvent, isTabletEvent;
+
+ isMouseOrTabletEvent = [e type] == NSLeftMouseDown || [e type] == NSOtherMouseDown || [e type] == NSRightMouseDown ||
+ [e type] == NSLeftMouseUp || [e type] == NSOtherMouseUp || [e type] == NSRightMouseUp ||
+ [e type] == NSLeftMouseDragged || [e type] == NSOtherMouseDragged || [e type] == NSRightMouseDragged ||
+ [e type] == NSMouseMoved || [e type] == NSTabletPoint;
+
+ isTabletEvent = ([e type] == NSTabletPoint) ||
+ (isMouseOrTabletEvent && ([e subtype] == NSTabletPointEventSubtype || [e subtype] == NSTabletProximityEventSubtype));
+
+ if(isMouseOrTabletEvent) {
+ static NSPoint lastpt;
+ NSWindow *window = [e window];
+ NSRect screen = [[[NSScreen screens] objectAtIndex:0] frame];;
+
+ if (window != nil) {
+ NSRect frame = [window frame];
+ location = [e locationInWindow];
+ location.x += frame.origin.x;
+ location.y += frame.origin.y;
+ lastpt = location;
+ } else if(isTabletEvent) {
+ // NSEvents for tablets are not consistent wrt deltaXY between events, so we cannot rely on that
+ // Thus tablets will be subject to the warp-pointer bug worked around by the delta, but tablets
+ // are not normally used in cases where that bug would present itself, so this is a fair tradeoff
+ // <rdar://problem/7111003> deltaX and deltaY are incorrect for NSMouseMoved, NSTabletPointEventSubtype
+ // http://xquartz.macosforge.org/trac/ticket/288
+ location = [e locationInWindow];
+ lastpt = location;
+ } else {
+ location.x = lastpt.x + [e deltaX];
+ location.y = lastpt.y - [e deltaY];
+ lastpt = [e locationInWindow];
+ }
+
+ /* Convert coordinate system */
+ location.y = (screen.origin.y + screen.size.height) - location.y;
}
- /* Convert coordinate system */
- screen = [[[NSScreen screens] objectAtIndex:0] frame];
- location.y = (screen.origin.y + screen.size.height) - location.y;
-
- /* Setup our valuators. These will range from 0 to 1 */
- pressure = 0;
- tilt.x = 0.0;
- tilt.y = 0.0;
-
modifierFlags = [e modifierFlags];
#ifdef NX_DEVICELCMDKEYMASK
commit 491c2d74c12d7f9bc9f31b427ece04e049ebff5a
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Aug 1 12:43:14 2009 -0700
XQuartz: Use mouseLocation rather than locationInWindow when setting lastpt
I don't understand the *why* ... I just see that it works better this way for games like Quake2 through wine. It *should* be better the other way, but somehow it's not.
I guess this will go in my list of puzzles to unravel.
(cherry picked from commit 65ae2d00e1a53f97f2ff9522406ab69d50bf3199)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 9d6ee71..5d28132 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1027,7 +1027,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
} else {
location.x = lastpt.x + [e deltaX];
location.y = lastpt.y - [e deltaY];
- lastpt = [e locationInWindow];
+ lastpt = [NSEvent mouseLocation]; // [e locationInWindow] gives us the "unfixed" location when our cursor is fixed. This bugs things like quake
}
/* Convert coordinate system */
commit df6c01352471c766e9f71ceac03cab8c3911faa1
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Aug 1 02:32:52 2009 -0700
XQuartz: Don't use location delta for tablets since NSEvent does not give a precise delta.
(cherry picked from commit 6c5bf756a7f5389cdfe2e43a339d7c31a3e522e9)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 7eadc48..9d6ee71 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -997,22 +997,37 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
float pressure;
DeviceIntPtr pDev;
int modifierFlags;
+ BOOL isTabletEvent;
static NSPoint lastpt;
/* convert location to be relative to top-left of primary display */
window = [e window];
+ isTabletEvent = ([e type] == NSTabletPoint) ||
+ (( [e type] == NSLeftMouseDown || [e type] == NSOtherMouseDown || [e type] == NSRightMouseDown ||
+ [e type] == NSLeftMouseUp || [e type] == NSOtherMouseUp || [e type] == NSRightMouseUp ||
+ [e type] == NSLeftMouseDragged || [e type] == NSOtherMouseDragged || [e type] == NSRightMouseDragged ||
+ [e type] == NSMouseMoved ) && ([e subtype] == NSTabletPointEventSubtype || [e subtype] == NSTabletProximityEventSubtype));
+
if (window != nil) {
NSRect frame = [window frame];
location = [e locationInWindow];
location.x += frame.origin.x;
location.y += frame.origin.y;
lastpt = location;
+ } else if(isTabletEvent) {
+ // NSEvents for tablets are not consistent wrt deltaXY between events, so we cannot rely on that
+ // Thus tablets will be subject to the warp-pointer bug worked around by the delta, but tablets
+ // are not normally used in cases where that bug would present itself, so this is a fair tradeoff
+ // <rdar://problem/7111003> deltaX and deltaY are incorrect for NSMouseMoved, NSTabletPointEventSubtype
+ // http://xquartz.macosforge.org/trac/ticket/288
+ location = [e locationInWindow];
+ lastpt = location;
} else {
location.x = lastpt.x + [e deltaX];
location.y = lastpt.y - [e deltaY];
- lastpt = [NSEvent mouseLocation];
+ lastpt = [e locationInWindow];
}
/* Convert coordinate system */
commit e360104880e6e2e666aa05dfd56e2ef3880f38ef
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Wed Aug 5 16:17:01 2009 -0700
XQuartz: Purge redundant QuartzBell
(cherry picked from commit de14a63d20095e1537fd74352850c734d900031d)
diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c
index 8627588..8cf2417 100644
--- a/hw/xquartz/quartzAudio.c
+++ b/hw/xquartz/quartzAudio.c
@@ -219,6 +219,12 @@ void DDXRingBell(
int pitch, // pitch is Hz
int duration ) // duration is milliseconds
{
+ if (quartzUseSysBeep) {
+ if (volume)
+ NSBeep();
+ return;
+ }
+
if (quartzAudioDevice == kAudioDeviceUnknown) return;
pthread_mutex_lock(&data.lock);
@@ -247,40 +253,6 @@ void DDXRingBell(
pthread_mutex_unlock(&data.lock);
}
-
-/*
- * QuartzBell
- * Ring the bell
- */
-void QuartzBell(
- int volume, // volume in percent of max
- DeviceIntPtr pDevice,
- pointer ctrl,
- int class )
-{
- int pitch; // pitch in Hz
- int duration; // duration in milliseconds
-
- if (class == BellFeedbackClass) {
- pitch = ((BellCtrl*)ctrl)->pitch;
- duration = ((BellCtrl*)ctrl)->duration;
- } else if (class == KbdFeedbackClass) {
- pitch = ((KeybdCtrl*)ctrl)->bell_pitch;
- duration = ((KeybdCtrl*)ctrl)->bell_duration;
- } else {
- ErrorF("QuartzBell: bad bell class %d\n", class);
- return;
- }
-
- if (quartzUseSysBeep) {
- if (volume)
- NSBeep();
- } else {
- DDXRingBell(volume, pitch, duration);
- }
-}
-
-
/*
* QuartzAudioInit
* Prepare to play the bell with the CoreAudio API
diff --git a/hw/xquartz/quartzAudio.h b/hw/xquartz/quartzAudio.h
index c406bbc..2a78b39 100644
--- a/hw/xquartz/quartzAudio.h
+++ b/hw/xquartz/quartzAudio.h
@@ -32,9 +32,6 @@
#ifndef _QUARTZAUDIO_H
#define _QUARTZAUDIO_H
-#include "input.h"
-
void QuartzAudioInit(void);
-void QuartzBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
#endif
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index ca0a527..4abf4af 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -327,7 +327,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
/* We need to really have rules... or something... */
//XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
- InitKeyboardDeviceStruct(pDev, NULL, QuartzBell, DarwinChangeKeyboardControl);
+ InitKeyboardDeviceStruct(pDev, NULL, NULL, DarwinChangeKeyboardControl);
pthread_mutex_lock(&keyInfo_mutex);
DarwinLoadKeyboardMapping(&keySyms);
More information about the xorg-commit
mailing list