[PATCH 4/5] xnest: make MAXSCREENS run-time configurable
Tiago Vignatti
tiago.vignatti at nokia.com
Thu Apr 8 08:06:36 PDT 2010
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
hw/xnest/Args.c | 5 +++--
hw/xnest/Color.c | 6 +++++-
hw/xnest/Init.c | 3 +++
hw/xnest/Screen.c | 4 ++--
hw/xnest/Screen.h | 4 ++--
5 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/hw/xnest/Args.c b/hw/xnest/Args.c
index cdc8311..1cd2105 100644
--- a/hw/xnest/Args.c
+++ b/hw/xnest/Args.c
@@ -19,6 +19,7 @@ is" without express or implied warranty.
#include <X11/X.h>
#include <X11/Xproto.h>
#include "screenint.h"
+#include "globals.h"
#include "input.h"
#include "misc.h"
#include "scrnintstr.h"
@@ -151,13 +152,13 @@ ddxProcessArgument (int argc, char *argv[], int i)
}
if (!strcmp(argv[i], "-scrns")) {
if (++i < argc && sscanf(argv[i], "%i", &xnestNumScreens) == 1) {
- if (xnestNumScreens > 0) {
+ if (xnestNumScreens > 0) SetMaxScreens(xnestNumScreens);
+ else return 0;
if (xnestNumScreens > MAXSCREENS) {
ErrorF("Maximum number of screens is %d.\n", MAXSCREENS);
xnestNumScreens = MAXSCREENS;
}
return 2;
- }
}
return 0;
}
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index dc74947..091f291 100644
--- a/hw/xnest/Color.c
+++ b/hw/xnest/Color.c
@@ -34,7 +34,7 @@ is" without express or implied warranty.
#include "XNWindow.h"
#include "Args.h"
-static ColormapPtr InstalledMaps[MAXSCREENS];
+static ColormapPtr *InstalledMaps;
Bool
xnestCreateColormap(ColormapPtr pCmap)
@@ -334,6 +334,8 @@ xnestInstallColormap(ColormapPtr pCmap)
{
int index;
ColormapPtr pOldCmap;
+
+ MAXSCREENSALLOC_FATAL(InstalledMaps);
index = pCmap->pScreen->myNum;
pOldCmap = InstalledMaps[index];
@@ -360,6 +362,8 @@ xnestUninstallColormap(ColormapPtr pCmap)
int index;
ColormapPtr pCurCmap;
+ MAXSCREENSFREE(InstalledMaps);
+
index = pCmap->pScreen->myNum;
pCurCmap = InstalledMaps[index];
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 8a90cc6..9e64bde 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -52,6 +52,9 @@ InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
{
int i, j;
+ MAXSCREENSALLOC_FATAL(xnestDefaultWindows);
+ MAXSCREENSALLOC_FATAL(xnestScreenSaverWindows);
+
xnestOpenDisplay(argc, argv);
screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index ca903d7..e82496d 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -43,8 +43,8 @@ is" without express or implied warranty.
#include "Args.h"
#include "mipointrst.h"
-Window xnestDefaultWindows[MAXSCREENS];
-Window xnestScreenSaverWindows[MAXSCREENS];
+Window *xnestDefaultWindows;
+Window *xnestScreenSaverWindows;
static int xnestCursorScreenKeyIndex;
DevPrivateKey xnestCursorScreenKey = &xnestCursorScreenKeyIndex;
diff --git a/hw/xnest/Screen.h b/hw/xnest/Screen.h
index b113c64..d8ffceb 100644
--- a/hw/xnest/Screen.h
+++ b/hw/xnest/Screen.h
@@ -15,8 +15,8 @@ is" without express or implied warranty.
#ifndef XNESTSCREEN_H
#define XNESTSCREEN_H
-extern Window xnestDefaultWindows[MAXSCREENS];
-extern Window xnestScreenSaverWindows[MAXSCREENS];
+extern Window *xnestDefaultWindows;
+extern Window *xnestScreenSaverWindows;
ScreenPtr xnestScreen(Window window);
Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]);
--
1.6.0.4
More information about the xorg-devel
mailing list