How to get notified when a GdkWindow becomes hidden/invisible/unrealized?



Hello,

Whats the best way to get notified when an GdkWindow is
invisible/hidden/destroyed (=minimized by the WM, hidden by the
program, ...), is the unrealized-signal what I search for?
And whats the best way to listen to these events if I would like to
listen directly "from inside" GdkWindow, i guess adding a singal
handler in GdkWindow would be a bit stupid ;)

I would need to know about these events since I plan to destroy my
backbuffer-pixmap when one of these events happen, for now I keep it
the whole lifetime of the GdkWindow.

Thank you in advance, lg Clemens

The way I decided to go was to create one backbuffer-pixmap per root
window (since otherwise e.g. just a plain gftp consumes 15mb for
pixmaps) and share it for all sub-windows.
This works quite well, I was able to run all gtk programs I've
installed, I only saw a strange corruption with all spinner widgets,
but everything else worked fine :-)
Gtkperf reports 70s vs 45s (modified version).

I know the code is awful, its just a prototype, its located directly
inside of gdk_window_begin_paint_region.
I don't know about GTKs internals, could somebody please be so kind to
check wether it violates some of GTKs assumptions (threading,
clipping, ....). Since the spinner widget is corrupted I guess
something is not working the way it should.
Is it correct to assume that only one window is painting itself at a time?

............

	root_window = (GdkWindowObject *)
gdk_screen_get_root_window(gdk_drawable_get_screen (GDK_DRAWABLE
(window)));
	backing_store = &root_window->back_buffer;

	if(backing_store->pixmap != NULL)
	{
		if(backing_store->width >= clip_box.width && backing_store->height
= clip_box.height)
		{
			paint->pixmap = backing_store->pixmap;
		}else
		{
			g_object_unref (backing_store->pixmap);
			backing_store->pixmap = NULL;
		}
	}

	if(backing_store->pixmap == NULL)
	{
		backing_store->width = MAX (clip_box.width, 1);
		backing_store->height = MAX (clip_box.height, 1);
		backing_store->pixmap = gdk_pixmap_new (window,
backing_store->width, backing_store->height, -1);
		paint->pixmap = backing_store->pixmap;
	}

 paint->surface = _gdk_drawable_ref_cairo_surface (paint->pixmap);
..............



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