commit: 895f8249860e1eafabcce8230f0c65486867196b
parent 2912f3fe5402494aedcab01138af1e7155b89eed
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 4 Dec 2020 03:51:09 +0100
Clear out converstion warnings
Diffstat:
2 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/inaban.c b/inaban.c
@@ -6,6 +6,7 @@
#include "config.h"
+#include <assert.h>
#include <getopt.h>
#include <signal.h> /* signal(), SIGTERM */
#include <stdio.h>
@@ -13,7 +14,6 @@
#include <time.h>
#include <unistd.h> /* execvp() */
#include <unistd.h>
-#include <assert.h>
#define LENGTH(X) (sizeof X / sizeof X[0])
@@ -219,15 +219,15 @@ process_cursor_motion(struct inaban_server *server, uint32_t time)
{
struct inaban_view *view = server->grabbed_view;
- view->x = server->cursor->x - server->grab_x;
- view->y = server->cursor->y - server->grab_y;
+ view->x = (int)server->cursor->x - (int)server->grab_x;
+ view->y = (int)server->cursor->y - (int)server->grab_y;
}
else if(server->cursor_mode == INABAN_CURSOR_RESIZE)
{
struct inaban_view *view = server->grabbed_view;
- int width = server->cursor->x - server->grab_x;
- int height = server->cursor->y - server->grab_y;
+ uint32_t width = (uint32_t)server->cursor->x - (uint32_t)server->grab_x;
+ uint32_t height = (uint32_t)server->cursor->y - (uint32_t)server->grab_y;
wlr_xdg_toplevel_set_size(view->xdg_surface, width, height);
}
@@ -407,10 +407,10 @@ render_surface(struct wlr_surface *surface, int sx, int sy, void *data)
/* We also have to apply the scale factor for HiDPI outputs. This is only
* part of the puzzle, TinyWL does not fully support HiDPI. */
struct wlr_box box = {
- .x = ox * output->scale,
- .y = oy * output->scale,
- .width = surface->current.width * output->scale,
- .height = surface->current.height * output->scale,
+ .x = (int)(ox * output->scale),
+ .y = (int)(oy * output->scale),
+ .width = (int)(surface->current.width * output->scale),
+ .height = (int)(surface->current.height * output->scale),
};
/*
@@ -618,7 +618,7 @@ main(int argc, char *argv[])
wlr_log_init(WLR_DEBUG, NULL);
char *startup_cmdv[] = {NULL};
int startup_cmdc = 0;
- int ret = 0;
+ int ret = 0;
struct wlr_server_decoration_manager *server_decoration_manager = NULL;
@@ -650,13 +650,15 @@ main(int argc, char *argv[])
}
server.wl_display = wl_display_create();
- if (!server.wl_display) {
+ if(!server.wl_display)
+ {
wlr_log(WLR_ERROR, "Cannot allocate a Wayland display");
return 1;
}
server.backend = wlr_backend_autocreate(server.wl_display, NULL);
- if (!server.backend) {
+ if(!server.backend)
+ {
wlr_log(WLR_ERROR, "Unable to create the wlroots backend");
ret = 1;
goto end;
@@ -672,13 +674,15 @@ main(int argc, char *argv[])
* necessary for clients to allocate surfaces and the data device manager
* handles the clipboard. Each of these wlroots interfaces has room for you
* to dig your fingers in and play with their behavior if you want. */
- if(!wlr_compositor_create(server.wl_display, server.renderer)) {
+ if(!wlr_compositor_create(server.wl_display, server.renderer))
+ {
wlr_log(WLR_ERROR, "Unable to create the wlroots compositor");
ret = 1;
goto end;
}
- if(!wlr_data_device_manager_create(server.wl_display)) {
+ if(!wlr_data_device_manager_create(server.wl_display))
+ {
wlr_log(WLR_ERROR, "Unable to create the data device manager");
ret = 1;
goto end;
@@ -687,7 +691,8 @@ main(int argc, char *argv[])
/* Creates an output layout, which a wlroots utility for working with an
* arrangement of screens in a physical layout. */
server.output_layout = wlr_output_layout_create();
- if(!server.output_layout) {
+ if(!server.output_layout)
+ {
wlr_log(WLR_ERROR, "Unable to create output layout");
ret = 1;
goto end;
@@ -768,8 +773,9 @@ main(int argc, char *argv[])
wl_list_init(&server.keyboards);
server.new_input.notify = server_new_input;
wl_signal_add(&server.backend->events.new_input, &server.new_input);
- server.seat = wlr_seat_create(server.wl_display, "seat0");
- if(!server.seat) {
+ server.seat = wlr_seat_create(server.wl_display, "seat0");
+ if(!server.seat)
+ {
wlr_log_errno(WLR_ERROR, "Unable to create wlroots seat");
ret = 1;
goto end;
diff --git a/inaban.h b/inaban.h
@@ -67,7 +67,12 @@ struct inaban_server
enum inaban_cursor_mode cursor_mode;
struct inaban_view *grabbed_view;
- int grab_x, grab_y, grab_width, grab_height;
+
+ /* cursor position */
+ double grab_x, grab_y;
+
+ /* window size */
+ int grab_width, grab_height;
};
struct inaban_output