[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: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h gui/gu... |
Date: |
Thu, 03 Jan 2008 15:11:33 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/01/03 15:11:32
Modified files:
. : ChangeLog
gui : gtk.cpp gtksup.h gui.cpp gui.h
Log message:
* gui/gui.{cpp,h}: add setFullscreen(), unsetFullscreen() and
_isFullscreen flag as virtual methods. At present only
available
as a menu toggle in the GTK GUI.
* gui/gtk{.cpp,sup.h}: implement fullscreen for GTK. It works
more or less for the plugin and standalone except that the
size and/or dimensions are often wrong, most notably for
youtube.
Use escape or the menu to exit fullscreen in the standalone player.
Escape isn't working in the plugin, I think because GTK has already bound it
and it causes the plugin to lose focus before.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5290&r2=1.5291
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.124&r2=1.125
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.121&r2=1.122
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.70&r2=1.71
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5290
retrieving revision 1.5291
diff -u -b -r1.5290 -r1.5291
--- ChangeLog 3 Jan 2008 12:36:31 -0000 1.5290
+++ ChangeLog 3 Jan 2008 15:11:31 -0000 1.5291
@@ -1,3 +1,12 @@
+2008-01-03 Benjamin Wolsey <address@hidden>
+
+ * gui/gui.{cpp,h}: add setFullscreen(), unsetFullscreen() and
+ _isFullscreen flag as virtual methods. At present only available
+ as a menu toggle in the GTK GUI.
+ * gui/gtk{.cpp,sup.h}: implement fullscreen for GTK. It works
+ more or less for the plugin and standalone except that the
+ size and/or dimensions are often wrong, most notably for youtube.
+
2008-01-03 Sandro Santilli <address@hidden>
* server/fill_style.cpp (sample_gradient): if no gradients
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -b -r1.124 -r1.125
--- gui/gtk.cpp 18 Dec 2007 15:02:24 -0000 1.124
+++ gui/gtk.cpp 3 Jan 2008 15:11:32 -0000 1.125
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: gtk.cpp,v 1.124 2007/12/18 15:02:24 strk Exp $ */
+/* $Id: gtk.cpp,v 1.125 2008/01/03 15:11:32 bwy Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -240,6 +240,13 @@
G_CALLBACK(&menuitem_sound_callback), this);
}
+ GtkMenuItem *menuitem_fsc =
+ GTK_MENU_ITEM(gtk_menu_item_new_with_label("Toggle Fullscreen"));
+ gtk_menu_append(_popup_menu, GTK_WIDGET(menuitem_fsc));
+ gtk_widget_show(GTK_WIDGET(menuitem_fsc));
+ g_signal_connect(GTK_OBJECT(menuitem_fsc), "activate",
+ G_CALLBACK(&menuitem_fullscreen_callback), this);
+
GtkMenuItem *menuitem_quit =
GTK_MENU_ITEM(gtk_menu_item_new_with_label("Quit Gnash"));
gtk_menu_append(_popup_menu, GTK_WIDGET(menuitem_quit));
@@ -467,6 +474,50 @@
}
void
+GtkGui::setFullscreen()
+{
+
+ if (_fullscreen) return;
+ // Plugin
+ if (_xid) {
+
+ // Create new window
+ _overlay = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ gtk_widget_reparent (_drawing_area, _overlay);
+ gtk_window_fullscreen(GTK_WINDOW(_overlay));
+ gtk_widget_show_all(_overlay);
+ }
+
+ // Stand-alone
+ else {
+ gtk_window_fullscreen(GTK_WINDOW(_window));
+ }
+
+ _fullscreen = true;
+}
+
+void
+GtkGui::unsetFullscreen()
+{
+
+ if (!_fullscreen) return;
+
+ // Plugin
+ if (_xid) {
+ gtk_widget_reparent (_drawing_area, _window);
+ gtk_widget_destroy(_overlay);
+ }
+
+ // Stand-alone
+ else {
+ gtk_window_unfullscreen(GTK_WINDOW(_window));
+ }
+
+ _fullscreen = false;
+}
+
+void
GtkGui::grabFocus()
{
gtk_widget_grab_focus(GTK_WIDGET(_drawing_area));
@@ -876,7 +927,9 @@
gdkcursor = gdk_cursor_new(cursortype);
}
- gdk_window_set_cursor (_window->window, gdkcursor);
+ // The parent of _drawing_area is different for the plugin in fullscreen
+ gdk_window_set_cursor (gtk_widget_get_parent_window(_drawing_area),
+ gdkcursor);
if (gdkcursor) {
gdk_cursor_unref(gdkcursor);
@@ -1243,6 +1296,20 @@
gui->menu_toggle_sound();
}
+void
+GtkGui::menuitem_fullscreen_callback(GtkMenuItem* /*menuitem*/, gpointer data)
+{
+// GNASH_REPORT_FUNCTION;
+ Gui* gui = static_cast<Gui*>(data);
+
+ if (!gui->isFullscreen()) {
+ gui->setFullscreen();
+ }
+ else {
+ gui->unsetFullscreen();
+ }
+}
+
/// \brief restart the movie from the beginning
void
@@ -1336,7 +1403,7 @@
{
// GNASH_REPORT_FUNCTION;
Gui* gui = static_cast<Gui*>(data);
- gui->menu_refresh_view();
+ gui->refreshView();
}
//
@@ -1839,7 +1906,7 @@
}
bool
-lirc_handler(void*, int, void* data)
+lirc_handler(void*, int, void* /*data*/)
{
GNASH_REPORT_FUNCTION;
// int* fd = static_cast<int*>(data);
Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- gui/gtksup.h 17 Dec 2007 09:32:39 -0000 1.56
+++ gui/gtksup.h 3 Jan 2008 15:11:32 -0000 1.57
@@ -78,6 +78,8 @@
/// @return true on success, false on failure.
bool addFDListener(int fd, callback_t callback, void* data);
+ void setFullscreen();
+ void unsetFullscreen();
/// Grab focus so to receive all key events
//
@@ -98,6 +100,8 @@
static void menuitem_sound_callback(GtkMenuItem *menuitem,
gpointer instance);
+ static void menuitem_fullscreen_callback(GtkMenuItem *menuitem,
+ gpointer instance);
static void menuitem_restart_callback(GtkMenuItem *menuitem,
gpointer instance);
static void menuitem_quit_callback(GtkMenuItem *menuitem,
@@ -174,6 +178,9 @@
HildonProgram *_hildon_program;
#endif
GtkWidget *_window;
+
+ // A window only for rendering the plugin as fullscreen.
+ GtkWidget *_overlay;
GdkPixbuf *_window_icon_pixbuf;
GtkWidget *_drawing_area;
GtkMenu *_popup_menu;
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -b -r1.121 -r1.122
--- gui/gui.cpp 18 Dec 2007 00:07:11 -0000 1.121
+++ gui/gui.cpp 3 Jan 2008 15:11:32 -0000 1.122
@@ -90,7 +90,8 @@
_depth(16),
_interval(0),
_renderer(NULL),
- _redraw_flag(true)
+ _redraw_flag(true),
+ _fullscreen(false)
#ifdef GNASH_FPS_DEBUG
,fps_counter(0)
,fps_counter_total(0)
@@ -158,9 +159,13 @@
}
void
-Gui::menu_refresh_view()
+Gui::setFullscreen()
+{
+}
+
+void
+Gui::unsetFullscreen()
{
- refresh_view();
}
void
@@ -378,7 +383,7 @@
}
void
-Gui::refresh_view()
+Gui::refreshView()
{
movie_root* m = _stage;
@@ -398,6 +403,14 @@
/* Handle GUI shortcuts */
if (pressed)
{
+ if (k == gnash::key::ESCAPE)
+ {
+ if (isFullscreen())
+ {
+ unsetFullscreen();
+ }
+ }
+
if (modifier & gnash::key::MOD_CONTROL)
{
switch(k)
@@ -412,7 +425,7 @@
break;
case gnash::key::l:
case gnash::key::L:
- menu_refresh_view();
+ refreshView();
break;
case gnash::key::q:
case gnash::key::Q:
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- gui/gui.h 4 Dec 2007 11:45:22 -0000 1.70
+++ gui/gui.h 3 Jan 2008 15:11:32 -0000 1.71
@@ -172,6 +172,8 @@
/// @return Whether or not the movie should be looped indefinitely.
bool loops();
+ bool isFullscreen() { return _fullscreen; }
+
/// Mouse notification callback to be called when the mouse is moved.
//
/// @param x The mouse coordinate X component in pixels.
@@ -215,7 +217,15 @@
/// Force immediate redraw
///
- void refresh_view();
+ void refreshView();
+
+ /// Run fullscreen
+ ///
+ virtual void setFullscreen();
+
+ /// Exit fullscreen
+ ///
+ virtual void unsetFullscreen();
/// Put the application in "stop" mode
//
@@ -347,6 +357,9 @@
/// window size did change.
bool _redraw_flag;
+ // True if Gnash is running in fullscreen
+ bool _fullscreen;
+
private:
bool display(movie_root* m);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/gtk.cpp gui/gtksup.h gui/gu...,
Benjamin Wolsey <=