Resizing the root window

Jeremy Huddleston jeremyhu at freedesktop.org
Mon May 5 19:37:51 PDT 2008


On May 5, 2008, at 16:58, Eamon Walsh wrote:

> Jeremy Huddleston wrote:
>> And in miSlideAndSizeWindow, we have:
>>
>>     /* if this is a root window, can't be resized */
>>     if (!(pParent = pWin->parent))
>> 	return ;
>>
>> So it looks like this is intentional.  So... how should I be  
>> resizing  the root window?
>>
>
>
> What happens if you comment out the check?

Crash and death, since pWin->parent is null and used later ;)

But putting that inside of protection causes a crash on:
REGION_COPY(pScreen, &pWin->valdata->after.exposed, &pWin->clipList);

because pWin->valdata->after is null.... after throwing a bunch of  
clutter around, I just gave up and handled it for our case in  
RootlessResizeWindow:

     if(pWin->parent) {
         ... do the old stuff ...
     } else {
         /* Special case for resizing the root window */
         BoxRec box;

         pWin->drawable.x = x;
         pWin->drawable.y = y;
         pWin->drawable.width = w;
         pWin->drawable.height = h;

         box.x1 = x; box.y1 = y;
         box.x2 = x + w; box.y2 = y + h;
         REGION_UNINIT(pScreen, &pWin->winSize);
         REGION_INIT(pScreen, &pWin->winSize, &box, 1);
         REGION_COPY(pScreen, &pWin->borderSize, &pWin->winSize);
         REGION_COPY(pScreen, &pWin->clipList, &pWin->winSize);
         REGION_COPY(pScreen, &pWin->borderClip, &pWin->winSize);

         miSendExposures(pWin, &pWin->borderClip,
                         pWin->drawable.x, pWin->drawable.y);
     }

Seems to work here.  Thoughts?  Am I missing a "gotcha"?



More information about the xorg mailing list