summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThijs Vermeir <thijsvermeir@gmail.com>2008-11-06 22:54:39 +0000
committerThijs Vermeir <thijsvermeir@gmail.com>2008-11-06 22:54:39 +0000
commit862cc7ddd221435ea5ecf2cc031949d07cfa27fa (patch)
treed9a2707898990d00833f61c23c73d07452ea00c0
parent761df7a066e1bd005db8f8b2b09ce61fafe1af20 (diff)
downloadgst-plugins-bad-862cc7ddd221435ea5ecf2cc031949d07cfa27fa.tar.gz
gst-plugins-bad-862cc7ddd221435ea5ecf2cc031949d07cfa27fa.tar.bz2
gst-plugins-bad-862cc7ddd221435ea5ecf2cc031949d07cfa27fa.zip
Fix basic navigation events
Original commit message from CVS: * configure.ac: * gst/librfb/Makefile.am: * gst/librfb/gstrfbsrc.c: Fix basic navigation events
-rw-r--r--ChangeLog7
-rw-r--r--configure.ac11
-rw-r--r--gst/librfb/Makefile.am4
-rw-r--r--gst/librfb/gstrfbsrc.c42
4 files changed, 52 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index d8925f07..1244dde8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-11-06 Thijs Vermeir <thijsvermeir@gmail.com>
+
+ * configure.ac:
+ * gst/librfb/Makefile.am:
+ * gst/librfb/gstrfbsrc.c:
+ Fix basic navigation events
+
2008-11-06 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/deinterlace2/gstdeinterlace2.c:
diff --git a/configure.ac b/configure.ac
index 732ae31d..5e04896e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -201,6 +201,17 @@ AC_SUBST(GLADE_CFLAGS)
AC_SUBST(HAVE_GLADE)
AM_CONDITIONAL(HAVE_GLADE, test "x$HAVE_GLADE" = "xyes")
+dnl x11 is optional for librfb
+HAVE_X11=NO
+PKG_CHECK_MODULES(X11, x11, HAVE_X11=yes, HAVE_X11=no)
+AC_SUBST(X11_LIBS)
+AC_SUBST(X11_CFLAGS)
+AC_SUBST(HAVE_X11)
+AM_CONDITIONAL(HAVE_X11, test "x$HAVE_X11" = "xyes")
+if test "x$HAVE_X11" = "xyes"; then
+ AC_DEFINE(HAVE_X11, 1, [Define if you have X11 library])
+fi
+
dnl set license and copyright notice
GST_LICENSE="LGPL"
AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
diff --git a/gst/librfb/Makefile.am b/gst/librfb/Makefile.am
index 373b0bc6..351beeec 100644
--- a/gst/librfb/Makefile.am
+++ b/gst/librfb/Makefile.am
@@ -4,8 +4,8 @@ noinst_LTLIBRARIES = librfb.la
plugin_LTLIBRARIES = libgstrfbsrc.la
libgstrfbsrc_la_SOURCES = gstrfbsrc.c
-libgstrfbsrc_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) -I$(srcdir)/..
-libgstrfbsrc_la_LIBADD = $(GST_BASE_LIBS) librfb.la
+libgstrfbsrc_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(X11_CFLAGS) -I$(srcdir)/..
+libgstrfbsrc_la_LIBADD = $(GST_BASE_LIBS) $(X11_LIBS) librfb.la
libgstrfbsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstrfbsrc_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/gst/librfb/gstrfbsrc.c b/gst/librfb/gstrfbsrc.c
index 8c5e11eb..5edd9f0a 100644
--- a/gst/librfb/gstrfbsrc.c
+++ b/gst/librfb/gstrfbsrc.c
@@ -30,6 +30,9 @@
#include <string.h>
#include <stdlib.h>
+#ifdef HAVE_X11
+#include <X11/Xlib.h>
+#endif
enum
{
@@ -462,6 +465,9 @@ gst_rfb_src_event (GstBaseSrc * bsrc, GstEvent * event)
gint button;
GstStructure *structure;
const gchar *event_type;
+ gboolean key_event, key_press;
+
+ key_event = FALSE;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NAVIGATION:
@@ -472,33 +478,49 @@ gst_rfb_src_event (GstBaseSrc * bsrc, GstEvent * event)
structure = event->structure;
event_type = gst_structure_get_string (structure, "event");
+
+ if (strcmp (event_type, "key-press") == 0) {
+ key_event = key_press = TRUE;
+ } else if (strcmp (event_type, "key-release") == 0) {
+ key_event = TRUE;
+ key_press = FALSE;
+ }
+
+ if (key_event) {
+#ifdef HAVE_X11
+ const gchar *key;
+ KeySym key_sym;
+
+ key = gst_structure_get_string (structure, "key");
+ key_sym = XStringToKeysym (key);
+
+ if (key_sym != NoSymbol)
+ rfb_decoder_send_key_event (src->decoder, key_sym, key_press);
+#endif
+ break;
+ }
+
gst_structure_get_double (structure, "pointer_x", &x);
gst_structure_get_double (structure, "pointer_y", &y);
- button = 0;
+ gst_structure_get_int (structure, "button", &button);
/* we need to take care of the offset's */
x += src->decoder->offset_x;
y += src->decoder->offset_y;
- if (strcmp (event_type, "key-press") == 0) {
- const gchar *key = gst_structure_get_string (structure, "key");
-
- GST_LOG_OBJECT (src, "sending key event for key %d", key[0]);
- rfb_decoder_send_key_event (src->decoder, key[0], 1);
- rfb_decoder_send_key_event (src->decoder, key[0], 0);
- } else if (strcmp (event_type, "mouse-move") == 0) {
+ if (strcmp (event_type, "mouse-move") == 0) {
GST_LOG_OBJECT (src, "sending mouse-move event "
"button_mask=%d, x=%d, y=%d", src->button_mask, (gint) x, (gint) y);
rfb_decoder_send_pointer_event (src->decoder, src->button_mask,
(gint) x, (gint) y);
} else if (strcmp (event_type, "mouse-button-release") == 0) {
- src->button_mask &= ~(1 << button);
+ src->button_mask &= ~(1 << (button - 1));
GST_LOG_OBJECT (src, "sending mouse-button-release event "
"button_mask=%d, x=%d, y=%d", src->button_mask, (gint) x, (gint) y);
rfb_decoder_send_pointer_event (src->decoder, src->button_mask,
(gint) x, (gint) y);
} else if (strcmp (event_type, "mouse-button-press") == 0) {
- src->button_mask |= (1 << button);
+ src->button_mask |= (1 << (button - 1));
GST_LOG_OBJECT (src, "sending mouse-button-press event "
"button_mask=%d, x=%d, y=%d", src->button_mask, (gint) x, (gint) y);
rfb_decoder_send_pointer_event (src->decoder, src->button_mask,