diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | clients/Makefile.am | 9 | ||||
-rw-r--r-- | clients/desktop-shell.c | 1 | ||||
-rw-r--r-- | clients/tablet-shell.c | 1 | ||||
-rw-r--r-- | clients/window.h | 27 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | shared/Makefile.am | 3 | ||||
-rw-r--r-- | shared/configparser.c (renamed from clients/config.c) | 2 | ||||
-rw-r--r-- | shared/configparser.h | 54 |
9 files changed, 67 insertions, 33 deletions
diff --git a/Makefile.am b/Makefile.am index b32051c..b52af26 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1 @@ -SUBDIRS = compositor clients data +SUBDIRS = shared compositor clients data diff --git a/clients/Makefile.am b/clients/Makefile.am index e2521d9..0494c3b 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -40,8 +40,7 @@ libtoytoolkit_a_SOURCES = \ window.c \ window.h \ cairo-util.c \ - cairo-util.h \ - config.c + cairo-util.h toolkit_libs = \ libtoytoolkit.a \ @@ -81,13 +80,15 @@ wayland_desktop_shell_SOURCES = \ desktop-shell.c \ desktop-shell-client-protocol.h \ desktop-shell-protocol.c -wayland_desktop_shell_LDADD = $(toolkit_libs) +wayland_desktop_shell_LDADD = $(toolkit_libs) \ + ../shared/libconfigparser.la wayland_tablet_shell_SOURCES = \ tablet-shell.c \ tablet-shell-client-protocol.h \ tablet-shell-protocol.c -wayland_tablet_shell_LDADD = $(toolkit_libs) +wayland_tablet_shell_LDADD = $(toolkit_libs) \ + ../shared/libconfigparser.la BUILT_SOURCES = \ screenshooter-client-protocol.h \ diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 8c3ef5c..23c8c40 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -35,6 +35,7 @@ #include <wayland-client.h> #include "cairo-util.h" #include "window.h" +#include "../shared/configparser.h" #include "desktop-shell-client-protocol.h" diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c index bce0a80..d6e0789 100644 --- a/clients/tablet-shell.c +++ b/clients/tablet-shell.c @@ -27,6 +27,7 @@ #include "window.h" #include "cairo-util.h" +#include "../shared/configparser.h" #include "tablet-shell-client-protocol.h" diff --git a/clients/window.h b/clients/window.h index 8d17340..c1a85ee 100644 --- a/clients/window.h +++ b/clients/window.h @@ -362,31 +362,4 @@ void output_get_allocation(struct output *output, struct rectangle *allocation); -enum { - CONFIG_KEY_INTEGER, - CONFIG_KEY_STRING, - CONFIG_KEY_BOOL -}; - -struct config_key { - const char *name; - int type; - void *data; -}; - -struct config_section { - const char *name; - const struct config_key *keys; - int num_keys; - void (*done)(void *data); -}; - -int -parse_config_file(const char *path, - const struct config_section *sections, int num_sections, - void *data); - -char * -config_file_path(const char *name); - #endif diff --git a/configure.ac b/configure.ac index 60d5f6b..428cfaa 100644 --- a/configure.ac +++ b/configure.ac @@ -140,6 +140,7 @@ AC_SUBST(GCC_CFLAGS) WAYLAND_SCANNER_RULES(['$(top_srcdir)/protocol']) AC_CONFIG_FILES([Makefile + shared/Makefile compositor/Makefile clients/Makefile data/Makefile]) diff --git a/shared/Makefile.am b/shared/Makefile.am new file mode 100644 index 0000000..a964a04 --- /dev/null +++ b/shared/Makefile.am @@ -0,0 +1,3 @@ +noinst_LTLIBRARIES = libconfigparser.la +libconfigparser_la_SOURCES = configparser.c \ + configparser.h diff --git a/clients/config.c b/shared/configparser.c index 69edbc6..c48fe4c 100644 --- a/clients/config.c +++ b/shared/configparser.c @@ -25,7 +25,7 @@ #include <stdlib.h> #include <assert.h> -#include "window.h" +#include "configparser.h" static int handle_key(const struct config_key *key, const char *value) diff --git a/shared/configparser.h b/shared/configparser.h new file mode 100644 index 0000000..93b335c --- /dev/null +++ b/shared/configparser.h @@ -0,0 +1,54 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef CONFIGPARSER_H +#define CONFIGPARSER_H + +enum { + CONFIG_KEY_INTEGER, + CONFIG_KEY_STRING, + CONFIG_KEY_BOOL +}; + +struct config_key { + const char *name; + int type; + void *data; +}; + +struct config_section { + const char *name; + const struct config_key *keys; + int num_keys; + void (*done)(void *data); +}; + +int +parse_config_file(const char *path, + const struct config_section *sections, int num_sections, + void *data); + +char * +config_file_path(const char *name); + +#endif /* CONFIGPARSER_H */ + |