[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h gui/gu...
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h gui/gu... |
Date: |
Thu, 12 Apr 2007 09:04:02 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Bastiaan Jacques <bjacques> 07/04/12 09:04:02
Modified files:
. : ChangeLog
gui : gtk.cpp gtksup.h gui.cpp gui.h kde.cpp
kde_glue.h kdesup.h
Log message:
Reverted Antti's patches, because they appear to be
lacking some changes in the gnash::key namespace. Fixes build.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2860&r2=1.2861
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kde.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kde_glue.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kdesup.h?cvsroot=gnash&r1=1.13&r2=1.14
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2860
retrieving revision 1.2861
diff -u -b -r1.2860 -r1.2861
--- ChangeLog 12 Apr 2007 08:55:52 -0000 1.2860
+++ ChangeLog 12 Apr 2007 09:04:01 -0000 1.2861
@@ -7,6 +7,8 @@
* server/asobj/string.cpp: from_char_code: create a wide string
in case the user tries to create one.
+ * gui: Reverted Antti's patches, because they appear to be
+ lacking some changes in the gnash::key namespace. Fixes build.
2007-04-11 Markus Gothe <address@hidden>
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- gui/gtk.cpp 12 Apr 2007 07:09:06 -0000 1.85
+++ gui/gtk.cpp 12 Apr 2007 09:04:01 -0000 1.86
@@ -14,7 +14,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: gtk.cpp,v 1.85 2007/04/12 07:09:06 bjacques Exp $ */
+/* $Id: gtk.cpp,v 1.86 2007/04/12 09:04:01 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1154,24 +1154,6 @@
return c;
}
-int
-GtkGui::gdk_to_gnash_modifier(int state)
-{
- int modifier = gnash::key::MOD_NONE;
-
- if (state & GDK_SHIFT_MASK) {
- modifier = modifier | gnash::key::MOD_SHIFT;
- }
- if (state & GDK_CONTROL_MASK) {
- modifier = modifier | gnash::key::MOD_CONTROL;
- }
- if (state & GDK_MOD1_MASK) {
- modifier = modifier | gnash::key::MOD_ALT;
- }
-
- return modifier;
-}
-
gboolean
GtkGui::key_press_event(GtkWidget *const /*widget*/,
GdkEventKey *const event,
@@ -1183,10 +1165,52 @@
/* Forward key event to gnash */
gnash::key::code c = gdk_to_gnash_key(event->keyval);
- int mod = gdk_to_gnash_modifier(event->state);
if (c != gnash::key::INVALID) {
- gui->notify_key_event(c, mod, true);
+ gui->notify_key_event(c, true);
+ }
+
+ /* Handle GUI shortcuts */
+ if (event->length <= 0) {
+ return true;
+ }
+ unsigned int key = gdk_unicode_to_keyval(event->keyval);
+ if (event->state == GDK_SHIFT_MASK) {
+ dbglogfile << "Got Shift-key: " << key << endl;
+ }
+ if (event->state == GDK_CONTROL_MASK) {
+ dbglogfile << "Got Control-key: " << key << endl;
+ switch(key) {
+ case 'r':
+ gui->menu_restart();
+ break;
+ case 'p':
+ gui->menu_pause();
+ break;
+ case 'q':
+ case 'w':
+ gui->menu_quit();
+ break;
+ default:
+ break;
+ }
+ } else {
+#if 0
+ dbglogfile << "Got key: '" << (char) key
+ << "' its name is: " << gdk_keyval_name(key)
+ << " it's value is: " << (int)key
+ << " hwkeycode: " << event->hardware_keycode << endl;
+#endif
+ switch (key) {
+ case '[':
+ menuitem_step_forward_callback(NULL, NULL);
+ break;
+ case ']':
+ menuitem_step_backward_callback(NULL, NULL);
+ break;
+ default:
+ break;
+ }
}
return true;
@@ -1204,10 +1228,9 @@
/* Forward key event to gnash */
gnash::key::code c = gdk_to_gnash_key(event->keyval);
- int mod = gdk_to_gnash_modifier(event->state);
if (c != gnash::key::INVALID) {
- gui->notify_key_event(c, mod, false);
+ gui->notify_key_event(c, false);
}
return true;
Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- gui/gtksup.h 12 Apr 2007 06:51:04 -0000 1.38
+++ gui/gtksup.h 12 Apr 2007 09:04:01 -0000 1.39
@@ -158,7 +158,6 @@
#endif
static gnash::key::code gdk_to_gnash_key(guint key);
- static int gdk_to_gnash_modifier(int state);
static void open_file(GtkWidget* dialog, gpointer data);
};
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- gui/gui.cpp 12 Apr 2007 06:51:04 -0000 1.70
+++ gui/gui.cpp 12 Apr 2007 09:04:01 -0000 1.71
@@ -277,46 +277,17 @@
}
void
-Gui::notify_key_event(gnash::key::code k, int modifier, bool pressed)
+Gui::notify_key_event(gnash::key::code k, bool pressed)
{
movie_root* m = get_current_root();
+ //log_msg("mouse @ %d,%d", x, y);
if ( m->notify_key_event(k, pressed) )
{
// any action triggered by the
// event required screen refresh
display(m);
}
-
- /* Handle GUI shortcuts */
- if (!pressed) return;
- if (modifier & gnash::key::MOD_CONTROL) {
- switch(k) {
- case gnash::key::R:
- menu_restart();
- break;
- case gnash::key::P:
- menu_pause();
- break;
- case gnash::key::Q:
- case gnash::key::W:
- menu_quit();
- break;
- default:
- break;
- }
- } else {
- switch (k) {
- case gnash::key::LEFT_BRACKET:
- menu_step_forward();
- break;
- case gnash::key::RIGHT_BRACKET:
- menu_step_backward();
- break;
- default:
- break;
- }
- }
}
bool
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- gui/gui.h 12 Apr 2007 06:51:04 -0000 1.48
+++ gui/gui.h 12 Apr 2007 09:04:01 -0000 1.49
@@ -182,11 +182,11 @@
/// Key event notification to be called when a key is pressed or depressed
//
/// @param k The key code.
- /// @param modifier Modifier key identifiers from gnash::key::modifier
ORed together
+ ///
/// @param pressed Determines whether the key is being
/// pressed (true) or being released (false)
///
- void notify_key_event(gnash::key::code k, int modifier, bool pressed);
+ void notify_key_event(gnash::key::code k, bool pressed);
/// Resize the client area view and the window accordingly.
//
Index: gui/kde.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/kde.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- gui/kde.cpp 12 Apr 2007 06:51:04 -0000 1.11
+++ gui/kde.cpp 12 Apr 2007 09:04:01 -0000 1.12
@@ -149,102 +149,6 @@
return true;
}
-gnash::key::code
-KdeGui::qtToGnashKey(QKeyEvent *event)
-{
- gnash::key::code c = gnash::key::INVALID;
- int key = event->key();
-
- if (key >= Qt::Key_0 && key <= Qt::Key_9) {
- if (event->state() & Qt::Keypad)
- c = (gnash::key::code) ((key - Qt::Key_0) + gnash::key::KP_0);
- else
- c = (gnash::key::code) ((key - Qt::Key_0) + gnash::key::_0);
- } else if (key >= Qt::Key_A && key <= Qt::Key_Z) {
- c = (gnash::key::code) ((key - Qt::Key_A) + gnash::key::A);
- } else if (key >= Qt::Key_F1 && key <= Qt::Key_F15) {
- c = (gnash::key::code) ((key - Qt::Key_F1) + gnash::key::F1);
- } else {
- // many keys don't correlate, so just use a look-up table.
- struct {
- int qt;
- gnash::key::code gs;
- } table[] = {
- { Qt::Key_Backspace, gnash::key::BACKSPACE },
- { Qt::Key_Tab, gnash::key::TAB },
- { Qt::Key_Clear, gnash::key::CLEAR },
- { Qt::Key_Return, gnash::key::ENTER },
- { Qt::Key_Enter, gnash::key::ENTER },
-
- { Qt::Key_Shift, gnash::key::SHIFT },
- { Qt::Key_Control, gnash::key::CONTROL },
- { Qt::Key_Alt, gnash::key::ALT },
- { Qt::Key_CapsLock, gnash::key::CAPSLOCK },
-
- { Qt::Key_Escape, gnash::key::ESCAPE },
- { Qt::Key_Space, gnash::key::SPACE },
-
- { Qt::Key_Next, gnash::key::PGDN },
- { Qt::Key_Prior, gnash::key::PGUP },
- { Qt::Key_Home, gnash::key::HOME },
- { Qt::Key_End, gnash::key::END },
- { Qt::Key_Left, gnash::key::LEFT },
- { Qt::Key_Up, gnash::key::UP },
- { Qt::Key_Right, gnash::key::RIGHT },
- { Qt::Key_Down, gnash::key::DOWN },
- { Qt::Key_Insert, gnash::key::INSERT },
- { Qt::Key_Delete, gnash::key::DELETEKEY },
-
- { Qt::Key_Help, gnash::key::HELP },
- { Qt::Key_NumLock, gnash::key::NUM_LOCK },
- { Qt::Key_Semicolon, gnash::key::SEMICOLON },
- { Qt::Key_Equal, gnash::key::EQUALS },
- { Qt::Key_Minus, gnash::key::MINUS },
- { Qt::Key_Slash, gnash::key::SLASH },
- { Qt::Key_BracketLeft, gnash::key::LEFT_BRACKET },
- { Qt::Key_Backslash, gnash::key::BACKSLASH },
- { Qt::Key_BracketRight, gnash::key::RIGHT_BRACKET },
- { Qt::Key_QuoteDbl, gnash::key::QUOTE },
- { 0, gnash::key::INVALID }
- };
-
- for (int i = 0; table[i].qt != 0; i++) {
- if (key == table[i].qt) {
- c = table[i].gs;
- break;
- }
- }
- }
-
- return c;
-}
-
-int
-KdeGui::qtToGnashModifier(Qt::ButtonState state)
-{
- int modifier = gnash::key::MOD_NONE;
-
- if (state & Qt::ShiftButton) {
- modifier = modifier | gnash::key::MOD_SHIFT;
- }
- if (state & Qt::ControlButton) {
- modifier = modifier | gnash::key::MOD_CONTROL;
- }
- if (state & Qt::AltButton) {
- modifier = modifier | gnash::key::MOD_ALT;
- }
-
- return modifier;
-}
-
-void
-KdeGui::handleKeyEvent(QKeyEvent *event, bool down)
-{
- gnash::key::code c = qtToGnashKey(event);
- int mod = qtToGnashModifier(event->state());
- notify_key_event(c, mod, down);
-}
-
/// \brief restart the movie from the beginning
void
@@ -355,7 +259,6 @@
_godfather = godfather;
setMouseTracking(true);
- setFocusPolicy(QWidget::StrongFocus);
}
void
@@ -389,17 +292,6 @@
_godfather->notify_mouse_clicked(false, 1);
}
-void
-qwidget::keyPressEvent(QKeyEvent *event)
-{
- _godfather->handleKeyEvent(event, true);
-}
-
-void
-qwidget::keyReleaseEvent(QKeyEvent *event)
-{
- _godfather->handleKeyEvent(event, false);
-}
void
qwidget::resizeEvent(QResizeEvent *event)
Index: gui/kde_glue.h
===================================================================
RCS file: /sources/gnash/gnash/gui/kde_glue.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- gui/kde_glue.h 12 Apr 2007 06:51:04 -0000 1.7
+++ gui/kde_glue.h 12 Apr 2007 09:04:01 -0000 1.8
@@ -18,7 +18,7 @@
//
-/* $Id: kde_glue.h,v 1.7 2007/04/12 06:51:04 nihilus Exp $ */
+/* $Id: kde_glue.h,v 1.8 2007/04/12 09:04:01 bjacques Exp $ */
#include "gnash.h"
@@ -30,7 +30,7 @@
class KdeGlue
{
public:
- virtual ~KdeGlue() { };
+ virtual ~KdeGlue() { delete _drawing_area; }
virtual bool init(int argc, char **argv[]) = 0;
virtual void prepDrawingArea(QWidget *drawing_area) = 0;
Index: gui/kdesup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/kdesup.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- gui/kdesup.h 12 Apr 2007 06:51:04 -0000 1.13
+++ gui/kdesup.h 12 Apr 2007 09:04:01 -0000 1.14
@@ -70,8 +70,6 @@
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent( QMouseEvent * );
void mouseMoveEvent(QMouseEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *event);
void timerEvent(QTimerEvent *);
void resizeEvent(QResizeEvent *event);
public slots:
@@ -104,16 +102,12 @@
virtual void renderBuffer();
virtual void setInterval(unsigned int interval);
virtual void setTimeout(unsigned int timeout);
- virtual void handleKeyEvent(QKeyEvent *event, bool down);
private:
QApplication* _qapp;
qwidget* _qwidget;
KdeOpenGLGlue _glue;
QTimer *_timer;
-
- gnash::key::code qtToGnashKey(QKeyEvent *event);
- int qtToGnashModifier(Qt::ButtonState state);
};
// end of namespace gnash