gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h
Date: Mon, 17 Dec 2007 09:32:39 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/12/17 09:32:39

Modified files:
        .              : ChangeLog 
        gui            : gtk.cpp gtksup.h 

Log message:
        grab focus on click (fix bug #21808)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5189&r2=1.5190
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.122&r2=1.123
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.55&r2=1.56

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5189
retrieving revision 1.5190
diff -u -b -r1.5189 -r1.5190
--- ChangeLog   17 Dec 2007 07:41:42 -0000      1.5189
+++ ChangeLog   17 Dec 2007 09:32:38 -0000      1.5190
@@ -1,3 +1,9 @@
+2007-12-17 Sandro Santilli <address@hidden>
+
+       * gui/: gtk.cpp, gtksup.h: grab focus on click.
+         Fixes bug #21808. Thanks Benjamin Wolsey for research
+         on the topic.
+
 2007-12-17 Zou Lunkai <address@hidden>
        
        * testsuite/misc-ming.all/new_child_in_unload_test.c, Makefile.am:

Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -b -r1.122 -r1.123
--- gui/gtk.cpp 22 Nov 2007 16:19:57 -0000      1.122
+++ gui/gtk.cpp 17 Dec 2007 09:32:39 -0000      1.123
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: gtk.cpp,v 1.122 2007/11/22 16:19:57 rsavoye Exp $ */
+/* $Id: gtk.cpp,v 1.123 2007/12/17 09:32:39 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -130,6 +130,10 @@
     }
     _drawing_area = gtk_drawing_area_new();
 
+    // IF we don't set this flag we won't be able to grab focus
+    // ( grabFocus() would be a no-op )
+    GTK_WIDGET_SET_FLAGS (GTK_WIDGET(_drawing_area), GTK_CAN_FOCUS);
+
     createMenu();
 #ifdef RENDERER_OPENGL
     // OpenGL _glue needs to prepare the drawing area for OpenGL rendering 
before
@@ -463,6 +467,12 @@
 }
 
 void
+GtkGui::grabFocus()
+{
+    gtk_widget_grab_focus(GTK_WIDGET(_drawing_area));
+}
+
+void
 GtkGui::quit()
 {
     gtk_main_quit();
@@ -1536,7 +1546,9 @@
                            const gpointer data)
 {
     //GNASH_REPORT_FUNCTION;
-    Gui *obj = static_cast<Gui *>(data);
+    GtkGui *obj = static_cast<GtkGui *>(data);
+
+    obj->grabFocus();
 
     int        mask = 1 << (event->button - 1);
     obj->notify_mouse_clicked(true, mask);

Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- gui/gtksup.h        22 Nov 2007 17:34:46 -0000      1.55
+++ gui/gtksup.h        17 Dec 2007 09:32:39 -0000      1.56
@@ -78,6 +78,13 @@
     /// @return true on success, false on failure.
     bool addFDListener(int fd, callback_t callback, void* data);
 
+
+    /// Grab focus so to receive all key events
+    //
+    /// Might become a virtual in the base class
+    ///
+    void grabFocus();
+
     /// Create a menu bar for the application, attach to our window. 
     //  This should only appear in the standalone player.
     bool createMenuBar();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]