Hi;

On 27 March 2015 at 10:22, Lucas Levrel <llev...@yahoo.fr> wrote:

>>> - draw your "background" on bare_pixmap
>>>
>>> - when you have to redraw, just copy bare_pixmap to full_pixmap, add
>>> stuff
>>>   to full_pixmap, then display it:
>>>
>>>   gdk_draw_drawable(full_pixmap,copy_gc,bare_pixmap,0,0,0,0,-1,-1);
>>>   (add stuff to full_pixmap)
>>>   gdk_draw_drawable(d_area->window, copy_gc, full_pixmap, x, y, x, y,
>>> width,
>>> height);
>>>
>>> Where copy_gc has been defined this way:
>>>   GdkGC *copy_gc=d_area->style->fg_gc[GTK_WIDGET_STATE (d_area)];
>>
>>
>> This is really GTK+ 2.x only, and even then it's pretty much X11-only.
>
>
> It works in Windows, cross-compiled in Linux with "mxe" (MinGW cross env).

It works in Windows because GDK has essentially reimplemented bits of
X11 in the Windows backend. :-)

In practice, though, it's only as tested as the equivalent X11
concepts, and when they don't match to Windows concepts, that's where
bugs lie in wait.

>> Pixmaps are really Cairo surfaces, these days, and GCs are Cairo
>> contexts. The widget state is part of the GtkStyleContext, and the
>> gtk_render_* API substitute the background rendering. Even for GTK+
>> 2.x API you should not be using gdk_draw_* and GdkGC API at all,
>> unless your code is supposed to work with GTK+ 2.6.
>
>
> It is supposed to use the latest GTK+ 2 (2.24 I guess).

After GTK 2.8, you should be using the Cairo API for everything; some

> I'm eager to read a tutorial on GTK2 programming. I think I never found one,
> so I'm using the reference manuals, which is a rather tough way to learn
> indeed. (gtk-demo doesn't have examples of what I need)

You likely won't ever see a GTK 2 programming tutorial that is both up
to date and maintained, considering that GTK 2 is in deep maintenance
mode, and all the work goes towards developing (and documenting) GTK
3.

A good idea of what's needed to make your GTK 2 code use at least the
latest API in the 2.x series is to look at the GTK 2.x → 3.x migration
guide:

  https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html#id-1.6.3.3

This will help you drop the use of deprecated API, like the gdk_draw_* one.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to