[Novalug] keyboard/console input blocking problem

Ed James edward.james@gmail.com
Thu Oct 11 18:04:16 EDT 2012


Hi Greg,

   I'm way past the tutorial stage, which is why I'm hitting the more
complicated issues.  I know how to deal with keyboard input that
is entered when the X Window created by myProgram has focus.
Thar's just pulling stuff off the event queue.  I've written quite a few
X Window programs, including my own widget library from scratch
using C++.

My problem deals with reading keyboard data from the terminal emulator
(which launched myProgram) when it has input focus.

   The terminal window is just a simple command-line interface.  When
the myProgram window has focus, it's a blank window that doesn't do
anything, but does capture mouse and keyboard activity and results in
event queue activity.  That's the easy part.  But move focus to the terminal
window, and stuff typed into the terminal window is read by myProgram
when I hit <ENTER>.  That's just a simple read via the C++ cin.  The
problem is that the terminal reading is blocked until <ENTER> is hit,
so my input loops blocks.  I'm trying to un-block it, similar to using
a socket in nonblock mode.

   So, the answer to your question is I'm using cin in a C++ program to
read console/keyboard input.

   I don't know much about recordmydesktop, except for about 2 minutes
of googling when you suggested it.  It seems interesting, so I'll check it
out, and tnx for that suggestion.

   One more thing - if worse comes to worse, I'll just abandon trying to
capture terminal input commands and collect the keyboard input via
the event queue.  It's a kludge, but if it work...yay!  Meantime, I'm
playing with pthread code.

Ed James

On Thu, Oct 11, 2012 at 5:40 PM, greg pryzby <greg@pryzby.org> wrote:
> recordmydesktop can help show what you are trying to do.
>
> what command are you using to read keyboard input?
>
> http://user.xmission.com/~georgeps/documentation/tutorials/Xlib_Beginner.html
> This might help but w/o knowing HOW you are doing it now, I can't be
> sure. I think the example will capture EACH keystroke, which is what
> you want.
...



More information about the Novalug mailing list