summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorepoch <epoch@thebackupbox.net>2020-04-14 06:19:54 -0500
committerepoch <epoch@thebackupbox.net>2020-04-14 06:19:54 -0500
commit1b57092b70e5a72ec948dd260745eec3c9230683 (patch)
tree4bcce8d67d76021cb226f3080772626b2c1d58cc /src
parent8ed4d5bcb2337f5542799f8b9eb05c5b6b3f360e (diff)
downloadhackvr-1b57092b70e5a72ec948dd260745eec3c9230683.tar.gz
hackvr-1b57092b70e5a72ec948dd260745eec3c9230683.zip
added ability for graphics system to not generate events.
Diffstat (limited to 'src')
-rw-r--r--src/hackvr.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/hackvr.c b/src/hackvr.c
index 7d2a8dc..80991dd 100644
--- a/src/hackvr.c
+++ b/src/hackvr.c
@@ -650,6 +650,7 @@ void alarm_handler(int sig) {
int main(int argc,char *argv[]) {
int i;
+ int fd;
if(argc == 2) {
if(!strcmp(argv[1],"-v") || !strcmp(argv[1],"--version")) {
hvr_version();
@@ -672,7 +673,6 @@ int main(int argc,char *argv[]) {
inittable(&global.ht_group,65536);
- fcntl(1,F_SETFL,O_NONBLOCK);//won't work
setbuf(stdin,0);
setbuf(stdout,0);
global.debug=DEBUG;
@@ -686,10 +686,13 @@ int main(int argc,char *argv[]) {
idc.shitlen=0;
#ifdef GRAPHICAL
- i=add_fd(graphics_init(),graphics_event_handler);
- fprintf(stderr,"# x11 fd: %d\n",idc.fds[i].fd);
- idc.fds[i].read_lines_for_us=0;
-
+ if((fd=graphics_init()) == -1) {
+ fprintf(stderr,"# graphics system in use doesn't generate events.\n");
+ } else {
+ i=add_fd(graphics_init(),graphics_event_handler);
+ fprintf(stderr,"# graphics fd: %d\n",idc.fds[i].fd);
+ idc.fds[i].read_lines_for_us=0;
+ }
i=add_fd(mouse_init(),mouse_event_handler);//this should probably be split to keyboard_init, and mouse_init
fprintf(stderr,"# mouse fd: %d\n",idc.fds[i].fd);