Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caca_get_even(key|mouse)_* not accessable by c++ interface #63

Open
sebastianohl opened this issue Dec 22, 2021 · 0 comments
Open

caca_get_even(key|mouse)_* not accessable by c++ interface #63

sebastianohl opened this issue Dec 22, 2021 · 0 comments

Comments

@sebastianohl
Copy link

Hi,

I am trying to use the c++ interface. However, when I try to evaluate a pressed key event, I did not get access to key codes.

The reason is that the Event class is not providing any functionality other than access to the type. I cannot even use the standard c functions as the caca_event_t data structure is protected.

Moreover, the Event class provides a public type attribute. I expected that this attribute will hold the event type. However, it is not updated by the getEvent function.

is there something that I missed or is this simply missing functionality

A solution would be to enhance the Event class by getter functions. Even that I do not use mouse functionality (yet), these getters would also be needed for the mouse access functions.

Regards
Sebastian

testcode:

Event event;
dp.getEvent(Event::CACA_EVENT_KEY_PRESS, &event, 0);
if (event.type & CACA_EVENT_KEY_PRESS) // this is not working as the type field is not updated
{
     auto key event.getKeyCH(); // what I would expect
     auto key = caca_get_event_key_ch(&event.e); // not working either
}

solution sketch for type and key_ch

class myEvent : public Event
{
  public:
    int getKeyCH() { return caca_get_event_key_ch(&this->e); }
    ::caca_event_type getType() { return caca_get_event_type(&this->e); }
};
@sebastianohl sebastianohl changed the title caca_get_event_key_ch not accessable by c++ interface caca_get_even(key|mouse)_* not accessable by c++ interface Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant