refactor: use ANSI C
This commit is contained in:
parent
bc999e3218
commit
a9fdae695a
4 changed files with 16 additions and 13 deletions
2
Makefile
2
Makefile
|
@ -5,7 +5,7 @@ SRCS := main.c event.c read_events.c read_file.c
|
|||
OBJS := main.o event.o read_events.o read_file.o
|
||||
|
||||
CC := gcc
|
||||
CFLAGS := -Wall -g -I.
|
||||
CFLAGS := -ansi -pedantic -Wall -Wextra -g -I.
|
||||
#CFLAGS := -Wall -ansi -g -I.
|
||||
LDLIBS := -lxdo -lX11
|
||||
|
||||
|
|
|
@ -147,10 +147,11 @@ void readfile() {
|
|||
|
||||
int main()
|
||||
{
|
||||
int t;
|
||||
FILE *file = fopen("t", "w+");
|
||||
if (file == NULL) return -1;
|
||||
|
||||
int t = listen(file);
|
||||
t = listen(file);
|
||||
if (t) return t;
|
||||
|
||||
printf("Fin\n");
|
||||
|
|
|
@ -26,6 +26,11 @@ int listen(FILE *file)
|
|||
unsigned char data[3];
|
||||
const char *pDevice = "/dev/input/mice";
|
||||
|
||||
int left = 0;
|
||||
int right = 0;
|
||||
int middle = 0;
|
||||
signed char x, y;
|
||||
|
||||
int fd = open(pDevice, O_RDWR);
|
||||
if (fd == -1)
|
||||
{
|
||||
|
@ -33,14 +38,9 @@ int listen(FILE *file)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int left = 0;
|
||||
int right = 0;
|
||||
int middle = 0;
|
||||
signed char x, y;
|
||||
|
||||
while (!(left && right))
|
||||
{
|
||||
// Read Mouse
|
||||
/* Read Mouse */
|
||||
bytes = read(fd, data, sizeof(data));
|
||||
|
||||
if (bytes > 0)
|
||||
|
@ -61,7 +61,7 @@ int listen(FILE *file)
|
|||
&event.xbutton.state
|
||||
);
|
||||
|
||||
//printf("%d - %d\n", event.xmotion.x, event.xmotion.y);
|
||||
/* printf("%d - %d\n", event.xmotion.x, event.xmotion.y); */
|
||||
|
||||
if ((left || right) && !(left && right)) {
|
||||
mouse_button type_button;
|
||||
|
@ -83,6 +83,8 @@ int listen(FILE *file)
|
|||
close(fd);
|
||||
XCloseDisplay(display);
|
||||
return 0;
|
||||
// TODO on ecoute la souris
|
||||
// TODO on repete ce qu'on a entre
|
||||
/*
|
||||
TODO on ecoute la souris
|
||||
TODO on repete ce qu'on a entre
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
//#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <xdo.h>
|
||||
|
@ -6,7 +5,8 @@
|
|||
#include "event.h"
|
||||
#include "read_file.h"
|
||||
|
||||
void readfile(FILE *file) {
|
||||
void readfile(FILE *file)
|
||||
{
|
||||
xdo_t *x_t = xdo_new(NULL);
|
||||
|
||||
event *current_event = new_event();
|
||||
|
|
Loading…
Reference in a new issue