diff options
Diffstat (limited to 'src/surface/wld.c')
-rw-r--r-- | src/surface/wld.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/surface/wld.c b/src/surface/wld.c index 29f9ae2..9ef3c40 100644 --- a/src/surface/wld.c +++ b/src/surface/wld.c @@ -48,7 +48,7 @@ struct wld_connection { struct wl_display *display; /**< connection object */ struct wl_registry *registry; /**< registry object */ - /** compositor object, available once teh registry messages have + /** compositor object, available once the registry messages have * been processed */ struct wl_compositor *compositor; @@ -975,13 +975,14 @@ pointer_handle_motion(void *data, UNUSED(time); event = calloc(1, sizeof(struct wld_event)); + if (event != NULL) { + event->event.type = NSFB_EVENT_MOVE_ABSOLUTE; + event->event.value.vector.x = wl_fixed_to_int(sx_w); + event->event.value.vector.y = wl_fixed_to_int(sy_w); + event->event.value.vector.z = 0; - event->event.type = NSFB_EVENT_MOVE_ABSOLUTE; - event->event.value.vector.x = wl_fixed_to_int(sx_w); - event->event.value.vector.y = wl_fixed_to_int(sy_w); - event->event.value.vector.z = 0; - - enqueue_wld_event(input->connection, event); + enqueue_wld_event(input->connection, event); + } } static void @@ -997,7 +998,9 @@ pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, UNUSED(time); event = calloc(1, sizeof(struct wld_event)); - + if (event == NULL) { + return; + } if (state == WL_POINTER_BUTTON_STATE_PRESSED) { event->event.type = NSFB_EVENT_KEY_DOWN; } else { @@ -1259,7 +1262,6 @@ new_connection(void) struct wld_connection* connection; connection = calloc(1, sizeof(struct wld_connection)); - if (connection == NULL) { return NULL; } @@ -1456,8 +1458,9 @@ os_create_anonymous_file(off_t size) } name = malloc(strlen(path) + sizeof(template)); - if (!name) + if (name == NULL) { return -1; + } strcpy(name, path); strcat(name, template); @@ -1657,8 +1660,9 @@ static int x_initialise(nsfb_t *nsfb) return -1; xstate = calloc(1, sizeof(xstate_t)); - if (xstate == NULL) + if (xstate == NULL) { return -1; /* no memory */ + } /* open connection with the server */ xstate->connection = xcb_connect(NULL, NULL); |