[MPlayer-dev-eng] GUI's icon - a X11 issue?
Steaphan Greene
sgreene at cs.binghamton.edu
Mon Jun 13 16:46:15 CEST 2011
On 06/13/2011 06:16 AM, Ingo Brückl wrote:
> Steaphan Greene wrote on Sun, 12 Jun 2011 16:18:23 -0400:
>> On 06/11/2011 06:10 PM, Ingo Brückl wrote:
>>> 1. Why does the GDK mask (most often) not work?
>
>> 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.
>
> This carries conviction, but raises the question why the icon itself seems
> to be ok, while the mask is a problem. Looking into the GDK source code
> shows, that gdk_pixmap_colormap_create_from_xpm_d() (finally somewhere) does
> a gdk_draw_pixbuf() for the icon, which seems to execute an X11 draw then.
> For the mask, there is no such draw, which may be the explanation.
I believe you are correct. However, I'd suggest that whatever you do to
realize the mask you still also do to the icon itself, just in case.
>>> 2. Why do I get return code 1 instead of Success from XCopyArea() and
>>> XCopyPlane()?
>>>
> A look into the X11 sources reveals the explanation for #2 above. Both
> functions end with "return 1" instead of "return Success". So how am I
> supposed to check the return code of a X11 function? 1 can be BadRequest as
> well.
Ahh, right. X11 is not really a graphics library, but a protocol, with
the server (display) and client (graphical program) decoupled. The
errors you are talking about are not return values, but error codes for
events generated by X. See the documentation on the XErrorEvent
structure for more details.
>>> 3. Why is the mask copied with XCopyPlane() to the video window all black
>>> and doesn't show any contours?
>
> #3 remains a mystery to me.
I'm afraid I didn't look into that. My random guess would be that the
foreground and background colors (used by XCopyPlane) were both black.
>> I'm sure there is a better way to realize these GtkDrawables into their X11
>> Pixmaps.
>
> With your indication of "realization" the gtk main loop came into my mind and
> I was wondering whether a call would perform this "pending" task. It seems
> that it does.
Perhaps, but calling that loop seems like overkill. Something like
creating a temporary drawable, copying each of these pixmaps to that
drawable with GDK, then freeing that temporary drawable, should do it.
--
Steaphan Greene <sgreene at cs.binghamton.edu>
Lecturer, Computer Science, Binghamton University
GPG public key: http://www.cs.binghamton.edu/~sgreene/gpg.key.txt
More information about the MPlayer-dev-eng
mailing list