Skip to content

Commit

Permalink
Incorporated keybinder
Browse files Browse the repository at this point in the history
  • Loading branch information
poisdeux committed Mar 6, 2012
1 parent 0bc9ceb commit 879f547
Show file tree
Hide file tree
Showing 11 changed files with 646 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README-DEVELOPERS
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Maintenance/update releases should be tested on the branch and result in a
git clone <YOUR_LOCAL_GIT_REPOS>

pushd gappman
git checkout <NEW_VERSION>
git checkout <NEW_VERSION>
libtoolize
pushd libs
libtoolize
Expand Down
17 changes: 17 additions & 0 deletions appmanager/appmanager.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "appmanager.h"
#include <glib.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib/gprintf.h>
#include <stdlib.h>
Expand All @@ -29,6 +30,7 @@
#include <gm_changeresolution.h>
#include <gm_layout.h>
#include <gm_generic.h>
#include <gm_keybinder.h>
#include "listener.h"
#include "appmanager_panel.h"
#include "appmanager_buttonmenu.h"
Expand All @@ -47,6 +49,14 @@ struct metadata *appmanager_get_metadata()
return config;
}

#define EXAMPLE_KEY "<Ctrl>A"

void handle_key_event(const char *keystring, void *user_data)
{
printf("Handle %s (%p)!\n", keystring, user_data);
gm_keybinder_unbind(keystring, handle_key_event);
}

void appmanager_update_resolution(gchar * programname, int width, int height)
{
gm_menu_element *elt = NULL;
Expand Down Expand Up @@ -355,6 +365,8 @@ int main(int argc, char **argv)
gint c;
gint fontsize;
const char *conffile = g_strconcat(SYSCONFDIR, "/conf.xml", NULL);
Display *Xdisplay;
Window Xwindow;

// Needs to be called before any another glib function
if (!g_thread_supported())
Expand Down Expand Up @@ -530,6 +542,11 @@ int main(int argc, char **argv)

autostartprograms(programs);

//Test key binding
gm_keybinder_init();
gm_keybinder_bind(EXAMPLE_KEY, handle_key_event, NULL);
printf("Press " EXAMPLE_KEY " to activate keybinding and quit\n");

gtk_widget_show(mainwin);

gdk_threads_enter();
Expand Down
18 changes: 16 additions & 2 deletions appmanager/m4/gmlib_search.m4
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ then
#our search. First see if the libs are
#available in the project
if test -d "$srcdir/../libs/layout" && \
test -d "$srcdir/../libs/keybinder" && \
test -d "$srcdir/../libs/generic" && \
test -d "$srcdir/../libs/parseconf"
then
LIBGM='$(top_srcdir)/../libs'
Expand All @@ -28,8 +30,8 @@ fi
#where to find the header and library files.
if test -n "$LIBGM"
then
AC_SUBST([GM_INCLUDES], ["-I$LIBGM/generic -I$LIBGM/layout -I$LIBGM/parseconf"])
AC_SUBST([GM_OBJS], ["$LIBGM/generic/libgm_generic.la $LIBGM/layout/libgm_layout.la $LIBGM/parseconf/libgm_parseconf.la"])
AC_SUBST([GM_INCLUDES], ["-I$LIBGM/generic -I$LIBGM/layout -I$LIBGM/parseconf -I$LIBGM/keybinder"])
AC_SUBST([GM_OBJS], ["$LIBGM/generic/libgm_generic.la $LIBGM/layout/libgm_layout.la $LIBGM/parseconf/libgm_parseconf.la $LIBGM/keybinder/libgm_keybinder.la"])
else
AC_SUBST([GM_INCLUDES], [""])
AC_SUBST([GM_OBJS], [""])
Expand All @@ -49,6 +51,18 @@ then
LIBGM="-lgm_parseconf"
LIBS="$LIBGM $LIBS"],
[AC_MSG_ERROR([No libgm_parseconf found])])
AC_CHECK_LIB([gm_keybinder], [gm_keybinder_bind],
[AC_CHECK_HEADERS([gm_keybinder.h])
LIBGM="-lgm_keybinder"
LIBS="$LIBGM $LIBS"],
[AC_MSG_ERROR([No libgm_keybinder found])])
AC_CHECK_LIB([gm_generic], [gm_menu_element_get_logo],
[AC_CHECK_HEADERS([gm_generic.h])
LIBGM="-lgm_generic"
LIBS="$LIBGM $LIBS"],
[AC_MSG_ERROR([No libgm_generic found])])
fi
AC_MSG_RESULT($LIBGM)
])
12 changes: 6 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ AC_ARG_ENABLE([building-libs],
[disable building the libs])],
[building_libs=no], [building_libs=yes])

