require 'gtk3'

TITLE = 'Show the XID example'

windows = Gtk::Window.new
windows.set_size_request(500, 300)
windows.move(0, 0)
windows.signal_connect(:event) {|widget, event|
  case event.to_s
  when /Gdk::EventFocus/,
       /EventFocus/
    puts 'Windows XID: '+windows.window.xid.to_s
    puts 'Size: '+windows.size.to_s
  end
}
windows.title = TITLE
windows.show_all
Gtk.main