This commit is contained in:
Enrico Weigelt 2026-10-21 18:28:01 +02:00 • committed by GitHub
commit 9aea91702d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 51 additions and 33 deletions

View file

@ -8,6 +8,8 @@
#include <stdbool.h>
#include "include/extinit.h"
#include "include/screenint.h"
#include "include/scrnintstr.h"
/*
* @brief return TRUE if panoramiX / xinerama extension is enabled
@ -27,4 +29,27 @@ static inline bool PanoramiXIsDisabled(void) {
return !PanoramiXIsEnabled();
}
/*
* @brief return TRUE if panoramix enabled and screen is the master or
* panoramix is disabled
*
* this function is usually called in order to check whether the given
* screen behaves normally (eg. sending events, etc) and is NOT a
* panoramix slave screen.
*/
static inline bool PanoramiXIsMasterScreen(ScreenPtr pScreen) {
return PanoramiXIsDisabled() || (pScreen->myNum == 0);
}
/*
* @brief return TRUE if panoramix enabled AND screen is a slave.
*
* this function is usually called in order to check whether the given
* screen is a panoramix slave screen (thus shall not be visible to
* clients, eg. sending events, etc)
*/
static inline bool PanoramiXIsSlaveScreen(ScreenPtr pScreen) {
return PanoramiXIsEnabled() && (pScreen->myNum != 0);
}
#endif /* _XSERVER_PANORAMIX_PRIV_H_ */

View file

@ -598,12 +598,11 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
ret = TRUE;
}
#ifdef XINERAMA
if (PanoramiXIsDisabled() || !pScreen->myNum)
#endif /* XINERAMA */
{
if (PanoramiXIsMasterScreen(pScreen)) {
SendScreenSaverNotify(pScreen, state, force);
}
return ret;
}

View file

@ -468,10 +468,11 @@ TellNoMap(WindowPtr pwin, Colormap * pmid)
.u.colormap.state = ColormapUninstalled
};
xE.u.u.type = ColormapNotify;
#ifdef XINERAMA
if (PanoramiXIsDisabled() || !pwin->drawable.pScreen->myNum)
#endif /* XINERAMA */
if (PanoramiXIsMasterScreen(pwin->drawable.pScreen)) {
DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL);
}
if (pwin->optional) {
pwin->optional->colormap = None;
CheckWindowOptionalNeed(pwin);
@ -487,7 +488,7 @@ TellLostMap(WindowPtr pwin, void *value)
{
Colormap *pmid = (Colormap *) value;
if (PanoramiXIsEnabled() && pwin->drawable.pScreen->myNum) {
if (PanoramiXIsSlaveScreen(pwin->drawable.pScreen)) {
return WT_STOPWALKING;
}
@ -512,11 +513,9 @@ TellGainedMap(WindowPtr pwin, void *value)
{
Colormap *pmid = (Colormap *) value;
#ifdef XINERAMA
if (PanoramiXIsEnabled() && pwin->drawable.pScreen->myNum) {
if (PanoramiXIsSlaveScreen(pwin->drawable.pScreen)) {
return WT_STOPWALKING;
}
#endif
if (wColormap(pwin) == *pmid) {
/* This should be call to DeliverEvent */

View file

@ -2591,13 +2591,11 @@ ProcAllocNamedColor(ClientPtr client)
}
/* if PanoramiX is active, and this isn't the master screen, keep radio silence */
#ifdef XINERAMA
if (PanoramiXIsDisabled() || !pcmp->pScreen->myNum)
return X_SEND_REPLY_SIMPLE(client, reply);
return Success;
#else
if (PanoramiXIsSlaveScreen(pcmp->pScreen)) {
return Success;
}
return X_SEND_REPLY_SIMPLE(client, reply);
#endif /* XINERAMA */
}
int
@ -2640,9 +2638,8 @@ ProcAllocColorCells(ClientPtr client)
x_rpcbuf_clear(&rpcbuf);
return rc;
}
#ifdef XINERAMA
if (PanoramiXIsDisabled() || !pcmp->pScreen->myNum)
#endif /* XINERAMA */
if (PanoramiXIsMasterScreen(pcmp->pScreen))
{
xAllocColorCellsReply reply = {
.nPixels = npixels,
@ -2716,12 +2713,10 @@ ProcAllocColorPlanes(ClientPtr client)
swapl(&reply.blueMask);
}
#ifdef XINERAMA
if (PanoramiXIsDisabled() || !pcmp->pScreen->myNum)
#endif /* XINERAMA */
{
if (PanoramiXIsMasterScreen(pcmp->pScreen)) {
return X_SEND_REPLY_WITH_RPCBUF(client, reply, rpcbuf);
}
x_rpcbuf_clear(&rpcbuf);
return Success;
}

View file

@ -2540,9 +2540,10 @@ Bool MaybeDeliverEventToClient(WindowPtr pWin, xEvent *pEvents,
if (dixClientForWindow(pWin) == dontClient)
return FALSE;
#ifdef XINERAMA
if (PanoramiXIsEnabled() && pWin->drawable.pScreen->myNum)
if (PanoramiXIsSlaveScreen(pWin->drawable.pScreen)) {
return XineramaTryClientEventsResult(dixClientForWindow(pWin), NullGrab,
pWin->eventMask, filter);
}
#endif /* XINERAMA */
if (XaceHookReceiveAccess(dixClientForWindow(pWin), pWin, pEvents, 1))
return TRUE; /* don't send, but pretend we did */
@ -2554,9 +2555,10 @@ Bool MaybeDeliverEventToClient(WindowPtr pWin, xEvent *pEvents,
if (SameClient(other, dontClient))
return FALSE;
#ifdef XINERAMA
if (PanoramiXIsEnabled() && pWin->drawable.pScreen->myNum)
if (PanoramiXIsSlaveScreen(pWin->drawable.pScreen)) {
return XineramaTryClientEventsResult(dixClientForOtherClients(other), NullGrab,
other->mask, filter);
}
#endif /* XINERAMA */
if (XaceHookReceiveAccess(dixClientForOtherClients(other), pWin, pEvents, 1))
return TRUE; /* don't send, but pretend we did */
@ -2935,10 +2937,9 @@ DeliverEvents(WindowPtr pWin, xEvent *xE, size_t count, WindowPtr otherParent)
DeviceIntRec dummy;
int deliveries;
#ifdef XINERAMA
if (PanoramiXIsEnabled() && pWin->drawable.pScreen->myNum)
if (PanoramiXIsSlaveScreen(pWin->drawable.pScreen)) {
return count;
#endif /* XINERAMA */
}
if (!count)
return 0;
@ -5946,10 +5947,9 @@ CheckCursorConfinement(WindowPtr pWin)
GrabPtr grab;
WindowPtr confineTo;
#ifdef XINERAMA
if (PanoramiXIsEnabled() && pWin->drawable.pScreen->myNum)
if (PanoramiXIsSlaveScreen(pWin->drawable.pScreen)) {
return;
#endif /* XINERMA */
}
for (DeviceIntPtr pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {

View file

@ -2763,7 +2763,7 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure)
if (pChild->realized) {
pChild->visibility = VisibilityNotViewable;
#ifdef XINERAMA
if (PanoramiXIsEnabled() && !pChild->drawable.pScreen->myNum) {
if (PanoramiXIsMasterScreen(pChild->drawable.pScreen)) {
PanoramiXRes *win;
int rc = dixLookupResourceByType((void **) &win,
pChild->drawable.id,