listening to stdin in the controlling terminal after gtk_main is called
- From: Dan Hitt <dan hitt gmail com>
- To: gtk-app-devel-list gnome org
- Subject: listening to stdin in the controlling terminal after gtk_main is called
- Date: Wed, 14 Sep 2016 21:51:46 -0700
HI All,
I'm writing a gtk application and i would like it to listen to stdin
in the controlling terminal after gtk_main() is called.
So for example, when you type a carriage return in the controlling
terminal, all the characters which have been typed since the last
carriage return are gathered up into a string, and the app receives
some event containing the string, and it has some handler that can
interpret and deal with it.
This would be analogous to listening for key presses in a window,
except that they don't come from a window, and instead of arriving a
character at a time they'd arrive a string at a time.
Now, i imagine it cannot be quite that simple, because that doesn't
sound like any of the events listed in gdkevents.h.
But on the other hand something along these lines must be possible
since applications like mpv certainly do listen to their stdin and
respond to it (as well as listening to characters that are typed to
their windows).
And there should be a select() or something to make it possible for an
apparatus such as gtk to do this.
And i don't even know how to google around for a solution :(
So i'd appreciate any hints on how to do this.
(And although it would be awesome to be able to read a character at a
time from stdin, a line at a time would certainly do, and i'd probably
have to plan on line-at-a-time anyway for the case when the app was
launched from a emacs buffer.)
TIA!
dan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]