# How to get input on Native C++ Service

**URL:** <https://forum.webosose.org/t/how-to-get-input-on-native-c-service/2237>\
**Category:** App Development\
**Created:** [September 13, 2023, 12:44am UTC](https://forum.webosose.org/t/how-to-get-input-on-native-c-service/2237 "2023-09-13T00:44:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kongkong](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kongkong](https://forum.webosose.org/u/kongkong)\
**Post date:** [September 13, 2023, 12:44am UTC](https://forum.webosose.org/t/how-to-get-input-on-native-c-service/2237/1 "2023-09-13T00:44:52Z")

</div>

I'm developing Native Service with C++.  
I develop wayland client (wl\_surface with wl\_shm) and I can see the screen.  
I want to get input event and I develop wayland client wl\_pointer and wl\_keyboard.  
I add wl\_pointer and wl\_keyboard listener on client side but I can receive any input event.  
At the log, the Surface is focused but there is no any input log.  
Would you tell me how can I get input event on wayland client side?

---

<div class="post-metadata">

**Author:** ![elvis22](https://avatars.discourse-cdn.com/v4/letter/e/7ea924/32.png) [@elvis22](https://forum.webosose.org/u/elvis22)\
**Post date:** [September 13, 2023, 6:08am UTC](https://forum.webosose.org/t/how-to-get-input-on-native-c-service/2237/2 "2023-09-13T06:08:50Z")

</div>

It's same with general wayland client.  
We need to update the example with the input usage.

> <https://github.com/webosose/samples/blob/master/native-apps/external/com.sample.waylandegl/src/wayland_egl.c>

It may take times.

---

<div class="post-metadata">

**Author:** ![kongkong](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kongkong](https://forum.webosose.org/u/kongkong)\
**Post date:** [September 13, 2023, 7:26am UTC](https://forum.webosose.org/t/how-to-get-input-on-native-c-service/2237/3 "2023-09-13T07:26:39Z")

</div>

Thank you for the reply.  
Before you update the guide page and I refer to it, I wonder if I missed anything.

I bind registry and add listener for wl\_seat like this.

wl\_registry\_bind(registry, id, &wl\_seat\_interface, version);

```
    static const struct wl_seat_listener seat_listener = {
        seatCapabilities,
        seatName
    };

    wl_seat_add_listener(mSeat, &seat_listener, mDisplay);

```

It works well and seatCapabilities function is called.  
In seatCapabilities function, I get pointer and add listener for pointer.  
wl\_pointer\_add\_listener returns 0 but I can't get pointer event when I use mouse.

Is there anything additional I need to do to get mouse input?

Thanks.

---

<div class="post-metadata">

**Author:** ![elvis22](https://avatars.discourse-cdn.com/v4/letter/e/7ea924/32.png) [@elvis22](https://forum.webosose.org/u/elvis22)\
**Post date:** [September 20, 2023, 8:31am UTC](https://forum.webosose.org/t/how-to-get-input-on-native-c-service/2237/5 "2023-09-20T08:31:59Z")

</div>

Yes, it should work.

1. get\_pointer for all the seats.
2. export WAYLAND\_DEBUG=1 , then you can find debug file in /tmp.  
file name is waland\_%processname\_%pid
