xserver: Branch 'xorg-server-1.6-apple' - 24 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Fri Jan 30 17:53:30 PST 2009
Xext/xtest.c | 2 +-
Xi/exevents.c | 20 ++++++++------------
Xi/queryst.c | 3 +--
dix/devices.c | 32 +++++++++-----------------------
dix/events.c | 29 +++++++++++++++++------------
dix/getevents.c | 14 +++++++++++++-
exa/exa_glyphs.c | 9 ++++++---
hw/xfree86/modes/xf86Rotate.c | 8 ++++++--
include/Makefile.am | 2 ++
include/dix-config-apple-verbatim.h | 8 ++++++++
include/dix-config.h.in | 7 +------
include/input.h | 1 +
include/inputstr.h | 9 +++++----
mi/mi.h | 4 ++++
mi/mieq.c | 26 ++++++++++++++++++++++++--
mi/mipointer.c | 2 +-
randr/rrcrtc.c | 23 ++++++++++++++++++-----
randr/rrxinerama.c | 27 ++++++++++++++++++++-------
xkb/ddxDevBtn.c | 2 +-
xkb/xkbActions.c | 4 ++--
20 files changed, 148 insertions(+), 84 deletions(-)
New commits:
commit d4414649f23c75cc6013e22088571fef9df2e973
Merge: 1432244... b893dc5...
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Jan 30 17:53:05 2009 -0800
Merge commit 'origin/server-1.6-branch' into xorg-server-1.6-apple
commit b893dc59da9f5a7afb59ea0b2cd794872fc5727f
Author: Thomas Jaeger <ThJaeger at gmail.com>
Date: Sat Dec 20 16:17:02 2008 +0100
Don't release grabs unless all buttons are up
Previously, only buttons <= 5 would count here, but the core protocol
allows for 255 buttons.
http://lists.freedesktop.org/archives/xorg/2009-January/042092.html
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
(cherry picked from commit 717a961528ec69a6e630d536e15568670e0b398a)
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/Xi/exevents.c b/Xi/exevents.c
index b4359a8..482041f 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1069,7 +1069,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
xE->u.u.detail = key;
return;
}
- if (!b->state && device->deviceGrab.fromPassiveGrab)
+ if (!b->buttonsDown && device->deviceGrab.fromPassiveGrab)
deactivateDeviceGrab = TRUE;
}
diff --git a/dix/events.c b/dix/events.c
index 768a33e..6743cae 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3848,7 +3848,7 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
if (xE->u.u.detail == 0)
return;
filters[mouse->id][Motion_Filter(butc)] = MotionNotify;
- if (!butc->state && mouse->deviceGrab.fromPassiveGrab)
+ if (!butc->buttonsDown && mouse->deviceGrab.fromPassiveGrab)
deactivateGrab = TRUE;
break;
default:
commit 191161a24a80dc553b11f829c12cfffb76ec7185
Author: Thomas Jaeger <ThJaeger at gmail.com>
Date: Mon Dec 22 00:55:09 2008 +0100
Count the number of logically down buttons in buttonsDown
This fixes the following bug. Assuming your window manager grabs
Alt+Button1 to move windows, map Button3 to 0 via XSetPointerMapping,
then press the physical button 3 (this shouldn't have any effect), press
Alt and then button 1. The press event is delivered to the application
instead of firing the grab.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
(cherry picked from commit f7f85f696570541e2dd43462675de9e6ee46f545)
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 2aa3161..b4359a8 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -895,10 +895,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
*kptr |= bit;
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
- b->buttonsDown++;
- b->motionMask = DeviceButtonMotionMask;
if (!b->map[key])
return DONT_PROCESS;
+ b->buttonsDown++;
+ b->motionMask = DeviceButtonMotionMask;
if (b->map[key] <= 5)
b->state |= (Button1Mask >> 1) << b->map[key];
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
@@ -927,10 +927,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
*kptr &= ~bit;
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
- if (b->buttonsDown >= 1 && !--b->buttonsDown)
- b->motionMask = 0;
if (!b->map[key])
return DONT_PROCESS;
+ if (b->buttonsDown >= 1 && !--b->buttonsDown)
+ b->motionMask = 0;
if (b->map[key] <= 5)
b->state &= ~((Button1Mask >> 1) << b->map[key]);
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
diff --git a/include/inputstr.h b/include/inputstr.h
index 4719d37..a6f823c 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -185,7 +185,11 @@ typedef struct _ValuatorClassRec {
typedef struct _ButtonClassRec {
CARD8 numButtons;
- CARD8 buttonsDown; /* number of buttons currently down */
+ CARD8 buttonsDown; /* number of buttons currently down
+ This counts logical buttons, not
+ physical ones, i.e if some buttons
+ are mapped to 0, they're not counted
+ here */
unsigned short state;
Mask motionMask;
CARD8 down[DOWN_LENGTH];
commit fe0abdceb483ec0bb2977016b00aef57033aa449
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Thu Jan 8 11:53:30 2009 +1000
mi: ensure chained button mappings from SD -> MD (#19282)
After copying the master event, flip the detail field to the mapped button of
the SD, not the physical button. This way if the SD has a mapping 1:3 and the
MD has a mapping of 3:4, a press on button 1 on the SD results in a core event
on button 4.
X.Org Bug 19282 <http://bugs.freedesktop.org/show_bug.cgi?id=19282>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/mi/mi.h b/mi/mi.h
index 444d3ad..6e8b89e 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -175,6 +175,10 @@ extern void mieqProcessInputEvents(
typedef void (*mieqHandler)(int, xEventPtr, DeviceIntPtr, int);
void mieqSetHandler(int event, mieqHandler handler);
+void
+CopyGetMasterEvent(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
+ EventListPtr master, int count);
+
/* miexpose.c */
extern RegionPtr miHandleExposures(
diff --git a/mi/mieq.c b/mi/mieq.c
index 8d68ca1..226caa6 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -327,15 +327,32 @@ ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
DebugF("[mi] Unknown event type (%d), cannot change id.\n", type);
}
+static void
+FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
+ EventListPtr master, int count)
+{
+ /* Ensure chained button mappings, i.e. that the detail field is the
+ * value of the mapped button on the SD, not the physical button */
+ if (original->u.u.type == DeviceButtonPress || original->u.u.type == DeviceButtonRelease)
+ {
+ int btn = original->u.u.detail;
+ if (!sdev->button)
+ return; /* Should never happen */
+
+ master->event->u.u.detail = sdev->button->map[btn];
+ }
+}
+
/**
* Copy the given event into master.
* @param mdev The master device
+ * @param sdev The slave device the original event comes from
* @param original The event as it came from the EQ
* @param master The event after being copied
* @param count Number of events in original.
*/
void
-CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original,
+CopyGetMasterEvent(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
EventListPtr master, int count)
{
int len = count * sizeof(xEvent);
@@ -350,11 +367,16 @@ CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original,
memcpy(master->event, original, len);
while (count--)
+ {
ChangeDeviceID(mdev, &master->event[count]);
+ FixUpEventForMaster(mdev, sdev, original, master, count);
+ }
}
extern void
CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
+
+
/* Call this from ProcessInputEvents(). */
void
mieqProcessInputEvents(void)
@@ -431,7 +453,7 @@ mieqProcessInputEvents(void)
event->u.u.type == DeviceKeyRelease)
CopyKeyClass(dev, master);
- CopyGetMasterEvent(master, event, masterEvents, nevents);
+ CopyGetMasterEvent(master, dev, event, masterEvents, nevents);
}
/* If someone's registered a custom event handler, let them
diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index 585ad19..44ee75f 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -117,7 +117,7 @@ DeviceIntPtr master = NULL;
if (!IsPointerDevice(master))
master = GetPairedDevice(dev->u.master);
- CopyGetMasterEvent(master, &events, masterEvents, count);
+ CopyGetMasterEvent(master, dev, &events, masterEvents, count);
}
(*dev->public.processInputProc)((xEventPtr)btn, dev, count);
commit 3441917008021fb13cf86fa619970859d927e17a
Author: Thomas Jaeger <thjaeger at gmail.com>
Date: Mon Jan 5 01:26:42 2009 -0500
Don't alter device button maps in DoSetPointerMapping
Currently, if a device map differs from the core pointer map, then the
request may return MappingBusy, even though all the affected core
buttons are in the up state.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
(cherry picked from commit 3d549438c29004d78032ecc50ab45ca0e3f49623)
diff --git a/dix/devices.c b/dix/devices.c
index 47e07f9..0858f20 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1831,36 +1831,23 @@ static int
DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n)
{
int rc, i = 0;
- DeviceIntPtr dev = NULL;
if (!device || !device->button)
return BadDevice;
- for (dev = inputInfo.devices; dev; dev = dev->next) {
- if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
- rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
- if (rc != Success)
- return rc;
- }
- }
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixManageAccess);
+ if (rc != Success)
+ return rc;
- for (dev = inputInfo.devices; dev; dev = dev->next) {
- if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
- for (i = 0; i < n; i++) {
- if ((device->button->map[i + 1] != map[i]) &&
- BitIsOn(device->button->down, i + 1)) {
- return MappingBusy;
- }
- }
+ for (i = 0; i < n; i++) {
+ if ((device->button->map[i + 1] != map[i]) &&
+ BitIsOn(device->button->down, i + 1)) {
+ return MappingBusy;
}
}
- for (dev = inputInfo.devices; dev; dev = dev->next) {
- if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
- for (i = 0; i < n; i++)
- dev->button->map[i + 1] = map[i];
- }
- }
+ for (i = 0; i < n; i++)
+ device->button->map[i + 1] = map[i];
return Success;
}
@@ -1917,7 +1904,6 @@ ProcSetPointerMapping(ClientPtr client)
return Success;
}
- /* FIXME: Send mapping notifies for all the extended devices as well. */
SendMappingNotify(ptr, MappingPointer, 0, 0, client);
WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
return Success;
commit 364bcbea48d5e49bef8d36f6724e2702cbb4b1af
Author: Thomas Jaeger <ThJaeger at gmail.com>
Date: Fri Jan 9 02:02:38 2009 -0500
Xext: Send out correct events in ProcXTestFakeInput
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
(cherry picked from commit b2756a71a432f7cf7c870a48676c98625512558d)
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 1290a23..a7f3830 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -396,7 +396,7 @@ ProcXTestFakeInput(client)
OsBlockSignals();
for (i = 0; i < nevents; i++)
- mieqEnqueue(dev, events->event);
+ mieqEnqueue(dev, (events+i)->event);
OsReleaseSignals();
return client->noClientException;
commit e789789196db8271a83c751fdf990ceb70164cb1
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Mon Jan 5 15:48:45 2009 +1000
xkb: fix typo - missing negation when checking button state.
Introduced with a85f0d6b98237d8a196de624207acf1983a1859a.
Reported by Thomas Jaeger.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
(cherry picked from commit 515ce3e4ba42605a1ee9979e8bb5acd3cf6470a3)
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 64e17e9..aea479c 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1075,7 +1075,7 @@ int button;
switch (filter->upAction.type) {
case XkbSA_LockDeviceBtn:
if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)||
- BitIsOn(dev->button->down, button))
+ !BitIsOn(dev->button->down, button))
return 0;
XkbDDXFakeDeviceButton(dev,False,button);
break;
commit ebb3872925315d705e47e1ccd7f193ac90ac33dc
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date: Wed Nov 26 11:15:05 2008 +1000
Xi: fix use of button->down - bitflags instead of int arrays.
The device's button down state array was changed to use DOWN_LENGTH and thus
bitflags for each button in cfcb3da7.
Update the DBSN events to copy this bit-wise state.
Update xkb and Xi to check for the bit flag instead of the array value.
Reported by ajax.
Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
(cherry picked from commit a85f0d6b98237d8a196de624207acf1983a1859a)
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 083bb2f..2aa3161 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1138,11 +1138,9 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
ev->num_valuators = 0;
if (b) {
- int i;
ev->classes_reported |= (1 << ButtonClass);
ev->num_buttons = b->numButtons;
- for (i = 0; i < 32; i++)
- SetBitIf(ev->buttons, b->down, i);
+ memcpy((char*)ev->buttons, (char*)b->down, 4);
} else if (k) {
ev->classes_reported |= (1 << KeyClass);
ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
@@ -1257,13 +1255,11 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
first += 3;
nval -= 3;
if (nbuttons > 32) {
- int i;
(ev - 1)->deviceid |= MORE_EVENTS;
bev = (deviceButtonStateNotify *) ev++;
bev->type = DeviceButtonStateNotify;
bev->deviceid = dev->id;
- for (i = 32; i < MAP_LENGTH; i++)
- SetBitIf(bev->buttons, b->down, i);
+ memcpy((char*)&bev->buttons[4], (char*)&b->down[4], DOWN_LENGTH - 4);
}
if (nval > 0) {
(ev - 1)->deviceid |= MORE_EVENTS;
@@ -1678,7 +1674,7 @@ SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map)
if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
return BadValue;
for (i = 0; i < nElts; i++)
- if ((b->map[i + 1] != map[i]) && (b->down[i + 1]))
+ if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1))
return MappingBusy;
for (i = 0; i < nElts; i++)
b->map[i + 1] = map[i];
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 268bdd7..21de843 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -139,8 +139,7 @@ ProcXQueryDeviceState(ClientPtr client)
tb->class = ButtonClass;
tb->length = sizeof(xButtonState);
tb->num_buttons = b->numButtons;
- for (i = 0; i < MAP_LENGTH; i++)
- SetBitIf(tb->buttons, b->down, i);
+ memcpy(tb->buttons, b->down, sizeof(b->down));
buf += sizeof(xButtonState);
}
diff --git a/dix/devices.c b/dix/devices.c
index bf79024..47e07f9 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1848,7 +1848,7 @@ DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n)
if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
for (i = 0; i < n; i++) {
if ((device->button->map[i + 1] != map[i]) &&
- device->button->down[i + 1]) {
+ BitIsOn(device->button->down, i + 1)) {
return MappingBusy;
}
}
diff --git a/include/inputstr.h b/include/inputstr.h
index 9591d2f..4719d37 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -57,9 +57,6 @@ SOFTWARE.
#include "privates.h"
#define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
-/* If byte[i] in src is non-zero, set bit i in dst, otherwise set bit to 0 */
-#define SetBitIf(dst, src, i) \
- (src[i]) ? (dst[i/8] |= (1 << (i % 8))) : (dst[i/8] &= ~(1 << (i % 8)));
#define SameClient(obj,client) \
(CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 94420cf..64e17e9 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1043,7 +1043,7 @@ int button;
switch (pAction->type) {
case XkbSA_LockDeviceBtn:
if ((pAction->devbtn.flags&XkbSA_LockNoLock)||
- (dev->button->down[button]))
+ BitIsOn(dev->button->down, button))
return 0;
XkbDDXFakeDeviceButton(dev,True,button);
filter->upAction.type= XkbSA_NoAction;
@@ -1075,7 +1075,7 @@ int button;
switch (filter->upAction.type) {
case XkbSA_LockDeviceBtn:
if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)||
- ((dev->button->down[button])==0))
+ BitIsOn(dev->button->down, button))
return 0;
XkbDDXFakeDeviceButton(dev,False,button);
break;
commit 50d80c25525a691472e3fc5859fb303a3ffe1ef2
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Mon Jan 12 15:29:36 2009 +1000
dix: fix WarpPointer calls for devices with custom valuator ranges (#19297)
If the MD's lastSlave was a devices with custom axes ranges, then a
WarpPointer would position the cursor at the wrong location. A WarpPointer
request provides screen coordinates and these coordinates were scaled to the
device range before warping.
This patch consists of two parts:
1) in the WarpPointer handling, get the lastSlave and post the event through
this device.
2) assume that WarpPointer coordinates are always in screen coordinates and
scale them to device coordinates in GPE before continuing. Note that this
breaks device-coordinate based XWarpDevicePointer calls (for which the spec
isn't nailed down yet anyway) until a better solution is found.
X.Org Bug 19297 <http://bugs.freedesktop.org/show_bug.cgi?id=19297>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
(cherry picked from commit d36adf52a2b2711d22b11105f7bd907d4493fb9b)
diff --git a/dix/events.c b/dix/events.c
index 498616f..768a33e 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3073,8 +3073,8 @@ ProcWarpPointer(ClientPtr client)
WindowPtr dest = NULL;
int x, y, rc;
ScreenPtr newScreen;
- DeviceIntPtr dev = PickPointer(client);
- SpritePtr pSprite = dev->spriteInfo->sprite;
+ DeviceIntPtr dev;
+ SpritePtr pSprite;
REQUEST(xWarpPointerReq);
REQUEST_SIZE_MATCH(xWarpPointerReq);
@@ -3087,6 +3087,12 @@ ProcWarpPointer(ClientPtr client)
return rc;
}
}
+
+ dev = PickPointer(client);
+ if (dev->u.lastSlave)
+ dev = dev->u.lastSlave;
+ pSprite = dev->spriteInfo->sprite;
+
#ifdef PANORAMIX
if(!noPanoramiXExtension)
return XineramaWarpPointer(client);
@@ -3153,13 +3159,12 @@ ProcWarpPointer(ClientPtr client)
else if (y >= pSprite->physLimits.y2)
y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
- ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
- (*newScreen->SetCursorPosition)(PickPointer(client), newScreen, x, y,
- TRUE);
+ ConfineToShape(dev, pSprite->hotShape, &x, &y);
+ (*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE);
}
- else if (!PointerConfinedToScreen(PickPointer(client)))
+ else if (!PointerConfinedToScreen(dev))
{
- NewCurrentScreen(PickPointer(client), newScreen, x, y);
+ NewCurrentScreen(dev, newScreen, x, y);
}
return Success;
}
diff --git a/dix/getevents.c b/dix/getevents.c
index 16e23dc..279f49e 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -973,8 +973,20 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
events = updateFromMaster(events, pDev, &num_events);
if (flags & POINTER_ABSOLUTE)
+ {
+ if (flags & POINTER_SCREEN) /* valuators are in screen coords */
+ {
+
+ valuators[0] = rescaleValuatorAxis(valuators[0], NULL,
+ pDev->valuator->axes + 0,
+ scr->width);
+ valuators[1] = rescaleValuatorAxis(valuators[1], NULL,
+ pDev->valuator->axes + 1,
+ scr->height);
+ }
+
moveAbsolute(pDev, &x, &y, first_valuator, num_valuators, valuators);
- else {
+ } else {
if (flags & POINTER_ACCELERATE)
accelPointer(pDev, first_valuator, num_valuators, valuators, ms);
moveRelative(pDev, &x, &y, first_valuator, num_valuators, valuators);
diff --git a/include/input.h b/include/input.h
index cf7f824..2ab815b 100644
--- a/include/input.h
+++ b/include/input.h
@@ -62,6 +62,7 @@ SOFTWARE.
#define POINTER_RELATIVE (1 << 1)
#define POINTER_ABSOLUTE (1 << 2)
#define POINTER_ACCELERATE (1 << 3)
+#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
/*int constants for pointer acceleration schemes*/
#define PtrAccelNoOp 0
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 9b2a1b2..8c8af6e 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -576,7 +576,7 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
}
}
- nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_SCREEN | POINTER_ABSOLUTE, 0, 2, valuators);
OsBlockSignals();
#ifdef XQUARTZ
commit b19f12712a0762f20065282fd055fe9bc3ca975f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Mon Jan 12 16:16:24 2009 +1000
dix: EnqueueEvent and PlayReleasedEvent need to handle DeviceMotionNotifies
No MotionNotify events in the processing anymore, so let's have them treat DMN
instead.
Reported by Thomas Jaeger.
(cherry picked from commit 488d45295105daf10ccd17ca93ae6a6f4d0104f1)
diff --git a/dix/events.c b/dix/events.c
index 122ce6a..498616f 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1160,14 +1160,14 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
* the data that GetCurrentRootWindow relies on hasn't been
* updated yet.
*/
- if (xE->u.u.type == MotionNotify)
+ if (xE->u.u.type == DeviceMotionNotify)
XE_KBPTR.root =
WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id;
eventinfo.events = xE;
eventinfo.count = count;
CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
}
- if (xE->u.u.type == MotionNotify)
+ if (xE->u.u.type == DeviceMotionNotify)
{
#ifdef PANORAMIX
if(!noPanoramiXExtension) {
@@ -1181,7 +1181,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
pSprite->hotPhys.y = XE_KBPTR.rootY;
/* do motion compression, but not if from different devices */
if (tail &&
- (tail->event->u.u.type == MotionNotify) &&
+ (tail->event->u.u.type == DeviceMotionNotify) &&
(tail->device == device) &&
(tail->pScreen == pSprite->hotPhys.pScreen))
{
@@ -1248,7 +1248,7 @@ PlayReleasedEvents(void)
pDev = qe->device;
if (*syncEvents.pendtail == *prev)
syncEvents.pendtail = prev;
- if (qe->event->u.u.type == MotionNotify)
+ if (qe->event->u.u.type == DeviceMotionNotify)
CheckVirtualMotion(pDev, qe, NullWindow);
syncEvents.time.months = qe->months;
/* XXX: Hack! We can't reliably get the time from GenericEvents,
commit ef796a95dd7ddf4ad5761a6ee2de1cdb56190ba2
Author: Xiang, Haihao <haihao.xiang at intel.com>
Date: Tue Jan 6 10:03:19 2009 +0800
avoid a potential endless loop.
Previously it is possible that creating rotation data, then cleaning
up and creating again so that pScreen->BlockHandler and
xf86_config->BlockHandler all point to xf86RotateBlockHandler.
See bug #19343.
(cherry picked from commit 5f3188228eb988bd8f08b62c84f98a8ff66ee283)
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 65a553e..f9f43c9 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -291,6 +291,8 @@ xf86RotateBlockHandler(int screenNum, pointer blockData,
/* Re-wrap if rotation is still happening */
xf86_config->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = xf86RotateBlockHandler;
+ } else {
+ xf86_config->BlockHandler = NULL;
}
}
@@ -477,8 +479,10 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
goto bail2;
/* Wrap block handler */
- xf86_config->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = xf86RotateBlockHandler;
+ if (!xf86_config->BlockHandler) {
+ xf86_config->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = xf86RotateBlockHandler;
+ }
}
#ifdef RANDR_12_INTERFACE
if (transform)
commit 840b4da5f29e43ccadc720f075e00237d12ef01b
Author: George Staplin <gstaplin at apple.com>
Date: Mon Jan 26 03:02:38 2009 -0700
XQuartz: GL: indirect.c changes to fix the build with newer OpenGL frameworks.
(cherry picked from commit 143224405ba74929c702a95de52b56df140b0d1b)
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 9ddc0e7..01cf0c6 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -37,6 +37,13 @@
#include "dri.h"
+#include <AvailabilityMacros.h>
+
+/*
+ * These define seem questionable to me, but I'm not sure why they were here
+ * in the first place.
+ */
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
#define GL_EXT_histogram 1
#define GL_EXT_polygon_offset 1
#define GL_SGIS_pixel_texture 1
@@ -53,6 +60,7 @@
#define GL_APPLE_fence 1
#define GL_IBM_multimode_draw_arrays 1
#define GL_EXT_fragment_shader 1
+#endif
#include <OpenGL/OpenGL.h>
#include <OpenGL/CGLContext.h>
@@ -904,12 +912,16 @@ static void setup_dispatch_table(void) {
SET_ColorTable(disp, glColorTable);
SET_ColorTableParameterfv(disp, glColorTableParameterfv);
SET_ColorTableParameteriv(disp, glColorTableParameteriv);
+
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
SET_CombinerInputNV(disp, glCombinerInputNV);
SET_CombinerOutputNV(disp, glCombinerOutputNV);
SET_CombinerParameterfNV(disp, glCombinerParameterfNV);
SET_CombinerParameterfvNV(disp, glCombinerParameterfvNV);
SET_CombinerParameteriNV(disp, glCombinerParameteriNV);
SET_CombinerParameterivNV(disp, glCombinerParameterivNV);
+#endif
SET_CompileShaderARB(disp, glCompileShaderARB);
SET_CompressedTexImage1DARB(disp, glCompressedTexImage1DARB);
SET_CompressedTexImage2DARB(disp, glCompressedTexImage2DARB);
@@ -987,7 +999,10 @@ static void setup_dispatch_table(void) {
SET_EvalPoint2(disp, glEvalPoint2);
//SET_ExecuteProgramNV(disp, glExecuteProgramNV);
SET_FeedbackBuffer(disp, glFeedbackBuffer);
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
SET_FinalCombinerInputNV(disp, glFinalCombinerInputNV);
+#endif
SET_Finish(disp, glFinish);
SET_FinishFenceNV(disp, glFinishFenceAPPLE); // <-- APPLE -> NV
SET_Flush(disp, glFlush);
@@ -1029,10 +1044,12 @@ static void setup_dispatch_table(void) {
SET_GetColorTable(disp, glGetColorTable);
SET_GetColorTableParameterfv(disp, glGetColorTableParameterfv);
SET_GetColorTableParameteriv(disp, glGetColorTableParameteriv);
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
SET_GetCombinerInputParameterfvNV(disp, glGetCombinerInputParameterfvNV);
SET_GetCombinerInputParameterivNV(disp, glGetCombinerInputParameterivNV);
SET_GetCombinerOutputParameterfvNV(disp, glGetCombinerOutputParameterfvNV);
SET_GetCombinerOutputParameterivNV(disp, glGetCombinerOutputParameterivNV);
+#endif
SET_GetCompressedTexImageARB(disp, glGetCompressedTexImageARB);
SET_GetConvolutionFilter(disp, glGetConvolutionFilter);
SET_GetConvolutionParameterfv(disp, glGetConvolutionParameterfv);
@@ -1040,8 +1057,10 @@ static void setup_dispatch_table(void) {
SET_GetDoublev(disp, glGetDoublev);
SET_GetError(disp, glGetError);
//SET_GetFenceivNV(disp, glGetFenceivNV);
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
SET_GetFinalCombinerInputParameterfvNV(disp, glGetFinalCombinerInputParameterfvNV);
SET_GetFinalCombinerInputParameterivNV(disp, glGetFinalCombinerInputParameterivNV);
+#endif
SET_GetFloatv(disp, glGetFloatv);
SET_GetFramebufferAttachmentParameterivEXT(disp, glGetFramebufferAttachmentParameterivEXT);
SET_GetHandleARB(disp, glGetHandleARB);
commit 97a6f55f221e3d470add18db80e3769713480103
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Jan 16 19:26:07 2009 -0800
XQuartz: SnowLeopard: Help system book name changed in 10.6
(cherry picked from commit b57cb05c69acbedb00a97234099ea104309aa2cb)
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 9b30fa6..adf861c 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -687,18 +687,19 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
[prefs_panel makeKeyAndOrderFront:sender];
}
-- (IBAction) quit:sender
-{
- DarwinSendDDXEvent(kXquartzQuit, 0);
+- (IBAction) quit:sender {
+ DarwinSendDDXEvent(kXquartzQuit, 0);
}
-- (IBAction) x11_help:sender
-{
- AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276"));
+- (IBAction) x11_help:sender {
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+ AHLookupAnchor((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR("mchlp2276"));
+#else
+ AHLookupAnchor(CFSTR("com.apple.machelp"), CFSTR("mchlp2276"));
+#endif
}
-- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item
-{
+- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item {
NSMenu *menu = [item menu];
if (item == toggle_fullscreen_item)
commit e81b4d495ba02d4fc0b05c26a53fd2a816a61eaa
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Jan 16 13:54:08 2009 -0800
XQuartz: mieq: Wait for the server to finish initializing before letting other threads mieqEnqueue
Avoid possible race condition whereby one thread might call mieqEnqueue before InitAndStartDevices finishes
(cherry picked from commit 94e417ac87a98cd5c6bf2d7c495d702748398931)
diff --git a/dix/main.c b/dix/main.c
index ee2e10d..0527621 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -234,6 +234,12 @@ static int indexForScanlinePad[ 65 ] = {
#endif
#ifdef XQUARTZ
+#include <pthread.h>
+
+BOOL serverInitComplete = FALSE;
+pthread_mutex_t serverInitCompleteMutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t serverInitCompleteCond = PTHREAD_COND_INITIALIZER;
+
int dix_main(int argc, char *argv[], char *envp[])
#else
int main(int argc, char *argv[], char *envp[])
@@ -378,6 +384,14 @@ int main(int argc, char *argv[], char *envp[])
}
}
+#ifdef XQUARTZ
+ /* Let the other threads know the server is done with its init */
+ pthread_mutex_lock(&serverInitCompleteMutex);
+ serverInitComplete = TRUE;
+ pthread_cond_broadcast(&serverInitCompleteCond);
+ pthread_mutex_unlock(&serverInitCompleteMutex);
+#endif
+
NotifyParentProcess();
Dispatch();
diff --git a/mi/mieq.c b/mi/mieq.c
index 15ba8e7..8d68ca1 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -36,11 +36,6 @@ in this Software without prior written authorization from The Open Group.
#include <dix-config.h>
#endif
-#ifdef XQUARTZ
-#include <pthread.h>
-static pthread_mutex_t miEventQueueMutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
# define NEED_EVENTS
# include <X11/X.h>
# include <X11/Xmd.h>
@@ -87,6 +82,25 @@ typedef struct _EventQueue {
static EventQueueRec miEventQueue;
static EventListPtr masterEvents; /* for use in mieqProcessInputEvents */
+#ifdef XQUARTZ
+#include <pthread.h>
+static pthread_mutex_t miEventQueueMutex = PTHREAD_MUTEX_INITIALIZER;
+
+extern BOOL serverInitComplete;
+extern pthread_mutex_t serverInitCompleteMutex;
+extern pthread_cond_t serverInitCompleteCond;
+
+static inline void wait_for_server_init(void) {
+ /* If the server hasn't finished initializing, wait for it... */
+ if(!serverInitComplete) {
+ pthread_mutex_lock(&serverInitCompleteMutex);
+ while(!serverInitComplete)
+ pthread_cond_wait(&serverInitCompleteCond, &serverInitCompleteMutex);
+ pthread_mutex_unlock(&serverInitCompleteMutex);
+ }
+}
+#endif
+
Bool
mieqInit(void)
{
@@ -145,6 +159,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
int evlen;
#ifdef XQUARTZ
+ wait_for_server_init();
pthread_mutex_lock(&miEventQueueMutex);
#endif
commit d6498ea62117cce6a00ac045ddeefb7268a70f5b
Author: Eric Anholt <eric at anholt.net>
Date: Fri Jan 30 16:17:58 2009 -0800
Move the apple fat binary hacks back to a header file, and make it apple-only.
(cherry picked from commit dd098501d800571e71d06ffc936635a6c9d44e05)
diff --git a/configure.ac b/configure.ac
index a90d400..da5f488 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,9 +39,7 @@ dnl drivers.
AC_CONFIG_HEADERS(include/xorg-server.h)
dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
dnl dix/).
-AC_CONFIG_HEADERS(include/dix-config.h, [mv include/dix-config.h include/dix-config.h.tmp
- sed 's|/undef|#undef|' < include/dix-config.h.tmp > include/dix-config.h
- rm include/dix-config.h.tmp])
+AC_CONFIG_HEADERS(include/dix-config.h)
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/xorg-config.h)
dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
diff --git a/include/Makefile.am b/include/Makefile.am
index f6b3670..cb0b293 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -62,3 +62,5 @@ endif
AM_CFLAGS = $(DIX_CFLAGS)
+EXTRA_DIST = \
+ dix-config-apple-verbatim.h
diff --git a/include/dix-config-apple-verbatim.h b/include/dix-config-apple-verbatim.h
new file mode 100644
index 0000000..f429d20
--- /dev/null
+++ b/include/dix-config-apple-verbatim.h
@@ -0,0 +1,8 @@
+/* Do not include this file directly. It is included at the end of <dix-config.h> */
+
+/* Correctly set _XSERVER64 for OSX fat binaries */
+#if defined(__LP64__) && !defined(_XSERVER64)
+#define _XSERVER64 1
+#elif !defined(__LP64__) && defined(_XSERVER64)
+#undef _XSERVER64
+#endif
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index e1d226c..2515d83 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -431,12 +431,7 @@
/* Correctly set _XSERVER64 for OSX fat binaries */
#ifdef __APPLE__
-#if defined(__LP64__) && !defined(_XSERVER64)
-#define _XSERVER64 1
-#elif !defined(__LP64__) && defined(_XSERVER64)
-/* configure mangles #undef, so we fix this in AC_CONFIG_HEADERS post process */
-/undef _XSERVER64
-#endif
+#include "dix-config-apple-verbatim.h"
#endif
#endif /* _DIX_CONFIG_H_ */
commit b530a0e97b5737375ca1f4eced26d587a16f843f
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Thu Jan 15 20:57:42 2009 -0800
XQuartz: Fix builddir != srcdir issues and undef _XSERVER64 where appropriate on fat binary compilation
(cherry picked from commit f020900641b44a1142e5c2198e9678de2744454e)
diff --git a/configure.ac b/configure.ac
index da5f488..a90d400 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,9 @@ dnl drivers.
AC_CONFIG_HEADERS(include/xorg-server.h)
dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
dnl dix/).
-AC_CONFIG_HEADERS(include/dix-config.h)
+AC_CONFIG_HEADERS(include/dix-config.h, [mv include/dix-config.h include/dix-config.h.tmp
+ sed 's|/undef|#undef|' < include/dix-config.h.tmp > include/dix-config.h
+ rm include/dix-config.h.tmp])
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/xorg-config.h)
dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am
index 03fa1dd..963327b 100644
--- a/hw/xquartz/bundle/Makefile.am
+++ b/hw/xquartz/bundle/Makefile.am
@@ -5,7 +5,10 @@ CPP_FILES_FLAGS = \
-DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)"
install-data-hook:
- ./mk_bundke.sh $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app
+ $(srcdir)/mk_bundke.sh $(srcdir) $(builddir) $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app install
+
+uninstall-hook:
+ $(RM) -rf $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app
noinst_PRE = Info.plist.cpp
noinst_DATA = $(noinst_PRE:plist.cpp=plist)
diff --git a/hw/xquartz/bundle/mk_bundke.sh b/hw/xquartz/bundle/mk_bundke.sh
index 7c8d148..c85b217 100755
--- a/hw/xquartz/bundle/mk_bundke.sh
+++ b/hw/xquartz/bundle/mk_bundke.sh
@@ -2,7 +2,9 @@
#
# 'Cause xcodebuild is hard to deal with
-BUNDLE_ROOT=$1
+SRCDIR=$1
+BUILDDIR=$2
+BUNDLE_ROOT=$3
localities="Dutch English French German Italian Japanese Spanish da fi ko no pl pt pt_PT ru sv zh_CN zh_TW"
for lang in ${localities} ; do
@@ -10,18 +12,18 @@ for lang in ${localities} ; do
[ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib ] || exit 1
for f in InfoPlist.strings Localizable.strings main.nib/keyedobjects.nib ; do
- install -m 644 Resources/${lang}.lproj/$f ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/${f}
+ install -m 644 ${SRCDIR}/Resources/${lang}.lproj/$f ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/${f}
done
done
-install -m 644 Resources/English.lproj/main.nib//designable.nib ${BUNDLE_ROOT}/Contents/Resources/English.lproj/main.nib
-install -m 644 Resources/X11.icns ${BUNDLE_ROOT}/Contents/Resources
+install -m 644 ${SRCDIR}/Resources/English.lproj/main.nib//designable.nib ${BUNDLE_ROOT}/Contents/Resources/English.lproj/main.nib
+install -m 644 ${SRCDIR}/Resources/X11.icns ${BUNDLE_ROOT}/Contents/Resources
-install -m 644 Info.plist ${BUNDLE_ROOT}/Contents
-install -m 644 PkgInfo ${BUNDLE_ROOT}/Contents
+install -m 644 ${BUILDDIR}/Info.plist ${BUNDLE_ROOT}/Contents
+install -m 644 ${SRCDIR}/PkgInfo ${BUNDLE_ROOT}/Contents
mkdir -p ${BUNDLE_ROOT}/Contents/MacOS
-install -m 755 X11.sh ${BUNDLE_ROOT}/Contents/MacOS/X11
+install -m 755 ${SRCDIR}/X11.sh ${BUNDLE_ROOT}/Contents/MacOS/X11
if [[ $(id -u) == 0 ]] ; then
chown -R root:admin ${BUNDLE_ROOT}
diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am
index 40060d0..b011294 100644
--- a/hw/xquartz/mach-startup/Makefile.am
+++ b/hw/xquartz/mach-startup/Makefile.am
@@ -65,8 +65,8 @@ BUILT_SOURCES = \
CLEANFILES = \
$(BUILT_SOURCES)
-$(BUILT_SOURCES): mach_startup.defs
- mig -sheader mach_startupServer.h mach_startup.defs
+$(BUILT_SOURCES): $(srcdir)/mach_startup.defs
+ mig -sheader mach_startupServer.h $(srcdir)/mach_startup.defs
EXTRA_DIST = \
launchd_fd.h \
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 8e047c4..e1d226c 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -434,7 +434,8 @@
#if defined(__LP64__) && !defined(_XSERVER64)
#define _XSERVER64 1
#elif !defined(__LP64__) && defined(_XSERVER64)
-#undef _XSERVER64
+/* configure mangles #undef, so we fix this in AC_CONFIG_HEADERS post process */
+/undef _XSERVER64
#endif
#endif
commit 82fd4d170824068dddf3b4e6581a12d48e1a069a
Author: George Staplin <gstaplin at apple.com>
Date: Mon Jan 12 19:30:43 2009 -0700
XQuartz: xpr: Cleanup some of the code and possibly fix part of the GLX Pixmap problem.
Split DRICreateSurface into 3 functions.
Make CreateSurfaceForPixmap use xp_configure_surface. I suspect this is partly why
GLXPixmaps never worked.
It will require some more work and thoughts for pbuffers, unless we fake those with
pixmaps and surfaces.
(cherry picked from commit 9cf264e67744262b9f45079e6cd752eb3e3b0e08)
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 8feba7e..50b478b 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -346,6 +346,121 @@ DRIUpdateSurface(DRIDrawablePrivPtr pDRIDrawablePriv, DrawablePtr pDraw)
xp_configure_surface(pDRIDrawablePriv->sid, flags, &wc);
}
+/* Return NULL if an error occurs. */
+static DRIDrawablePrivPtr
+CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr) {
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+ xp_window_id wid = 0;
+
+ *widPtr = 0;
+
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ if (pDRIDrawablePriv == NULL) {
+ xp_error err;
+ xp_window_changes wc;
+
+ /* allocate a DRI Window Private record */
+ if (!(pDRIDrawablePriv = xalloc(sizeof(*pDRIDrawablePriv)))) {
+ return NULL;
+ }
+
+ pDRIDrawablePriv->pDraw = (DrawablePtr)pWin;
+ pDRIDrawablePriv->pScreen = pScreen;
+ pDRIDrawablePriv->refCount = 0;
+ pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->notifiers = NULL;
+
+ /* find the physical window */
+ wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE));
+
+ if (wid == 0) {
+ xfree(pDRIDrawablePriv);
+ return NULL;
+ }
+
+ /* allocate the physical surface */
+ err = xp_create_surface(wid, &pDRIDrawablePriv->sid);
+
+ if (err != Success) {
+ xfree(pDRIDrawablePriv);
+ return NULL;
+ }
+
+ /* Make it visible */
+ wc.stack_mode = XP_MAPPED_ABOVE;
+ wc.sibling = 0;
+ err = xp_configure_surface(pDRIDrawablePriv->sid, XP_STACKING, &wc);
+
+ if (err != Success) {
+ xp_destroy_surface(pDRIDrawablePriv->sid);
+ xfree(pDRIDrawablePriv);
+ return NULL;
+ }
+
+ /* save private off of preallocated index */
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
+ pDRIDrawablePriv);
+ }
+
+ *widPtr = wid;
+
+ return pDRIDrawablePriv;
+}
+
+/* Return FALSE if an error occurs. */
+static DRIDrawablePrivPtr
+CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix);
+
+ if (pDRIDrawablePriv == NULL) {
+ xp_error err;
+ xp_window_changes wc;
+
+ /* allocate a DRI Window Private record */
+ if (!(pDRIDrawablePriv = xcalloc(1, sizeof(*pDRIDrawablePriv)))) {
+ return NULL;
+ }
+
+ pDRIDrawablePriv->pDraw = (DrawablePtr)pPix;
+ pDRIDrawablePriv->pScreen = pScreen;
+ pDRIDrawablePriv->refCount = 0;
+ pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->notifiers = NULL;
+
+ /* Passing a null window id to Xplugin in 10.3+ asks for
+ an accelerated offscreen surface. */
+
+ err = xp_create_surface(0, &pDRIDrawablePriv->sid);
+ if (err != Success) {
+ xfree(pDRIDrawablePriv);
+ return NULL;
+ }
+
+ wc.x = 0;
+ wc.y = 0;
+ wc.width = pPix->drawable.width;
+ wc.height = pPix->drawable.height;
+
+ err = xp_configure_surface(pDRIDrawablePriv->sid, XP_BOUNDS, &wc);
+
+ if(err != Success) {
+ xp_destroy_surface(pDRIDrawablePriv->sid);
+ xfree(pDRIDrawablePriv);
+ return NULL;
+ }
+
+ /* save private off of preallocated index */
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey,
+ pDRIDrawablePriv);
+ }
+
+ return pDRIDrawablePriv;
+}
+
+
Bool
DRICreateSurface(ScreenPtr pScreen, Drawable id,
DrawablePtr pDrawable, xp_client_id client_id,
@@ -353,107 +468,39 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
void (*notify) (void *arg, void *data), void *notify_data)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- DRIDrawablePrivPtr pDRIDrawablePriv;
xp_window_id wid = 0;
+ DRIDrawablePrivPtr pDRIDrawablePriv;
if (pDrawable->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDrawable;
-
- pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
- if (pDRIDrawablePriv == NULL) {
- xp_error err;
- xp_window_changes wc;
-
- /* allocate a DRI Window Private record */
- if (!(pDRIDrawablePriv = xalloc(sizeof(DRIDrawablePrivRec)))) {
- return FALSE;
- }
-
- pDRIDrawablePriv->pDraw = pDrawable;
- pDRIDrawablePriv->pScreen = pScreen;
- pDRIDrawablePriv->refCount = 0;
- pDRIDrawablePriv->drawableIndex = -1;
- pDRIDrawablePriv->notifiers = NULL;
-
- /* find the physical window */
- wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE));
- if (wid == 0) {
- xfree(pDRIDrawablePriv);
- return FALSE;
- }
-
- /* allocate the physical surface */
- err = xp_create_surface(wid, &pDRIDrawablePriv->sid);
- if (err != Success) {
- xfree(pDRIDrawablePriv);
- return FALSE;
- }
-
- /* Make it visible */
- wc.stack_mode = XP_MAPPED_ABOVE;
- wc.sibling = 0;
- err = xp_configure_surface(pDRIDrawablePriv->sid, XP_STACKING, &wc);
- if (err != Success)
- {
- xp_destroy_surface(pDRIDrawablePriv->sid);
- xfree(pDRIDrawablePriv);
- return FALSE;
- }
+ pDRIDrawablePriv = CreateSurfaceForWindow(pScreen,
+ (WindowPtr)pDrawable, &wid);
- /* save private off of preallocated index */
- dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
- pDRIDrawablePriv);
- }
+ if(NULL == pDRIDrawablePriv)
+ return FALSE; /*error*/
}
-
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
else if (pDrawable->type == DRAWABLE_PIXMAP) {
- PixmapPtr pPix = (PixmapPtr)pDrawable;
-
- pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix);
- if (pDRIDrawablePriv == NULL) {
- xp_error err;
+ pDRIDrawablePriv = CreateSurfaceForPixmap(pScreen,
+ (PixmapPtr)pDrawable);
- /* allocate a DRI Window Private record */
- if (!(pDRIDrawablePriv = xcalloc(1, sizeof(DRIDrawablePrivRec)))) {
- return FALSE;
- }
-
- pDRIDrawablePriv->pDraw = pDrawable;
- pDRIDrawablePriv->pScreen = pScreen;
- pDRIDrawablePriv->refCount = 0;
- pDRIDrawablePriv->drawableIndex = -1;
- pDRIDrawablePriv->notifiers = NULL;
-
- /* Passing a null window id to Xplugin in 10.3+ asks for
- an accelerated offscreen surface. */
-
- err = xp_create_surface(0, &pDRIDrawablePriv->sid);
- if (err != Success) {
- xfree(pDRIDrawablePriv);
- return FALSE;
- }
-
- /* save private off of preallocated index */
- dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey,
- pDRIDrawablePriv);
- }
+ if(NULL == pDRIDrawablePriv)
+ return FALSE; /*error*/
}
#endif
-
else { /* for GLX 1.3, a PBuffer */
/* NOT_DONE */
return FALSE;
}
+
+
/* Finish initialization of new surfaces */
if (pDRIDrawablePriv->refCount == 0) {
unsigned int key[2] = {0};
xp_error err;
/* try to give the client access to the surface */
- if (client_id != 0 && wid != 0)
- {
+ if (client_id != 0 && wid != 0) {
err = xp_export_surface(wid, pDRIDrawablePriv->sid,
client_id, key);
if (err != Success) {
commit 9cbdcf1fa4bdcc115def9f134a57ac96a56c69dd
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sun Jan 11 14:49:39 2009 -0800
XQuartz: Only call DarwinUpdateModKeys when needed
Previously, we were calling it on almost every itteration through sendX11Event
(cherry picked from commit 6461729647ff4441d80811e73f0c0d2f108f2700)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index ec58ab1..9f4738c 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -65,6 +65,7 @@ extern BOOL xpbproxy_init (void);
/* Stuck modifier / button state... force release when we context switch */
static NSEventType keyState[NUM_KEYCODES];
+static int modifierFlagsMask;
int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE;
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
@@ -200,7 +201,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
}
} else {
- DarwinUpdateModKeys(0);
+ if(darwin_modifier_flags)
+ DarwinUpdateModKeys(0);
for(i=0; i < NUM_KEYCODES; i++) {
if(keyState[i] == NSKeyDown) {
DarwinSendKeyboardEvents(KeyRelease, i);
@@ -872,6 +874,7 @@ environment the next time you start X11?", @"Startup xinitrc dialog");
void X11ApplicationMain (int argc, char **argv, char **envp) {
NSAutoreleasePool *pool;
+ int *p;
#ifdef DEBUG
while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
@@ -916,6 +919,10 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
fprintf(stderr, "X11ApplicationMain: Could not build a valid keymap.\n");
}
+ for(p=darwin_modifier_mask_list, modifierFlagsMask=0; *p; p++) {
+ modifierFlagsMask |= *p;
+ }
+
/* Tell the server thread that it can proceed */
QuartzInitServer(argc, argv, envp);
@@ -932,7 +939,6 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
}
@implementation X11Application (Private)
-extern int darwin_modifier_flags; // darwinEvents.c
#ifdef NX_DEVICELCMDKEYMASK
/* This is to workaround a bug in the VNC server where we sometimes see the L
@@ -987,6 +993,8 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK, NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK, NX_DEVICELALTKEYMASK);
#endif
+ modifierFlags &= modifierFlagsMask;
+
/* We don't receive modifier key events while out of focus, and 3button
* emulation mucks this up, so we need to check our modifier flag state
* on every event... ugg
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 1863eff..89d2233 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -146,7 +146,7 @@ static void DarwinPressModifierKey(int pressed, int key) {
* Send events to update the modifier state.
*/
-static int modifier_mask_list[] = {
+int darwin_modifier_mask_list[] = {
#ifdef NX_DEVICELCMDKEYMASK
NX_DEVICELCTLKEYMASK, NX_DEVICERCTLKEYMASK,
NX_DEVICELSHIFTKEYMASK, NX_DEVICERSHIFTKEYMASK,
@@ -173,7 +173,7 @@ static void DarwinUpdateModifiers(
DarwinPressModifierKey(KeyRelease, NX_MODIFIERKEY_ALPHALOCK);
}
- for(f=modifier_mask_list; *f; f++)
+ for(f=darwin_modifier_mask_list; *f; f++)
if(*f & flags) {
key = DarwinModifierNXMaskToNXKey(*f);
if(key == -1)
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 2f1d9ff..9ec3bda 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -78,4 +78,7 @@ enum {
/* Send one of the above events to the server thread. */
void DarwinSendDDXEvent(int type, int argc, ...);
+extern int darwin_modifier_mask_list[];
+extern int darwin_modifier_flags;
+
#endif /* _DARWIN_EVENTS_H */
commit 037e52fd7353410397dfd877b3e9af99f791fce1
Author: George Staplin <gstaplin at apple.com>
Date: Mon Jan 12 14:14:44 2009 -0700
XQuartz: GL: Make indirect.c build and work in the 1.6 branch.
Reorder some header files and provide some types earlier on.
Remove the static __GLXextensionInfo __glDDXExtensionInfo; that isn't
used in 1.4 or 1.5, and seems to have been removed from 1.6. Remove
the data structures associated with that too.
Remove __glXAquaDrawableResize. The GLX structure doesn't use
it anymore, and the Apple version did nothing useful before.
__glXAquaDrawableSwapBuffers(): base no longer contains a drawGlxc
member. Now provide the the Apple/Aqua context in the __GLXAquaDrawable
struct. Add the context member to the __GLXAquaDrawable struct.
Remove the fallback configs. They aren't used in 1.4 or 1.5 either.
Remove init_visuals(). It's not used in 1.4 or 1.5 either.
In the drawable constructor initialize the state properly, including
the new context member.
Remove glAquaResetExtension() -- it's not used anymore.
This has been tested remotely and proven to work with glxgears,
fire, various texture programs I wrote, and various Mesa demos.
(cherry picked from commit d514152195452ae11ec7769c76489651620ad380)
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index afaa957..9ddc0e7 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -57,7 +57,6 @@
#include <OpenGL/OpenGL.h>
#include <OpenGL/CGLContext.h>
-// X11 and X11's glx
#include <GL/gl.h>
#include <GL/glxproto.h>
#include <windowstr.h>
@@ -78,16 +77,13 @@
#include "capabilities.h"
-#include <dispatch.h>
-#define GLAPIENTRYP *
typedef unsigned long long GLuint64EXT;
typedef long long GLint64EXT;
+#include <dispatch.h>
#include <Xplugin.h>
#include <glapi.h>
#include <glapitable.h>
-// ggs: needed to call back to glx with visual configs
-extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs);
__GLXprovider * GlxGetDRISWrastProvider (void);
// Write debugging output, or not
@@ -105,15 +101,6 @@ void warn_func(void * p1, char *format, ...);
static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen);
static __GLXdrawable * __glXAquaScreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, int type, XID drawId, __GLXconfig *conf);
-static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
- int *nvisualp, int *ndepthp,
- int *rootDepthp, VisualID *defaultVisp,
- unsigned long sizes, int bitsPerRGB);
-
-static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
- void **privates);
-
-static void glAquaResetExtension(void);
static void __glXAquaContextDestroy(__GLXcontext *baseContext);
static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext);
static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext);
@@ -123,16 +110,16 @@ static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, un
static CGLPixelFormatObj makeFormat(__GLXconfig *conf);
__GLXprovider __glXDRISWRastProvider = {
- __glXAquaScreenProbe,
- "Core OpenGL",
+ __glXAquaScreenProbe,
+ "Core OpenGL",
NULL
};
__GLXprovider *
GlxGetDRISWRastProvider (void)
{
- GLAQUA_DEBUG_MSG("GlxGetDRISWRastProvider\n");
- return &__glXDRISWRastProvider;
+ GLAQUA_DEBUG_MSG("GlxGetDRISWRastProvider\n");
+ return &__glXDRISWRastProvider;
}
typedef struct __GLXAquaScreen __GLXAquaScreen;
@@ -143,11 +130,8 @@ struct __GLXAquaScreen {
__GLXscreen base;
int index;
int num_vis;
- //__GLcontextModes *modes;
};
-static __GLXAquaScreen glAquaScreens[MAXSCREENS];
-
struct __GLXAquaContext {
__GLXcontext base;
CGLContextObj ctx;
@@ -160,71 +144,60 @@ struct __GLXAquaDrawable {
__GLXdrawable base;
DrawablePtr pDraw;
xp_surface_id sid;
+ __GLXAquaContext *context;
};
+
static __GLXcontext *
__glXAquaScreenCreateContext(__GLXscreen *screen,
__GLXconfig *conf,
__GLXcontext *baseShareContext)
{
- __GLXAquaContext *context;
- __GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext;
- CGLError gl_err;
+ __GLXAquaContext *context;
+ __GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext;
+ CGLError gl_err;
- GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n");
-
- context = xalloc (sizeof (__GLXAquaContext));
-
- if (context == NULL)
- return NULL;
-
- memset(context, 0, sizeof *context);
-
- context->base.pGlxScreen = screen;
-
- context->base.destroy = __glXAquaContextDestroy;
- context->base.makeCurrent = __glXAquaContextMakeCurrent;
- context->base.loseCurrent = __glXAquaContextLoseCurrent;
- context->base.copy = __glXAquaContextCopy;
- context->base.forceCurrent = __glXAquaContextForceCurrent;
- /*FIXME verify that the context->base is fully initialized. */
-
- context->pixelFormat = makeFormat(conf);
+ GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n");
+
+ context = xalloc (sizeof (__GLXAquaContext));
+
+ if (context == NULL)
+ return NULL;
- if (!context->pixelFormat) {
+ memset(context, 0, sizeof *context);
+
+ context->base.pGlxScreen = screen;
+
+ context->base.destroy = __glXAquaContextDestroy;
+ context->base.makeCurrent = __glXAquaContextMakeCurrent;
+ context->base.loseCurrent = __glXAquaContextLoseCurrent;
+ context->base.copy = __glXAquaContextCopy;
+ context->base.forceCurrent = __glXAquaContextForceCurrent;
+ /*FIXME verify that the context->base is fully initialized. */
+
+ context->pixelFormat = makeFormat(conf);
+
+ if (!context->pixelFormat) {
xfree(context);
return NULL;
- }
-
- context->ctx = NULL;
- gl_err = CGLCreateContext(context->pixelFormat,
- shareContext ? shareContext->ctx : NULL,
- &context->ctx);
-
- if (gl_err != 0) {
- ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err));
- CGLDestroyPixelFormat(context->pixelFormat);
- xfree(context);
- return NULL;
- }
+ }
- setup_dispatch_table();
- GLAQUA_DEBUG_MSG("glAquaCreateContext done\n");
+ context->ctx = NULL;
+ gl_err = CGLCreateContext(context->pixelFormat,
+ shareContext ? shareContext->ctx : NULL,
+ &context->ctx);
- return &context->base;
-}
-
-/* Nothing seems to use these anymore... */
-static __GLXextensionInfo __glDDXExtensionInfo = {
- GL_CORE_APPLE,
- glAquaResetExtension,
- glAquaInitVisuals,
- glAquaSetVisualConfigs
-};
-
-void *__glXglDDXExtensionInfo(void) {
- GLAQUA_DEBUG_MSG("glXAglDDXExtensionInfo\n");
- return &__glDDXExtensionInfo;
+ if (gl_err != 0) {
+ ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err));
+ CGLDestroyPixelFormat(context->pixelFormat);
+ xfree(context);
+ return NULL;
+ }
+
+ setup_dispatch_table();
+ GLAQUA_DEBUG_MSG("glAquaCreateContext done\n");
+
+ return &context->base;
}
/* maps from surface id -> list of __GLcontext */
@@ -234,7 +207,7 @@ static void __glXAquaContextDestroy(__GLXcontext *baseContext) {
x_list *lst;
__GLXAquaContext *context = (__GLXAquaContext *) baseContext;
-
+
GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx 0x%x)\n",
(unsigned int) baseContext);
if (context != NULL) {
@@ -275,33 +248,33 @@ static void surface_notify(void *_arg, void *data) {
__GLXAquaDrawable *draw = (__GLXAquaDrawable *)data;
__GLXAquaContext *context;
x_list *lst;
- if(_arg == NULL || data == NULL) {
- ErrorF("surface_notify called with bad params");
- return;
- }
+ if(_arg == NULL || data == NULL) {
+ ErrorF("surface_notify called with bad params");
+ return;
+ }
GLAQUA_DEBUG_MSG("surface_notify(%p, %p)\n", _arg, data);
switch (arg->kind) {
case AppleDRISurfaceNotifyDestroyed:
if (surface_hash != NULL)
x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(arg->id));
- draw->base.pDraw = NULL;
- draw->sid = 0;
+ draw->base.pDraw = NULL;
+ draw->sid = 0;
break;
case AppleDRISurfaceNotifyChanged:
if (surface_hash != NULL) {
lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(arg->id), NULL);
for (; lst != NULL; lst = lst->next)
- {
+ {
context = lst->data;
xp_update_gl_context(context->ctx);
}
}
break;
- default:
- ErrorF("surface_notify: unknown kind %d\n", arg->kind);
- break;
+ default:
+ ErrorF("surface_notify: unknown kind %d\n", arg->kind);
+ break;
}
}
@@ -316,7 +289,7 @@ static BOOL attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) {
pDraw = draw->base.pDraw;
if(NULL == pDraw) {
- ErrorF("%s:attach() pDraw is NULL!\n", __FILE__);
+ ErrorF("%s:%s() pDraw is NULL!\n", __FILE__, __func__);
return TRUE;
}
@@ -355,10 +328,14 @@ static BOOL attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) {
x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid), lst);
}
+
+
GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id,
(unsigned int) draw->sid);
}
+ draw->context = context;
+
return FALSE;
}
@@ -434,27 +411,31 @@ static int __glXAquaContextForceCurrent(__GLXcontext *baseContext)
/* Drawing surface notification callbacks */
-static GLboolean __glXAquaDrawableResize(__GLXdrawable *base) {
- GLAQUA_DEBUG_MSG("unimplemented glAquaDrawableResize\n");
- return GL_TRUE;
-}
-
static GLboolean __glXAquaDrawableSwapBuffers(__GLXdrawable *base) {
- CGLError gl_err;
- __GLXAquaContext * drawableCtx;
+ CGLError err;
+ __GLXAquaDrawable *drawable;
+
// GLAQUA_DEBUG_MSG("glAquaDrawableSwapBuffers(%p)\n",base);
if(!base) {
- ErrorF("glXAquaDrawbleSwapBuffers passed NULL\n");
+ ErrorF("%s passed NULL\n", __func__);
return GL_FALSE;
}
- drawableCtx = (__GLXAquaContext *)base->drawGlxc;
-
- if (drawableCtx != NULL && drawableCtx->ctx != NULL) {
- gl_err = CGLFlushDrawable(drawableCtx->ctx);
- if (gl_err != 0)
- ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err));
+ drawable = (__GLXAquaDrawable *)base;
+
+ if(NULL == drawable->context) {
+ ErrorF("%s called with a NULL->context for drawable %p!\n",
+ __func__, (void *)drawable);
+ return GL_FALSE;
+ }
+
+ err = CGLFlushDrawable(drawable->context->ctx);
+
+ if(kCGLNoError != err) {
+ ErrorF("CGLFlushDrawable error: %s in %s\n", CGLErrorString(err),
+ __func__);
+ return GL_FALSE;
}
return GL_TRUE;
@@ -518,482 +499,6 @@ static CGLPixelFormatObj makeFormat(__GLXconfig *conf) {
return fobj;
}
-// Originally copied from Mesa
-
-static int numConfigs = 0;
-static __GLXvisualConfig *visualConfigs = NULL;
-static void **visualPrivates = NULL;
-
-/*
- * In the case the driver defines no GLX visuals we'll use these.
- * Note that for TrueColor and DirectColor visuals, bufferSize is the
- * sum of redSize, greenSize, blueSize and alphaSize, which may be larger
- * than the nplanes/rootDepth of the server's X11 visuals
- */
-#define NUM_FALLBACK_CONFIGS 5
-static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = {
- /* [0] = RGB, double buffered, Z */
- {
- -1, /* vid */
- -1, /* class */
- True, /* rgba */
- -1, -1, -1, 0, /* rgba sizes */
- -1, -1, -1, 0, /* rgba masks */
- 0, 0, 0, 0, /* rgba accum sizes */
- True, /* doubleBuffer */
- False, /* stereo */
- -1, /* bufferSize */
- 16, /* depthSize */
- 0, /* stencilSize */
- 0, /* auxBuffers */
- 0, /* level */
- GLX_NONE, /* visualRating */
- GLX_NONE, /* transparentPixel */
- 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
- 0 /* transparentIndex */
- },
- /* [1] = RGB, double buffered, Z, stencil, accum */
- {
- -1, /* vid */
- -1, /* class */
- True, /* rgba */
- -1, -1, -1, 0, /* rgba sizes */
- -1, -1, -1, 0, /* rgba masks */
- 16, 16, 16, 0, /* rgba accum sizes */
- True, /* doubleBuffer */
- False, /* stereo */
- -1, /* bufferSize */
- 16, /* depthSize */
- 8, /* stencilSize */
- 0, /* auxBuffers */
- 0, /* level */
- GLX_NONE, /* visualRating */
- GLX_NONE, /* transparentPixel */
- 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
- 0 /* transparentIndex */
- },
- /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */
- {
- -1, /* vid */
- -1, /* class */
- True, /* rgba */
- -1, -1, -1, 8, /* rgba sizes */
- -1, -1, -1, -1, /* rgba masks */
- 16, 16, 16, 16, /* rgba accum sizes */
- True, /* doubleBuffer */
- False, /* stereo */
- -1, /* bufferSize */
- 16, /* depthSize */
- 8, /* stencilSize */
- 0, /* auxBuffers */
- 0, /* level */
- GLX_NONE, /* visualRating */
- GLX_NONE, /* transparentPixel */
- 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
- 0 /* transparentIndex */
- },
- /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */
- {
- -1, /* vid */
- -1, /* class */
- True, /* rgba */
- -1, -1, -1, 8, /* rgba sizes */
- -1, -1, -1, -1, /* rgba masks */
- 16, 16, 16, 16, /* rgba accum sizes */
- False, /* doubleBuffer */
- False, /* stereo */
- -1, /* bufferSize */
- 16, /* depthSize */
- 8, /* stencilSize */
- 0, /* auxBuffers */
- 0, /* level */
- GLX_NONE, /* visualRating */
- GLX_NONE, /* transparentPixel */
- 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
- 0 /* transparentIndex */
- },
- /* [4] = CI, double buffered, Z */
- {
- -1, /* vid */
- -1, /* class */
- False, /* rgba? (false = color index) */
- -1, -1, -1, 0, /* rgba sizes */
- -1, -1, -1, 0, /* rgba masks */
- 0, 0, 0, 0, /* rgba accum sizes */
- True, /* doubleBuffer */
- False, /* stereo */
- -1, /* bufferSize */
- 16, /* depthSize */
- 0, /* stencilSize */
- 0, /* auxBuffers */
- 0, /* level */
- GLX_NONE, /* visualRating */
- GLX_NONE, /* transparentPixel */
- 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
- 0 /* transparentIndex */
- },
-};
-
-static __GLXvisualConfig NullConfig = {
- -1, /* vid */
- -1, /* class */
- False, /* rgba */
- -1, -1, -1, 0, /* rgba sizes */
- -1, -1, -1, 0, /* rgba masks */
- 0, 0, 0, 0, /* rgba accum sizes */
- False, /* doubleBuffer */
- False, /* stereo */
- -1, /* bufferSize */
- 16, /* depthSize */
- 0, /* stencilSize */
- 0, /* auxBuffers */
- 0, /* level */
- GLX_NONE_EXT, /* visualRating */
- 0, /* transparentPixel */
- 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
- 0 /* transparentIndex */
-};
-
-
-static inline int count_bits(uint32_t x)
-{
- x = x - ((x >> 1) & 0x55555555);
- x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
- x = (x + (x >> 4)) & 0x0f0f0f0f;
- x = x + (x >> 8);
- x = x + (x >> 16);
- return x & 63;
-}
-
-
-static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
- VisualID *defaultVisp,
- int ndepth, DepthPtr pdepth,
- int rootDepth)
-{
-#if 0
- int numRGBconfigs;
- int numCIconfigs;
- int numVisuals = *nvisualp;
- int numNewVisuals;
- int numNewConfigs;
- VisualPtr pVisual = *visualp;
- VisualPtr pVisualNew = NULL;
- VisualID *orig_vid = NULL;
- __GLcontextModes *modes;
- __GLXvisualConfig *pNewVisualConfigs = NULL;
- void **glXVisualPriv;
- void **pNewVisualPriv;
- int found_default;
- int i, j, k;
-
- GLAQUA_DEBUG_MSG("init_visuals\n");
-
- if (numConfigs > 0)
- numNewConfigs = numConfigs;
- else
- numNewConfigs = NUM_FALLBACK_CONFIGS;
-
- /* Alloc space for the list of new GLX visuals */
- pNewVisualConfigs = (__GLXvisualConfig *)
- malloc(numNewConfigs * sizeof(__GLXvisualConfig));
- if (!pNewVisualConfigs) {
- return FALSE;
- }
-
- /* Alloc space for the list of new GLX visual privates */
- pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *));
- if (!pNewVisualPriv) {
- free(pNewVisualConfigs);
- return FALSE;
- }
-
- /*
- ** If SetVisualConfigs was not called, then use default GLX
- ** visual configs.
- */
- if (numConfigs == 0) {
- memcpy(pNewVisualConfigs, FallbackConfigs,
- NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig));
- memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *));
- }
- else {
- /* copy driver's visual config info */
- for (i = 0; i < numConfigs; i++) {
- pNewVisualConfigs[i] = visualConfigs[i];
- pNewVisualPriv[i] = visualPrivates[i];
- }
- }
-
- /* Count the number of RGB and CI visual configs */
- numRGBconfigs = 0;
- numCIconfigs = 0;
- for (i = 0; i < numNewConfigs; i++) {
- if (pNewVisualConfigs[i].rgba)
- numRGBconfigs++;
- else
- numCIconfigs++;
- }
-
- /* Count the total number of visuals to compute */
- numNewVisuals = 0;
- for (i = 0; i < numVisuals; i++) {
- int count;
-
- count = ((pVisual[i].class == TrueColor ||
- pVisual[i].class == DirectColor)
- ? numRGBconfigs : numCIconfigs);
- if (count == 0)
- count = 1; /* preserve the existing visual */
-
- numNewVisuals += count;
- }
-
- /* Reset variables for use with the next screen/driver's visual configs */
- visualConfigs = NULL;
- numConfigs = 0;
-
- /* Alloc temp space for the list of orig VisualIDs for each new visual */
- orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID));
- if (!orig_vid) {
- free(pNewVisualPriv);
- free(pNewVisualConfigs);
- return FALSE;
- }
-
- /* Alloc space for the list of glXVisuals */
- modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes));
- if (modes == NULL) {
- free(orig_vid);
- free(pNewVisualPriv);
- free(pNewVisualConfigs);
- return FALSE;
- }
-
- /* Alloc space for the list of glXVisualPrivates */
- glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *));
- if (!glXVisualPriv) {
- _gl_context_modes_destroy( modes );
- free(orig_vid);
- free(pNewVisualPriv);
- free(pNewVisualConfigs);
- return FALSE;
- }
-
- /* Alloc space for the new list of the X server's visuals */
- pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec));
- if (!pVisualNew) {
- free(glXVisualPriv);
- _gl_context_modes_destroy( modes );
- free(orig_vid);
- free(pNewVisualPriv);
- free(pNewVisualConfigs);
- return FALSE;
- }
-
- /* Initialize the new visuals */
- found_default = FALSE;
- glAquaScreens[screenInfo.numScreens-1].modes = modes;
- for (i = j = 0; i < numVisuals; i++) {
- int is_rgb = (pVisual[i].class == TrueColor ||
- pVisual[i].class == DirectColor);
-
- if (!is_rgb)
- {
- /* We don't support non-rgb visuals for GL. But we don't
- want to remove them either, so just pass them through
- with null glX configs */
-
- pVisualNew[j] = pVisual[i];
- pVisualNew[j].vid = FakeClientID(0);
-
- /* Check for the default visual */
- if (!found_default && pVisual[i].vid == *defaultVisp) {
- *defaultVisp = pVisualNew[j].vid;
- found_default = TRUE;
- }
-
- /* Save the old VisualID */
- orig_vid[j] = pVisual[i].vid;
-
- /* Initialize the glXVisual */
- _gl_copy_visual_to_context_mode( modes, & NullConfig );
- modes->visualID = pVisualNew[j].vid;
-
- j++;
-
- continue;
- }
-
- for (k = 0; k < numNewConfigs; k++) {
- if (pNewVisualConfigs[k].rgba != is_rgb)
- continue;
-
- assert( modes != NULL );
-
- /* Initialize the new visual */
- pVisualNew[j] = pVisual[i];
- pVisualNew[j].vid = FakeClientID(0);
-
- /* Check for the default visual */
- if (!found_default && pVisual[i].vid == *defaultVisp) {
- *defaultVisp = pVisualNew[j].vid;
- found_default = TRUE;
- }
-
- /* Save the old VisualID */
- orig_vid[j] = pVisual[i].vid;
-
- /* Initialize the glXVisual */
- _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] );
- modes->visualID = pVisualNew[j].vid;
-
- /*
- * If the class is -1, then assume the X visual information
- * is identical to what GLX needs, and take them from the X
- * visual. NOTE: if class != -1, then all other fields MUST
- * be initialized.
- */
- if (modes->visualType == GLX_NONE) {
- modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class );
- modes->redBits = count_bits(pVisual[i].redMask);
- modes->greenBits = count_bits(pVisual[i].greenMask);
- modes->blueBits = count_bits(pVisual[i].blueMask);
- modes->alphaBits = modes->alphaBits;
- modes->redMask = pVisual[i].redMask;
- modes->greenMask = pVisual[i].greenMask;
- modes->blueMask = pVisual[i].blueMask;
- modes->alphaMask = modes->alphaMask;
- modes->rgbBits = (is_rgb)
- ? (modes->redBits + modes->greenBits +
- modes->blueBits + modes->alphaBits)
- : rootDepth;
- }
-
- /* Save the device-dependent private for this visual */
- glXVisualPriv[j] = pNewVisualPriv[k];
-
- j++;
- modes = modes->next;
- }
- }
-
- assert(j <= numNewVisuals);
-
- /* Save the GLX visuals in the screen structure */
- glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals;
- // glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv;
-
- /* set up depth's VisualIDs */
- for (i = 0; i < ndepth; i++) {
- int numVids = 0;
- VisualID *pVids = NULL;
- int k, n = 0;
-
- /* Count the new number of VisualIDs at this depth */
- for (j = 0; j < pdepth[i].numVids; j++)
- for (k = 0; k < numNewVisuals; k++)
- if (pdepth[i].vids[j] == orig_vid[k])
- numVids++;
-
- /* Allocate a new list of VisualIDs for this depth */
- pVids = (VisualID *)malloc(numVids * sizeof(VisualID));
-
- /* Initialize the new list of VisualIDs for this depth */
- for (j = 0; j < pdepth[i].numVids; j++)
- for (k = 0; k < numNewVisuals; k++)
- if (pdepth[i].vids[j] == orig_vid[k])
- pVids[n++] = pVisualNew[k].vid;
-
- /* Update this depth's list of VisualIDs */
- free(pdepth[i].vids);
- pdepth[i].vids = pVids;
- pdepth[i].numVids = numVids;
- }
-
- /* Update the X server's visuals */
- *nvisualp = numNewVisuals;
- *visualp = pVisualNew;
-
- /* Free the old list of the X server's visuals */
- free(pVisual);
-
- /* Clean up temporary allocations */
- free(orig_vid);
- free(pNewVisualPriv);
- free(pNewVisualConfigs);
-
- /* Free the private list created by DDX HW driver */
- if (visualPrivates)
- free(visualPrivates);
- visualPrivates = NULL;
-
- return TRUE;
-#endif
- return FALSE;
-}
-
-static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
- void **privates)
-{
-#if 0
- GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n");
-
- numConfigs = nconfigs;
- visualConfigs = configs;
- visualPrivates = privates;
-#endif
-}
-
-
-static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
- int *nvisualp, int *ndepthp,
- int *rootDepthp, VisualID *defaultVisp,
- unsigned long sizes, int bitsPerRGB)
-{
- GLAQUA_DEBUG_MSG("glAquaInitVisuals\n");
-
- /*
- * setup the visuals supported by this particular screen.
- */
- return init_visuals(nvisualp, visualp, defaultVisp,
- *ndepthp, *depthp, *rootDepthp);
-}
-
-#if 0
-static void fixup_visuals(int screen)
-{
- ScreenPtr pScreen = screenInfo.screens[screen];
- glAquaScreenRec *pScr = &glAquaScreens[screen];
- int j;
- __GLcontextModes *modes;
-
- GLAQUA_DEBUG_MSG("fixup_visuals\n");
-
- for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) {
- const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
- const int nplanes = (modes->rgbBits - modes->alphaBits);
- const VisualPtr pVis = pScreen->visuals;
-
- /* Find a visual that matches the GLX visual's class and size */
- for (j = 0; j < pScreen->numVisuals; j++) {
- if (pVis[j].class == vis_class &&
- pVis[j].nplanes == nplanes) {
-
- /* Fixup the masks */
- modes->redMask = pVis[j].redMask;
- modes->greenMask = pVis[j].greenMask;
- modes->blueMask = pVis[j].blueMask;
-
- /* Recalc the sizes */
- modes->redBits = count_bits(modes->redMask);
- modes->greenBits = count_bits(modes->greenMask);
- modes->blueBits = count_bits(modes->blueMask);
- }
- }
- }
-}
-#endif
static void __glXAquaScreenDestroy(__GLXscreen *screen) {
GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen);
@@ -1210,10 +715,6 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
screen->base.fbconfigs = CreateConfigs(&screen->base.numFBConfigs,
pScreen->myNum);
- /* This seems odd, but visuals is a __GLXconfig too. */
- screen->base.visuals = screen->base.fbconfigs;
- screen->base.numVisuals = screen->base.numFBConfigs;
-
GlxSetVisualConfig(GLX_ALL_VISUALS);
__glXScreenInit(&screen->base, pScreen);
@@ -1271,8 +772,6 @@ __glXAquaScreenCreateDrawable(__GLXscreen *screen,
__GLXconfig *conf) {
__GLXAquaDrawable *glxPriv;
- GLAQUA_DEBUG_MSG("glAquaScreenCreateDrawable(%p,%p,%d,%p)\n", context, pDraw, drawId, modes);
-
glxPriv = xalloc(sizeof *glxPriv);
if(glxPriv == NULL)
@@ -1286,19 +785,16 @@ __glXAquaScreenCreateDrawable(__GLXscreen *screen,
}
glxPriv->base.destroy = __glXAquaDrawableDestroy;
- glxPriv->base.resize = __glXAquaDrawableResize;
glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers;
glxPriv->base.copySubBuffer = NULL; /* __glXAquaDrawableCopySubBuffer; */
+ glxPriv->pDraw = pDraw;
+ glxPriv->sid = 0;
+ glxPriv->context = NULL;
+
return &glxPriv->base;
}
-static void glAquaResetExtension(void)
-{
- GLAQUA_DEBUG_MSG("glAquaResetExtension\n");
- CGLSetOption(kCGLGOResetLibrary, GL_TRUE);
-}
-
// Extra goodies for glx
GLuint __glFloorLog2(GLuint val)
commit ee9736b26b1021fac2cf259e6b2142ea780b2af8
Author: George Staplin <gstaplin at apple.com>
Date: Fri Jan 9 16:08:26 2009 -0700
XQuartz: GL: Set the __GLXconfig renderType to GLX_RGBA_BIT.
(cherry picked from commit 3c14546f58f8a138fe67c9cacc3bd0b7fa90c29a)
(cherry picked from commit a665ed16f736cf1901b89448dc5d37f4d16dfaf4)
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index fbf13ce..afaa957 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -1137,7 +1137,7 @@ static __GLXconfig *CreateConfigs(int *numConfigsPtr, int screenNumber) {
/* SGIX_fbconfig / GLX 1.3 */
c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
- c->renderType = /*FIXME*/ GL_TRUE;
+ c->renderType = GLX_RGBA_BIT;
c->xRenderable = GL_TRUE;
c->fbconfigID = -1;
commit b646513861aac9538ba3ebd8e2c7ef530392ff5d
Author: George Staplin <gstaplin at apple.com>
Date: Fri Jan 9 15:53:39 2009 -0700
XQuartz: GL: Make many more fbconfigs and visuals available for the 1.5 branch.
Use a __GLXconfig linked list struct to store the configurations for the
fbconfigs and visuals in a pGlxScreen.
Also, remove the __GLXvisualConfig/GlxSetVisualConfigs code that isn't used
anymore. There is more code we can remove later, but I want to do that in
separate commits.
(cherry picked from commit 94162b0f8a25267aca280d25e216cc6bde47da6e)
(cherry picked from commit 15bb6abd59fdefe7037237faaea1a39711a972ed)
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 32b9dd4..fbf13ce 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -1,8 +1,8 @@
/*
* GLX implementation that uses Apple's OpenGL.framework
- * (Indirect rendering path)
+ * (Indirect rendering path -- it's also used for some direct mode code too)
*
- * Copyright (c) 2007 Apple Inc.
+ * Copyright (c) 2007, 2008, 2009 Apple Inc.
* Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved.
* Copyright (c) 2002 Greg Parker. All Rights Reserved.
*
@@ -76,6 +76,8 @@
#include "x-hash.h"
#include "x-list.h"
+#include "capabilities.h"
+
#include <dispatch.h>
#define GLAPIENTRYP *
typedef unsigned long long GLuint64EXT;
@@ -212,6 +214,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
return &context->base;
}
+/* Nothing seems to use these anymore... */
static __GLXextensionInfo __glDDXExtensionInfo = {
GL_CORE_APPLE,
glAquaResetExtension,
@@ -930,100 +933,6 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
return FALSE;
}
-Bool enable_stereo = FALSE;
-/* based on code in i830_dri.c
- This ends calling glAquaSetVisualConfigs to set the static
- numconfigs, etc. */
-static void
-glAquaInitVisualConfigs(void)
-{
-#if 0
- int lclNumConfigs = 0;
- __GLXvisualConfig *lclVisualConfigs = NULL;
- void **lclVisualPrivates = NULL;
-
- int stereo, depth, aux, buffers, stencil, accum;
- int i = 0;
-
- GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs ");
-
- /* count num configs:
- 2 stereo (on, off) (optional)
- 2 Z buffer (0, 24 bit)
- 2 AUX buffer (0, 2)
- 2 buffers (single, double)
- 2 stencil (0, 8 bit)
- 2 accum (0, 64 bit)
- = 64 configs with stereo, or 32 without */
-
- if (enable_stereo) lclNumConfigs = 2 * 2 * 2 * 2 * 2 * 2; /* 64 */
- else lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */
-
- /* alloc */
- lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs);
- lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs);
-
- /* fill in configs */
- if (NULL != lclVisualConfigs) {
- i = 0; /* current buffer */
- for (stereo = 0; stereo < (enable_stereo ? 2 : 1); stereo++) {
- for (depth = 0; depth < 2; depth++) {
- for (aux = 0; aux < 2; aux++) {
- for (buffers = 0; buffers < 2; buffers++) {
- for (stencil = 0; stencil < 2; stencil++) {
- for (accum = 0; accum < 2; accum++) {
- lclVisualConfigs[i].vid = -1;
- lclVisualConfigs[i].class = -1;
- lclVisualConfigs[i].rgba = TRUE;
- lclVisualConfigs[i].redSize = -1;
- lclVisualConfigs[i].greenSize = -1;
- lclVisualConfigs[i].blueSize = -1;
- lclVisualConfigs[i].redMask = -1;
- lclVisualConfigs[i].greenMask = -1;
- lclVisualConfigs[i].blueMask = -1;
- lclVisualConfigs[i].alphaMask = 0;
- if (accum) {
- lclVisualConfigs[i].accumRedSize = 16;
- lclVisualConfigs[i].accumGreenSize = 16;
- lclVisualConfigs[i].accumBlueSize = 16;
- lclVisualConfigs[i].accumAlphaSize = 16;
- } else {
- lclVisualConfigs[i].accumRedSize = 0;
- lclVisualConfigs[i].accumGreenSize = 0;
- lclVisualConfigs[i].accumBlueSize = 0;
- lclVisualConfigs[i].accumAlphaSize = 0;
- }
- lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE;
- lclVisualConfigs[i].stereo = stereo ? TRUE : FALSE;
- lclVisualConfigs[i].bufferSize = -1;
-
- lclVisualConfigs[i].depthSize = depth? 24 : 0;
- lclVisualConfigs[i].stencilSize = stencil ? 8 : 0;
- lclVisualConfigs[i].auxBuffers = aux ? 2 : 0;
- lclVisualConfigs[i].level = 0;
- lclVisualConfigs[i].visualRating = GLX_NONE_EXT;
- lclVisualConfigs[i].transparentPixel = 0;
- lclVisualConfigs[i].transparentRed = 0;
- lclVisualConfigs[i].transparentGreen = 0;
- lclVisualConfigs[i].transparentBlue = 0;
- lclVisualConfigs[i].transparentAlpha = 0;
- lclVisualConfigs[i].transparentIndex = 0;
- i++;
- }
- }
- }
- }
- }
- }
- }
- if (i != lclNumConfigs)
- GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs");
-
- GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates);
-#endif
-}
-
-
static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
void **privates)
{
@@ -1044,9 +953,6 @@ static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
{
GLAQUA_DEBUG_MSG("glAquaInitVisuals\n");
- if (numConfigs == 0) /* if no configs */
- glAquaInitVisualConfigs(); /* ensure the visual configs are setup */
-
/*
* setup the visuals supported by this particular screen.
*/
@@ -1096,157 +1002,193 @@ static void __glXAquaScreenDestroy(__GLXscreen *screen) {
xfree(screen);
}
-static void init_screen_visuals(__GLXAquaScreen *screen) {
-#if 0
- ScreenPtr pScreen = screen->base.pScreen;
- __GLcontextModes *modes;
- int *used;
- int i, j;
-
- GLAQUA_DEBUG_MSG("init_screen_visuals\n");
+static __GLXconfig *CreateConfigs(int *numConfigsPtr, int screenNumber) {
+ __GLXconfig *c, *result;
+ struct glCapabilities cap;
+ struct glCapabilitiesConfig *conf = NULL;
+ int numConfigs = 0;
+ int i;
- /* FIXME: Change 'used' to be a array of bits (rather than of ints),
- * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less
- * FIXME: than 64 or 128 the stack array can be used instead of calling
- * FIXME: malloc / free. If nothing else, convert 'used' to
- * FIXME: array of bytes instead of ints!
- */
- used = (int *)malloc(pScreen->numVisuals * sizeof(int));
- memset(used, 0, pScreen->numVisuals * sizeof(int));
+ if(getGlCapabilities(&cap))
+ FatalError("error from getGlCapabilities() in %s\n", __func__);
- i = 0;
- for ( modes = screen -> base.modes
- ; modes != NULL
- ; modes = modes->next ) {
- const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
- const int nplanes = (modes->rgbBits - modes->alphaBits);
- const VisualPtr pVis = pScreen->visuals;
+ assert(NULL != cap.configurations);
- for (j = 0; j < pScreen->numVisuals; j++) {
- if (pVis[j].class == vis_class &&
- pVis[j].nplanes == nplanes &&
- pVis[j].redMask == modes->redMask &&
- pVis[j].greenMask == modes->greenMask &&
- pVis[j].blueMask == modes->blueMask &&
- !used[j]) {
-
- /* set the VisualID */
- modes->visualID = pVis[j].vid;
-
- /* Mark this visual used */
- used[j] = 1;
- break;
- }
- }
- if ( j == pScreen->numVisuals ) {
- ErrorF("No matching visual for __GLcontextMode with "
- "visual class = %d (%d), nplanes = %u\n",
- vis_class,
- (int)modes->visualType,
- (unsigned int)(modes->rgbBits - modes->alphaBits) );
- }
- else if ( modes->visualID == -1 ) {
- FatalError( "Matching visual found, but visualID still -1!\n" );
- }
+ for(conf = cap.configurations; conf; conf = conf->next) {
+ if(conf->total_color_buffers <= 0)
+ continue;
- i++;
+ numConfigs += (conf->stereo ? 2 : 1)
+ * (conf->aux_buffers ? 2 : 1)
+ * conf->buffers
+ * ((conf->total_stencil_bit_depths > 0) ?
+ conf->total_stencil_bit_depths : 1)
+ * conf->total_color_buffers
+ * ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1)
+ * conf->total_depth_buffer_depths
+ * (conf->multisample_buffers + 1);
}
- free(used);
-#endif
-}
-
-/* This will eventually need to use the capabilities.c code.
- * We can probably update the visualConfigs.c code to work with __GLXconfig.
- */
-static __GLXconfig *createConfigs(void) {
- __GLXconfig *conf;
-
- conf = xalloc(sizeof *conf);
+ *numConfigsPtr = numConfigs;
+
+ c = xalloc(sizeof(*c) * numConfigs);
- if(NULL == conf)
+ if(NULL == c)
return NULL;
- conf->next = NULL;
- conf->doubleBufferMode = GL_TRUE;
- conf->stereoMode = GL_FALSE;
- conf->redBits = 8;
- conf->greenBits = 8;
- conf->blueBits = 8;
- conf->alphaBits = 0;
-
- conf->redMask = -1;
- conf->greenMask = -1;
- conf->blueMask = -1;
- conf->alphaMask = -1;
-
- conf->rgbBits = conf->redBits + conf->greenBits + conf->blueBits + conf->alphaBits;
- conf->indexBits = 0;
-
- conf->accumRedBits = 0;
- conf->accumGreenBits = 0;
- conf->accumBlueBits = 0;
- conf->accumAlphaBits = 0;
- conf->depthBits = 24;
- conf->stencilBits = 0;
-
- conf->numAuxBuffers = 0;
+ result = c;
- conf->level = 0;
+ memset(result, 0, sizeof(*c) * numConfigs);
- conf->pixmapMode = 0;
-
- conf->visualID = -1;
- conf->visualType = GLX_TRUE_COLOR;
- conf->visualRating = 0;
-
- conf->transparentPixel = 0;
- conf->transparentRed = 0;
- conf->transparentGreen = 0;
- conf->transparentAlpha = 0;
- conf->transparentIndex = 0;
+ i = 0;
+
+ for(conf = cap.configurations; conf; conf = conf->next) {
+ int stereo, aux, buffers, stencil, color, accum, depth, msample;
+
+ for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
+ for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
+ for(buffers = 0; buffers < conf->buffers; ++buffers) {
+ for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ?
+ conf->total_stencil_bit_depths : 1); ++stencil) {
+ for(color = 0; color < conf->total_color_buffers; ++color) {
+ for(accum = 0; accum < ((conf->total_accum_buffers > 0) ?
+ conf->total_accum_buffers : 1); ++accum) {
+ for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) {
+ for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) {
+ if((i + 1) < numConfigs) {
+ c->next = c + 1;
+ } else {
+ c->next = NULL;
+ }
+
+ c->doubleBufferMode = buffers ? GL_TRUE : GL_FALSE;
+ c->stereoMode = stereo ? GL_TRUE : GL_FALSE;
+
+ c->redBits = conf->color_buffers[color].r;
+ c->greenBits = conf->color_buffers[color].g;
+ c->blueBits = conf->color_buffers[color].b;
+ c->alphaBits = 0;
+
+ if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) {
+ c->alphaBits = conf->color_buffers[color].a;
+ }
+
+ c->redMask = -1;
+ c->greenMask = -1;
+ c->blueMask = -1;
+ c->alphaMask = -1;
+
+ c->rgbBits = c->redBits + c->greenBits + c->blueBits + c->alphaBits;
+ c->indexBits = 0;
+
+ c->accumRedBits = 0;
+ c->accumGreenBits = 0;
+ c->accumBlueBits = 0;
+ c->accumAlphaBits = 0;
+
+ if(conf->total_accum_buffers > 0) {
+ c->accumRedBits = conf->accum_buffers[accum].r;
+ c->accumGreenBits = conf->accum_buffers[accum].g;
+ c->accumBlueBits = conf->accum_buffers[accum].b;
+ if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
+ c->accumAlphaBits = conf->accum_buffers[accum].a;
+ }
+ }
+
+ c->depthBits = conf->depth_buffers[depth];
+
+ c->stencilBits = 0;
+
+ if(conf->total_stencil_bit_depths > 0) {
+ c->stencilBits = conf->stencil_bit_depths[stencil];
+ }
+
+
+ c->numAuxBuffers = aux ? conf->aux_buffers : 0;
+
+ c->level = 0;
+ /*TODO what should this be? */
+ c->pixmapMode = 0;
+
+ c->visualID = -1;
+ c->visualType = GLX_TRUE_COLOR;
+
+ if(conf->accelerated) {
+ c->visualRating = GLX_NONE;
+ } else {
+ c->visualRating = GLX_SLOW_VISUAL_EXT;
+ }
+
+ c->transparentPixel = GLX_NONE;
+ c->transparentRed = GLX_NONE;
+ c->transparentGreen = GLX_NONE;
+ c->transparentAlpha = GLX_NONE;
+ c->transparentIndex = GLX_NONE;
+
+ c->sampleBuffers = 0;
+ c->samples = 0;
+
+ if(msample > 0) {
+ c->sampleBuffers = conf->multisample_buffers;
+ c->samples = conf->multisample_samples;
+ }
+
+ /* SGIX_fbconfig / GLX 1.3 */
+ c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+ c->renderType = /*FIXME*/ GL_TRUE;
+ c->xRenderable = GL_TRUE;
+ c->fbconfigID = -1;
+
+ /*TODO add querying code to capabilities.c for the Pbuffer maximums.
+ *I'm not sure we can even use CGL for Pbuffers yet...
+ */
+ /* SGIX_pbuffer / GLX 1.3 */
+ c->maxPbufferWidth = 0;
+ c->maxPbufferHeight = 0;
+ c->maxPbufferPixels = 0;
+ c->optimalPbufferWidth = 0;
+ c->optimalPbufferHeight = 0;
+ c->visualSelectGroup = 0;
+
+ c->swapMethod = GLX_SWAP_UNDEFINED_OML;
+
+ c->screen = screenNumber;
+
+ /* EXT_texture_from_pixmap */
+ c->bindToTextureRgb = 0;
+ c->bindToTextureRgba = 0;
+ c->bindToMipmapTexture = 0;
+ c->bindToTextureTargets = 0;
+ c->yInverted = 0;
+
+ if(c->next)
+ c = c->next;
+
+ ++i;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(i != numConfigs)
+ FatalError("The number of __GLXconfig generated does not match the initial calculation!\n");
- conf->sampleBuffers = 0;
- conf->samples = 0;
-
- /* SGIX_fbconfig / GLX 1.3 */
- conf->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
- conf->renderType = GL_TRUE;
- conf->xRenderable = GL_TRUE;
- conf->fbconfigID = -1;
-
- /*TODO add querying code to capabilities.c for the Pbuffer maximums. */
- /* SGIX_pbuffer / GLX 1.3 */
- conf->maxPbufferWidth = 0;
- conf->maxPbufferHeight = 0;
- conf->maxPbufferPixels = 0;
- conf->optimalPbufferWidth = 0;
- conf->optimalPbufferHeight = 0;
-
- conf->visualSelectGroup = 0;
-
- conf->swapMethod = GLX_SWAP_UNDEFINED_OML;
-
- /* FIXME */
- conf->screen = 0;
-
- /* EXT_texture_from_pixmap */
- conf->bindToTextureRgb = 0;
- conf->bindToTextureRgba = 0;
- conf->bindToMipmapTexture = 0;
- conf->bindToTextureTargets = 0;
- conf->yInverted = 0;
-
- return conf;
-}
+ freeGlCapabilities(&cap);
+
+ return result;
+}
/* This is called by __glXInitScreens(). */
static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
__GLXAquaScreen *screen;
- __GLXconfig *configs;
GLAQUA_DEBUG_MSG("glXAquaScreenProbe\n");
@@ -1265,41 +1207,28 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
screen->base.swapBarrierFuncs = NULL;
screen->base.pScreen = pScreen;
- configs = createConfigs();
-
- screen->base.fbconfigs = configs;
- screen->base.numFBConfigs = 1;
-
- screen->base.visuals = NULL;
- screen->base.numVisuals = 0;
-
+ screen->base.fbconfigs = CreateConfigs(&screen->base.numFBConfigs,
+ pScreen->myNum);
+
+ /* This seems odd, but visuals is a __GLXconfig too. */
+ screen->base.visuals = screen->base.fbconfigs;
+ screen->base.numVisuals = screen->base.numFBConfigs;
+
GlxSetVisualConfig(GLX_ALL_VISUALS);
__glXScreenInit(&screen->base, pScreen);
/* __glXScreenInit initializes these, so the order here is important, if we need these... */
- screen->base.GLextensions = "";
- screen->base.GLXvendor = "Apple";
- screen->base.GLXversion = "1.4";
- screen->base.GLXextensions = "GLX_SGIX_fbconfig "
- "GLX_SGIS_multisample "
- "GLX_ARB_multisample "
- "GLX_EXT_visual_info "
- "GLX_EXT_import_context "
- "GLX_EXT_texture_from_pixmap ";
- /*We may be able to add more GLXextensions at a later time. */
+ // screen->base.GLextensions = "";
+ // screen->base.GLXvendor = "Apple";
+ screen->base.GLXversion = xstrdup("1.4");
+ screen->base.GLXextensions = xstrdup("GLX_SGIX_fbconfig "
+ "GLX_SGIS_multisample "
+ "GLX_ARB_multisample "
+ "GLX_EXT_visual_info "
+ "GLX_EXT_import_context ");
-
- /*
- * These are both commented out, because they cause problems with
- * the other visual config code, and visuals.
- * This probe function is called normally on startup in direct
- * mode too.
- * They don't seem to be needed now that we have better visual
- * setup.
- */
- //init_screen_visuals(screen);
- //glAquaInitVisualConfigs();
+ /*We may be able to add more GLXextensions at a later time. */
return &screen->base;
}
@@ -1359,7 +1288,7 @@ __glXAquaScreenCreateDrawable(__GLXscreen *screen,
glxPriv->base.destroy = __glXAquaDrawableDestroy;
glxPriv->base.resize = __glXAquaDrawableResize;
glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers;
- glxPriv->base.copySubBuffer = __glXAquaDrawableCopySubBuffer;
+ glxPriv->base.copySubBuffer = NULL; /* __glXAquaDrawableCopySubBuffer; */
return &glxPriv->base;
}
commit 9e03178ae2da6beb939141f662d875c4c1d40354
Author: Michel Dänzer <daenzer at vmware.com>
Date: Tue Jan 13 13:05:32 2009 +0100
EXA: Declare glyph cache picture as component-alpha when necessary.
Without this, rendering component-alpha glyphs may break without a mask.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=19233 .
(cherry picked from commit 639f289dcdbe00a516820f573c01a8339e120ed4)
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index 169763f..688081d 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -140,6 +140,8 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen,
}
}
+#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
+
/* All caches for a single format share a single pixmap for glyph storage,
* allowing mixing glyphs of different sizes without paying a penalty
* for switching between source pixmaps. (Note that for a size of font
@@ -159,6 +161,7 @@ exaRealizeGlyphCaches(ScreenPtr pScreen,
PictFormatPtr pPictFormat;
PixmapPtr pPixmap;
PicturePtr pPicture;
+ CARD32 component_alpha;
int height;
int i;
int error;
@@ -191,8 +194,10 @@ exaRealizeGlyphCaches(ScreenPtr pScreen,
if (!pPixmap)
return FALSE;
+ component_alpha = NeedsComponent(pPictFormat->format);
pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat,
- 0, 0, serverClient, &error);
+ CPComponentAlpha, &component_alpha, serverClient,
+ &error);
(*pScreen->DestroyPixmap) (pPixmap); /* picture holds a refcount */
@@ -741,8 +746,6 @@ exaGlyphsIntersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs)
return FALSE;
}
-#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
-
void
exaGlyphs (CARD8 op,
PicturePtr pSrc,
commit 648807adb059b6cfc413d41e3a37670ce850aee6
Author: Keith Packard <keithp at keithp.com>
Date: Fri Jan 30 15:43:04 2009 -0800
Make RandR CRTC info report panning area instead of just crtc area
This makes the RandR info consistent with the Xinerama info.
Signed-off-by: Keith Packard <keithp at keithp.com>
(cherry picked from commit 6e49fdd2c839b6244c23ce95c3ae76a1a265b986)
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 99f7d1e..81ccf41 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -632,6 +632,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
RROutput *possible;
int i, j, k, n;
int width, height;
+ BoxRec panned_area;
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
@@ -652,11 +653,23 @@ ProcRRGetCrtcInfo (ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
- rep.x = crtc->x;
- rep.y = crtc->y;
- RRCrtcGetScanoutSize (crtc, &width, &height);
- rep.width = width;
- rep.height = height;
+ if (pScrPriv->rrGetPanning &&
+ pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&
+ (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
+ {
+ rep.x = panned_area.x1;
+ rep.y = panned_area.y1;
+ rep.width = panned_area.x2 - panned_area.x1;
+ rep.height = panned_area.y2 - panned_area.y1;
+ }
+ else
+ {
+ RRCrtcGetScanoutSize (crtc, &width, &height);
+ rep.x = crtc->x;
+ rep.y = crtc->y;
+ rep.width = width;
+ rep.height = height;
+ }
rep.mode = mode ? mode->mode.id : 0;
rep.rotation = crtc->rotation;
rep.rotations = crtc->rotations;
commit 9b2958b3a2fb4b65d67916ba7e98dfd21ad434f3
Author: Maarten Maathuis <madman2003 at gmail.com>
Date: Fri Dec 19 18:59:27 2008 +0100
randr: Consider panned crtc's when calculating xinerama screen sizes.
- This will allow window managers and applications to actually use the panned area.
(cherry picked from commit 332d65ec7a6e94d75efe95d53742f137835274de)
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index ad40a1e..5af6fb0 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -267,12 +267,26 @@ RRXineramaWriteCrtc(ClientPtr client, RRCrtcPtr crtc)
if (RRXineramaCrtcActive (crtc))
{
- int width, height;
- RRCrtcGetScanoutSize (crtc, &width, &height);
- scratch.x_org = crtc->x;
- scratch.y_org = crtc->y;
- scratch.width = width;
- scratch.height = height;
+ ScreenPtr pScreen = crtc->pScreen;
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
+ BoxRec panned_area;
+
+ /* Check to see if crtc is panned and return the full area when applicable. */
+ if (pScrPriv && pScrPriv->rrGetPanning &&
+ pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&
+ (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) {
+ scratch.x_org = panned_area.x1;
+ scratch.y_org = panned_area.y1;
+ scratch.width = panned_area.x2 - panned_area.x1;
+ scratch.height = panned_area.y2 - panned_area.y1;
+ } else {
+ int width, height;
+ RRCrtcGetScanoutSize (crtc, &width, &height);
+ scratch.x_org = crtc->x;
+ scratch.y_org = crtc->y;
+ scratch.width = width;
+ scratch.height = height;
+ }
if(client->swapped) {
register int n;
swaps(&scratch.x_org, n);
@@ -313,7 +327,6 @@ ProcRRXineramaQueryScreens(ClientPtr client)
if(rep.number) {
rrScrPriv(pScreen);
- xXineramaScreenInfo scratch;
int i;
int has_primary = (pScrPriv->primaryOutput != NULL);
More information about the xorg-commit
mailing list