gtk3 - GTK motion notify event, is_hint always true -


i'm new gtk , trying vala feel. (i'm using gtk+3.0)

can explain why event->is_hint seems return 1? docs impression it's supposed cut-down excess motion events.

here's small vala sample. motion_notify_event handler never gets chance follow else-clause.

am grokking wrong, or making stupid mistake or gtk+3 thing that's not ready yet?

/* compile: valac --pkg gtk+-3.0 appname.vala */  using cairo;  namespace demo {  public class scribble : gtk.drawingarea {    public scribble () {     this.add_events ( gdk.eventmask.pointer_motion_mask | gdk.eventmask.pointer_motion_hint_mask );     this.set_size_request (100,100);   }    private void draw_circ ( cairo.context cr ) {       var y = get_allocated_height () / 2;       var radius = double.min (get_allocated_width () / 2, get_allocated_height () / 2) - 5;       cr.arc (y, y, radius, 0, 2 * math.pi);       cr.set_source_rgb (1, 1, 1);       cr.fill_preserve ();       cr.set_source_rgb (0, 0, 0);       cr.stroke ();   }    public override bool draw ( cairo.context cr ) {       this.draw_circ ( cr);       return false;   }    public override bool motion_notify_event (gdk.eventmotion event ) {     //seems event.is_hint *always* 1     //stdout.printf ( "is_hint: %d\n", event.is_hint );      if (event.is_hint == 1) {       stdout.printf ( "is hint\n" );       gdk.event.request_motions(event); //always 1, what's point?     } else {       //never gets here. why?       stdout.printf ( "normal motion at: %g, %g\n", event.x, event.y );     }     return true; //false not change either.   }  } }  int main ( string[] args ) {   gtk.init ( ref args );   var window = new gtk.window ();   var scribble = new demo.scribble ();    window.add (scribble);   window.show_all ();   window.destroy.connect (gtk.main_quit);    gtk.main ();    return 0; } 

not is_hint (i can't comment) if want cut down motion notifications, consider using idle_add.

it can used process motion events after there no longer motion events.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -