Merge remote-tracking branch 'jeremyhu/master'

This commit is contained in:
Keith Packard 2012-08-06 15:08:01 -07:00
commit ad707a7dcc
3 changed files with 65 additions and 44 deletions

View File

@ -1499,7 +1499,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete,
/* Allocation */ /* Allocation */
- init - (id) init
{ {
unsigned long pixel; unsigned long pixel;

View File

@ -37,7 +37,6 @@
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#include "darwin.h"
#include "pseudoramiX.h" #include "pseudoramiX.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" #include "extinit.h"
@ -46,6 +45,9 @@
#include <X11/extensions/panoramiXproto.h> #include <X11/extensions/panoramiXproto.h>
#include "globals.h" #include "globals.h"
#define TRACE PseudoramiXTrace("TRACE " __FILE__ ":%s",__FUNCTION__)
#define DEBUG_LOG PseudoramiXDebug
Bool noPseudoramiXExtension = FALSE; Bool noPseudoramiXExtension = FALSE;
extern int extern int
@ -96,6 +98,26 @@ static int pseudoramiXScreensAllocated = 0;
static int pseudoramiXNumScreens = 0; static int pseudoramiXNumScreens = 0;
static unsigned long pseudoramiXGeneration = 0; static unsigned long pseudoramiXGeneration = 0;
static void
PseudoramiXTrace(const char *format, ...)
{
va_list ap;
va_start(ap, format);
LogVMessageVerb(X_NONE, 10, format, ap);
va_end(ap);
}
static void
PseudoramiXDebug(const char *format, ...)
{
va_list ap;
va_start(ap, format);
LogVMessageVerb(X_NONE, 3, format, ap);
va_end(ap);
}
// Add a PseudoramiX screen. // Add a PseudoramiX screen.
// The rest of the X server will know nothing about this screen. // The rest of the X server will know nothing about this screen.
// Can be called before or after extension init. // Can be called before or after extension init.
@ -133,7 +155,7 @@ PseudoramiXExtensionInit(void)
if (noPseudoramiXExtension) return; if (noPseudoramiXExtension) return;
TRACE(); TRACE;
/* Even with only one screen we need to enable PseudoramiX to allow /* Even with only one screen we need to enable PseudoramiX to allow
dynamic screen configuration changes. */ dynamic screen configuration changes. */
@ -170,7 +192,7 @@ PseudoramiXExtensionInit(void)
void void
PseudoramiXResetScreens(void) PseudoramiXResetScreens(void)
{ {
TRACE(); TRACE;
pseudoramiXNumScreens = 0; pseudoramiXNumScreens = 0;
} }
@ -178,7 +200,7 @@ PseudoramiXResetScreens(void)
static void static void
PseudoramiXResetProc(ExtensionEntry *extEntry) PseudoramiXResetProc(ExtensionEntry *extEntry)
{ {
TRACE(); TRACE;
PseudoramiXResetScreens(); PseudoramiXResetScreens();
} }
@ -187,7 +209,7 @@ PseudoramiXResetProc(ExtensionEntry *extEntry)
static int static int
ProcPseudoramiXQueryVersion(ClientPtr client) ProcPseudoramiXQueryVersion(ClientPtr client)
{ {
TRACE(); TRACE;
return ProcPanoramiXQueryVersion(client); return ProcPanoramiXQueryVersion(client);
} }
@ -201,7 +223,7 @@ ProcPseudoramiXGetState(ClientPtr client)
xPanoramiXGetStateReply rep; xPanoramiXGetStateReply rep;
register int rc; register int rc;
TRACE(); TRACE;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
@ -212,10 +234,11 @@ ProcPseudoramiXGetState(ClientPtr client)
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.state = !noPseudoramiXExtension; rep.state = !noPseudoramiXExtension;
rep.window = stuff->window;
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
swaps(&rep.state); swapl(&rep.window);
} }
WriteToClient(client, sizeof(xPanoramiXGetStateReply),&rep); WriteToClient(client, sizeof(xPanoramiXGetStateReply),&rep);
return Success; return Success;
@ -230,7 +253,7 @@ ProcPseudoramiXGetScreenCount(ClientPtr client)
xPanoramiXGetScreenCountReply rep; xPanoramiXGetScreenCountReply rep;
register int rc; register int rc;
TRACE(); TRACE;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
@ -241,10 +264,11 @@ ProcPseudoramiXGetScreenCount(ClientPtr client)
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.ScreenCount = pseudoramiXNumScreens; rep.ScreenCount = pseudoramiXNumScreens;
rep.window = stuff->window;
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
swaps(&rep.ScreenCount); swapl(&rep.window);
} }
WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply),&rep); WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply),&rep);
return Success; return Success;
@ -259,7 +283,10 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
xPanoramiXGetScreenSizeReply rep; xPanoramiXGetScreenSizeReply rep;
register int rc; register int rc;
TRACE(); TRACE;
if (stuff->screen >= pseudoramiXNumScreens)
return BadMatch;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
@ -274,11 +301,15 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
// was screenInfo.screens[stuff->screen]->width; // was screenInfo.screens[stuff->screen]->width;
rep.height = pseudoramiXScreens[stuff->screen].h; rep.height = pseudoramiXScreens[stuff->screen].h;
// was screenInfo.screens[stuff->screen]->height; // was screenInfo.screens[stuff->screen]->height;
rep.window = stuff->window;
rep.screen = stuff->screen;
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
swaps(&rep.width); swapl(&rep.width);
swaps(&rep.height); swapl(&rep.height);
swapl(&rep.window);
swapl(&rep.screen);
} }
WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply),&rep); WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply),&rep);
return Success; return Success;
@ -291,7 +322,7 @@ ProcPseudoramiXIsActive(ClientPtr client)
/* REQUEST(xXineramaIsActiveReq); */ /* REQUEST(xXineramaIsActiveReq); */
xXineramaIsActiveReply rep; xXineramaIsActiveReply rep;
TRACE(); TRACE;
REQUEST_SIZE_MATCH(xXineramaIsActiveReq); REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
@ -360,7 +391,7 @@ static int
ProcPseudoramiXDispatch(ClientPtr client) ProcPseudoramiXDispatch(ClientPtr client)
{ {
REQUEST(xReq); REQUEST(xReq);
TRACE(); TRACE;
switch (stuff->data) { switch (stuff->data) {
case X_PanoramiXQueryVersion: case X_PanoramiXQueryVersion:
return ProcPseudoramiXQueryVersion(client); return ProcPseudoramiXQueryVersion(client);
@ -388,7 +419,7 @@ SProcPseudoramiXQueryVersion(ClientPtr client)
{ {
REQUEST(xPanoramiXQueryVersionReq); REQUEST(xPanoramiXQueryVersionReq);
TRACE(); TRACE;
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
@ -400,7 +431,7 @@ SProcPseudoramiXGetState(ClientPtr client)
{ {
REQUEST(xPanoramiXGetStateReq); REQUEST(xPanoramiXGetStateReq);
TRACE(); TRACE;
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
@ -412,7 +443,7 @@ SProcPseudoramiXGetScreenCount(ClientPtr client)
{ {
REQUEST(xPanoramiXGetScreenCountReq); REQUEST(xPanoramiXGetScreenCountReq);
TRACE(); TRACE;
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
@ -424,7 +455,7 @@ SProcPseudoramiXGetScreenSize(ClientPtr client)
{ {
REQUEST(xPanoramiXGetScreenSizeReq); REQUEST(xPanoramiXGetScreenSizeReq);
TRACE(); TRACE;
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
@ -436,7 +467,7 @@ SProcPseudoramiXIsActive(ClientPtr client)
{ {
REQUEST(xXineramaIsActiveReq); REQUEST(xXineramaIsActiveReq);
TRACE(); TRACE;
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq); REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
@ -448,7 +479,7 @@ SProcPseudoramiXQueryScreens(ClientPtr client)
{ {
REQUEST(xXineramaQueryScreensReq); REQUEST(xXineramaQueryScreensReq);
TRACE(); TRACE;
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
@ -460,7 +491,7 @@ SProcPseudoramiXDispatch(ClientPtr client)
{ {
REQUEST(xReq); REQUEST(xReq);
TRACE(); TRACE;
switch (stuff->data) { switch (stuff->data) {
case X_PanoramiXQueryVersion: case X_PanoramiXQueryVersion:

View File

@ -59,13 +59,6 @@
#include "rootlessWindow.h" #include "rootlessWindow.h"
#include "xprEvent.h" #include "xprEvent.h"
/* This is important enough to declare here if building against an old
* libXplugin, so we pick it up whenever libXplugin starts to support it.
*/
#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION < 6
extern xp_error xp_window_bring_all_to_front(void) __attribute__((weak_import));
#endif
Bool Bool
QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev)
{ {
@ -86,21 +79,18 @@ QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev)
/* There's no need to do xp_window_bring_all_to_front on Leopard, /* There's no need to do xp_window_bring_all_to_front on Leopard,
* and we don't care about the result, so just do it async. * and we don't care about the result, so just do it async.
*/ */
#if defined(HAVE_LIBDISPATCH) #if defined(HAVE_LIBDISPATCH) && defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 6
#if (defined(XPLUGIN_VERSION_MIN_REQUIRED) && XPLUGIN_VERSION_MIN_REQUIRED >= 6) || \ # if defined(XPLUGIN_VERSION_MIN_REQUIRED) && XPLUGIN_VERSION_MIN_REQUIRED < 6
(!defined(XPLUGIN_VERSION_MIN_REQUIRED) && defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 6) if (&xp_window_bring_all_to_front) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ # endif
xp_window_bring_all_to_front(); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
}); xp_window_bring_all_to_front();
#else });
if (&xp_window_bring_all_to_front) { # if defined(XPLUGIN_VERSION_MIN_REQUIRED) && XPLUGIN_VERSION_MIN_REQUIRED < 6
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ } else {
xp_window_bring_all_to_front(); RootlessOrderAllWindows(e->data[0]);
}); }
} else { # endif
RootlessOrderAllWindows(e->data[0]);
}
#endif
#else #else
RootlessOrderAllWindows(e->data[0]); RootlessOrderAllWindows(e->data[0]);
#endif #endif