Fix basic navigation events

Original commit message from CVS:
* configure.ac:
* gst/librfb/Makefile.am:
* gst/librfb/gstrfbsrc.c:
Fix basic navigation events
This commit is contained in:
Thijs Vermeir 2008-11-06 22:54:39 +00:00
parent 761df7a066
commit 862cc7ddd2
4 changed files with 52 additions and 12 deletions

View file

@ -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:

View file

@ -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])

View file

@ -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

View file

@ -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,