tools: use the new shared lib from event-gui

This gives the event gui the ability to use the path backend, and any
configuration toggles given on the commandline.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-12-18 14:47:54 +10:00
parent 363a7f783f
commit 6ee8c5854c
2 changed files with 11 additions and 41 deletions

View file

@ -18,7 +18,7 @@ if BUILD_EVENTGUI
noinst_PROGRAMS += event-gui
event_gui_SOURCES = event-gui.c
event_gui_LDADD = ../src/libinput.la $(CAIRO_LIBS) $(GTK_LIBS) $(LIBUDEV_LIBS)
event_gui_LDADD = ../src/libinput.la libshared.la $(CAIRO_LIBS) $(GTK_LIBS) $(LIBUDEV_LIBS)
event_gui_CFLAGS = $(CAIRO_CFLAGS) $(GTK_CFLAGS) $(LIBUDEV_CFLAGS)
event_gui_LDFLAGS = -no-install
endif

View file

@ -27,7 +27,6 @@
#include <cairo.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
@ -40,8 +39,12 @@
#include <libinput.h>
#include <libinput-util.h>
#include "shared.h"
#define clip(val_, min_, max_) min((max_), max((min_), (val_)))
struct tools_options options;
struct touch {
int active;
int x, y;
@ -95,12 +98,6 @@ msg(const char *fmt, ...)
va_end(args);
}
static void
usage(void)
{
printf("%s [path/to/device]\n", program_invocation_short_name);
}
static gboolean
draw(GtkWidget *widget, cairo_t *cr, gpointer data)
{
@ -490,35 +487,6 @@ sockets_init(struct libinput *li)
g_io_add_watch(c, G_IO_IN, handle_event_libinput, li);
}
static int
parse_opts(int argc, char *argv[])
{
while (1) {
static struct option long_options[] = {
{ "help", no_argument, 0, 'h' },
};
int option_index = 0;
int c;
c = getopt_long(argc, argv, "h", long_options,
&option_index);
if (c == -1)
break;
switch(c) {
case 'h':
usage();
return 0;
default:
usage();
return 1;
}
}
return 0;
}
static int
open_restricted(const char *path, int flags, void *user_data)
{
@ -546,16 +514,18 @@ main(int argc, char *argv[])
gtk_init(&argc, &argv);
if (parse_opts(argc, argv) != 0)
tools_init_options(&options);
if (tools_parse_args(argc, argv, &options) != 0)
return 1;
udev = udev_new();
if (!udev)
error("Failed to initialize udev\n");
li = libinput_udev_create_context(&interface, &w, udev);
if (!li || libinput_udev_assign_seat(li, "seat0") != 0)
error("Failed to initialize context from udev\n");
li = tools_open_backend(&options, &interface);
if (!li)
return 1;
window_init(&w);
sockets_init(li);