Problems with Ruby 2.1 & Windows 8

Hi, I’ve been trying to upgrade my workplaces ruby version from 1.8.6 to
2.1, and one of our most important projects is done in Gtk2. I finally
have the gtk2 (2.2.5-x86-mingw32) installed properly in windows on ruby
2.1, but the code behavior is all wrong. I first thought it was
just some small api changes, but I think now its a serious bug.

I’ve made a small program to demonstrate.


require ‘gtk2’

window = Gtk::Window.new()
window.set_default_size(200, 200)

window.signal_connect(“destroy”) do
Gtk.main_quit
end

a = Gtk::VBox.new()

a.pack_start(Gtk::TextView.new())
a.pack_start(Gtk::Button.new())
a.pack_start(Gtk::TextView.new())

window.add(a)

window.show_all()
Gtk.main()

If I click on any of the TextViews or the button, the focus gets stuck
on that widget and I can’t click on any of the other widgets via mouse.
I have no idea why it would do that. If anybody happens to have a clue
on how to fix this I would really appreciate it! Otherwise I’ll have to
give up on the upgrade and run everything on ruby 1.8.6 until the end of
time…

Edit: Forgot to mention, I tried going back to the 2.1.0 gem and had
the same problem. Any further back and the gem’s don’t seem compatible
with ruby 2.1.

I did a bit more digging, trying different versions of GTK sans ruby
(running gtk-demo.exe) to see if I would have the same problem. It
works fine until GTK 2.18, where it has the same problem as my ruby
code (GTK 2.16 works fine).

Hmm, I’ll keep thinking about this.

In GTK 2.18, setting the environment variable GDK_NATIVE_WINDOWS fixes
it as well, but that doesn’t seem to work in later versions or the ruby
gem.

Man, I want to pull my hair out. I can’t find anyone else having the
same problems with GTK & Windows 8, so its probably something weird with
my system. :frowning:

Oh well.

Problem solved. I ran windows update and now everything magically
works. Guess it was a bug in windows. :slight_smile: