[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-144-gf25e8b8 |
Date: |
Mon, 28 Feb 2011 03:53:36 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via f25e8b850cb828fc011c67a212721f2a899adef0 (commit)
from 630938c5eb52921eb510192df3015ffc4395e276 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=f25e8b850cb828fc011c67a212721f2a899adef0
commit f25e8b850cb828fc011c67a212721f2a899adef0
Author: Bastiaan Jacques <address@hidden>
Date: Mon Feb 28 04:52:16 2011 +0100
Hook into visibility notification events and avoid display() if the
window is obscured.
diff --git a/gui/gtk/gtk.cpp b/gui/gtk/gtk.cpp
index e720f84..61fe3eb 100644
--- a/gui/gtk/gtk.cpp
+++ b/gui/gtk/gtk.cpp
@@ -111,6 +111,8 @@ namespace {
gpointer data);
gboolean motionNotifyEvent(GtkWidget *widget, GdkEventMotion *event,
gpointer data);
+ gboolean visibilityNotifyEvent(GtkWidget *widget, GdkEventVisibility
*event,
+ gpointer data);
gint popupHandler(GtkWidget *widget, GdkEvent *event);
gint popupHandlerAlt(GtkWidget *widget, GdkEvent *event);
@@ -145,6 +147,7 @@ GtkGui::GtkGui(unsigned long xid, float scale, bool loop,
RunResources& r)
,_resumeButton(0)
,_overlay(0)
,_canvas(0)
+ ,_visible(true)
,_popup_menu(0)
,_popup_menu_alt(0)
,_menubar(0)
@@ -567,6 +570,7 @@ GtkGui::setupEvents()
setupWindowEvents();
gtk_widget_add_events(_canvas, GDK_EXPOSURE_MASK
+ | GDK_VISIBILITY_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_KEY_RELEASE_MASK
@@ -589,6 +593,8 @@ GtkGui::setupEvents()
G_CALLBACK(motionNotifyEvent), this);
g_signal_connect(_canvas, "scroll_event",
G_CALLBACK(mouseWheelEvent), this);
+ g_signal_connect(_canvas, "visibility-notify-event",
+ G_CALLBACK(visibilityNotifyEvent), this);
g_signal_connect_after(_canvas, "realize",
G_CALLBACK (realizeEvent), NULL);
@@ -2440,6 +2446,25 @@ motionNotifyEvent(GtkWidget *const /*widget*/,
GdkEventMotion *const event,
return true;
}
+gboolean
+visibilityNotifyEvent(GtkWidget *const /*widget*/, GdkEventVisibility *const
event,
+ const gpointer data)
+{
+ GtkGui *obj = static_cast<GtkGui *>(data);
+
+ switch (event->state) {
+ case GDK_VISIBILITY_FULLY_OBSCURED:
+ obj->setVisible(false);
+ break;
+ case GDK_VISIBILITY_PARTIAL:
+ case GDK_VISIBILITY_UNOBSCURED:
+ obj->setVisible(true);
+ break;
+ }
+
+ return false; // propagate the event to other listeners, if any.
+}
+
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// ///
diff --git a/gui/gtk/gtksup.h b/gui/gtk/gtksup.h
index ba49507..bd0ce6e 100644
--- a/gui/gtk/gtksup.h
+++ b/gui/gtk/gtksup.h
@@ -123,6 +123,10 @@ public:
bool checkX11Extension(const std::string& ext);
+ virtual bool visible() { return _visible; }
+
+ void setVisible(bool visible) { _visible = visible; }
+
private:
GtkWidget* _window;
@@ -133,12 +137,14 @@ private:
// The area rendered into by Gnash
GtkWidget* _canvas;
+ bool _visible;
GtkMenu* _popup_menu;
GtkMenu* _popup_menu_alt;
GtkWidget* _menubar;
GtkWidget* _vbox;
+
/// Add key press events to the toplevel window.
//
/// The plugin fullscreen creates a new top level
@@ -159,7 +165,6 @@ private:
void startAdvanceTimer();
void stopAdvanceTimer();
-
};
} // namespace gnash
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 5d92421..90923de 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -1003,7 +1003,7 @@ Gui::advanceMovie(bool doDisplay)
}
#endif // ndef SKIP_RENDERING_IF_LATE
- if (doDisplay) display(m);
+ if (doDisplay && visible()) display(m);
if (!loops()) {
size_t curframe = m->get_current_frame(); // can be 0 on
malformed SWF
diff --git a/gui/gui.h b/gui/gui.h
index 45b4610..87a7c17 100644
--- a/gui/gui.h
+++ b/gui/gui.h
@@ -539,6 +539,8 @@ protected:
/// Called by Gui::play().
virtual void playHook() {}
+ /// Determines whether the Gui is visible (not obscured).
+ virtual bool visible() { return true; }
private:
struct Display;
-----------------------------------------------------------------------
Summary of changes:
gui/gtk/gtk.cpp | 25 +++++++++++++++++++++++++
gui/gtk/gtksup.h | 7 ++++++-
gui/gui.cpp | 2 +-
gui/gui.h | 2 ++
4 files changed, 34 insertions(+), 2 deletions(-)
hooks/post-receive
--
Gnash
- [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-144-gf25e8b8,
Bastiaan Jacques <=