Re: [PATCH] GtkLayout for Win32.



Owen Taylor wrote:
> 
> Wolfgang Glas <Wolfgang.Glas@hfm.tu-graz.ac.at> writes:
> 
> > Hi,
> >
> >   I just hacked out a rewrite gtklayout, which is running under Win32 at a first
> > glance.
> >
> > I uploaded a patch to the gtk+-1.2.4 distribution to ftp.gimp.org and include
> > the whole source file gtklayout.c and a README file to this mail and hope, that
> > it turns out to be useful.
> 
> It would be more useful to send in such a patch as a diff against
> the existing gtklayout.c, so we can tell what changed.

I'*ve uploaded the patch to ftp.gimp.org/incoming (diff -u, README etc.) and
expected it to become available for everybody. I included the whole source file
in mail, because I changed so much, that I thought it might be useful for a
first test of my new source to have the whole new version available at a glance.

> > Problem fixed:
> >
> >    The Guffaw-scrolling of gtklayout.c was heavily dependent on X11 event calls,
> > which wasn't compatible with Win32.
> >
> >    Also Win32 does not support static Gravity, so I implemented a fallback
> > scrolling method, which works halfway, but I consider it to be useful because
> > I get good results with gtkplot-4.0 under Win32.
> 
> I believe this is the wrong approach. All the complexity
> of gtklayout.c is an attempt to get around limitations in
> X11 that win32 does not share.

 You're right. I also think that there should be a more specific solution for
Win32, but unfortunately I learned programming X11 and I'm not willing to learn
Win32. Anyways, I think that the hevy dependance on X11 in the source is a
design problem. I consider my approach to be equally efficient with X11 but with
no X11 stuff in the toolkit source code. (So the source is independent of the
expose-event-driven window system used.)

>   - Windows has call to scroll the contents of a window.
>   - Windows does not have coordinate limitations of 32k.
> 
> So, basically, gtklayout.c needs to have a separate (much
> simpler) implementation on Win32 that takes advantage of
> these advantages.
> 
> > Technicalities:
> >
> >   This patch is an all-platform re-write of The guffaw-scrolling
> > in gtklayout.c.
> >
> >   As I can't handle configure events for the bin_window using gdk-calls,
> > I decided to mark
> > the temporary expose events from the scrolling by a contaminated
> > expose-event, which tells the expose-event handler to treat the temporary
> > exposures just the way that the original gtklayout.c did.
> 
> >   I also had to hack a facility to pop the expose events from the gdk
> > event stack instead of using X11-filters. This code should be replaced
> > by a gdk_event_... call, which works just like XCheckIfEvent or some
> > call which extends the possibilities of gdk_event_get_graphics_expose, which
> > is far too less flexible for the requirements of guffaw-scrolling.
> 
> The problem with this is that the translation from XEvent to
> GdkEvent actually affects the state of GDK. So doing this may
> screw things up. This is also why I removed the original
> gdk_event_check() call ... it had the possibility of creating
> all sorts of weird affects.

  Ok, if this is true, we should start a discussion on how to encapsultate the
configure/expose event extraction in a way, that helps both, X11 and Win32
developpers. I sent a message to the 
Win32 gtk-developer mailing list gimpwin-dev@gimp.org, in which I searched for
other people who want to change GtkLayout in order to run with Win32.
Unfortunately nobody answered. Even Tor Lillquist himself doesn't consider this
problem to have a high priority, because it apparently doesn't interfere with
the development of gimp.

  So I'd like to have other opinions like yours on my source and on the task to
port the whole scrolling facility of GtkLayout to Win32. Maybe we could find a
group that works the problem out in a reasonable way. Until this happens I
consider my patch to be a quite useful workaround for my puposes and I'm looking
forward on receiving a better solution.

> >   I tested the patch under IRIX-6.5 with gcc-2.95.1 and under Win32
> > using Tor Lillquist's gtk+19990828 snapshot. My aim was to port an application
> > which uses gtkplot-4.0 to Win32, which succeeded with this patch.
> >
> >   At my advice the patch should be carefully tested with a set of X Servers
> > and platforms. Maybe the original author Mark Owen should also srtess-test
> > the new scrolling source in order to make it a reliable replacement for
> > the former version.
> 
> Who? ;-)

  Sorry, I messed up your name.....

  Regards,
      
     Wolfgang

--
Mag. Wolfgang Glas
Institut fuer hydraulische Stroemungsmaschinen
Kopernikusgasse 24                              Phone:++43/316/873/7578
A-8010 Graz                                     Fax:  ++43/316/873/7577

mailto:Wolfgang.Glas@hfm.tu-graz.ac.at   
http://fhysmsg01.tu-graz.ac.at/Wolfgang.Glas/



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