[MPlayer-dev-eng] GUI's icon - a X11 issue?

Steaphan Greene sgreene at cs.binghamton.edu
Sun Jun 12 22:18:23 CEST 2011


On 06/11/2011 06:10 PM, Ingo Brückl wrote:
> Although I'm relieved to finally have found a solution, there are questions
> and oddities left I'm very curious about. I don't know whether you are in the
> mood for looking into them (attached test.patch), but I'd really like to
> unravel some mysteries:
> 
> 1. Why does the GDK mask (most often) not work?
> 
> 2. Why do I get return code 1 instead of Success from XCopyArea() and
>    XCopyPlane()?
> 
> 3. Why is the mask copied with XCopyPlane() to the video window all black
>    and doesn't show any contours?

I believe the answers to most, if not all, of your questions and
problems lies deep inside GDK.  Basically, what's happening here is that
you are creating the GDK pixmap, but requesting its XID before GDK ever
actually uses it with X (it hasn't actually put the data there yet).
GDK must have realized this icon (and its mask) before its XID actually
has the data, and you can really use it.

For an example, I've inserted calls to the (deprecated) function
gdk_drawable_get_image() to realize these pixmaps in GDK before getting
their XIDs, and the problem seems to have been resolved.  I've attached
a patch (based on SVN) so you can test this yourself.  In this patch, I
also cleaned out some extra GTK stuff that's not really required just to
do this icon transfer.

Note: I am not saying this is the patch that should be applied to
mplayer.  It is just a demo of the problem.  I'm sure there is a better
way to realize these GtkDrawables into their X11 Pixmaps.

And, I also found a bug in a later section of code dealing with this
icon (a "long" was assumed to be 32-bits), which I have also corrected
in this patch.

-- 
Steaphan Greene <sgreene at cs.binghamton.edu>
Lecturer, Computer Science, Binghamton University
GPG public key: http://www.cs.binghamton.edu/~sgreene/gpg.key.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer_badicon_x11_fixdemo.patch
Type: text/x-patch
Size: 1220 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20110612/1846dafd/attachment.bin>


More information about the MPlayer-dev-eng mailing list