Showing Gtk.Menu on pressing mouse button freezes the system



Hello.

I have a test application that uses GtkClutter. Popup menu Gtk.Menu is not shown while handling 
button_press_event of Clutter.Actor — instead the system freezes.
Versions of packages used are:
libgtk-3-0 — 3.18.9-1
libclutter-1.0-0 — 1.26.0-2
libclutter-gtk-1.0-0 — 1.6.6-1

Your help would be very appreciated.

*** main.vala
   Gtk.Builder builder;
   Gtk.Window window;
   GtkClutter.Embed clutterEmbed;
   Gtk.Menu popupmenu;
   Clutter.Actor mainstage;

   bool actor_clicked (Clutter.ButtonEvent evt)
   {
      popupmenu.popup (null, null, null, evt.button, evt.time);
      return true;
   }

   int main (string [] args)
   {
      if ((GtkClutter.init (ref args)) != Clutter.InitError.SUCCESS)
         return 1;

      builder = new Gtk.Builder ();
      try
      {
         builder.add_from_file ("popup_main.glade");
      }
      catch (GLib.Error ex)
      {
         assert (false);
      }

      window = new Gtk.Window ();
      clutterEmbed = new GtkClutter.Embed ();
      popupmenu = builder.get_object ("menu_main") as Gtk.Menu;
      mainstage = clutterEmbed.get_stage ();

      window.add (clutterEmbed);
      mainstage.button_press_event.connect (actor_clicked);

      window.show_all ();

      Gtk.main ();
      return 0;
   }

*** popup_main.glade
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
  <requires lib="gtk+" version="3.12"/>
  <object class="GtkMenu" id="menu_main">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <child>
      <object class="GtkMenuItem" id="option1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes">Element 1</property>
        <property name="use_underline">True</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="option2">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes">Element 2</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id="option3">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes">Element 3</property>
      </object>
    </child>
  </object>
</interface>


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