Re: File Descriptor Input
- From: Dave Benson <daveb ffem org>
- To: Shiraz Baig <shiraz_baig yahoo com>
- Cc: gtk-list gnome org
- Subject: Re: File Descriptor Input
- Date: Thu, 27 Mar 2003 20:18:09 -0800
your problem is that standard input is line-buffered,
so you only get input when ENTER is pressed.
(in the terminal from which you run the program!)
I don't know exactly the behavior you want when you "trap the keyboard".
if you are writing a gui, you must use X windows (eg gtk_widget_add_events() and
connecting to the "key-pressed-event" signal (only works with a toplevel widget!))
if you are writing a ncurses program, there's other functions
you must read about in that library...
in any event, without special calls to tcsetattr to put stdin in "raw" mode,
gdk_input_add( fileno(stdin), ...) is unlikely to be what you want.
the reason why no one responds: keyboard handling is a mess,
and your question seems vague to someone who knows the answer ;)
- dave
On Thu, Mar 27, 2003 at 07:40:55PM -0800, Shiraz Baig wrote:
>
> --- Paul Davis <paul linuxaudiosystems com> wrote:
>
> First Point:
> ------------
> > that's not what it says. it says:
> >
> > gint gdk_input_add (gint
> > source,
> >
> > GdkInputCondition condition,
> >
> > GdkInputFunction function,
> > gpointer data);
>
> /**** Ok, I have now revised it as follows ***/
>
> void input_callback( gpointer data,
> gint source,
> GdkInputCondition condition )
> {
> gchar *mesg;
> mesg =data;
> g_print("Got something.\n");
> }
>
> main()
> .........
> gint gdk_input_add( fileno(stdin),
> GTK_INPUT_READ,
> (GtkInputFunction) input_callback,
> gpointer data );
> .............
>
> But it still does not invoke that function call. My
> purpose is that at least the function be called. Then
> I can start thinking of something else.
>
> Second Point:
> -------------
> > you can't do this. if you don't read the data, then
> > your function will
> > be called again immediately, because there is still
> > data to be read.
>
> I wish, it is called again and again :-)
> My problem is that it is not being called at all :-(
>
> Third point:
> -----------
> > this is completely wrong. i think you need a little
> > experience with C programming.
>
> May be I failed to explain myself. I have been doing
> programming in c for last 10 years. In fact, recently,
> ,I have written a multi-threaded, multiplexed (stdin
> and socket input), multicast application in
> transmission of video image with RTP protocol.
> So, I hope, I have adequate experience.
>
> Thanks for bearing with me, and listening to my, may
> be foolish questions.
>
> Bye and I shall wait for your answer. At least you are
> responding , others are not.
>
> bye
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
> http://platinum.yahoo.com
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]