Merge branch 'merging'
This commit is contained in:
commit
1acdc0ca01
0
wmfs2/TODO
Executable file → Normal file
0
wmfs2/TODO
Executable file → Normal file
0
wmfs2/src/barwin.c
Executable file → Normal file
0
wmfs2/src/barwin.c
Executable file → Normal file
0
wmfs2/src/barwin.h
Executable file → Normal file
0
wmfs2/src/barwin.h
Executable file → Normal file
0
wmfs2/src/client.c
Executable file → Normal file
0
wmfs2/src/client.c
Executable file → Normal file
0
wmfs2/src/client.h
Executable file → Normal file
0
wmfs2/src/client.h
Executable file → Normal file
0
wmfs2/src/config.c
Executable file → Normal file
0
wmfs2/src/config.c
Executable file → Normal file
0
wmfs2/src/config.h
Executable file → Normal file
0
wmfs2/src/config.h
Executable file → Normal file
0
wmfs2/src/draw.h
Executable file → Normal file
0
wmfs2/src/draw.h
Executable file → Normal file
0
wmfs2/src/event.c
Executable file → Normal file
0
wmfs2/src/event.c
Executable file → Normal file
0
wmfs2/src/event.h
Executable file → Normal file
0
wmfs2/src/event.h
Executable file → Normal file
0
wmfs2/src/ewmh.c
Executable file → Normal file
0
wmfs2/src/ewmh.c
Executable file → Normal file
0
wmfs2/src/ewmh.h
Executable file → Normal file
0
wmfs2/src/ewmh.h
Executable file → Normal file
53
wmfs2/src/fifo.c
Normal file
53
wmfs2/src/fifo.c
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* wmfs2 by Martin Duquesnoy <xorg62@gmail.com> { for(i = 2011; i < 2111; ++i) ©(i); }
|
||||||
|
* For license, see COPYING.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "wmfs.h"
|
||||||
|
#include "fifo.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#define FIFO_DEFAULT_PATH "/tmp/wmfs-fifo"
|
||||||
|
|
||||||
|
void
|
||||||
|
fifo_init(void)
|
||||||
|
{
|
||||||
|
W->fifo.path = FIFO_DEFAULT_PATH;
|
||||||
|
|
||||||
|
if(mkfifo(W->fifo.path, 0644) < 0 || !(W->fifo.fp = fopen(W->fifo.path, "w+")))
|
||||||
|
{
|
||||||
|
warnx("Can't create FIFO: %s\n", strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fcntl(fileno(W->fifo.fp), F_SETFL, O_NONBLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fifo_parse(char *cmd)
|
||||||
|
{
|
||||||
|
void (*func)(Uicb cmd);
|
||||||
|
char *uicb = strtok(cmd, " ");
|
||||||
|
char *arg = strtok(NULL, "\n");
|
||||||
|
|
||||||
|
printf ("%s %s\n", uicb, arg);
|
||||||
|
|
||||||
|
func = uicb_name_func(uicb);
|
||||||
|
if(func)
|
||||||
|
func(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fifo_read(void)
|
||||||
|
{
|
||||||
|
char buf[256] = {0};
|
||||||
|
|
||||||
|
/* Don't read it if not open */
|
||||||
|
if(!(W->fifo.fp)) return;
|
||||||
|
|
||||||
|
fread(buf, sizeof(buf) - 1, 1, W->fifo.fp);
|
||||||
|
|
||||||
|
if (buf[0])
|
||||||
|
fifo_parse(buf);
|
||||||
|
}
|
||||||
|
|
||||||
17
wmfs2/src/fifo.h
Normal file
17
wmfs2/src/fifo.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* wmfs2 by Martin Duquesnoy <xorg62@gmail.com> { for(i = 2011; i < 2111; ++i) ©(i); }
|
||||||
|
* For license, see COPYING.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FIFO_H
|
||||||
|
#define FIFO_H
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
void fifo_init(void);
|
||||||
|
void fifo_read(void);
|
||||||
|
|
||||||
|
#endif /* FIFO_H */
|
||||||
0
wmfs2/src/infobar.c
Executable file → Normal file
0
wmfs2/src/infobar.c
Executable file → Normal file
0
wmfs2/src/infobar.h
Executable file → Normal file
0
wmfs2/src/infobar.h
Executable file → Normal file
0
wmfs2/src/parse.c
Executable file → Normal file
0
wmfs2/src/parse.c
Executable file → Normal file
0
wmfs2/src/parse.h
Executable file → Normal file
0
wmfs2/src/parse.h
Executable file → Normal file
0
wmfs2/src/parse_api.c
Executable file → Normal file
0
wmfs2/src/parse_api.c
Executable file → Normal file
0
wmfs2/src/screen.c
Executable file → Normal file
0
wmfs2/src/screen.c
Executable file → Normal file
0
wmfs2/src/screen.h
Executable file → Normal file
0
wmfs2/src/screen.h
Executable file → Normal file
0
wmfs2/src/tag.c
Executable file → Normal file
0
wmfs2/src/tag.c
Executable file → Normal file
0
wmfs2/src/tag.h
Executable file → Normal file
0
wmfs2/src/tag.h
Executable file → Normal file
0
wmfs2/src/util.c
Executable file → Normal file
0
wmfs2/src/util.c
Executable file → Normal file
0
wmfs2/src/util.h
Executable file → Normal file
0
wmfs2/src/util.h
Executable file → Normal file
11
wmfs2/src/wmfs.c
Executable file → Normal file
11
wmfs2/src/wmfs.c
Executable file → Normal file
@ -15,6 +15,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "fifo.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
wmfs_error_handler(Display *d, XErrorEvent *event)
|
wmfs_error_handler(Display *d, XErrorEvent *event)
|
||||||
@ -213,8 +214,13 @@ wmfs_loop(void)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
while(XPending(W->dpy))
|
while(XPending(W->dpy))
|
||||||
|
{
|
||||||
while(W->running && !XNextEvent(W->dpy, &ev))
|
while(W->running && !XNextEvent(W->dpy, &ev))
|
||||||
|
{
|
||||||
HANDLE_EVENT(&ev);
|
HANDLE_EVENT(&ev);
|
||||||
|
fifo_read();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@ -225,6 +231,7 @@ wmfs_init(void)
|
|||||||
screen_init();
|
screen_init();
|
||||||
event_init();
|
event_init();
|
||||||
config_init();
|
config_init();
|
||||||
|
fifo_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -244,6 +251,10 @@ wmfs_quit(void)
|
|||||||
FREE_LIST(Keybind, W->h.keybind);
|
FREE_LIST(Keybind, W->h.keybind);
|
||||||
FREE_LIST(Theme, W->h.theme);
|
FREE_LIST(Theme, W->h.theme);
|
||||||
|
|
||||||
|
/* FIFO stuffs */
|
||||||
|
fclose(W->fifo.fp);
|
||||||
|
free(W->fifo.path);
|
||||||
|
|
||||||
W->running = false;
|
W->running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
7
wmfs2/src/wmfs.h
Executable file → Normal file
7
wmfs2/src/wmfs.h
Executable file → Normal file
@ -213,6 +213,13 @@ struct Wmfs
|
|||||||
*/
|
*/
|
||||||
Scr33n *screen;
|
Scr33n *screen;
|
||||||
|
|
||||||
|
/* FIFO */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
char *path;
|
||||||
|
} fifo;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int wmfs_error_handler(Display *d, XErrorEvent *event);
|
int wmfs_error_handler(Display *d, XErrorEvent *event);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user