mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
ximagesink: don't use deprecated XKeycodeToKeysym
https://bugzilla.gnome.org/show_bug.cgi?id=671299 Signed-off-by: Oleksij Rempel (Alexey Fisher) <bug-track@fisher-privat.net>
This commit is contained in:
parent
3b0a2a60da
commit
6d83f695b7
1 changed files with 13 additions and 14 deletions
|
@ -115,6 +115,9 @@
|
||||||
|
|
||||||
#include "gst/glib-compat-private.h"
|
#include "gst/glib-compat-private.h"
|
||||||
|
|
||||||
|
/* for XkbKeycodeToKeysym */
|
||||||
|
#include <X11/XKBlib.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagesink);
|
GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagesink);
|
||||||
#define GST_CAT_DEFAULT gst_debug_ximagesink
|
#define GST_CAT_DEFAULT gst_debug_ximagesink
|
||||||
|
|
||||||
|
@ -1024,6 +1027,7 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
KeyPressMask | KeyReleaseMask |
|
KeyPressMask | KeyReleaseMask |
|
||||||
ButtonPressMask | ButtonReleaseMask, &e)) {
|
ButtonPressMask | ButtonReleaseMask, &e)) {
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
|
const char *key_str = NULL;
|
||||||
|
|
||||||
/* We lock only for the X function call */
|
/* We lock only for the X function call */
|
||||||
g_mutex_unlock (ximagesink->x_lock);
|
g_mutex_unlock (ximagesink->x_lock);
|
||||||
|
@ -1048,25 +1052,20 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink)
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
/* Key pressed/released over our window. We send upstream
|
/* Key pressed/released over our window. We send upstream
|
||||||
events for interactivity/navigation */
|
events for interactivity/navigation */
|
||||||
GST_DEBUG ("ximagesink key %d pressed over window at %d,%d",
|
|
||||||
e.xkey.keycode, e.xkey.x, e.xkey.x);
|
|
||||||
g_mutex_lock (ximagesink->x_lock);
|
g_mutex_lock (ximagesink->x_lock);
|
||||||
keysym = XKeycodeToKeysym (ximagesink->xcontext->disp,
|
keysym = XkbKeycodeToKeysym (ximagesink->xcontext->disp,
|
||||||
e.xkey.keycode, 0);
|
e.xkey.keycode, 0, 0);
|
||||||
g_mutex_unlock (ximagesink->x_lock);
|
|
||||||
if (keysym != NoSymbol) {
|
if (keysym != NoSymbol) {
|
||||||
char *key_str = NULL;
|
|
||||||
|
|
||||||
g_mutex_lock (ximagesink->x_lock);
|
|
||||||
key_str = XKeysymToString (keysym);
|
key_str = XKeysymToString (keysym);
|
||||||
g_mutex_unlock (ximagesink->x_lock);
|
|
||||||
gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
|
|
||||||
e.type == KeyPress ? "key-press" : "key-release", key_str);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
|
key_str = "unknown";
|
||||||
e.type == KeyPress ? "key-press" : "key-release", "unknown");
|
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (ximagesink->x_lock);
|
||||||
|
GST_DEBUG_OBJECT (ximagesink,
|
||||||
|
"key %d pressed over window at %d,%d (%s)",
|
||||||
|
e.xkey.keycode, e.xkey.x, e.xkey.y, key_str);
|
||||||
|
gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
|
||||||
|
e.type == KeyPress ? "key-press" : "key-release", key_str);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_DEBUG_OBJECT (ximagesink, "ximagesink unhandled X event (%d)",
|
GST_DEBUG_OBJECT (ximagesink, "ximagesink unhandled X event (%d)",
|
||||||
|
|
Loading…
Reference in a new issue