Confusion over X Resources
- From: Dave Foster <daf minuslab net>
- To: gtkmm-list gnome org
- Subject: Confusion over X Resources
- Date: Wed, 21 Jun 2006 01:04:10 -0400
Hi all-
I've been developing a background setter/previwer/restorer with gtkmm
for a number of months with a friend of mine. It's quite usable at the
moment, but not very well rounded, it has an issue of leaking pixmaps
and it has some bad interaction with other programs (other background
setters can kill my program in its tracks!).
I'm trying to get to the bottom of this problem. To briefly outline
what happens to set the background image of X (note: this is NOT using
gnome/nautilus to draw the background):
- Open a connection to the X display
- Execute XSetCloseDownMode() and set it to RetainPermanent
- Load from file, scale or whatever, copy Pixbuf to a Pixmap
- Destroy prior pixmap
- Set the background of the root window
- Set two named X atoms to the id of the new pixmap
- Close connection to the X display
In my set background function, I open a connection using
Gdk::Display::open(the_display_name) (it supports multihead setups,
which I run). I use the GDK_DISPLAY_XDISPLAY() macro to get the
Display* pointer so I can call XSetCloseDownMode() and set the proper
atoms.
Using the GDK wrappers of gtkmm I create my pixbuf, scale or whatever,
create a Gdk::Pixmap, and copy the pixbuf into that. I paint the
background, set the atoms, and that is all. However, the connection
never appears to close, becuase if I run a program like feh to set the
background from the command line, my program immediatly dies, terminated
by the call to XKillClient() which is supposed to kill the creator of
the pixmap (remember the close down mode is permanent).
Two issues:
- If I am creating and closing a connection via Gdk::Display::open()
shouldn't it be then separate from my main connection, thus not being
subject to getting killed?
- If I explicitly call flush() and close() on my Gdk::Display instance,
I get a segmentation fault. The backtrace for this appears to be in the
RefPtr destructor. (see below) Is this a bug?
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1223510336 (LWP 6436)]
0xb7bdb3d0 in gdk_display_x11_dispose ()
from /usr/lib/libgdk-x11-2.0.so.0
(gdb) bt
#0 0xb7bdb3d0 in gdk_display_x11_dispose ()
from /usr/lib/libgdk-x11-2.0.so.0
#1 0xb7aabf2b in g_object_unref () from /usr/lib/libgobject-2.0.so.0
#2 0xb772f520 in Glib::ObjectBase::unreference ()
from /usr/lib/libglibmm-2.4.so.1
#3 0x08058941 in ~RefPtr (this=0xbf9b32b0) at refptr.h:179
#4 0x080584a2 in SetBG::set_bg (disp= 0xbf9b33a0, file= 0xbf9b339c,
mode=SetBG::SET_SCALE, bgcolor= 0xbf9b3398) at SetBG.cc:219
*trim*
(SetBG::set_bg is my program)
If you are wondering why feh or similar calls XKillClient, see this
link:
http://www.eterm.org/docs/view.php?doc=ref#trans
The source to my project can be found at:
http://svn.syscrash.ca/nitrogen/trunk/ or I can give relevant extracts
if needed. The function which is giving the problems is SetBG::set_bg
in http://svn.syscrash.ca/nitrogen/trunk/src/SetBG.cc
Sorry for the long read on my first post, please someone have some idea
of what to do!
Thanks!
dave
--
Dave Foster <daf minuslab net>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]