Re: [Vala] stdout flushing? and button_click_event

Hi Karl,

On Sun, 2008-11-23 at 10:46 +0000, Karl Lattimer wrote:
I have a button_press_event function in my GtkWidget which should be
called when the mouse button is pressed, however it won't output
anything via stdout.printf(...) on button press. Instead it outputs when
motion_notify_event is called, I'm wondering if there is any requirement
for a flushing of stdout to ensure that the button press text goes out
on screen immediately rather than the next time a printf is called.

There is no Vala-specific output buffering, however, stdout in C is line
buffered by default, which means that you won't see the text until you
print a newline, so stdout.printf ("...\n") might help if you're not
adding a newline to the output yet.

Alternatively, you can also use stderr instead of stdout, stderr should
be unbuffered.

Also, is there such a thing as a button_click_event for brief clicks of
the mouse button? I need a button_release to behave differently to a
click event, so I want a momentary click to fire off one function and a
press and release to fire off another.

Is the long click for drag and drop? The way this usually works in GTK+
is to use gtk_drag_check_threshold to check whether the cursor has moved
far enough to be considered a drag and drop operation, as far as I can
tell. Long clicks without cursor moving are not handled differently in
most widgets.


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