[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12106: Add fd to mainloop to allow
From: |
John Wimer |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12106: Add fd to mainloop to allow shutdown in Kde4 gui. |
Date: |
Wed, 24 Mar 2010 23:40:31 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12106
committer: John Wimer <address@hidden>
branch nick: trunk
timestamp: Wed 2010-03-24 23:40:31 +0100
message:
Add fd to mainloop to allow shutdown in Kde4 gui.
Some whitespace cleanup as well.
modified:
gui/Kde4Gui.cpp
gui/Kde4Gui.h
gui/gtk.cpp
=== modified file 'gui/Kde4Gui.cpp'
--- a/gui/Kde4Gui.cpp 2010-03-22 20:48:47 +0000
+++ b/gui/Kde4Gui.cpp 2010-03-24 22:40:31 +0000
@@ -53,6 +53,7 @@
#include <QCheckBox>
#include <QLCDNumber>
#include <QSpinBox>
+#include <QSocketNotifier>
#include "Range2d.h"
@@ -79,6 +80,7 @@
Kde4Gui::Kde4Gui(unsigned long xid, float scale, bool loop, RunResources& r)
: Gui(xid, scale, loop, r)
+ , _fdMonitor(*this)
{
}
@@ -155,6 +157,14 @@
bool
+Kde4Gui::watchFD(int fd)
+{
+ _fdMonitor.addFD(fd);
+ return true;
+}
+
+
+bool
Kde4Gui::createWindow(const char* windowtitle, int width, int height,
int xPosition, int yPosition)
{
@@ -996,6 +1006,32 @@
} // End of Kde4GuiPrefs namespace
+FDMonitor::FDMonitor(Kde4Gui& gui)
+ : _gui(gui)
+{
+}
+
+FDMonitor::~FDMonitor()
+{
+}
+
+void
+FDMonitor::dataReceived(int fd)
+{
+ _gui.callCallback(fd);
+}
+
+void
+FDMonitor::addFD(int fd)
+{
+ QSocketNotifier* socketNotifier =
+ new QSocketNotifier(fd, QSocketNotifier::Read, this);
+
+ connect(socketNotifier, SIGNAL(activated(int)),
+ this, SLOT(dataReceived(int)));
+
+ socketNotifier->setEnabled(true);
+}
}
=== modified file 'gui/Kde4Gui.h'
--- a/gui/Kde4Gui.h 2010-03-22 20:48:47 +0000
+++ b/gui/Kde4Gui.h 2010-03-24 22:40:31 +0000
@@ -56,7 +56,7 @@
namespace gnash {
class Kde4Gui;
- class DrawingWidget;
+ class DrawingWidget;
}
namespace gnash
@@ -82,9 +82,26 @@
};
+class FDMonitor : public QObject
+{
+ Q_OBJECT
+public:
+ FDMonitor(Kde4Gui& gui);
+ ~FDMonitor();
+
+ // Add a file descriptor for monitoring.
+ void addFD(int fd);
+
+public slots:
+ void dataReceived(int fd);
+
+private:
+ Kde4Gui& _gui;
+};
+
+
class DSOEXPORT Kde4Gui : public Gui
{
-
public:
Kde4Gui(unsigned long xid, float scale, bool loop, RunResources& r);
virtual ~Kde4Gui();
@@ -93,6 +110,7 @@
int xPosition = 0, int yPosition = 0);
virtual void resizeWindow(int width, int height);
virtual bool run();
+ virtual bool watchFD(int fd);
virtual void renderBuffer();
virtual void setInterval(unsigned int interval);
virtual void setTimeout(unsigned int timeout);
@@ -114,7 +132,6 @@
void popupMenu(const QPoint& point);
private:
-
typedef std::vector<geometry::Range2d<int> > DrawBounds;
typedef std::map<int, gnash::key::code> KeyMap;
@@ -132,6 +149,8 @@
/// Called when the movie is played.
void playHook();
+ /// Object that allows the mainloop to read file descriptors.
+ FDMonitor _fdMonitor;
DrawBounds _drawbounds;
@@ -149,7 +168,7 @@
DrawingWidget* _drawingWidget;
/// Takes care of painting onto the widget.
- std::auto_ptr<Kde4Glue> _glue;
+ std::auto_ptr<Kde4Glue> _glue;
/// The main application window.
std::auto_ptr<QMainWindow> _window;
@@ -187,7 +206,6 @@
QMenu* viewMenu;
QAction* refreshAction;
QAction* fullscreenAction;
-
};
namespace Kde4GuiPrefs
=== modified file 'gui/gtk.cpp'
--- a/gui/gtk.cpp 2010-03-22 20:38:55 +0000
+++ b/gui/gtk.cpp 2010-03-24 22:40:31 +0000
@@ -180,8 +180,8 @@
GtkGui::init(int argc, char **argv[])
{
if (!XInitThreads()) {
- log_debug("Failed to initialize X threading support\n");
- return false;
+ log_debug("Failed to initialize X threading support\n");
+ return false;
}
gtk_init(&argc, argv);
@@ -213,11 +213,11 @@
std::string hwaccel = _runResources.getHWAccelBackend();
if (hwaccel.empty()) {
- hwaccel = rcfile.getHWAccel();
+ hwaccel = rcfile.getHWAccel();
}
std::string renderer = _runResources.getRenderBackend();
if (renderer.empty()) {
- renderer = rcfile.getRenderer();
+ renderer = rcfile.getRenderer();
}
if (renderer == "opengl") {
@@ -238,7 +238,7 @@
// If we don't have these extensions, don't bother with OpenGl,
// drop back to AGG.
if (!glx || !dri) {
- g_warning("This systms lacks a hardware OpenGL driver!");
+ g_warning("This system lacks a hardware OpenGL driver!");
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12106: Add fd to mainloop to allow shutdown in Kde4 gui.,
John Wimer <=