strange behaviour with goocanvas signal handler


I have to deal with a workaround for a bug

But the behavior is quite strange!
After pressing on the circle a dialog is shown (expected). If I press the ok button on the dialog, the whole 
window hangs on the mouse pointer! This is really not what I expect! :-)

To reproduce it:

compile prog with:
/opt/linux-gnu_4.8.2/bin/g++ `pkg-config gtkmm-3.0 --cflags` `pkg-config goocanvasmm-2.0 --cflags` 
--std=c++11 -Wall --pedantic -Wextra -O2 `pkg-config gtkmm-3.0 --libs` `pkg-config goocanvasmm-2.0 --libs` 
main.cpp -g -o go

and main.cpp is:

#include <gtkmm.h>
#include <goocanvasmm.h>
#include <sigc++/sigc++.h>
Goocanvas::Canvas m_canvas;

bool ShowDialog( const Glib::RefPtr<Goocanvas::Item>& item, GdkEventButton* ev) 
    enum { OK };
    Gtk::Dialog dialog;
    dialog.add_button( Gtk::Stock::OK, OK);

    // this line SHOULD! fixes the problem reported in BUG 711709
    m_canvas.pointer_ungrab( item, ev->time);
    return false;

int main(int argc, char* argv[])
    Gtk::Main app(&argc, &argv);
    Goocanvas::init("example", "0.1", argc, argv);
    Gtk::Window win;

    m_canvas.set_size_request(640, 480);
    m_canvas.set_bounds(0, 0, 800, 800);
    Glib::RefPtr<Goocanvas::Item> root = m_canvas.get_root_item();

    Glib::RefPtr<Goocanvas::Ellipse> outer = Goocanvas::Ellipse::create( 100,100,20,20);
    outer->property_line_width() = 5;
    outer->property_stroke_color() = "red";
    root->add_child( outer );

    sigc::connection conn2= outer->signal_button_press_event().connect( sigc::ptr_fun(&ShowDialog));


    return 0;

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