[Geany-Devel] Geany with gtk+ 3.6.4 under Windows

Dimitar Zhekov dimitar.zhekov at xxxxx
Wed Jun 18 18:09:16 UTC 2014

On Tue, 17 Jun 2014 17:34:22 -0700
Matthew Brush <mbrush at codebrainz.ca> wrote:

> On 14-06-17 09:28 AM, Dimitar Zhekov wrote:
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x006e4340 in gdk_window_has_impl () from c:\tmp\scp\gtk+\bin
> > ...
> >
> > ...
> >
> > I coudn't get a proper HWND for Geany main window. Using
> > gdk_win32_window_get_handle(gdk_get_default_root_window()) works,
> > but the link UI may (or may not?) be displayed below the Geany
> > window, looking as if we blocked.
> >
> > A possible solution would be to use some Windows API directly, for
> > example GetActiveWindow().
> >
> There's tons of bug reports about crashers on a number of different 
> platforms when you search Google for "gdk_window_has_impl" (with and 
> without leading underscore), seems like it does/did miss a NULL check or 
> such. My first thought is that we try to access the native window handle 
> before it has actually been allocated (eg. before a map event or 
> whichever event fires once window resources have been allocated), but 
> it's just an idea.

Well it works on gtk+2... Whether the window actually exists can be
easily tested by GetActiveWindow(). Personally I see no reason to use
GDK macros, when we need exactly the active window.

> Maybe trying to do `gtk_widget_map(win)` (or 
> whichever is the correct function) before trying to access the HWND 
> would fix/hide the bug?

That's the main Geany window... I'm not sure it's a good idea.

> > 3. The items under cursor are not always highlighted. For example,
> > when I open Edit and move the mouse, the menu items are highlighted
> > fine, except for Preferences, which may or may not be highlighted.
> >
> I never noticed this when using GTK3 on Windows, but it's possible it 
> happened and I just didn't notice. Maybe there's something weird about 
> that particular menu item, like that we have one below it who's 
> sensitivity changes depending on runtime conditions, or the current UI 
> language/translation string, etc. It'd be interesting to move the menu 
> item up to the top of the menu, try changing the stock/icon/labels, 
> removing accelerator, etc. to see why only one item acts weird.

I gave this as a more or less stable example. Sometimes a button is not
highlighted, but it's rare and random.

> > 4. The second and especially the third tab in the About dialog cause
> > 100% CPU load and blocking.
> >
> IIRC we have some weird stuff in those tabs, custom wrapping widgets 
> which are no longer needed for GTK3, etc. Even on Linux the "Credits" 
> tab is fairly broken, it doesn't allow selection, context menu, etc. IMO 
> we should move this whole dialog to Glade, just use a plain GtkTextView 
> and add all the names into the Glade file instead of loading from static 
> arrays and doing all the markup formatting using string/markup 
> functions, etc or just use GtkAboutDialog (properly).

The second tab is mostly two labels with markup, and the third is
exactly a GtkTextView, which is disturbing for my Scope plugin.

> > 5. The waf build of geany plugins does not currently support gtk+3.
> >
> Not a problem with GTK3, just a matter of those using/responsible for 
> Waf to update the build system.

Not a gtk+3 problem, of course, just a note. I'll try to add gtk+3
support to test Scope.

> > Wikipedia calls gtk+3.4 "the first version of GTK+ 3 that works well
> > on Windows", but that seems to be an overstatement. Maybe 3.10+ with
> > the changed event loop and drawing will be better. Or worse...
> It might be assuming the "works well" is for applications coded against 
> GTK3, fully using the framework supporting the toolkit, not trying to 
> support gtk2 and 3 at the same time, and that don't have almost a decade 
> of cruft built up to work around issues which may or may not even exist 
> anymore in the toolkit or/on the supported Windows versions :)

Hello world? :) I haven't seen any large and popular application started
with gtk+3. Of course, some may be partially rewritten to take full
advantages of it.

> > For now, we'd better stick to gtk+2 under Windows.
> Even better would be to find out what is causing the problems and fix 
> the issues, most likely the stuff is going to be things we did slightly 
> weird in GTK2 that is no longer needed or doesn't work exactly the same 
> with GTK3. If we hold off switching to bundled version to GTK3, nobody 
> will use it and it won't get tested or fixed.

The event loop and drawing were changed considerably in 3.10. It may be
reasonable to wait a bit, and see how Geany works with it. After all,
these problems are specific to gtk+3 under Win~1.

> BTW, which Windows version and which GTK+ architecture bundle (32/64) 
> are you using, in case I get a chance to try and reproduce?

XP, 32-bit, OEM. Maybe I'll buy a new machine this year with 7 or 8.

E-gards: Jimmy

More information about the Devel mailing list