AC_ARG_ENABLE([building-tools],
[AS_HELP_STRING([--disable-building-tools],
[disable building the tools])],
[building_tools=no], [building_tools=yes])
#AC_ARG_ENABLE([building-tools],
# [AS_HELP_STRING([--disable-building-tools],
# [disable building the tools])],
# [building_tools=no], [building_tools=yes])

AC_ARG_ENABLE([building-gappman],
[AS_HELP_STRING([--disable-building-gappman],
Expand All @@ -57,8 +57,8 @@ AM_COND_IF([BUILD_LIBS], AC_CONFIG_SUBDIRS([libs]))
AM_CONDITIONAL([BUILD_APPLETS], [test "x$building_applets" == "xyes"])
AM_COND_IF([BUILD_APPLETS], AC_CONFIG_SUBDIRS([applets]))

AM_CONDITIONAL([BUILD_TOOLS], [test "x$building_tools" == "xyes"])
AM_COND_IF([BUILD_TOOLS], AC_CONFIG_FILES([tools/Makefile]))
#AM_CONDITIONAL([BUILD_TOOLS], [test "x$building_tools" == "xyes"])
#AM_COND_IF([BUILD_TOOLS], AC_CONFIG_FILES([tools/Makefile]))

# Check for programs if doxygen docs should be build

Expand Down
Binary file removed keybinder-0.2.2.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion libs/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = generic parseconf layout network
SUBDIRS = generic parseconf layout network keybinder
17 changes: 16 additions & 1 deletion libs/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,24 @@ PKG_CHECK_MODULES([LIBXML],[libxml-2.0 >= 2.6.32])
PKG_CHECK_MODULES([GTK],[gtk+-2.0 >= 2.12.12])
PKG_CHECK_MODULES([XRANDR],[xrandr >= 1.2.3])

# Checks for library functions

# Checks for header files.
AC_PATH_X
AS_IF([test "x${disable_listener}" == "xno"],
AC_CHECK_HEADERS([netdb.h netinet/in.h sys/socket.h], [], [disable_listener=yes]))

## Check if XkbQueryExtension is available
X_LIBS="`$PKG_CONFIG --libs x11 xext xrender`"
X_CFLAGS="`$PKG_CONFIG --cflags x11 xext xrender`"
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS $X_CFLAGS"
old_libs="$LIBS"
LIBS="$X_LIBS $LIBS"
AC_CHECK_FUNC(XkbQueryExtension, [], AC_MSG_ERROR(Could not find XKB))
CFLAGS="$old_cflags"
LIBS="$old_libs"

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_C_CONST
Expand Down Expand Up @@ -84,7 +97,9 @@ AC_CONFIG_FILES([Makefile
network/libgm_network.pc
generic/Makefile
layout/Makefile
parseconf/Makefile])
parseconf/Makefile
keybinder/Makefile
keybinder/keybinder.pc])
AC_OUTPUT

echo \
Expand Down
10 changes: 10 additions & 0 deletions libs/keybinder/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
#noinst_LTLIBRARIES = libgm_keybinder.la
lib_LTLIBRARIES = libgm_keybinder.la
libgm_keybinder_la_SOURCES = bind.c
include_HEADERS = gm_keybinder.h
libgm_keybinder_la_CPPFLAGS = $(GTK_CFLAGS)
libgm_keybinder_la_LIBADD = $(GTK_LIBS)
libgm_keybinder_la_LDFLAGS = -version-info 1:0:0
libgm_pkgconfigdir = $(libdir)/pkgconfig
libgm_pkgconfig_DATA = keybinder.pc
Loading

0 comments on commit 879f547

Please sign in to comment.