summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2010-04-07 18:38:27 +0300
committerTiago Vignatti <tiago.vignatti@nokia.com>2010-04-21 17:25:38 +0300
commitb9b1ecc812abb57b160fe806f3e1bdef1ea93705 (patch)
treec1f725cb6f445b0f15eb9cf2d28e0c84a8f847ab
parent75ee56b27158bd44c5eb8331b240ecb70db2c258 (diff)
xnest: make screens structures run-time adjustablemaxscreenless
It removes MAXSCREENS dependency. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
-rw-r--r--hw/xnest/Args.c14
-rw-r--r--hw/xnest/Color.c6
-rw-r--r--hw/xnest/Init.c3
-rw-r--r--hw/xnest/Screen.c4
-rw-r--r--hw/xnest/Screen.h4
5 files changed, 16 insertions, 15 deletions
diff --git a/hw/xnest/Args.c b/hw/xnest/Args.c
index cdc831133..a881fa2f1 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"
@@ -45,7 +46,7 @@ int xnestUserGeometry = 0;
int xnestBorderWidth;
Bool xnestUserBorderWidth = False;
char *xnestWindowName = NULL;
-int xnestNumScreens = 0;
+int xnestNumScreens = 1;
Bool xnestDoDirectColormaps = False;
Window xnestParentWindow = 0;
@@ -150,15 +151,8 @@ ddxProcessArgument (int argc, char *argv[], int i)
return 0;
}
if (!strcmp(argv[i], "-scrns")) {
- if (++i < argc && sscanf(argv[i], "%i", &xnestNumScreens) == 1) {
- if (xnestNumScreens > 0) {
- if (xnestNumScreens > MAXSCREENS) {
- ErrorF("Maximum number of screens is %d.\n", MAXSCREENS);
- xnestNumScreens = MAXSCREENS;
- }
- return 2;
- }
- }
+ if (++i < argc && sscanf(argv[i], "%i", &xnestNumScreens) == 1)
+ return 2;
return 0;
}
if (!strcmp(argv[i], "-install")) {
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index dc749478f..0a1b0bb20 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;
+
+ SCREENSALLOC_FATAL(InstalledMaps, xnestNumScreens);
index = pCmap->pScreen->myNum;
pOldCmap = InstalledMaps[index];
@@ -360,6 +362,8 @@ xnestUninstallColormap(ColormapPtr pCmap)
int index;
ColormapPtr pCurCmap;
+ SCREENSFREE(InstalledMaps);
+
index = pCmap->pScreen->myNum;
pCurCmap = InstalledMaps[index];
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 8a90cc65e..60bb7d1ff 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;
+ SCREENSALLOC_FATAL(xnestDefaultWindows, xnestNumScreens);
+ SCREENSALLOC_FATAL(xnestScreenSaverWindows, xnestNumScreens);
+
xnestOpenDisplay(argc, argv);
screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index ca903d7ac..e82496d9b 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 b113c6460..d8ffcebc6 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[]);