projects
/
my-code
/
api.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed rgb values of pixmap struct
[my-code/api.git]
/
input
/
input.c
diff --git
a/input/input.c
b/input/input.c
index
86dac62
..
285a08d
100644
(file)
--- a/
input/input.c
+++ b/
input/input.c
@@
-6,15
+6,22
@@
#include "input.h"
#include "input.h"
-int input_init(t_input *input) {
+int input_init(t_input *input,int outfd) {
+
+ dprintf(outfd,"[input] initializing input system ...\n");
+
+ input->outfd=outfd;
+ input->mode=0;
+
+ return I_SUCCESS;
+}
+
+int input_ios_init(t_input *input) {
struct termios tios;
int size;
struct termios tios;
int size;
- puts("[input] initializing input system ...");
-
- // size=((input->mode&CONTENT_BUFFER)?MAX_CONTENT:1); <- ???
- size=MAX_CONTENT;
+ size=((input->mode&CONTENT_BUFFER)?MAX_CONTENT:1);
if((input->content=(char *)malloc(size))==NULL) {
perror("[input] malloc call");
if((input->content=(char *)malloc(size))==NULL) {
perror("[input] malloc call");
@@
-33,6
+40,8
@@
int input_init(t_input *input) {
tios.c_cc[VMIN]=1; /* 1 char for non-can. mode */
/* depending on used modes */
tios.c_cc[VMIN]=1; /* 1 char for non-can. mode */
/* depending on used modes */
+ tios.c_lflag|=ICANON;
+ tios.c_lflag|=ECHO;
if(!(input->mode&LINE_BUFFERED)) tios.c_lflag&=(~ICANON);
if(!(input->mode&INPUT_ECHO)) tios.c_lflag&=(~ECHO);
if(!(input->mode&LINE_BUFFERED)) tios.c_lflag&=(~ICANON);
if(!(input->mode&INPUT_ECHO)) tios.c_lflag&=(~ECHO);
@@
-45,7
+54,7
@@
int input_shutdown(t_input *input) {
free(input->content);
tcsetattr(0,TCSANOW,&(input->tios));
free(input->content);
tcsetattr(0,TCSANOW,&(input->tios));
-
puts("[input] shutdow
n");
+
dprintf(input->outfd,"[input] shutdown\
n");
return I_SUCCESS;
}
return I_SUCCESS;
}
@@
-65,7
+74,7
@@
int input_get_event(t_input *input,int (*callback)(t_input *input,void *ptr),
}
if(input->c_count>=MAX_CONTENT) {
}
if(input->c_count>=MAX_CONTENT) {
-
puts("[input] max input length reached
");
+
dprintf(input->outfd,"[input] max input length reached\n
");
return I_ERROR;
}
return I_ERROR;
}