Re: porting Xlib/Motif apps to GTK+



As a short-term fix I think it'd be fine to target gtk2, it's going to be
around for years.

In my opinion, the time of xor rubber banding has passed, it's just too
hard to get it working reliably in complex situations. Once you have double
buffering, background scrolling, overlapping display objects with mouseover
highlights, background animations in some of the objects .... argh, knowing
in every possible case for every pixel in the line whether an xor draw will
set or unset is almost impossible.

You need a compositing model instead. Your draw window should be a stack of
2D layers. In your expose callback, paint that part of the window back to
front. Do rubberbanding by creating a temporary top layer with the rubber
band in and queueing refresh events for the pixels it touches as it moves.
Very simple, reasonably efficient, easy to make flicker-free with gtk's
automatic double-buffering.

J

On Wednesday, 29 February 2012, Roger Davis wrote:


Hi John, thanks for your comments!

 As you say, gdk_ is a thin layer over the X11 drawing system, so
converting that is pretty easy. Gdk has quite a few helpers too, eg.
stuff for rendering a 24-bit image to whatever visual the server has,
so you can save some code there. It shouldn't be a huge effort to
port.


Too bad all of the GDK Xlib wrapper functions appear to be completely
removed from GTK 3, it would have been a much easier port! Oh well.

Roger




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