Re: Switching X contexts HOWTO ??



Brett Granger wrote:

Tristan Van Berkom wrote:
Owen Taylor wrote:

Tristan Van Berkom <vantr touchtunes com> writes:


Hi there!

     I'm writing an Image server that has to load images ("GdkPixmaps" etc
....)
as X recources (with an XID *) into various X servers And before I go
and write a
"gtk_xcontext_switch(const char *display);" interface I'm wondering if
one already exists

... but it doesn't seem like gtk was developed with that in mind.

I've got a few Ideas

1. Spawn a child proccess to do gtk_init() ... add widgets and exit()
(the exit will cleanup gtk)
2. Spawn a child for every X server I have to serve (what a pain in the
ass :( )

Idealy I need to "Uninit" gtk without flaging X resources as "dirty".

If anyone has any Ideas or has had / having similar problems please mail
me at:

This is simply not possible with GTK+-1.2.x or GTK+-2.0.x.

GTK+-2.2, which should be released within a few months, will
have multiple display and multiple screen support as it's
main new feature.

Regards,
                                       Owen
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



Hi!

      Actualy I found a way to do it (only with pixbufs) ... If you look
at "gdk-pixbuf-xlib" module you'll find that with a couple of hours of
work (instead of "static Display *gdk_pixbuf_display" make an array of
struct "instance" containing all static variable's and adding "Display
*disp"
as the first arg to all function prototypes)

      All I have to do is a Cleanup function now (to do the oposite of
gdk_pixbuf_xlib_init(Display *display); )

      Anyhow ... its been about a week since I joined the list and asked this
question
(maybe it didn't get through right away) and at least someone responded

Much apreciation
      -Tristan
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

I'm impressed that you would dive into the guts of gdk like that...

If the goal is just to leave the images on the XServer so they're
available to other apps to use and not have the gtk app remain resident,
you might consider the XSetCloseDownMode call with the RetainPermanent
option.  It does exactly that -- lets an app close without getting rid
of any of the X resources.  However, you would still have to launch a
small image loading app per display, which goes against #2 of your
desires.  I have used it quite well in combination with the
gdk_pixmap_foreign_new call to share large pixmaps between GTK (2.0) apps.

--Brett

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Actualy thats almost exactly what I'm doing, I have (for example) N
programms 
running on the same computer but exported on diferent hosts. And N
exported
programms on the same hosts which all access the same images with
"foreign_new"
getting the XID from a shared memory cache. I'll need XSetCloseDownMode
to do
the exact opposite. I need resources to be freed _DIRECTLY_ after my
"image server"
does XCloseDisplay.
        This way I have one proccess to "Own" all the image files and manage
shared resources (the problem would obviously be that if P1 loads
resource
and P2 tries to share ... than P1 doesn't need it any more but P2 keeps
Using it ... P2 can never free the resource)

        -Tristan        


PS. What fun !



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]