summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2015-08-03 18:13:19 +0100
committerFrediano Ziglio <fziglio@redhat.com>2015-08-03 18:13:19 +0100
commitb823ef871d082f536c0eb5fc4cfb1956f48d0cde (patch)
treecff72ad3c3583543b8da5171f22268296e91ebc8
parentaeaa6c6ba2611f0d133eb66d21e717558f2465df (diff)
style changes
-rw-r--r--record.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/record.c b/record.c
index 0079cb7..e313e73 100644
--- a/record.c
+++ b/record.c
@@ -25,7 +25,7 @@ sig_end(int sig)
}
static void
-update_win_pos(void)
+get_win_pos(void)
{
int win_x, win_y;
Window child;
@@ -58,6 +58,12 @@ handle_motion(XIDeviceEvent* ev)
}
static void
+handle_xi_keys(XIDeviceEvent* event)
+{
+ printf("Got a key\n");
+}
+
+static void
handle_xinput(XGenericEventCookie *cookie)
{
if (verbose >= 2)
@@ -67,7 +73,7 @@ handle_xinput(XGenericEventCookie *cookie)
case XI_KeyPress:
case XI_KeyRelease:
if (has_focus)
- printf("Got a key\n");
+ handle_xi_keys(cookie->data);
break;
case XI_ButtonPress:
break;
@@ -136,17 +142,20 @@ handle_xev(XEvent *ev)
case ConfigureNotify:
handle_ConfigureNotify(ev);
break;
+ /* don't care */
case KeyPress:
case KeyRelease:
case ButtonPress:
case ButtonRelease:
case MotionNotify:
+ case ColormapNotify:
+ break;
case KeymapNotify:
case Expose:
case GraphicsExpose:
case NoExpose:
case VisibilityNotify:
- case CreateNotify:
+ case CreateNotify: /* see if our client was created ? */
case UnmapNotify:
case MapNotify:
case MapRequest:
@@ -156,11 +165,10 @@ handle_xev(XEvent *ev)
case ResizeRequest:
case CirculateNotify:
case CirculateRequest:
- case PropertyNotify:
+ case PropertyNotify: /* handle status change (visible/not) ? */
case SelectionClear:
case SelectionRequest:
case SelectionNotify:
- case ColormapNotify:
case ClientMessage:
case MappingNotify:
if (verbose == 1)
@@ -169,13 +177,13 @@ handle_xev(XEvent *ev)
}
}
-void record(const char *fn_out, Window _win)
+void record(const char *fn_out, Window w)
{
- if (_win == 0) {
+ if (w == 0) {
fprintf (stderr, "record mode require a window to be specified\n");
exit(EXIT_FAILURE);
}
- win = _win;
+ win = w;
f_out = fopen(fn_out, "wb");
if (!f_out) {
@@ -186,7 +194,8 @@ void record(const char *fn_out, Window _win)
xev_init(win);
xinput_init(dpy, win);
- update_win_pos();
+ /* TODO get focus and if mouse inside */
+ get_win_pos();
signal(SIGINT, sig_end);
signal(SIGTERM, sig_end);