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/gui.cpp gui/gui...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gui.cpp gui/gui...
Date: Fri, 06 Oct 2006 21:47:05 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/10/06 21:47:05

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

Log message:
                * gui/sdl.cpp (run): use _xsize, _ysize when notifying mouse 
move.
                * gui/gtk.cpp (motion_notify_event): take xscale/yscale
                  into account, (configure_event): invoke Gui::resize_view
                  with an object.
                * gui/gui.{h,cpp}: split _scale into x/y components,
                  resize_view method made non-static so it can update
                  _xscale and _yscale.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1052&r2=1.1053
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl.cpp?cvsroot=gnash&r1=1.28&r2=1.29

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1052
retrieving revision 1.1053
diff -u -b -r1.1052 -r1.1053
--- ChangeLog   6 Oct 2006 21:20:05 -0000       1.1052
+++ ChangeLog   6 Oct 2006 21:47:04 -0000       1.1053
@@ -1,3 +1,13 @@
+2006-10-06 Sandro Santilli <address@hidden>
+
+       * gui/sdl.cpp (run): use _xsize, _ysize when notifying mouse move.
+       * gui/gtk.cpp (motion_notify_event): take xscale/yscale
+         into account, (configure_event): invoke Gui::resize_view
+         with an object.
+       * gui/gui.{h,cpp}: split _scale into x/y components,
+         resize_view method made non-static so it can update
+         _xscale and _yscale.
+
 2006-10-06 Markus Gothe <address@hidden>
 
        * server/impl.cpp, server/ref_counted.h: Moved code to ref_counted.h

Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- gui/gtk.cpp 1 Oct 2006 20:21:57 -0000       1.26
+++ gui/gtk.cpp 6 Oct 2006 21:47:04 -0000       1.27
@@ -338,7 +338,7 @@
   g_signal_connect_after(G_OBJECT (_drawing_area), "realize",
                          G_CALLBACK (realize_event), NULL);
   g_signal_connect(G_OBJECT (_drawing_area), "configure_event",
-                   G_CALLBACK (configure_event), &glue);
+                   G_CALLBACK (configure_event), this);
 //   g_signal_connect(G_OBJECT (_drawing_area), "expose_event",
 //                    G_CALLBACK (expose_event), NULL);
 //   g_signal_connect(G_OBJECT (_drawing_area), "unrealize",
@@ -489,14 +489,16 @@
 {
     GNASH_REPORT_FUNCTION;
 
+       GtkGui* obj = static_cast<GtkGui*>(data);
+
 #ifdef RENDERER_CAIRO
-    GtkCairoGlue* glue = static_cast<GtkCairoGlue*> ( data );
+    GtkCairoGlue& glue = obj->glue;
 #elif defined(RENDERER_OPENGL)
-    GtkGlExtGlue* glue = static_cast<GtkGlExtGlue*> ( data );
+    GtkGlExtGlue& glue = obj->glue;
 #endif
 
-    glue->configure(widget, event);
-    resize_view(event->width, event->height);
+    glue.configure(widget, event);
+    obj->resize_view(event->width, event->height);
 
     return TRUE;
 }
@@ -706,8 +708,9 @@
 //    GNASH_REPORT_FUNCTION;
     Gui *obj = static_cast<Gui *>(data);
 
-    float scale = obj->getScale();
-    obj->notify_mouse_moved(int(event->x / scale), int(event->y / scale));
+    float xscale = obj->getXScale();
+    float yscale = obj->getYScale();
+    obj->notify_mouse_moved(int(event->x / xscale), int(event->y / yscale));
     return true;
 }
 

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- gui/gui.cpp 27 Sep 2006 09:51:23 -0000      1.18
+++ gui/gui.cpp 6 Oct 2006 21:47:04 -0000       1.19
@@ -58,7 +58,8 @@
     _xid(0),
     _width(0),
     _height(0),
-    _scale(1.0f),
+    _xscale(1.0f),
+    _yscale(1.0f),
     _depth(16)
 {
 //    GNASH_REPORT_FUNCTION;
@@ -69,7 +70,8 @@
     _xid(xid),
     _width(0),
     _height(0),
-    _scale(scale),
+    _xscale(scale),
+    _yscale(scale),
     _depth(depth)
 {
 }
@@ -112,8 +114,22 @@
 //    GNASH_REPORT_FUNCTION;
     movie_interface* m = get_current_root();
     if (m) {
+
+               movie_definition* md = m->get_movie_definition();
+               float swfwidth = md->get_width_pixels();
+               float swfheight = md->get_height_pixels();
+
         m->set_display_viewport(0, 0, width, height);
+
+               // set new scale value
+               _xscale = width / swfwidth;
+               _yscale = height / swfheight;
+
+       } else {
+               log_warning("Resize request received while there's still"
+                       " no movie loaded, can't correctly set movie scale");
     }
+
 }
 
 void

Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- gui/gui.h   28 Sep 2006 08:20:31 -0000      1.15
+++ gui/gui.h   6 Oct 2006 21:47:04 -0000       1.16
@@ -99,7 +99,8 @@
     virtual void renderBuffer() = 0;
 
 
-    float getScale()                { return _scale; }
+    float getXScale()                { return _xscale; }
+    float getYScale()                { return _yscale; }
     bool loops()                    { return _loop; }
 
     void addMouseHandler(callback_t ptr);
@@ -118,14 +119,15 @@
     static void notify_mouse_moved(int x, int y);
     static void notify_mouse_clicked(bool mouse_pressed, int mask);
     static bool advance_movie(void *data);
-    static void resize_view(int width, int height);
+    void resize_view(int width, int height);
 
 protected:
     bool            _loop;
     unsigned long   _xid;
     int             _width;
     int             _height;
-    float           _scale;
+    float           _xscale;
+    float           _yscale;
     int             _depth;
     std::string     _name;
     callback_t      _mouse_handler;

Index: gui/sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- gui/sdl.cpp 28 Sep 2006 16:30:24 -0000      1.28
+++ gui/sdl.cpp 6 Oct 2006 21:47:04 -0000       1.29
@@ -35,7 +35,7 @@
 // 
 //
 
-/* $Id: sdl.cpp,v 1.28 2006/09/28 16:30:24 nihilus Exp $ */
+/* $Id: sdl.cpp,v 1.29 2006/10/06 21:47:04 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -142,7 +142,7 @@
             if (event.motion.x == x_old && event.motion.y == y_old) { break; }
             x_old = event.motion.x;
             y_old = event.motion.y;
-            notify_mouse_moved((int) (x_old / _scale), (int) (y_old / _scale));
+            notify_mouse_moved((int) (x_old / _xscale), (int) (y_old / 
_yscale));
             break;
           case SDL_MOUSEBUTTONDOWN:
           case SDL_MOUSEBUTTONUP:




reply via email to

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