fix some warnings

This commit is contained in:
rick 2022-12-19 14:52:03 +01:00
parent b8abbfc5a6
commit 21260fbfdf
Signed by: Rick
GPG key ID: 4A6223D66294EB20
5 changed files with 13 additions and 12 deletions

View file

@ -35,6 +35,7 @@ void mouse_event(event *event, mouse_button button)
break; break;
case M_MIDDLE: event->infos |= 0x3; case M_MIDDLE: event->infos |= 0x3;
break; break;
case M_NONE: break;
} }
} }

View file

@ -23,7 +23,7 @@ int main(void)
GLFWwindow* window; GLFWwindow* window;
ImGuiContext *ctx; ImGuiContext *ctx;
ImGuiIO *io; /* ImGuiIO *io; */
const char *glsl_version; const char *glsl_version;
@ -47,7 +47,7 @@ int main(void)
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
ctx = igCreateContext(NULL); ctx = igCreateContext(NULL);
io = igGetIO(); /* io = igGetIO(); */
glsl_version = "#version 330 core"; glsl_version = "#version 330 core";
ImGui_ImplGlfw_InitForOpenGL(window, true); ImGui_ImplGlfw_InitForOpenGL(window, true);
@ -55,8 +55,7 @@ int main(void)
igStyleColorsDark(NULL); igStyleColorsDark(NULL);
char is_recording = 0; const char *name = "fichier.macros";
char *name = "fichier.macros";
ui_infos *ui = init_ui(name); ui_infos *ui = init_ui(name);

View file

@ -54,7 +54,6 @@ int listen(FILE *file)
int left = 0; int left = 0;
int right = 0; int right = 0;
int middle = 0; int middle = 0;
signed char x, y;
int fd = open(pDevice, O_RDWR); int fd = open(pDevice, O_RDWR);
if (fd == -1) if (fd == -1)

View file

@ -8,7 +8,9 @@
#include "read_file.h" #include "read_file.h"
#include "ui.h" #include "ui.h"
ui_infos * init_ui(char *name) const struct ImVec2 zero_vec2 = {0, 0};
ui_infos * init_ui(const char *name)
{ {
ui_infos *ret = (ui_infos *) malloc(sizeof(ui_infos)); ui_infos *ret = (ui_infos *) malloc(sizeof(ui_infos));
ret->name = (char *) malloc(strlen(name) + 1); ret->name = (char *) malloc(strlen(name) + 1);
@ -31,8 +33,8 @@ int draw_ui(ui_infos *ptr)
{ {
/* en plein écran */ /* en plein écran */
ImGuiViewport *vp = igGetMainViewport(); ImGuiViewport *vp = igGetMainViewport();
igSetNextWindowPos(vp->Pos, NULL, (ImVec2) { 0, 0 }); igSetNextWindowPos(vp->Pos, ImGuiCond_None, zero_vec2);
igSetNextWindowSize(vp->Size, NULL); igSetNextWindowSize(vp->Size, ImGuiCond_None);
/* /*
* Choix du fichier * Choix du fichier
@ -49,7 +51,7 @@ int draw_ui(ui_infos *ptr)
if (ptr->is_recording) if (ptr->is_recording)
{ {
if (igButton("Arrêter l'enregistrement.", (ImVec2) { 0, 0 })) if (igButton("Arrêter l'enregistrement.", zero_vec2))
{ {
if (pthread_cancel(ptr->pid)) if (pthread_cancel(ptr->pid))
{ {
@ -62,7 +64,7 @@ int draw_ui(ui_infos *ptr)
} }
else else
{ {
if (igButton("Lancer l'enregistrement.", (ImVec2) { 0, 0 })) if (igButton("Lancer l'enregistrement.", zero_vec2))
{ {
ptr->is_recording = 1; ptr->is_recording = 1;
@ -77,7 +79,7 @@ int draw_ui(ui_infos *ptr)
igInputInt("Temps de repos entre chaque clic (s)", &ptr->args_rf->time_sleep, 1, 10, 0); igInputInt("Temps de repos entre chaque clic (s)", &ptr->args_rf->time_sleep, 1, 10, 0);
if (ptr->args_rf->time_sleep <= 0) ptr->args_rf->time_sleep = 1; if (ptr->args_rf->time_sleep <= 0) ptr->args_rf->time_sleep = 1;
if (igButton("Replay", (ImVec2) {0, 0})) if (igButton("Replay", zero_vec2))
{ {
rewind(ptr->file); rewind(ptr->file);
readfile(ptr->args_rf); readfile(ptr->args_rf);

View file

@ -11,7 +11,7 @@ typedef struct {
args_readfile *args_rf; args_readfile *args_rf;
} ui_infos; } ui_infos;
ui_infos * init_ui(char *name); ui_infos * init_ui(const char *name);
void free_ui(ui_infos *ptr); void free_ui(ui_infos *ptr);
int draw_ui(ui_infos *ptr); int draw_ui(ui_infos *ptr);