aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-12-13 23:18:34 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-12-13 23:18:34 +0100
commitc5f3c204236614261cfd8c694d713004847a3b0d (patch)
treecdca5ba521547bec21739b61d84a39f7967a7797 /nx-X11/programs/Xserver/hw
parent73c113ce64bb454361f4a145e4880651af7707f7 (diff)
parentbd1ca625e4a48c3702da8a5ac170904c371e9bda (diff)
downloadnx-libs-c5f3c204236614261cfd8c694d713004847a3b0d.tar.gz
nx-libs-c5f3c204236614261cfd8c694d713004847a3b0d.tar.bz2
nx-libs-c5f3c204236614261cfd8c694d713004847a3b0d.zip
Merge branch 'uli42-pr/pre-rrxinerama-fallback' into 3.6.x
Attributes GH PR #602: https://github.com/ArcticaProject/nx-libs/pull/602
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Extensions.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c119
2 files changed, 100 insertions, 21 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c
index d9db1a8aa..237e13fb6 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c
@@ -136,7 +136,7 @@ void nxagentInitRandRExtension(ScreenPtr pScreen)
pRandRScrPriv = rrGetScrPriv(pScreen);
- pRandRScrPriv -> rrGetInfo = nxagentRandRGetInfo;
+ pRandRScrPriv -> rrGetInfo = nxagentRandRGetInfo;
#if RANDR_15_INTERFACE
/* nothing to be assigned here, so far */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index 90ebe9829..d642f63b7 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -3666,11 +3666,88 @@ Bool intersect_bb(int ax1, int ay1, unsigned int aw, unsigned int ah,
}
#endif
+RRModePtr nxagentRRCustomMode = NULL;
+
+/*
+ This is basically the code that was used on screen resize before
+ xinerama was implemented. We need it as fallback if the user
+ disables xinerama
+*/
+void nxagentAdjustCustomMode(ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
+ RROutputPtr output;
+
+ if (pScrPriv)
+ {
+ output = RRFirstOutput(pScreen);
+
+ if (output && output -> crtc)
+ {
+ RRCrtcPtr crtc;
+ char name[100];
+ xRRModeInfo modeInfo;
+ const int refresh = 60;
+ int width = nxagentOption(Width);
+ int height = nxagentOption(Height);
+
+ crtc = output -> crtc;
+
+ for (int c = 0; c < pScrPriv -> numCrtcs; c++)
+ {
+ RRCrtcSet(pScrPriv -> crtcs[c], NULL, 0, 0, RR_Rotate_0, 0, NULL);
+ }
+
+ memset(&modeInfo, '\0', sizeof(modeInfo));
+ sprintf(name, "%dx%d", width, height);
+
+ modeInfo.width = width;
+ modeInfo.height = height;
+ modeInfo.hTotal = width;
+ modeInfo.vTotal = height;
+ modeInfo.dotClock = ((CARD32) width * (CARD32) height *
+ (CARD32) refresh);
+ modeInfo.nameLength = strlen(name);
+
+ if (nxagentRRCustomMode != NULL)
+ {
+ RROutputDeleteUserMode(output, nxagentRRCustomMode);
+ FreeResource(nxagentRRCustomMode -> mode.id, 0);
+
+ if (crtc != NULL && crtc -> mode == nxagentRRCustomMode)
+ {
+ RRCrtcSet(crtc, NULL, 0, 0, RR_Rotate_0, 0, NULL);
+ }
+
+ #ifdef TEST
+ fprintf(stderr, "%s: Going to destroy mode %p with refcnt %d.\n",
+ __func__, nxagentRRCustomMode, nxagentRRCustomMode->refcnt);
+ #endif
+
+ RRModeDestroy(nxagentRRCustomMode);
+ }
+
+ nxagentRRCustomMode = RRModeGet(&modeInfo, name);
+
+ RROutputAddUserMode(output, nxagentRRCustomMode);
+
+ RRCrtcSet(crtc, nxagentRRCustomMode, 0, 0, RR_Rotate_0, 1, &output);
+
+ RROutputChanged(output, 1);
+ }
+
+ pScrPriv -> lastSetTime = currentTime;
+
+ pScrPriv->changed = 1;
+ pScrPriv->configChanged = 1;
+ } /* if (pScrPriv) */
+
+ RRScreenSizeNotify(pScreen);
+}
+
int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, int mmHeight)
{
ScreenPtr pScreen;
- /* FIXME: when is this needed? */
- int doNotify = TRUE;
int r;
#ifdef DEBUG
@@ -3726,12 +3803,18 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in
if (r != 0)
{
- nxagentAdjustRandRXinerama(pScreen);
- }
+ if (nxagentOption(Xinerama))
+ {
+ nxagentAdjustRandRXinerama(pScreen);
+ }
+ else
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "%s: Xinerama is disabled\n", __func__);
+ #endif
- if (doNotify)
- {
- RRScreenSizeNotify(pScreen);
+ nxagentAdjustCustomMode(pScreen);
+ }
}
#ifdef DEBUG
@@ -3782,24 +3865,20 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
XineramaScreenInfo *screeninfo = NULL;
- if (nxagentOption(Xinerama)) {
- screeninfo = XineramaQueryScreens(nxagentDisplay, &number);
+ screeninfo = XineramaQueryScreens(nxagentDisplay, &number);
+ if (number)
+ {
#ifdef DEBUG
- if (number) {
- fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() returned [%d] screens:\n", number);
- for (int i=0; i < number; i++) {
- fprintf(stderr, "nxagentAdjustRandRXinerama: screen_number [%d] x_org [%d] y_org [%d] width [%d] height [%d]\n", screeninfo[i].screen_number, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height);
- }
-
- }
- else
- {
- fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() failed - continuing without Xinerama\n");
+ fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() returned [%d] screens:\n", number);
+ for (int i=0; i < number; i++) {
+ fprintf(stderr, "nxagentAdjustRandRXinerama: screen_number [%d] x_org [%d] y_org [%d] width [%d] height [%d]\n", screeninfo[i].screen_number, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height);
}
+#endif
}
else
{
- fprintf(stderr, "nxagentAdjustRandRXinerama: Xinerama is disabled\n");
+#ifdef DEBUG
+ fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() failed - continuing without Xinerama\n");
#endif
}