aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-07-07 14:34:56 +0200
committerSimon Ser <contact@emersion.fr>2023-07-07 17:31:11 +0200
commit7a9f8d8d6bf72fcea210552b7bec9b99f342f857 (patch)
treec84c622b9ea25646c081f81b534ec7c70b84ac84 /xwayland
parent4966857f211cb6f48852928076a59f16aadb742b (diff)
Use struct initializers instead of memset()
This is a bit more type-safe.
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/selection/selection.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/xwayland/selection/selection.c b/xwayland/selection/selection.c
index 4cc8b627..0079df2f 100644
--- a/xwayland/selection/selection.c
+++ b/xwayland/selection/selection.c
@@ -34,9 +34,10 @@ void xwm_selection_transfer_destroy_property_reply(
void xwm_selection_transfer_init(struct wlr_xwm_selection_transfer *transfer,
struct wlr_xwm_selection *selection) {
- memset(transfer, 0, sizeof(*transfer));
- transfer->selection = selection;
- transfer->wl_client_fd = -1;
+ *transfer = (struct wlr_xwm_selection_transfer){
+ .selection = selection,
+ .wl_client_fd = -1,
+ };
}
void xwm_selection_transfer_destroy(
@@ -175,14 +176,14 @@ int xwm_handle_selection_event(struct wlr_xwm *xwm,
void xwm_selection_init(struct wlr_xwm_selection *selection,
struct wlr_xwm *xwm, xcb_atom_t atom) {
- memset(selection, 0, sizeof(*selection));
+ *selection = (struct wlr_xwm_selection){
+ .xwm = xwm,
+ .atom = atom,
+ .window = xcb_generate_id(xwm->xcb_conn),
+ };
wl_list_init(&selection->incoming);
wl_list_init(&selection->outgoing);
- selection->xwm = xwm;
- selection->atom = atom;
- selection->window = xcb_generate_id(xwm->xcb_conn);
-
if (atom == xwm->atoms[DND_SELECTION]) {
xcb_create_window(
xwm->xcb_conn,