On Thu, 23 Aug 2001 08:42:51 +0100 Tom Gilbert <tom@...> babbled
profusely:
> * raster@... (raster@...) wrote:
> > On Wed, 22 Aug 2001 20:42:01 -0700 Michael Jennings <mej@...>
> > babbled profusely:
> >
> > > On Thursday, 23 August 2001, at 12:51:05 (+1000),
> > > Carsten Haitzler wrote:
> > >
> > > > you could also open a 2nd display connection, copy the 1st display
> > > > create dpixmap to the 2nd pixmap on the 2nd display and set the
> > > > closedown mode ont he 2nd display only... :)
> > >
> > > This is an intriguing idea. I considered the idea of migrating the
> > > pixmap, but I wasn't sure how best to do it. Is there an easier way
> > > then dumping the data to an XImage and copying it over?
> >
> > /* d1 = 1st display */
> > /* p1 = pixmap on 1st display */
> > /* width = width of pixmap to copy over */
> > /* height = height of pixmap to copy over */
> > Display *d2;
> > Pixmap p2;
> > GC gc;
> > XGCValues gcvalues;
> >
> > d2= XOpenDisplay(NULL);
> > p2 = XCreatePixmap(d2, DefaultRootWindow(d2), width, height,
> > DefaultDepth(d2, DefaultScreen(d2)));
> > gc = XCreateGC(d1, p1, 0, &gcvalues);
> > XCopyArea(d1, p1, p2, gc, 0, 0, width, height, 0, 0);
> > XFreeGC(d1, gc);
> > XSync(d1, False);
>
> You sure about that raster?
>
> X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)
> Major opcode of failed request: 62 (X_CopyArea)
> Resource id in failed request: 0x1c00001
> Serial number of failed request: 310
> Current serial number in output stream: 313
>
> That was from this code:
> disp2 = XOpenDisplay(NULL);
> root2 = RootWindow(disp2, DefaultScreen(disp2));
> depth2 = DefaultDepth(disp2, DefaultScreen(disp2));
>
> gc = XCreateGC(disp, pmap_d1, 0, &gcvalues);
> pmap_d2 = XCreatePixmap(disp2, root2, w, h, depth2);
> XCopyArea(disp, pmap_d1, pmap_d2, gc, 0, 0, w, h, 0, 0);
> XFreeGC(disp, gc);
> XFreePixmap(disp, pmap_d1);
> XSync(disp, False);
ooh yeah. i know why... display 1 is using display 1 and display 1's gc to write
to display2's pixmap.. you can read an duse other clients pixmaps.. but can't
wrtie to them..
also i think we have a buffer flush issu.. throw an extra XSync in... :)
the following code does work.. just comapield and ran it. it's better than
getting/putting the image since ti first doesnt need to be read fomr the
framebuffer but can use the blitter and hardware accelerator to do the copy.. if
you have the spare video ram and the hardware is supported... and it aoids a
server->client and back round trip for the image data.. which is nastily slow :)
#include <X11/Xlib.h>
int
main (int argc, char **argv)
{
Display *d1, *d2;
Pixmap p1, p2;
GC gc;
XGCValues gcvalues;
int w, h;
/* lets create a first dummy pixmap */
w = 256;
h = 256;
d1 = XOpenDisplay(NULL);
p1 = XCreatePixmap(d1, DefaultRootWindow(d1), w, h,
DefaultDepth(d1, DefaultScreen(d1)));
/* this xsync.. need it.. we have buffer flush issues without it. */
XSync(d1, False);
/* our 2nd display & pixmap */
d2 = XOpenDisplay(NULL);
p2 = XCreatePixmap(d2, DefaultRootWindow(d2), w, h,
DefaultDepth(d2, DefaultScreen(d2)));
/* now lets duplicate it */
gc = XCreateGC(d2, p2, 0, &gcvalues);
XCopyArea(d2, p1, p2, gc, 0, 0, w, h, 0, 0);
XFreeGC(d2, gc);
/* and sync just to flush buffers and wait for x to be done */
XSync(d2, False);
/* just for the hell of it... */
XSync(d1, False);
/* done.. happy.. works 1st. client can now go and shut down etc. */
}
> Tom.
> --
> .^. .-------------------------------------------------------.
> /V\ | Tom Gilbert, London, England | http://linuxbrit.co.uk |
> /( )\ | Open Source/UNIX consultant | tom@... |
> ^^-^^ `-------------------------------------------------------'
>
> _______________________________________________
> Enlightenment-devel mailing list
> Enlightenment-devel@...
> http://lists.sourceforge.net/lists/listinfo/enlightenment-devel
--
--------------- Codito, ergo sum - "I code, therefore I am" --------------------
The Rasterman (Carsten Haitzler) raster@... raster@...
VA Linux Systems raster@...
Mobile Phone: +61 (0)408 363 984 Work Phone: +61 (02) 9386 9362
|