Strange display problem with gtk-win32 and VC++

2010-11-06 Thread John Emmas
For the past few years I've been migrating my Windows apps to GTK+ which I now 
tend to use in preference to Microsoft's MFC.  However, I've always been 
conscious of the fact that the official gnome binaries are (apparently) built 
using the 'C' runtime that equates to VC6.  VC6 has been obsolete for nearly a 
decade and is utterly useless for building modern-day apps.  As it happens, I'm 
building with VC8 but I'm worried about the potential problems of mixing VC6 
and VC8 runtimes in the same application.

Fortunately, the more recent releases of GTK+ come with Visual Studio projects 
supplied as part of the sources.  So I decided to try and build libgtk-win32 
and its dependencies, using VC8.

To test my build, I used a very simple "Hello World" app.  In fact it's the 
Hello World example from Andrew Krause's book 'Foundations of GTK+ 
Development'.  It launches a very simple window whose title is "Hello World!".  
The window has a gtk label which is supposed to display the text "Welcome to 
GTK+".

If I build the app and link it to the official gnome binaries, it works 
perfectly well.  However, if I rebuild those binaries (using the various Visual 
Studio projects supplied with gtk / glib etc) the app doesn't work.  The window 
and title display correctly but the label (which is supposed to say "Welcome to 
GTK+") just displays a sequence of 15 squares.  The number of squares is always 
related to the label.  So if I shorten the label text to 10 characters, I get 
10 squares etc. I'm not sure if this mailing list supports file attachments but 
if there's a way to attach a file, I have a small screenshot available which 
illustrates the problem.

Anyway, has anyone here ever seen this kind of thing before?  Or can anyone 
suggest a particular place where I should start looking for the problem?

John
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Strange display problem with gtk-win32 and VC++

2010-11-06 Thread Guy Rouillier

On 11/6/2010 1:03 PM, John Emmas wrote:


If I build the app and link it to the official gnome binaries, it
works perfectly well.  However, if I rebuild those binaries (using
the various Visual Studio projects supplied with gtk / glib etc) the
app doesn't work.  The window and title display correctly but the
label (which is supposed to say "Welcome to GTK+") just displays a
sequence of 15 squares.  The number of squares is always related to
the label.  So if I shorten the label text to 10 characters, I get 10
squares etc. I'm not sure if this mailing list supports file
attachments but if there's a way to attach a file, I have a small
screenshot available which illustrates the problem.


If it works with the official GTK binaries (which is what I assume you 
meant when you said "gnome binaries"), I would just stick with those. 
You don't want to be in the business of supplying GTK binaries.  That's 
a difficult, time-consuming task; just look at all the conversations 
about the Windows GTK libraries involving Tor - no one ever wants to 
volunteer to help.


Since the number of squares equals the number of characters in the label 
you are trying to display, the problem appears to be one of font 
rendering.  Other than that meager observation, I can't really help.


--
Guy Rouillier
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Strange display problem with gtk-win32 and VC++

2010-11-07 Thread Tor Lillqvist
>no one ever wants to volunteer to help.

Actually, that is not true. For instance, the ms-windows theme engine
is now effectively maintained once again and compiles and maybe even
works in gtk+ master. And for bulding the GTK+ stack for Windows (32-
and 64-bit), I very much plan to stop doing it myself "manually"
eventually, and instead just make use of the great work done by my
colleague Fridrich Štrba who has set up cross-compilation of a lot of
stuff (including the GTK+ stack) in the openSUSE Build Service (OBS).
The Windows binaries etc in OBS are very usable already, the only
slight problem is that they are found inside "noarch" RPM archives.
(But at least 7zip handles RPM archives fine, I am told. For instance,
the GIMP installer uses GTK+ stack binaries from OBS.

Also, there is a person actively submitting patches for the Visual
Studio project files. (So if you are trying to use those with a
current GLib or GTK+, please check bugzilla for ones that actually
work...)  I definitely would like him to get a GNOME git account so
that he can do that directly. So if somebody reading this can make
that happen quicker, please do...  (Especially as I have been very
lazy in applying those patches...)

--tml
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Strange display problem with gtk-win32 and VC++

2010-11-07 Thread John Emmas

On 7 Nov 2010, at 00:15, Guy Rouillier wrote:

> 
> Since the number of squares equals the number of characters in the label you 
> are trying to display, the problem appears to be one of font rendering.
> 
Thanks Guy.  I think I've been easing towards that conclusion myself but it's 
good that someone else is thinking along the same lines.


> 
> If it works with the official GTK binaries (which is what I assume you meant 
> when you said "gnome binaries"), I would just stick with those. You don't 
> want to be in the business of supplying GTK binaries.  That's a difficult, 
> time-consuming task; just look at all the conversations about the Windows GTK 
> libraries involving Tor - no one ever wants to volunteer to help.
> 
Well I probably would.  I can appreciate where you're coming from Guy, but 
there are bigger ramifications to consider.  What I DON'T want to be doing is 
to distribute an application made with a mishmash of incompatible compilers and 
different 'C' runtimes.  If my information is correct, the distributed GTK 
binaries were built with MinGW and gcc.  I won't be using either of those so 
it's important that I find out what's wrong.  The libraries appear to build 
perfectly with VC++ but subsequently they don't work (or at least, they don't 
"appear to" work) once they're built.

Strange as it may seem, the very reason I embarked upon building everything 
with VC++ was that I was already seeing this problem when using the official 
GTK binaries.  The difference then was that it was only an occasional problem 
whereas now I seem to have it permanently.  However, that could be helpful in 
tracking it down!  It might well be something as simple as a path problem.  In 
fact the more I think about it, the more likely that seems.


On 7 Nov 2010, at 07:31, Tor Lillqvist wrote:

> 
> Also, there is a person actively submitting patches for the Visual
> Studio project files. (So if you are trying to use those with a
> current GLib or GTK+, please check bugzilla for ones that actually
> work...) 
> 


Thanks Tor, I'll do that.  I'd be happy to help in testing the Visual Studio 
builds since I definitely have a vested interest in seeing them work reliably!  
To be honest, I can't quite believe that something so obvious would have been 
missed, so I'm inclined to think there's some kind of configuration issue at my 
end.  In case you've ever bought Andrew Krause's book (Foundations of GTK+ 
Development) I've simply built listing 2-2 on page 23.  There can't be more 
than 30 lines of code.  I've changed the label text slightly but that's 
essentially what I'm using to test with.

Going back to my "path" theory  is there possibly a config file somewhere 
where I need to set up my Windows paths or something like that?  GTK+ normally 
handles that kind of thing very intelligently (which is why I didn't think to 
check) but maybe I've just got a simple configuration problem here.

If not, I'd be happy to liaise with your colleagues to find out why this isn't 
working.  I feel sure it'll be something blindingly obvious that I've forgotten 
to set up.

John
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Strange display problem with gtk-win32 and VC++

2010-11-07 Thread Vincent Torri



On Sun, 7 Nov 2010, Tor Lillqvist wrote:


no one ever wants to volunteer to help.


Actually, that is not true. For instance, the ms-windows theme engine
is now effectively maintained once again and compiles and maybe even
works in gtk+ master. And for bulding the GTK+ stack for Windows (32-
and 64-bit), I very much plan to stop doing it myself "manually"
eventually, and instead just make use of the great work done by my
colleague Fridrich ÿÿtrba who has set up cross-compilation of a lot of
stuff (including the GTK+ stack) in the openSUSE Build Service (OBS).
The Windows binaries etc in OBS are very usable already, the only
slight problem is that they are found inside "noarch" RPM archives.
(But at least 7zip handles RPM archives fine, I am told. For instance,
the GIMP installer uses GTK+ stack binaries from OBS.


What annoyes me is that plenty of people are doing that, and there is no 
central repository for dependencies. On 32bits, there is more or less 
gnuwin32, but you propose also your packages on the gtk site and i'm sure 
kde guys are doing that too.


I fear that it will be the same for 64bits packages. I know 4 places where 
there are packages built with the mingw-w64 compiler and there might be 
more.


What about joining forces and make one unique official repository for 
packages on Windows ?


Vincent Torri___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Strange display problem with gtk-win32 and VC++

2010-11-07 Thread Tor Lillqvist
> What about joining forces and make one unique official repository for
> packages on Windows ?

You mean, like there is one unique official Linux distribution?

--tml
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Strange display problem with gtk-win32 and VC++

2010-11-07 Thread Vincent Torri



On Sun, 7 Nov 2010, Tor Lillqvist wrote:


What about joining forces and make one unique official repository for
packages on Windows ?


You mean, like there is one unique official Linux distribution?


nice comment

Vincent Torri
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Strange display problem with gtk-win32 and VC++

2010-11-07 Thread John Emmas

On 7 Nov 2010, at 07:31, Tor Lillqvist wrote:

> 
> if you are trying to use those with a current GLib or GTK+,
> please check bugzilla for ones that actually work
> 

I found this info on bugzilla:-

https://bugzilla.gnome.org/browse.cgi?product=gtk%2B

but it wasn't very obvious which releases are considered as stable.  However, I 
remembered later that libgtk didn't even include VC++ build projects until 
around version 2.22, so I doubt if it'd be possible to use anything much older 
than that.  I couldn't go back to 2.16 say, which has often been described as 
the most stable version.

I also checked my various config.h files to see if there was anything relating 
to fonts or font folders - but the only settings I found were HAVE_CAIRO and 
HAVE_CAIRO_WIN32.  The latter tells cairo to use the Windows GDI for font 
rendering (I think).  I'm not sure if either setting is relevant but in any 
case, both were #defined to 1.  Doesn't seem as if I need to set up any paths 
anywhere but I'll continue looking.

Although the label widget displays those garbage squares that I described, the 
window title actually displays correctly.  Not sure if that's telling me 
anything.  My guess at the moment is that there's no font being loaded for the 
label widget.  Does that seem like a possible explanation?

John
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Strange display problem with gtk-win32 and VC++

2010-11-07 Thread John Emmas

On 7 Nov 2010, at 11:39, John Emmas wrote:

> 
>  My guess at the moment is that there's no font being loaded
>  for the label widget.  Does that seem like a possible explanation?
> 

Oops, how silly of me!  Just noticed some text in the console window saying 
"Pango-WARNING **: failed to choose a font, expect ugly output. 
engine-type='PangoRenderWin32', script='latin'
 
I guess that narrows it down a bit..!  
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Strange display problem with gtk-win32 and VC++

2010-11-07 Thread Jaroslav Šmíd
So try to set your desired font - edit or create
(GTKDIR)\etc\gtk-2.0\gtkrc and add line like
gtk-font-name = "Segoe UI"

On Sun, Nov 7, 2010 at 2:19 PM, John Emmas  wrote:
>
> On 7 Nov 2010, at 11:39, John Emmas wrote:
>
>>
>>  My guess at the moment is that there's no font being loaded
>>  for the label widget.  Does that seem like a possible explanation?
>>
>
> Oops, how silly of me!  Just noticed some text in the console window saying 
> "Pango-WARNING **: failed to choose a font, expect ugly output. 
> engine-type='PangoRenderWin32', script='latin'
>
> I guess that narrows it down a bit..!
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>



-- 
Jaroslav Šmíd
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Strange display problem with gtk-win32 and VC++

2010-11-08 Thread John Emmas
On 7 Nov 2010, at 18:14, Jaroslav Šmíd wrote:

> So try to set your desired font - edit or create
> (GTKDIR)\etc\gtk-2.0\gtkrc and add line like
> gtk-font-name = "Segoe UI"
> 
Thanks for the tip.  In fact it turned out to be due to the fact that an entry 
in my pango.modules file had spaces in its pathname (in fact, there was only 
one entry for my simple testing purposes).  This was causing the file contents 
to be incorrectly hashed when the file was being processed.  I don't quite 
understand why everything worked when I substituted the official GTK binaries 
but I'm guessing there might be some fallback mechanism which works when built 
with gcc but doesn't work in the VC++ build for some reason.  Anyway, 
surrounding the path with quotation marks fixed the problem.  Thanks.

John
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list