strange behaviour with goocanvas signal handler
- From: "Klaus Rudolph" <lts-rudolph gmx de>
- To: gtkmm-list gnome org
- Subject: strange behaviour with goocanvas signal handler
- Date: Fri, 28 Nov 2014 08:43:36 +0100
Hi,
I have to deal with a workaround for a bug https://bugzilla.gnome.org/show_bug.cgi?id=711709
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);
dialog.show_all_children();
dialog.run();
// 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";
outer->property_fill_color()="blue";
root->add_child( outer );
sigc::connection conn2= outer->signal_button_press_event().connect( sigc::ptr_fun(&ShowDialog));
win.add(m_canvas);
win.show_all_children();
Gtk::Main::run(win);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]