diff options
author | Adam Jackson <ajax@redhat.com> | 2007-12-24 13:13:19 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2008-02-22 15:19:54 -0500 |
commit | ee21aba6be0078949204e315ddfffd99de60c2f1 (patch) | |
tree | d44a51d1ec696ddca109c943ca4cdd5bc11b1218 /Xext/panoramiXprocs.c | |
parent | a4202b898f07dd733590ae5adb21e48775369781 (diff) |
Fix Xinerama's consolidated visual handling.
Formerly the code claimed it could only handle up to 256 visuals, which
was true. Also true, but not explicitly stated, was that it could only
handle visuals with VID < 256. If you have enough screens, and subsystems
that add lots of visuals, you can easily run off the end. (Made worse
because we allocate visual IDs from the same pool as XIDs.) If your app
then chooses a visual > 256, then the Xinerama code would throw BadMatch
on CreateColormap and your app wouldn't start.
With this change, PanoramiXVisualTable is gone. Other subsystems that
were using it as a translation table between each screen's visuals now
use a PanoramiXTranslateVisual() helper.
Diffstat (limited to 'Xext/panoramiXprocs.c')
-rw-r--r-- | Xext/panoramiXprocs.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index f9a579625..d19b3039a 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -150,7 +150,7 @@ int PanoramiXCreateWindow(ClientPtr client) if (cmap) *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id; if ( orig_visual != CopyFromParent ) - stuff->visual = PanoramiXVisualTable[(orig_visual*MAXSCREENS) + j]; + stuff->visual = PanoramiXTranslateVisualID(j, orig_visual); result = (*SavedProcVector[X_CreateWindow])(client); if(result != Success) break; } @@ -2077,9 +2077,6 @@ int PanoramiXCreateColormap(ClientPtr client) client, stuff->window, XRT_WINDOW, DixReadAccess))) return BadWindow; - if(!stuff->visual || (stuff->visual > 255)) - return BadValue; - if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -2092,7 +2089,7 @@ int PanoramiXCreateColormap(ClientPtr client) FOR_NSCREENS_BACKWARD(j){ stuff->mid = newCmap->info[j].id; stuff->window = win->info[j].id; - stuff->visual = PanoramiXVisualTable[(orig_visual * MAXSCREENS) + j]; + stuff->visual = PanoramiXTranslateVisualID(j, orig_visual); result = (* SavedProcVector[X_CreateColormap])(client); if(result != Success) break; } |