51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
#ifndef MS_PACKET_KEY_DOWN
|
|
#define MS_PACKET_KEY_DOWN
|
|
#include <stdio.h>
|
|
#include <sys/un.h>
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
#include <msgba/client_connection_data.h>
|
|
|
|
struct msPacket;
|
|
|
|
/**
|
|
* The packet kind received when a key is pressed that should be handled by the emulator.
|
|
*/
|
|
struct msPacketKeyDown {
|
|
//! Determines if the key is pressed or un pressed.
|
|
char isPressed;
|
|
//! The key pressed.
|
|
int key;
|
|
};
|
|
|
|
/**
|
|
* Destroys the msPacketKeyDown
|
|
* @param keyDown The pointer to the pointer to keyDown to null it after this operation.
|
|
*/
|
|
void
|
|
msPacketKeyDownDestroy(struct msPacketKeyDown **keyDown);
|
|
|
|
/**
|
|
* Handles the msPacketKeyDown
|
|
* @param packet The packet containing msPacketKeyDown, should have PACKET_GET_KEY_DOWN as its id.
|
|
* @param keyDown This object.
|
|
* @param data The session data.
|
|
*/
|
|
bool
|
|
msPacketKeyDownHandle(const struct msPacket *packet, struct msPacketKeyDown *keyDown,
|
|
struct msClientConnectionData *const data);
|
|
|
|
/**
|
|
* Retrieves the msPacketKeyDown contained in the packet raw_data.
|
|
* @param packet The packet containing msPacketKeyDown, should have PACKET_GET_KEY_DOWN as its id.
|
|
* @param client_fd The source of this packet.
|
|
* @param data The session data.
|
|
*/
|
|
bool
|
|
msPacketKeyDownGet(const struct msPacket *packet, int client_fd,
|
|
struct msClientConnectionData *const data);
|
|
#endif
|