[vlc-commits] gtk: exit from the fullscreen mode using the escape key
Ludovic Fauvet
git at videolan.org
Tue Jan 1 18:39:09 CET 2013
npapi-vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Thu Dec 27 18:32:44 2012 +0100| [218b2580ec7b6ed9391859fd9e695f3868c8d6a7] | committer: Ludovic Fauvet
gtk: exit from the fullscreen mode using the escape key
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=218b2580ec7b6ed9391859fd9e695f3868c8d6a7
---
npapi/vlcplugin_gtk.cpp | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/npapi/vlcplugin_gtk.cpp b/npapi/vlcplugin_gtk.cpp
index c49a8cc..38c2df7 100644
--- a/npapi/vlcplugin_gtk.cpp
+++ b/npapi/vlcplugin_gtk.cpp
@@ -23,6 +23,7 @@
#include "vlcplugin_gtk.h"
#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
#include <cstring>
static uint32_t get_xid(GtkWidget *widget)
@@ -358,6 +359,19 @@ static void fullscreen_win_visibility_handler(GtkWidget *widget, gpointer user_d
plugin->do_set_fullscreen(gtk_widget_get_visible(widget));
}
+static gboolean fullscreen_win_keypress_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+ VlcPluginGtk *plugin = (VlcPluginGtk *) user_data;
+ switch (event->keyval)
+ {
+ case GDK_KEY_Escape:
+ plugin->set_fullscreen(false);
+ return True;
+ default:
+ return False;
+ }
+}
+
void VlcPluginGtk::update_controls()
{
if (get_player().is_open()) {
@@ -445,6 +459,7 @@ bool VlcPluginGtk::create_windows()
g_signal_connect(G_OBJECT(fullscreen_win), "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), this);
g_signal_connect(G_OBJECT(fullscreen_win), "show", G_CALLBACK(fullscreen_win_visibility_handler), this);
g_signal_connect(G_OBJECT(fullscreen_win), "hide", G_CALLBACK(fullscreen_win_visibility_handler), this);
+ g_signal_connect(G_OBJECT(fullscreen_win), "key_press_event", G_CALLBACK(fullscreen_win_keypress_handler), this);
/* actual video window */
/* libvlc is handed this window's xid. A raw X window is used because
More information about the vlc-commits
mailing list