Re: wscons API question: input handling?

2019-02-21 Thread joshua stein
On Thu, 21 Feb 2019 at 08:49:26 +0200, Leonid Bobrov wrote:
> On Wed, Feb 20, 2019 at 08:37:59PM -0500, James Huddle wrote:
> > is ncurses too high-level for your needs?  That might work.
> > 
> 
> I said I need a direct access to input devices, ie, /dev/wskbd* and
> /dev/wsmouse*, not a library for text UI. ncurses won't work for what
> I need, and I need to port libinput which works with input devices
> directly, get it?

https://github.com/mpieuchot/libinput



Re: wscons API question: input handling?

2019-02-20 Thread Leonid Bobrov
On Wed, Feb 20, 2019 at 08:37:59PM -0500, James Huddle wrote:
> is ncurses too high-level for your needs?  That might work.
> 

I said I need a direct access to input devices, ie, /dev/wskbd* and
/dev/wsmouse*, not a library for text UI. ncurses won't work for what
I need, and I need to port libinput which works with input devices
directly, get it?

libinput is a library to handle input devices in Wayland compositors and
to provide a generic X.Org input driver. It provides device detection,
device handling, input device event processing and abstraction so
minimize the amount of custom input code compositors need to provide the
common set of functionality that users expect.
https://www.freedesktop.org/wiki/Software/libinput/



Re: wscons API question: input handling?

2019-02-20 Thread James Huddle
is ncurses too high-level for your needs?  That might work.

On Tue, Feb 19, 2019 at 1:27 PM Leonid Bobrov  wrote:

> On Tue, Feb 19, 2019 at 04:01:08PM +, tfrohw...@fastmail.com wrote:
> > Is the package x11/xbindkeys what you are looking for?
> >
>
> No, I need a direct access to keyboard outside X11. If I understand
> wscons, I might help to port libinput to OpenBSD (and send patches to
> upstream) to have usable Wayland compositors, but before I do that, I
> need to start small.
>
>


Re: wscons API question: input handling?

2019-02-19 Thread Leonid Bobrov
On Tue, Feb 19, 2019 at 04:01:08PM +, tfrohw...@fastmail.com wrote:
> Is the package x11/xbindkeys what you are looking for?
>

No, I need a direct access to keyboard outside X11. If I understand
wscons, I might help to port libinput to OpenBSD (and send patches to
upstream) to have usable Wayland compositors, but before I do that, I
need to start small.



Re: wscons API question: input handling?

2019-02-19 Thread tfrohw...@fastmail.com
On February 19, 2019 2:16:04 PM UTC, Leonid Bobrov  wrote:
>Hi!
>
>I want to write a program that executes a particular code at key press,
>where can I find documentation about that? I have example program which
>doesn't work:
>
>int
>main(void)
>{
>int kbdfd = open("/dev/wskbd", O_RDWR, 0);
>
>if (errno != 0) {
>printf("%s\n", strerror(errno));
>return 1;
>}
>
>int key;
>
>while(ioctl(kbdfd, WSCONS_EVENT_KEY_UP, ) != -1) {
>if (key == KS_k)
>printf("You pressed k!");
>else if (key == KS_q)
>break;
>else
>printf("You pressed %d!", key);
>}
>
>if (errno != 0) {
>printf("%s\n", strerror(errno));
>return 1;
>}
>
>return 0;
>}

Is the package x11/xbindkeys what you are looking for?



Re: wscons API question: input handling?

2019-02-19 Thread Leonid Bobrov
I don't know why, but my includes were not sent:











wscons API question: input handling?

2019-02-19 Thread Leonid Bobrov
Hi!

I want to write a program that executes a particular code at key press,
where can I find documentation about that? I have example program which
doesn't work:

int
main(void)
{
int kbdfd = open("/dev/wskbd", O_RDWR, 0);

if (errno != 0) {
printf("%s\n", strerror(errno));
return 1;
}

int key;

while(ioctl(kbdfd, WSCONS_EVENT_KEY_UP, ) != -1) {
if (key == KS_k)
printf("You pressed k!");
else if (key == KS_q)
break;
else
printf("You pressed %d!", key);
}

if (errno != 0) {
printf("%s\n", strerror(errno));
return 1;
}

return 0;
}