[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    [gtkmm] problem using Rulers and Statusbar
From:       Denis Korzunov <disya21 () yandex ! ru>
Date:       2004-04-27 12:44:15
Message-ID: 743629829.20040427194415 () yandex ! ru
[Download RAW message or body]

I have some problems using Gtk::Statusbar and Gtk::VRuler and
Gtk::HRuler.
I've connected Gtk::DrawingArea::signal_motion_notify_event() with handlers:
(class Stat_bar: public Gtk::Statusbar)
bool Stat_bar::refresh(GdkEventMotion* motion_event)
{
     std::stringstream stream;
     stream<<" x: "<<event->x<<" y: "<<event->y;
     int id = push(stream.str(),0);
     return false;
}

(class H_Ruler: public Gtk:: HRuler)
bool H_Ruler::refresh(GdkEventMotion* event)
{
     if(event) property_position().set_value(event->x);
     return false;
}

It works, but too slow. CPU is loaded on 90-100% when I'm
moving mouse pointer. I thought that I did something wrong connecting
signal with handlers, but I've got same results with example rulers.cc.
Is there any way to do this handling properly?
I've also tried this:
...
conn=Glib::signal_timeout().connect(
   SigC::slot(Stat_bar_obj, &Stat_bar::refresh_on_timeout ), 20, Glib::PRIORITY_LOW);
...
bool Stat_bar::refresh(GdkEventMotion* motion_event)
{
    x=event->x; y=event->y;
    flag=true;
    return false;
}
bool Stat_bar::refresh_on_timeout()
{
    if(flag)
    {
     std::stringstream stream;
     stream<<" x: "<<x<<" y: "<<y;
     int id = push(stream.str(),0);
     flag=false;
    }   
    return true;
}

It works, but not very good.

I would highly appreciate any help.
-- 
Best regards,
 Denis                          mailto:disya21@yandex.ru

_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic