mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[c23,uwac] replace NULL with nullptr
This commit is contained in:
@@ -349,7 +349,7 @@ extern "C"
|
|||||||
UWAC_API void UwacInstallErrorHandler(UwacErrorHandler handler);
|
UWAC_API void UwacInstallErrorHandler(UwacErrorHandler handler);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the corresponding wayland display, using NULL you will open the default
|
* Opens the corresponding wayland display, using nullptr you will open the default
|
||||||
* display.
|
* display.
|
||||||
*
|
*
|
||||||
* @param name the name of the display to open
|
* @param name the name of the display to open
|
||||||
@@ -436,7 +436,7 @@ extern "C"
|
|||||||
*
|
*
|
||||||
* @param display the display to query
|
* @param display the display to query
|
||||||
* @param index index of the output
|
* @param index index of the output
|
||||||
* @return the given UwacOutput, NULL if something failed (so you should query
|
* @return the given UwacOutput, nullptr if something failed (so you should query
|
||||||
*UwacDisplayGetLastError() to have the reason)
|
*UwacDisplayGetLastError() to have the reason)
|
||||||
*/
|
*/
|
||||||
UWAC_API const UwacOutput* UwacDisplayGetOutput(UwacDisplay* display, int index);
|
UWAC_API const UwacOutput* UwacDisplayGetOutput(UwacDisplay* display, int index);
|
||||||
@@ -466,7 +466,7 @@ extern "C"
|
|||||||
* @param width the width of the window
|
* @param width the width of the window
|
||||||
* @param height the height of the window
|
* @param height the height of the window
|
||||||
* @param format format to use for the SHM surface
|
* @param format format to use for the SHM surface
|
||||||
* @return the created UwacWindow, NULL if something failed (use UwacDisplayGetLastError() to
|
* @return the created UwacWindow, nullptr if something failed (use UwacDisplayGetLastError() to
|
||||||
*know more about this)
|
*know more about this)
|
||||||
*/
|
*/
|
||||||
UWAC_API UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t height,
|
UWAC_API UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t height,
|
||||||
@@ -649,8 +649,8 @@ extern "C"
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief UwacSeatSetMouseCursor Sets the specified image as the new mouse cursor.
|
* @brief UwacSeatSetMouseCursor Sets the specified image as the new mouse cursor.
|
||||||
* Special values: If data == NULL && length == 0
|
* Special values: If data == nullptr && length == 0
|
||||||
* the cursor is hidden, if data == NULL && length != 0
|
* the cursor is hidden, if data == nullptr && length != 0
|
||||||
* the default system cursor is used.
|
* the default system cursor is used.
|
||||||
*
|
*
|
||||||
* @param seat The UwacSeat to apply the cursor image to
|
* @param seat The UwacSeat to apply the cursor image to
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ static void data_device_data_offer(void* data, struct wl_data_device* data_devic
|
|||||||
seat->offer = data_offer;
|
seat->offer = data_offer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
seat->offer = NULL;
|
seat->offer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void data_device_selection(void* data, struct wl_data_device* data_device,
|
static void data_device_selection(void* data, struct wl_data_device* data_device,
|
||||||
@@ -138,7 +138,7 @@ static UwacReturnCode UwacCreateDataSource(UwacSeat* s)
|
|||||||
|
|
||||||
UwacReturnCode UwacSeatRegisterClipboard(UwacSeat* s)
|
UwacReturnCode UwacSeatRegisterClipboard(UwacSeat* s)
|
||||||
{
|
{
|
||||||
UwacClipboardEvent* event = NULL;
|
UwacClipboardEvent* event = nullptr;
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return UWAC_ERROR_INTERNAL;
|
return UWAC_ERROR_INTERNAL;
|
||||||
@@ -194,7 +194,7 @@ static const struct wl_callback_listener callback_listener = { .done = callback_
|
|||||||
|
|
||||||
static uint32_t get_serial(UwacSeat* s)
|
static uint32_t get_serial(UwacSeat* s)
|
||||||
{
|
{
|
||||||
struct wl_callback* callback = NULL;
|
struct wl_callback* callback = nullptr;
|
||||||
uint32_t serial = 0;
|
uint32_t serial = 0;
|
||||||
callback = wl_display_sync(s->display->display);
|
callback = wl_display_sync(s->display->display);
|
||||||
wl_callback_add_listener(callback, &callback_listener, &serial);
|
wl_callback_add_listener(callback, &callback_listener, &serial);
|
||||||
@@ -229,15 +229,15 @@ void* UwacClipboardDataGet(UwacSeat* seat, const char* mime, size_t* size)
|
|||||||
ssize_t r = 0;
|
ssize_t r = 0;
|
||||||
size_t alloc = 0;
|
size_t alloc = 0;
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
char* data = NULL;
|
char* data = nullptr;
|
||||||
int pipefd[2] = WINPR_C_ARRAY_INIT;
|
int pipefd[2] = WINPR_C_ARRAY_INIT;
|
||||||
|
|
||||||
if (!seat || !mime || !size || !seat->offer)
|
if (!seat || !mime || !size || !seat->offer)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
*size = 0;
|
*size = 0;
|
||||||
if (pipe(pipefd) != 0)
|
if (pipe(pipefd) != 0)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
wl_data_offer_receive(seat->offer, mime, pipefd[1]);
|
wl_data_offer_receive(seat->offer, mime, pipefd[1]);
|
||||||
close(pipefd[1]);
|
close(pipefd[1]);
|
||||||
@@ -278,5 +278,5 @@ void* UwacClipboardDataGet(UwacSeat* seat, const char* mime, size_t* size)
|
|||||||
fail:
|
fail:
|
||||||
free(data);
|
free(data);
|
||||||
close(pipefd[0]);
|
close(pipefd[0]);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ static const char* event_names[] = {
|
|||||||
"new seat", "removed seat", "new output", "configure", "pointer enter",
|
"new seat", "removed seat", "new output", "configure", "pointer enter",
|
||||||
"pointer leave", "pointer motion", "pointer buttons", "pointer axis", "keyboard enter",
|
"pointer leave", "pointer motion", "pointer buttons", "pointer axis", "keyboard enter",
|
||||||
"key", "touch frame begin", "touch up", "touch down", "touch motion",
|
"key", "touch frame begin", "touch up", "touch down", "touch motion",
|
||||||
"touch cancel", "touch frame end", "frame done", "close", NULL
|
"touch cancel", "touch frame end", "frame done", "close", nullptr
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -109,8 +109,8 @@ static const struct zwp_fullscreen_shell_v1_listener fullscreen_shell_listener =
|
|||||||
|
|
||||||
static void display_destroy_seat(UwacDisplay* d, uint32_t name)
|
static void display_destroy_seat(UwacDisplay* d, uint32_t name)
|
||||||
{
|
{
|
||||||
UwacSeat* seat = NULL;
|
UwacSeat* seat = nullptr;
|
||||||
UwacSeat* tmp = NULL;
|
UwacSeat* tmp = nullptr;
|
||||||
wl_list_for_each_safe(seat, tmp, &d->seats, link)
|
wl_list_for_each_safe(seat, tmp, &d->seats, link)
|
||||||
{
|
{
|
||||||
if (seat->seat_id == name)
|
if (seat->seat_id == name)
|
||||||
@@ -143,7 +143,7 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin
|
|||||||
const char* interface, uint32_t version)
|
const char* interface, uint32_t version)
|
||||||
{
|
{
|
||||||
UwacDisplay* d = data;
|
UwacDisplay* d = data;
|
||||||
UwacGlobal* global = NULL;
|
UwacGlobal* global = nullptr;
|
||||||
global = xzalloc(sizeof *global);
|
global = xzalloc(sizeof *global);
|
||||||
global->name = id;
|
global->name = id;
|
||||||
global->interface = xstrdup(interface);
|
global->interface = xstrdup(interface);
|
||||||
@@ -163,8 +163,8 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin
|
|||||||
}
|
}
|
||||||
else if (strcmp(interface, "wl_output") == 0)
|
else if (strcmp(interface, "wl_output") == 0)
|
||||||
{
|
{
|
||||||
UwacOutput* output = NULL;
|
UwacOutput* output = nullptr;
|
||||||
UwacOutputNewEvent* ev = NULL;
|
UwacOutputNewEvent* ev = nullptr;
|
||||||
output = UwacCreateOutput(d, id, version);
|
output = UwacCreateOutput(d, id, version);
|
||||||
|
|
||||||
if (!output)
|
if (!output)
|
||||||
@@ -180,8 +180,8 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin
|
|||||||
}
|
}
|
||||||
else if (strcmp(interface, "wl_seat") == 0)
|
else if (strcmp(interface, "wl_seat") == 0)
|
||||||
{
|
{
|
||||||
UwacSeatNewEvent* ev = NULL;
|
UwacSeatNewEvent* ev = nullptr;
|
||||||
UwacSeat* seat = NULL;
|
UwacSeat* seat = nullptr;
|
||||||
seat = UwacSeatNew(d, id, min(version, TARGET_SEAT_INTERFACE));
|
seat = UwacSeatNew(d, id, min(version, TARGET_SEAT_INTERFACE));
|
||||||
|
|
||||||
if (!seat)
|
if (!seat)
|
||||||
@@ -205,8 +205,8 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin
|
|||||||
}
|
}
|
||||||
else if (strcmp(interface, "wl_data_device_manager") == 0)
|
else if (strcmp(interface, "wl_data_device_manager") == 0)
|
||||||
{
|
{
|
||||||
UwacSeat* seat = NULL;
|
UwacSeat* seat = nullptr;
|
||||||
UwacSeat* tmp = NULL;
|
UwacSeat* tmp = nullptr;
|
||||||
|
|
||||||
d->data_device_manager = wl_registry_bind(registry, id, &wl_data_device_manager_interface,
|
d->data_device_manager = wl_registry_bind(registry, id, &wl_data_device_manager_interface,
|
||||||
min(TARGET_DDM_INTERFACE, version));
|
min(TARGET_DDM_INTERFACE, version));
|
||||||
@@ -277,8 +277,8 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin
|
|||||||
static void registry_handle_global_remove(void* data, struct wl_registry* registry, uint32_t name)
|
static void registry_handle_global_remove(void* data, struct wl_registry* registry, uint32_t name)
|
||||||
{
|
{
|
||||||
UwacDisplay* d = data;
|
UwacDisplay* d = data;
|
||||||
UwacGlobal* global = NULL;
|
UwacGlobal* global = nullptr;
|
||||||
UwacGlobal* tmp = NULL;
|
UwacGlobal* tmp = nullptr;
|
||||||
wl_list_for_each_safe(global, tmp, &d->globals, link)
|
wl_list_for_each_safe(global, tmp, &d->globals, link)
|
||||||
{
|
{
|
||||||
if (global->name != name)
|
if (global->name != name)
|
||||||
@@ -293,7 +293,7 @@ static void registry_handle_global_remove(void* data, struct wl_registry* regist
|
|||||||
|
|
||||||
if (strcmp(global->interface, "wl_seat") == 0)
|
if (strcmp(global->interface, "wl_seat") == 0)
|
||||||
{
|
{
|
||||||
UwacSeatRemovedEvent* ev = NULL;
|
UwacSeatRemovedEvent* ev = nullptr;
|
||||||
display_destroy_seat(d, name);
|
display_destroy_seat(d, name);
|
||||||
ev = (UwacSeatRemovedEvent*)UwacDisplayNewEvent(d, UWAC_EVENT_REMOVED_SEAT);
|
ev = (UwacSeatRemovedEvent*)UwacDisplayNewEvent(d, UWAC_EVENT_REMOVED_SEAT);
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ int UwacDisplayWatchFd(UwacDisplay* display, int fd, uint32_t events, UwacTask*
|
|||||||
|
|
||||||
static void UwacDisplayUnwatchFd(UwacDisplay* display, int fd)
|
static void UwacDisplayUnwatchFd(UwacDisplay* display, int fd)
|
||||||
{
|
{
|
||||||
epoll_ctl(display->epoll_fd, EPOLL_CTL_DEL, fd, NULL);
|
epoll_ctl(display->epoll_fd, EPOLL_CTL_DEL, fd, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void display_exit(UwacDisplay* display)
|
static void display_exit(UwacDisplay* display)
|
||||||
@@ -385,13 +385,13 @@ static void display_dispatch_events(UwacTask* task, uint32_t events)
|
|||||||
|
|
||||||
UwacDisplay* UwacOpenDisplay(const char* name, UwacReturnCode* err)
|
UwacDisplay* UwacOpenDisplay(const char* name, UwacReturnCode* err)
|
||||||
{
|
{
|
||||||
UwacDisplay* ret = NULL;
|
UwacDisplay* ret = nullptr;
|
||||||
ret = (UwacDisplay*)xzalloc(sizeof(*ret));
|
ret = (UwacDisplay*)xzalloc(sizeof(*ret));
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
*err = UWAC_ERROR_NOMEMORY;
|
*err = UWAC_ERROR_NOMEMORY;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&ret->globals);
|
wl_list_init(&ret->globals);
|
||||||
@@ -400,7 +400,7 @@ UwacDisplay* UwacOpenDisplay(const char* name, UwacReturnCode* err)
|
|||||||
wl_list_init(&ret->windows);
|
wl_list_init(&ret->windows);
|
||||||
ret->display = wl_display_connect(name);
|
ret->display = wl_display_connect(name);
|
||||||
|
|
||||||
if (ret->display == NULL)
|
if (ret->display == nullptr)
|
||||||
{
|
{
|
||||||
char buffer[256] = WINPR_C_ARRAY_INIT;
|
char buffer[256] = WINPR_C_ARRAY_INIT;
|
||||||
(void)fprintf(stderr, "failed to connect to Wayland display %s: %s\n", name,
|
(void)fprintf(stderr, "failed to connect to Wayland display %s: %s\n", name,
|
||||||
@@ -457,14 +457,14 @@ out_disconnect:
|
|||||||
wl_display_disconnect(ret->display);
|
wl_display_disconnect(ret->display);
|
||||||
out_free:
|
out_free:
|
||||||
free(ret);
|
free(ret);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UwacDisplayDispatch(UwacDisplay* display, int timeout)
|
int UwacDisplayDispatch(UwacDisplay* display, int timeout)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
UwacTask* task = NULL;
|
UwacTask* task = nullptr;
|
||||||
struct epoll_event ep[16];
|
struct epoll_event ep[16];
|
||||||
wl_display_dispatch_pending(display->display);
|
wl_display_dispatch_pending(display->display);
|
||||||
|
|
||||||
@@ -502,15 +502,15 @@ UwacReturnCode UwacDisplayGetLastError(const UwacDisplay* display)
|
|||||||
|
|
||||||
UwacReturnCode UwacCloseDisplay(UwacDisplay** pdisplay)
|
UwacReturnCode UwacCloseDisplay(UwacDisplay** pdisplay)
|
||||||
{
|
{
|
||||||
UwacDisplay* display = NULL;
|
UwacDisplay* display = nullptr;
|
||||||
UwacSeat* seat = NULL;
|
UwacSeat* seat = nullptr;
|
||||||
UwacSeat* tmpSeat = NULL;
|
UwacSeat* tmpSeat = nullptr;
|
||||||
UwacWindow* window = NULL;
|
UwacWindow* window = nullptr;
|
||||||
UwacWindow* tmpWindow = NULL;
|
UwacWindow* tmpWindow = nullptr;
|
||||||
UwacOutput* output = NULL;
|
UwacOutput* output = nullptr;
|
||||||
UwacOutput* tmpOutput = NULL;
|
UwacOutput* tmpOutput = nullptr;
|
||||||
UwacGlobal* global = NULL;
|
UwacGlobal* global = nullptr;
|
||||||
UwacGlobal* tmpGlobal = NULL;
|
UwacGlobal* tmpGlobal = nullptr;
|
||||||
assert(pdisplay);
|
assert(pdisplay);
|
||||||
display = *pdisplay;
|
display = *pdisplay;
|
||||||
|
|
||||||
@@ -598,7 +598,7 @@ UwacReturnCode UwacCloseDisplay(UwacDisplay** pdisplay)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(display);
|
free(display);
|
||||||
*pdisplay = NULL;
|
*pdisplay = nullptr;
|
||||||
return UWAC_SUCCESS;
|
return UWAC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,8 +631,8 @@ const char* UwacErrorString(UwacReturnCode error)
|
|||||||
UwacReturnCode UwacDisplayQueryInterfaceVersion(const UwacDisplay* display, const char* name,
|
UwacReturnCode UwacDisplayQueryInterfaceVersion(const UwacDisplay* display, const char* name,
|
||||||
uint32_t* version)
|
uint32_t* version)
|
||||||
{
|
{
|
||||||
const UwacGlobal* global = NULL;
|
const UwacGlobal* global = nullptr;
|
||||||
const UwacGlobal* tmp = NULL;
|
const UwacGlobal* tmp = nullptr;
|
||||||
|
|
||||||
if (!display)
|
if (!display)
|
||||||
return UWAC_ERROR_INVALID_DISPLAY;
|
return UWAC_ERROR_INVALID_DISPLAY;
|
||||||
@@ -687,14 +687,14 @@ const UwacOutput* UwacDisplayGetOutput(UwacDisplay* display, int index)
|
|||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int display_count = 0;
|
int display_count = 0;
|
||||||
UwacOutput* ret = NULL;
|
UwacOutput* ret = nullptr;
|
||||||
|
|
||||||
if (!display)
|
if (!display)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
display_count = wl_list_length(&display->outputs);
|
display_count = wl_list_length(&display->outputs);
|
||||||
if (display_count <= index)
|
if (display_count <= index)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
wl_list_for_each(ret, &display->outputs, link)
|
wl_list_for_each(ret, &display->outputs, link)
|
||||||
{
|
{
|
||||||
@@ -706,7 +706,7 @@ const UwacOutput* UwacDisplayGetOutput(UwacDisplay* display, int index)
|
|||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
display->last_error = UWAC_NOT_FOUND;
|
display->last_error = UWAC_NOT_FOUND;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
display->last_error = UWAC_SUCCESS;
|
display->last_error = UWAC_SUCCESS;
|
||||||
@@ -730,11 +730,11 @@ UwacReturnCode UwacOutputGetPosition(const UwacOutput* output, UwacPosition* pos
|
|||||||
|
|
||||||
UwacEvent* UwacDisplayNewEvent(UwacDisplay* display, int type)
|
UwacEvent* UwacDisplayNewEvent(UwacDisplay* display, int type)
|
||||||
{
|
{
|
||||||
UwacEventListItem* ret = NULL;
|
UwacEventListItem* ret = nullptr;
|
||||||
|
|
||||||
if (!display)
|
if (!display)
|
||||||
{
|
{
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = xzalloc(sizeof(UwacEventListItem));
|
ret = xzalloc(sizeof(UwacEventListItem));
|
||||||
@@ -744,7 +744,7 @@ UwacEvent* UwacDisplayNewEvent(UwacDisplay* display, int type)
|
|||||||
assert(uwacErrorHandler(display, UWAC_ERROR_NOMEMORY, "unable to allocate a '%s' event",
|
assert(uwacErrorHandler(display, UWAC_ERROR_NOMEMORY, "unable to allocate a '%s' event",
|
||||||
event_names[type]));
|
event_names[type]));
|
||||||
display->last_error = UWAC_ERROR_NOMEMORY;
|
display->last_error = UWAC_ERROR_NOMEMORY;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret->event.type = type;
|
ret->event.type = type;
|
||||||
@@ -761,12 +761,12 @@ UwacEvent* UwacDisplayNewEvent(UwacDisplay* display, int type)
|
|||||||
|
|
||||||
bool UwacHasEvent(UwacDisplay* display)
|
bool UwacHasEvent(UwacDisplay* display)
|
||||||
{
|
{
|
||||||
return display->pop_queue != NULL;
|
return display->pop_queue != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
UwacReturnCode UwacNextEvent(UwacDisplay* display, UwacEvent* event)
|
UwacReturnCode UwacNextEvent(UwacDisplay* display, UwacEvent* event)
|
||||||
{
|
{
|
||||||
UwacEventListItem* prevItem = NULL;
|
UwacEventListItem* prevItem = nullptr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!display)
|
if (!display)
|
||||||
@@ -788,9 +788,9 @@ UwacReturnCode UwacNextEvent(UwacDisplay* display, UwacEvent* event)
|
|||||||
display->pop_queue = prevItem;
|
display->pop_queue = prevItem;
|
||||||
|
|
||||||
if (prevItem)
|
if (prevItem)
|
||||||
prevItem->tail = NULL;
|
prevItem->tail = nullptr;
|
||||||
else
|
else
|
||||||
display->push_queue = NULL;
|
display->push_queue = nullptr;
|
||||||
|
|
||||||
return UWAC_SUCCESS;
|
return UWAC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@
|
|||||||
|
|
||||||
static struct wl_buffer* create_pointer_buffer(UwacSeat* seat, const void* src, size_t size)
|
static struct wl_buffer* create_pointer_buffer(UwacSeat* seat, const void* src, size_t size)
|
||||||
{
|
{
|
||||||
struct wl_buffer* buffer = NULL;
|
struct wl_buffer* buffer = nullptr;
|
||||||
struct wl_shm_pool* pool = NULL;
|
struct wl_shm_pool* pool = nullptr;
|
||||||
|
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ static struct wl_buffer* create_pointer_buffer(UwacSeat* seat, const void* src,
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
||||||
void* data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
void* data = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
|
|
||||||
if (data == MAP_FAILED)
|
if (data == MAP_FAILED)
|
||||||
{
|
{
|
||||||
@@ -97,10 +97,10 @@ static const struct wl_buffer_listener buffer_release_listener = { on_buffer_rel
|
|||||||
|
|
||||||
static UwacReturnCode set_cursor_image(UwacSeat* seat, uint32_t serial)
|
static UwacReturnCode set_cursor_image(UwacSeat* seat, uint32_t serial)
|
||||||
{
|
{
|
||||||
struct wl_buffer* buffer = NULL;
|
struct wl_buffer* buffer = nullptr;
|
||||||
struct wl_cursor* cursor = NULL;
|
struct wl_cursor* cursor = nullptr;
|
||||||
struct wl_cursor_image* image = NULL;
|
struct wl_cursor_image* image = nullptr;
|
||||||
struct wl_surface* surface = NULL;
|
struct wl_surface* surface = nullptr;
|
||||||
int32_t x = 0;
|
int32_t x = 0;
|
||||||
int32_t y = 0;
|
int32_t y = 0;
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ static UwacReturnCode set_cursor_image(UwacSeat* seat, uint32_t serial)
|
|||||||
x = WINPR_ASSERTING_INT_CAST(int32_t, image->hotspot_x / scale);
|
x = WINPR_ASSERTING_INT_CAST(int32_t, image->hotspot_x / scale);
|
||||||
y = WINPR_ASSERTING_INT_CAST(int32_t, image->hotspot_y / scale);
|
y = WINPR_ASSERTING_INT_CAST(int32_t, image->hotspot_y / scale);
|
||||||
break;
|
break;
|
||||||
case 1: /* NULL pointer */
|
case 1: /* nullptr pointer */
|
||||||
break;
|
break;
|
||||||
default: /* Default system pointer */
|
default: /* Default system pointer */
|
||||||
cursor = seat->default_cursor;
|
cursor = seat->default_cursor;
|
||||||
@@ -172,7 +172,7 @@ static void keyboard_repeat_func(UwacTask* task, uint32_t events)
|
|||||||
|
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
UwacKeyEvent* key = NULL;
|
UwacKeyEvent* key = nullptr;
|
||||||
|
|
||||||
key = (UwacKeyEvent*)UwacDisplayNewEvent(input->display, UWAC_EVENT_KEY);
|
key = (UwacKeyEvent*)UwacDisplayNewEvent(input->display, UWAC_EVENT_KEY);
|
||||||
if (!key)
|
if (!key)
|
||||||
@@ -190,9 +190,9 @@ static void keyboard_handle_keymap(void* data, struct wl_keyboard* keyboard, uin
|
|||||||
int fd, uint32_t size)
|
int fd, uint32_t size)
|
||||||
{
|
{
|
||||||
UwacSeat* input = data;
|
UwacSeat* input = data;
|
||||||
struct xkb_keymap* keymap = NULL;
|
struct xkb_keymap* keymap = nullptr;
|
||||||
struct xkb_state* state = NULL;
|
struct xkb_state* state = nullptr;
|
||||||
char* map_str = NULL;
|
char* map_str = nullptr;
|
||||||
int mapFlags = MAP_SHARED;
|
int mapFlags = MAP_SHARED;
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
@@ -210,7 +210,7 @@ static void keyboard_handle_keymap(void* data, struct wl_keyboard* keyboard, uin
|
|||||||
if (input->seat_version >= 7)
|
if (input->seat_version >= 7)
|
||||||
mapFlags = MAP_PRIVATE;
|
mapFlags = MAP_PRIVATE;
|
||||||
|
|
||||||
map_str = mmap(NULL, size, PROT_READ, mapFlags, fd, 0);
|
map_str = mmap(nullptr, size, PROT_READ, mapFlags, fd, 0);
|
||||||
if (map_str == MAP_FAILED)
|
if (map_str == MAP_FAILED)
|
||||||
{
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -279,7 +279,7 @@ static void keyboard_handle_leave(void* data, struct wl_keyboard* keyboard, uint
|
|||||||
struct wl_surface* surface)
|
struct wl_surface* surface)
|
||||||
{
|
{
|
||||||
struct itimerspec its = WINPR_C_ARRAY_INIT;
|
struct itimerspec its = WINPR_C_ARRAY_INIT;
|
||||||
uint32_t* pressedKey = NULL;
|
uint32_t* pressedKey = nullptr;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
UwacSeat* input = (UwacSeat*)data;
|
UwacSeat* input = (UwacSeat*)data;
|
||||||
@@ -289,7 +289,7 @@ static void keyboard_handle_leave(void* data, struct wl_keyboard* keyboard, uint
|
|||||||
its.it_interval.tv_nsec = 0;
|
its.it_interval.tv_nsec = 0;
|
||||||
its.it_value.tv_sec = 0;
|
its.it_value.tv_sec = 0;
|
||||||
its.it_value.tv_nsec = 0;
|
its.it_value.tv_nsec = 0;
|
||||||
(void)timerfd_settime(input->repeat_timer_fd, 0, &its, NULL);
|
(void)timerfd_settime(input->repeat_timer_fd, 0, &its, nullptr);
|
||||||
|
|
||||||
UwacPointerEnterLeaveEvent* event =
|
UwacPointerEnterLeaveEvent* event =
|
||||||
(UwacPointerEnterLeaveEvent*)UwacDisplayNewEvent(input->display, UWAC_EVENT_POINTER_LEAVE);
|
(UwacPointerEnterLeaveEvent*)UwacDisplayNewEvent(input->display, UWAC_EVENT_POINTER_LEAVE);
|
||||||
@@ -312,7 +312,7 @@ static void keyboard_handle_leave(void* data, struct wl_keyboard* keyboard, uint
|
|||||||
|
|
||||||
static int update_key_pressed(UwacSeat* seat, uint32_t key)
|
static int update_key_pressed(UwacSeat* seat, uint32_t key)
|
||||||
{
|
{
|
||||||
uint32_t* keyPtr = NULL;
|
uint32_t* keyPtr = nullptr;
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
/* check if the key is not already pressed */
|
/* check if the key is not already pressed */
|
||||||
@@ -366,12 +366,12 @@ static void keyboard_handle_key(void* data, struct wl_keyboard* keyboard, uint32
|
|||||||
assert(input);
|
assert(input);
|
||||||
|
|
||||||
UwacWindow* window = input->keyboard_focus;
|
UwacWindow* window = input->keyboard_focus;
|
||||||
UwacKeyEvent* keyEvent = NULL;
|
UwacKeyEvent* keyEvent = nullptr;
|
||||||
|
|
||||||
uint32_t code = 0;
|
uint32_t code = 0;
|
||||||
uint32_t num_syms = 0;
|
uint32_t num_syms = 0;
|
||||||
enum wl_keyboard_key_state state = state_w;
|
enum wl_keyboard_key_state state = state_w;
|
||||||
const xkb_keysym_t* syms = NULL;
|
const xkb_keysym_t* syms = nullptr;
|
||||||
xkb_keysym_t sym = 0;
|
xkb_keysym_t sym = 0;
|
||||||
struct itimerspec its;
|
struct itimerspec its;
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ static void keyboard_handle_key(void* data, struct wl_keyboard* keyboard, uint32
|
|||||||
its.it_interval.tv_nsec = 0;
|
its.it_interval.tv_nsec = 0;
|
||||||
its.it_value.tv_sec = 0;
|
its.it_value.tv_sec = 0;
|
||||||
its.it_value.tv_nsec = 0;
|
its.it_value.tv_nsec = 0;
|
||||||
(void)timerfd_settime(input->repeat_timer_fd, 0, &its, NULL);
|
(void)timerfd_settime(input->repeat_timer_fd, 0, &its, nullptr);
|
||||||
}
|
}
|
||||||
else if (state == WL_KEYBOARD_KEY_STATE_PRESSED &&
|
else if (state == WL_KEYBOARD_KEY_STATE_PRESSED &&
|
||||||
xkb_keymap_key_repeats(input->xkb.keymap, code))
|
xkb_keymap_key_repeats(input->xkb.keymap, code))
|
||||||
@@ -417,7 +417,7 @@ static void keyboard_handle_key(void* data, struct wl_keyboard* keyboard, uint32
|
|||||||
its.it_interval.tv_nsec = input->repeat_rate_nsec;
|
its.it_interval.tv_nsec = input->repeat_rate_nsec;
|
||||||
its.it_value.tv_sec = input->repeat_delay_sec;
|
its.it_value.tv_sec = input->repeat_delay_sec;
|
||||||
its.it_value.tv_nsec = input->repeat_delay_nsec;
|
its.it_value.tv_nsec = input->repeat_delay_nsec;
|
||||||
(void)timerfd_settime(input->repeat_timer_fd, 0, &its, NULL);
|
(void)timerfd_settime(input->repeat_timer_fd, 0, &its, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
keyEvent = (UwacKeyEvent*)UwacDisplayNewEvent(input->display, UWAC_EVENT_KEY);
|
keyEvent = (UwacKeyEvent*)UwacDisplayNewEvent(input->display, UWAC_EVENT_KEY);
|
||||||
@@ -438,7 +438,7 @@ static void keyboard_handle_modifiers(void* data, struct wl_keyboard* keyboard,
|
|||||||
UwacSeat* input = data;
|
UwacSeat* input = data;
|
||||||
assert(input);
|
assert(input);
|
||||||
|
|
||||||
UwacKeyboardModifiersEvent* event = NULL;
|
UwacKeyboardModifiersEvent* event = nullptr;
|
||||||
xkb_mod_mask_t mask = 0;
|
xkb_mod_mask_t mask = 0;
|
||||||
|
|
||||||
/* If we're not using a keymap, then we don't handle PC-style modifiers */
|
/* If we're not using a keymap, then we don't handle PC-style modifiers */
|
||||||
@@ -523,7 +523,7 @@ static void touch_handle_down(void* data, struct wl_touch* wl_touch, uint32_t se
|
|||||||
wl_fixed_t y_w)
|
wl_fixed_t y_w)
|
||||||
{
|
{
|
||||||
UwacSeat* seat = data;
|
UwacSeat* seat = data;
|
||||||
UwacTouchDown* tdata = NULL;
|
UwacTouchDown* tdata = nullptr;
|
||||||
|
|
||||||
assert(seat);
|
assert(seat);
|
||||||
assert(seat->display);
|
assert(seat->display);
|
||||||
@@ -559,7 +559,7 @@ static void touch_handle_down(void* data, struct wl_touch* wl_touch, uint32_t se
|
|||||||
|
|
||||||
if (surface != input->touch_focus->main_surface->surface) {
|
if (surface != input->touch_focus->main_surface->surface) {
|
||||||
DBG("Ignoring input event from subsurface %p\n", (void*) surface);
|
DBG("Ignoring input event from subsurface %p\n", (void*) surface);
|
||||||
input->touch_focus = NULL;
|
input->touch_focus = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,7 +592,7 @@ static void touch_handle_up(void* data, struct wl_touch* wl_touch, uint32_t seri
|
|||||||
int32_t id)
|
int32_t id)
|
||||||
{
|
{
|
||||||
UwacSeat* seat = data;
|
UwacSeat* seat = data;
|
||||||
UwacTouchUp* tdata = NULL;
|
UwacTouchUp* tdata = nullptr;
|
||||||
|
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
@@ -637,7 +637,7 @@ static void touch_handle_motion(void* data, struct wl_touch* wl_touch, uint32_t
|
|||||||
UwacSeat* seat = data;
|
UwacSeat* seat = data;
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
UwacTouchMotion* tdata = NULL;
|
UwacTouchMotion* tdata = nullptr;
|
||||||
|
|
||||||
if (!seat->touch_frame_started && !touch_send_start_frame(seat))
|
if (!seat->touch_frame_started && !touch_send_start_frame(seat))
|
||||||
return;
|
return;
|
||||||
@@ -757,8 +757,8 @@ static void pointer_handle_enter(void* data, struct wl_pointer* pointer, uint32_
|
|||||||
struct wl_surface* surface, wl_fixed_t sx_w, wl_fixed_t sy_w)
|
struct wl_surface* surface, wl_fixed_t sx_w, wl_fixed_t sy_w)
|
||||||
{
|
{
|
||||||
UwacSeat* input = data;
|
UwacSeat* input = data;
|
||||||
UwacWindow* window = NULL;
|
UwacWindow* window = nullptr;
|
||||||
UwacPointerEnterLeaveEvent* event = NULL;
|
UwacPointerEnterLeaveEvent* event = nullptr;
|
||||||
|
|
||||||
assert(input);
|
assert(input);
|
||||||
|
|
||||||
@@ -797,8 +797,8 @@ static void pointer_handle_enter(void* data, struct wl_pointer* pointer, uint32_
|
|||||||
static void pointer_handle_leave(void* data, struct wl_pointer* pointer, uint32_t serial,
|
static void pointer_handle_leave(void* data, struct wl_pointer* pointer, uint32_t serial,
|
||||||
struct wl_surface* surface)
|
struct wl_surface* surface)
|
||||||
{
|
{
|
||||||
UwacPointerEnterLeaveEvent* event = NULL;
|
UwacPointerEnterLeaveEvent* event = nullptr;
|
||||||
UwacWindow* window = NULL;
|
UwacWindow* window = nullptr;
|
||||||
UwacSeat* input = data;
|
UwacSeat* input = data;
|
||||||
assert(input);
|
assert(input);
|
||||||
|
|
||||||
@@ -818,7 +818,7 @@ static void pointer_handle_leave(void* data, struct wl_pointer* pointer, uint32_
|
|||||||
static void pointer_handle_motion(void* data, struct wl_pointer* pointer, uint32_t time,
|
static void pointer_handle_motion(void* data, struct wl_pointer* pointer, uint32_t time,
|
||||||
wl_fixed_t sx_w, wl_fixed_t sy_w)
|
wl_fixed_t sx_w, wl_fixed_t sy_w)
|
||||||
{
|
{
|
||||||
UwacPointerMotionEvent* motion_event = NULL;
|
UwacPointerMotionEvent* motion_event = nullptr;
|
||||||
UwacSeat* input = data;
|
UwacSeat* input = data;
|
||||||
assert(input);
|
assert(input);
|
||||||
|
|
||||||
@@ -852,7 +852,7 @@ static void pointer_handle_motion(void* data, struct wl_pointer* pointer, uint32
|
|||||||
static void pointer_handle_button(void* data, struct wl_pointer* pointer, uint32_t serial,
|
static void pointer_handle_button(void* data, struct wl_pointer* pointer, uint32_t serial,
|
||||||
uint32_t time, uint32_t button, uint32_t state_w)
|
uint32_t time, uint32_t button, uint32_t state_w)
|
||||||
{
|
{
|
||||||
UwacPointerButtonEvent* event = NULL;
|
UwacPointerButtonEvent* event = nullptr;
|
||||||
UwacSeat* seat = data;
|
UwacSeat* seat = data;
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
@@ -875,7 +875,7 @@ static void pointer_handle_button(void* data, struct wl_pointer* pointer, uint32
|
|||||||
static void pointer_handle_axis(void* data, struct wl_pointer* pointer, uint32_t time,
|
static void pointer_handle_axis(void* data, struct wl_pointer* pointer, uint32_t time,
|
||||||
uint32_t axis, wl_fixed_t value)
|
uint32_t axis, wl_fixed_t value)
|
||||||
{
|
{
|
||||||
UwacPointerAxisEvent* event = NULL;
|
UwacPointerAxisEvent* event = nullptr;
|
||||||
UwacSeat* seat = data;
|
UwacSeat* seat = data;
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
@@ -898,7 +898,7 @@ static void pointer_handle_axis(void* data, struct wl_pointer* pointer, uint32_t
|
|||||||
|
|
||||||
static void pointer_frame(void* data, struct wl_pointer* wl_pointer)
|
static void pointer_frame(void* data, struct wl_pointer* wl_pointer)
|
||||||
{
|
{
|
||||||
UwacPointerFrameEvent* event = NULL;
|
UwacPointerFrameEvent* event = nullptr;
|
||||||
UwacSeat* seat = data;
|
UwacSeat* seat = data;
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
@@ -917,7 +917,7 @@ static void pointer_frame(void* data, struct wl_pointer* wl_pointer)
|
|||||||
|
|
||||||
static void pointer_axis_source(void* data, struct wl_pointer* wl_pointer, uint32_t axis_source)
|
static void pointer_axis_source(void* data, struct wl_pointer* wl_pointer, uint32_t axis_source)
|
||||||
{
|
{
|
||||||
UwacPointerSourceEvent* event = NULL;
|
UwacPointerSourceEvent* event = nullptr;
|
||||||
UwacSeat* seat = data;
|
UwacSeat* seat = data;
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
@@ -946,7 +946,7 @@ static void pointer_axis_discrete(void* data, struct wl_pointer* wl_pointer, uin
|
|||||||
int32_t discrete)
|
int32_t discrete)
|
||||||
{
|
{
|
||||||
/*UwacSeat *seat = data;*/
|
/*UwacSeat *seat = data;*/
|
||||||
UwacPointerAxisEvent* event = NULL;
|
UwacPointerAxisEvent* event = nullptr;
|
||||||
UwacSeat* seat = data;
|
UwacSeat* seat = data;
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
@@ -972,7 +972,7 @@ static void pointer_axis_value120(void* data, struct wl_pointer* wl_pointer, uin
|
|||||||
int32_t value120)
|
int32_t value120)
|
||||||
{
|
{
|
||||||
/*UwacSeat *seat = data;*/
|
/*UwacSeat *seat = data;*/
|
||||||
UwacPointerAxisEvent* event = NULL;
|
UwacPointerAxisEvent* event = nullptr;
|
||||||
UwacSeat* seat = data;
|
UwacSeat* seat = data;
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
@@ -1011,7 +1011,7 @@ static void seat_handle_capabilities(void* data, struct wl_seat* seat, uint32_t
|
|||||||
wl_pointer_set_user_data(input->pointer, input);
|
wl_pointer_set_user_data(input->pointer, input);
|
||||||
wl_pointer_add_listener(input->pointer, &pointer_listener, input);
|
wl_pointer_add_listener(input->pointer, &pointer_listener, input);
|
||||||
|
|
||||||
input->cursor_theme = wl_cursor_theme_load(NULL, 32, input->display->shm);
|
input->cursor_theme = wl_cursor_theme_load(nullptr, 32, input->display->shm);
|
||||||
if (!input->cursor_theme)
|
if (!input->cursor_theme)
|
||||||
{
|
{
|
||||||
assert(uwacErrorHandler(input->display, UWAC_ERROR_NOMEMORY,
|
assert(uwacErrorHandler(input->display, UWAC_ERROR_NOMEMORY,
|
||||||
@@ -1038,9 +1038,9 @@ static void seat_handle_capabilities(void* data, struct wl_seat* seat, uint32_t
|
|||||||
if (input->cursor_theme)
|
if (input->cursor_theme)
|
||||||
wl_cursor_theme_destroy(input->cursor_theme);
|
wl_cursor_theme_destroy(input->cursor_theme);
|
||||||
|
|
||||||
input->default_cursor = NULL;
|
input->default_cursor = nullptr;
|
||||||
input->cursor_theme = NULL;
|
input->cursor_theme = nullptr;
|
||||||
input->pointer = NULL;
|
input->pointer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard)
|
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard)
|
||||||
@@ -1057,7 +1057,7 @@ static void seat_handle_capabilities(void* data, struct wl_seat* seat, uint32_t
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
wl_keyboard_destroy(input->keyboard);
|
wl_keyboard_destroy(input->keyboard);
|
||||||
input->keyboard = NULL;
|
input->keyboard = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch)
|
if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch)
|
||||||
@@ -1074,7 +1074,7 @@ static void seat_handle_capabilities(void* data, struct wl_seat* seat, uint32_t
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
wl_touch_destroy(input->touch);
|
wl_touch_destroy(input->touch);
|
||||||
input->touch = NULL;
|
input->touch = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1098,7 +1098,7 @@ UwacSeat* UwacSeatNew(UwacDisplay* d, uint32_t id, uint32_t version)
|
|||||||
{
|
{
|
||||||
UwacSeat* ret = xzalloc(sizeof(UwacSeat));
|
UwacSeat* ret = xzalloc(sizeof(UwacSeat));
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
ret->display = d;
|
ret->display = d;
|
||||||
ret->seat_id = id;
|
ret->seat_id = id;
|
||||||
@@ -1134,7 +1134,7 @@ UwacSeat* UwacSeatNew(UwacDisplay* d, uint32_t id, uint32_t version)
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
UwacSeatDestroy(ret);
|
UwacSeatDestroy(ret);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UwacSeatDestroy(UwacSeat* s)
|
void UwacSeatDestroy(UwacSeat* s)
|
||||||
@@ -1152,7 +1152,7 @@ void UwacSeatDestroy(UwacSeat* s)
|
|||||||
#endif
|
#endif
|
||||||
wl_seat_destroy(s->seat);
|
wl_seat_destroy(s->seat);
|
||||||
}
|
}
|
||||||
s->seat = NULL;
|
s->seat = nullptr;
|
||||||
|
|
||||||
free(s->name);
|
free(s->name);
|
||||||
wl_array_release(&s->pressed_keys);
|
wl_array_release(&s->pressed_keys);
|
||||||
@@ -1226,7 +1226,7 @@ UwacReturnCode UwacSeatInhibitShortcuts(UwacSeat* s, bool inhibit)
|
|||||||
if (s->keyboard_inhibitor)
|
if (s->keyboard_inhibitor)
|
||||||
{
|
{
|
||||||
zwp_keyboard_shortcuts_inhibitor_v1_destroy(s->keyboard_inhibitor);
|
zwp_keyboard_shortcuts_inhibitor_v1_destroy(s->keyboard_inhibitor);
|
||||||
s->keyboard_inhibitor = NULL;
|
s->keyboard_inhibitor = nullptr;
|
||||||
}
|
}
|
||||||
if (inhibit && s->display && s->display->keyboard_inhibit_manager)
|
if (inhibit && s->display && s->display->keyboard_inhibit_manager)
|
||||||
s->keyboard_inhibitor = zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts(
|
s->keyboard_inhibitor = zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts(
|
||||||
@@ -1244,14 +1244,14 @@ UwacReturnCode UwacSeatSetMouseCursor(UwacSeat* seat, const void* data, size_t l
|
|||||||
return UWAC_ERROR_CLOSED;
|
return UWAC_ERROR_CLOSED;
|
||||||
|
|
||||||
free(seat->pointer_image);
|
free(seat->pointer_image);
|
||||||
seat->pointer_image = NULL;
|
seat->pointer_image = nullptr;
|
||||||
|
|
||||||
free(seat->pointer_data);
|
free(seat->pointer_data);
|
||||||
seat->pointer_data = NULL;
|
seat->pointer_data = nullptr;
|
||||||
seat->pointer_size = 0;
|
seat->pointer_size = 0;
|
||||||
|
|
||||||
/* There is a cursor provided */
|
/* There is a cursor provided */
|
||||||
if ((data != NULL) && (length != 0))
|
if ((data != nullptr) && (length != 0))
|
||||||
{
|
{
|
||||||
seat->pointer_image = xzalloc(sizeof(struct wl_cursor_image));
|
seat->pointer_image = xzalloc(sizeof(struct wl_cursor_image));
|
||||||
if (!seat->pointer_image)
|
if (!seat->pointer_image)
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <winpr/wtypes.h>
|
||||||
#include <uwac/config.h>
|
#include <uwac/config.h>
|
||||||
|
|
||||||
#include "uwac-os.h"
|
#include "uwac-os.h"
|
||||||
@@ -120,9 +121,9 @@ int uwac_os_dupfd_cloexec(int fd, long minfd)
|
|||||||
static ssize_t recvmsg_cloexec_fallback(int sockfd, struct msghdr* msg, int flags)
|
static ssize_t recvmsg_cloexec_fallback(int sockfd, struct msghdr* msg, int flags)
|
||||||
{
|
{
|
||||||
ssize_t len = 0;
|
ssize_t len = 0;
|
||||||
struct cmsghdr* cmsg = NULL;
|
struct cmsghdr* cmsg = nullptr;
|
||||||
unsigned char* data = NULL;
|
unsigned char* data = nullptr;
|
||||||
int* end = NULL;
|
int* end = nullptr;
|
||||||
len = recvmsg(sockfd, msg, flags);
|
len = recvmsg(sockfd, msg, flags);
|
||||||
|
|
||||||
if (len == -1)
|
if (len == -1)
|
||||||
@@ -133,7 +134,7 @@ static ssize_t recvmsg_cloexec_fallback(int sockfd, struct msghdr* msg, int flag
|
|||||||
|
|
||||||
cmsg = CMSG_FIRSTHDR(msg);
|
cmsg = CMSG_FIRSTHDR(msg);
|
||||||
|
|
||||||
for (; cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg))
|
for (; cmsg != nullptr; cmsg = CMSG_NXTHDR(msg, cmsg))
|
||||||
{
|
{
|
||||||
if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS)
|
if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS)
|
||||||
continue;
|
continue;
|
||||||
@@ -236,7 +237,7 @@ int uwac_create_anonymous_file(off_t size)
|
|||||||
{
|
{
|
||||||
static const char template[] = "/weston-shared-XXXXXX";
|
static const char template[] = "/weston-shared-XXXXXX";
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
char* name = NULL;
|
char* name = nullptr;
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
// NOLINTNEXTLINE(concurrency-mt-unsafe)
|
// NOLINTNEXTLINE(concurrency-mt-unsafe)
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ static bool dupstr(char** dst, const char* src)
|
|||||||
{
|
{
|
||||||
assert(dst);
|
assert(dst);
|
||||||
free(*dst);
|
free(*dst);
|
||||||
*dst = NULL;
|
*dst = nullptr;
|
||||||
if (!src)
|
if (!src)
|
||||||
return true;
|
return true;
|
||||||
*dst = strdup(src);
|
*dst = strdup(src);
|
||||||
return *dst != NULL;
|
return *dst != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_handle_geometry(void* data, struct wl_output* wl_output, int x, int y,
|
static void output_handle_geometry(void* data, struct wl_output* wl_output, int x, int y,
|
||||||
@@ -151,7 +151,7 @@ UwacOutput* UwacCreateOutput(UwacDisplay* d, uint32_t id, uint32_t version)
|
|||||||
{
|
{
|
||||||
UwacOutput* o = xzalloc(sizeof *o);
|
UwacOutput* o = xzalloc(sizeof *o);
|
||||||
if (!o)
|
if (!o)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
o->display = d;
|
o->display = d;
|
||||||
o->server_output_id = id;
|
o->server_output_id = id;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <uwac/uwac-tools.h>
|
#include <uwac/uwac-tools.h>
|
||||||
|
#include <winpr/wtypes.h>
|
||||||
|
|
||||||
struct uwac_touch_automata
|
struct uwac_touch_automata
|
||||||
{
|
{
|
||||||
@@ -42,7 +43,7 @@ void UwacTouchAutomataReset(UwacTouchAutomata* automata)
|
|||||||
bool UwacTouchAutomataInjectEvent(UwacTouchAutomata* automata, UwacEvent* event)
|
bool UwacTouchAutomataInjectEvent(UwacTouchAutomata* automata, UwacEvent* event)
|
||||||
{
|
{
|
||||||
|
|
||||||
UwacTouchPoint* tp = NULL;
|
UwacTouchPoint* tp = nullptr;
|
||||||
|
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <winpr/wtypes.h>
|
||||||
|
|
||||||
#include "uwac-utils.h"
|
#include "uwac-utils.h"
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
|
|
||||||
static void* fail_on_null(void* p)
|
static void* fail_on_null(void* p)
|
||||||
{
|
{
|
||||||
if (p == NULL)
|
if (p == nullptr)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "out of memory\n");
|
(void)fprintf(stderr, "out of memory\n");
|
||||||
// NOLINTNEXTLINE(concurrency-mt-unsafe)
|
// NOLINTNEXTLINE(concurrency-mt-unsafe)
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ static void UwacWindowDestroyBuffers(UwacWindow* w)
|
|||||||
|
|
||||||
w->nbuffers = 0;
|
w->nbuffers = 0;
|
||||||
free(w->buffers);
|
free(w->buffers);
|
||||||
w->buffers = NULL;
|
w->buffers = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int UwacWindowShmAllocBuffers(UwacWindow* w, uint64_t nbuffers, uint64_t allocSize,
|
static int UwacWindowShmAllocBuffers(UwacWindow* w, uint64_t nbuffers, uint64_t allocSize,
|
||||||
@@ -92,10 +92,10 @@ static void xdg_handle_toplevel_configure(void* data, struct xdg_toplevel* xdg_t
|
|||||||
int32_t actual_height = height;
|
int32_t actual_height = height;
|
||||||
width *= scale;
|
width *= scale;
|
||||||
height *= scale;
|
height *= scale;
|
||||||
UwacConfigureEvent* event = NULL;
|
UwacConfigureEvent* event = nullptr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int surfaceState = 0;
|
int surfaceState = 0;
|
||||||
enum xdg_toplevel_state* state = NULL;
|
enum xdg_toplevel_state* state = nullptr;
|
||||||
surfaceState = 0;
|
surfaceState = 0;
|
||||||
wl_array_for_each(state, states)
|
wl_array_for_each(state, states)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ static void xdg_handle_toplevel_configure(void* data, struct xdg_toplevel* xdg_t
|
|||||||
|
|
||||||
static void xdg_handle_toplevel_close(void* data, struct xdg_toplevel* xdg_toplevel)
|
static void xdg_handle_toplevel_close(void* data, struct xdg_toplevel* xdg_toplevel)
|
||||||
{
|
{
|
||||||
UwacCloseEvent* event = NULL;
|
UwacCloseEvent* event = nullptr;
|
||||||
UwacWindow* window = (UwacWindow*)data;
|
UwacWindow* window = (UwacWindow*)data;
|
||||||
event = (UwacCloseEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CLOSE);
|
event = (UwacCloseEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CLOSE);
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ static void ivi_handle_configure(void* data, struct ivi_surface* surface, int32_
|
|||||||
int32_t height)
|
int32_t height)
|
||||||
{
|
{
|
||||||
UwacWindow* window = (UwacWindow*)data;
|
UwacWindow* window = (UwacWindow*)data;
|
||||||
UwacConfigureEvent* event = NULL;
|
UwacConfigureEvent* event = nullptr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
event = (UwacConfigureEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CONFIGURE);
|
event = (UwacConfigureEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CONFIGURE);
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ static void shell_configure(void* data, struct wl_shell_surface* surface, uint32
|
|||||||
int32_t width, int32_t height)
|
int32_t width, int32_t height)
|
||||||
{
|
{
|
||||||
UwacWindow* window = (UwacWindow*)data;
|
UwacWindow* window = (UwacWindow*)data;
|
||||||
UwacConfigureEvent* event = NULL;
|
UwacConfigureEvent* event = nullptr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
event = (UwacConfigureEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CONFIGURE);
|
event = (UwacConfigureEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CONFIGURE);
|
||||||
|
|
||||||
@@ -326,8 +326,8 @@ int UwacWindowShmAllocBuffers(UwacWindow* w, uint64_t nbuffers, uint64_t allocSi
|
|||||||
{
|
{
|
||||||
int ret = UWAC_SUCCESS;
|
int ret = UWAC_SUCCESS;
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
void* data = NULL;
|
void* data = nullptr;
|
||||||
struct wl_shm_pool* pool = NULL;
|
struct wl_shm_pool* pool = nullptr;
|
||||||
|
|
||||||
if ((width > INT32_MAX) || (height > INT32_MAX))
|
if ((width > INT32_MAX) || (height > INT32_MAX))
|
||||||
return UWAC_ERROR_NOMEMORY;
|
return UWAC_ERROR_NOMEMORY;
|
||||||
@@ -363,7 +363,7 @@ int UwacWindowShmAllocBuffers(UwacWindow* w, uint64_t nbuffers, uint64_t allocSi
|
|||||||
return UWAC_ERROR_INTERNAL;
|
return UWAC_ERROR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = mmap(NULL, allocbuffersize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
data = mmap(nullptr, allocbuffersize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
|
|
||||||
if (data == MAP_FAILED)
|
if (data == MAP_FAILED)
|
||||||
{
|
{
|
||||||
@@ -437,7 +437,7 @@ static UwacBuffer* UwacWindowFindFreeBuffer(UwacWindow* w, ssize_t* index)
|
|||||||
if (ret != UWAC_SUCCESS)
|
if (ret != UWAC_SUCCESS)
|
||||||
{
|
{
|
||||||
w->display->last_error = ret;
|
w->display->last_error = ret;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
w->buffers[i].used = true;
|
w->buffers[i].used = true;
|
||||||
@@ -483,12 +483,12 @@ static UwacReturnCode UwacWindowSetDecorations(UwacWindow* w)
|
|||||||
UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t height,
|
UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t height,
|
||||||
enum wl_shm_format format)
|
enum wl_shm_format format)
|
||||||
{
|
{
|
||||||
UwacWindow* w = NULL;
|
UwacWindow* w = nullptr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!display)
|
if (!display)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = xzalloc(sizeof(*w));
|
w = xzalloc(sizeof(*w));
|
||||||
@@ -496,7 +496,7 @@ UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t h
|
|||||||
if (!w)
|
if (!w)
|
||||||
{
|
{
|
||||||
display->last_error = UWAC_ERROR_NOMEMORY;
|
display->last_error = UWAC_ERROR_NOMEMORY;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
w->display = display;
|
w->display = display;
|
||||||
@@ -533,7 +533,7 @@ UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t h
|
|||||||
if (env)
|
if (env)
|
||||||
{
|
{
|
||||||
unsigned long val = 0;
|
unsigned long val = 0;
|
||||||
char* endp = NULL;
|
char* endp = nullptr;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
val = strtoul(env, &endp, 10);
|
val = strtoul(env, &endp, 10);
|
||||||
@@ -556,7 +556,7 @@ UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t h
|
|||||||
{
|
{
|
||||||
zwp_fullscreen_shell_v1_present_surface(display->fullscreen_shell, w->surface,
|
zwp_fullscreen_shell_v1_present_surface(display->fullscreen_shell, w->surface,
|
||||||
ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER,
|
ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER,
|
||||||
NULL);
|
nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -609,12 +609,12 @@ out_error_surface:
|
|||||||
UwacWindowDestroyBuffers(w);
|
UwacWindowDestroyBuffers(w);
|
||||||
out_error_free:
|
out_error_free:
|
||||||
free(w);
|
free(w);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
UwacReturnCode UwacDestroyWindow(UwacWindow** pwindow)
|
UwacReturnCode UwacDestroyWindow(UwacWindow** pwindow)
|
||||||
{
|
{
|
||||||
UwacWindow* w = NULL;
|
UwacWindow* w = nullptr;
|
||||||
assert(pwindow);
|
assert(pwindow);
|
||||||
w = *pwindow;
|
w = *pwindow;
|
||||||
UwacWindowDestroyBuffers(w);
|
UwacWindowDestroyBuffers(w);
|
||||||
@@ -647,7 +647,7 @@ UwacReturnCode UwacDestroyWindow(UwacWindow** pwindow)
|
|||||||
wl_surface_destroy(w->surface);
|
wl_surface_destroy(w->surface);
|
||||||
wl_list_remove(&w->link);
|
wl_list_remove(&w->link);
|
||||||
free(w);
|
free(w);
|
||||||
*pwindow = NULL;
|
*pwindow = nullptr;
|
||||||
return UWAC_SUCCESS;
|
return UWAC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -693,14 +693,14 @@ UwacReturnCode UwacWindowSetInputRegion(UwacWindow* window, uint32_t x, uint32_t
|
|||||||
|
|
||||||
void* UwacWindowGetDrawingBuffer(UwacWindow* window)
|
void* UwacWindowGetDrawingBuffer(UwacWindow* window)
|
||||||
{
|
{
|
||||||
UwacBuffer* buffer = NULL;
|
UwacBuffer* buffer = nullptr;
|
||||||
|
|
||||||
if (window->drawingBufferIdx < 0)
|
if (window->drawingBufferIdx < 0)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
buffer = &window->buffers[window->drawingBufferIdx];
|
buffer = &window->buffers[window->drawingBufferIdx];
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return buffer->data;
|
return buffer->data;
|
||||||
}
|
}
|
||||||
@@ -766,7 +766,7 @@ static void UwacSubmitBufferPtr(UwacWindow* window, UwacBuffer* buffer)
|
|||||||
static void frame_done_cb(void* data, struct wl_callback* callback, uint32_t time)
|
static void frame_done_cb(void* data, struct wl_callback* callback, uint32_t time)
|
||||||
{
|
{
|
||||||
UwacWindow* window = (UwacWindow*)data;
|
UwacWindow* window = (UwacWindow*)data;
|
||||||
UwacFrameDoneEvent* event = NULL;
|
UwacFrameDoneEvent* event = nullptr;
|
||||||
|
|
||||||
wl_callback_destroy(callback);
|
wl_callback_destroy(callback);
|
||||||
window->pendingBufferIdx = -1;
|
window->pendingBufferIdx = -1;
|
||||||
@@ -780,7 +780,7 @@ static void frame_done_cb(void* data, struct wl_callback* callback, uint32_t tim
|
|||||||
UwacReturnCode UwacWindowAddDamage(UwacWindow* window, uint32_t x, uint32_t y, uint32_t width,
|
UwacReturnCode UwacWindowAddDamage(UwacWindow* window, uint32_t x, uint32_t y, uint32_t width,
|
||||||
uint32_t height)
|
uint32_t height)
|
||||||
{
|
{
|
||||||
UwacBuffer* buf = NULL;
|
UwacBuffer* buf = nullptr;
|
||||||
|
|
||||||
if (window->drawingBufferIdx < 0)
|
if (window->drawingBufferIdx < 0)
|
||||||
return UWAC_ERROR_INTERNAL;
|
return UWAC_ERROR_INTERNAL;
|
||||||
@@ -797,7 +797,7 @@ UwacReturnCode UwacWindowAddDamage(UwacWindow* window, uint32_t x, uint32_t y, u
|
|||||||
uint32_t height)
|
uint32_t height)
|
||||||
{
|
{
|
||||||
RECTANGLE_16 box;
|
RECTANGLE_16 box;
|
||||||
UwacBuffer* buf = NULL;
|
UwacBuffer* buf = nullptr;
|
||||||
|
|
||||||
box.left = x;
|
box.left = x;
|
||||||
box.top = y;
|
box.top = y;
|
||||||
@@ -839,9 +839,9 @@ UwacReturnCode UwacWindowGetDrawingBufferGeometry(UwacWindow* window, UwacSize*
|
|||||||
|
|
||||||
UwacReturnCode UwacWindowSubmitBuffer(UwacWindow* window, bool copyContentForNextFrame)
|
UwacReturnCode UwacWindowSubmitBuffer(UwacWindow* window, bool copyContentForNextFrame)
|
||||||
{
|
{
|
||||||
UwacBuffer* currentDrawingBuffer = NULL;
|
UwacBuffer* currentDrawingBuffer = nullptr;
|
||||||
UwacBuffer* nextDrawingBuffer = NULL;
|
UwacBuffer* nextDrawingBuffer = nullptr;
|
||||||
UwacBuffer* pendingBuffer = NULL;
|
UwacBuffer* pendingBuffer = nullptr;
|
||||||
|
|
||||||
if (window->drawingBufferIdx < 0)
|
if (window->drawingBufferIdx < 0)
|
||||||
return UWAC_ERROR_INTERNAL;
|
return UWAC_ERROR_INTERNAL;
|
||||||
@@ -882,7 +882,7 @@ UwacReturnCode UwacWindowSetFullscreenState(UwacWindow* window, UwacOutput* outp
|
|||||||
{
|
{
|
||||||
if (isFullscreen)
|
if (isFullscreen)
|
||||||
{
|
{
|
||||||
xdg_toplevel_set_fullscreen(window->xdg_toplevel, output ? output->output : NULL);
|
xdg_toplevel_set_fullscreen(window->xdg_toplevel, output ? output->output : nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -895,7 +895,7 @@ UwacReturnCode UwacWindowSetFullscreenState(UwacWindow* window, UwacOutput* outp
|
|||||||
{
|
{
|
||||||
wl_shell_surface_set_fullscreen(window->shell_surface,
|
wl_shell_surface_set_fullscreen(window->shell_surface,
|
||||||
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0,
|
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0,
|
||||||
output ? output->output : NULL);
|
output ? output->output : nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user