Shortened some if statements.

master
MadcowOG 2023-02-21 17:36:29 -08:00
parent 862239a655
commit ab491b03d6
2 changed files with 7 additions and 12 deletions

View File

@ -87,9 +87,8 @@ void layerSurface(void* data, zwlr_layer_surface_v1* _, uint32_t serial, uint32_
zwlr_layer_surface_v1_ack_configure(bar->layer_surface, serial);
if (bar->shm) {
if (bar->shm->width == width && bar->shm->height) {
if (bar->shm->width == width && bar->shm->height)
return;
}
shm_destroy(bar->shm);
}
@ -384,9 +383,8 @@ void bar_invalidate(Bar* bar) {
}
void bar_show(Bar* bar, wl_output* output) {
if (!bar || !output || bar_is_visible(bar)) {
if (!bar || !output || bar_is_visible(bar))
return;
}
bar->surface = wl_compositor_create_surface(compositor);
bar->layer_surface = zwlr_layer_shell_v1_get_layer_surface(shell, bar->surface, output, ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, "doom.dwl-bar");

View File

@ -275,13 +275,11 @@ void button(void *data, wl_pointer *pointer, uint32_t serial, uint32_t time,
static void frame(void* data, wl_pointer* pointer) {
Seat seat = *(Seat*)data;
Monitor* monitor = seat.pointer->focused_monitor;
if (!monitor) {
if (!monitor)
return;
}
for (int i = 0; i < seat.pointer->size; i++) {
for (int i = 0; i < seat.pointer->size; i++)
bar_click(monitor->bar, monitor, seat.pointer->x, seat.pointer->y, seat.pointer->buttons[i]);
}
free(seat.pointer->buttons);
seat.pointer->buttons = NULL;
@ -303,9 +301,9 @@ void capabilites(void* data, wl_seat* wl_seat, uint32_t capabilities) {
if (seat->pointer && !has_pointer) {
wl_pointer_release(seat->pointer->pointer);
seat->pointer->focused_monitor = NULL;
if (seat->pointer->buttons) {
if (seat->pointer->buttons)
free(seat->pointer->buttons);
}
free(seat->pointer);
}
}
@ -865,9 +863,8 @@ void die(const char *fmt, ...) {
void* ecalloc(size_t amnt, size_t size) {
void *p;
if (!(p = calloc(amnt, size))) {
if (!(p = calloc(amnt, size)))
die("calloc did not allocate");
}
return p;
}