summaryrefslogtreecommitdiff
path: root/src/videowidget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/videowidget.cc')
-rw-r--r--src/videowidget.cc39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/videowidget.cc b/src/videowidget.cc
index e4477a4..8160833 100644
--- a/src/videowidget.cc
+++ b/src/videowidget.cc
@@ -31,6 +31,10 @@
/*
* $Log$
+ * Revision 1.8 2005/07/26 16:16:56 deva
+ *
+ * Added fullscreen functionality.
+ *
* Revision 1.7 2005/07/25 16:18:34 deva
* *** empty log message ***
*
@@ -49,18 +53,21 @@
* Revision 1.2 2005/05/01 09:56:26 deva
* Added Id and Log tags to all files
*/
-
#include <config.h>
#ifdef USE_GUI
#include "videowidget.h"
-VideoWidget::VideoWidget(QWidget *p, Camera *c) : QWidget(p, "")
+#include "miav_config.h"
+
+VideoWidget::VideoWidget(QWidget *p, Camera *c, QWidget* old) : QWidget(p, "")
{
camera = c;
parent = p;
+ oldWindow = old;
+
// A welltested hack to force SDL to draw in the QWidget
QString ids;
setenv("SDL_WINDOWID", ids.setNum(winId()), 1);
@@ -75,24 +82,22 @@ QPixmap VideoWidget::getScreenshot()
return QPixmap::grabWindow (winId());
}
-void VideoWidget::mousePressEvent(QMouseEvent *event)
+void VideoWidget::mouseReleaseEvent(QMouseEvent *event)
{
- camera->pause();
-
- if(isFullScreen()) {
- printf("Going normal\n");
-
- reparent(parent, 0, QPoint(10,10), FALSE);
-
- showNormal();
+ if(!parent) {
+ // We are a fullscreen window
+ QString ids;
+ setenv("SDL_WINDOWID", ids.setNum(oldWindow->winId()), 1);
+ camera->resize(oldWindow->width(), oldWindow->height());
+ destroy();
} else {
- printf("Going fullscreen\n");
-
- reparent(NULL, 0, QPoint(0,0), FALSE);
-
- showFullScreen();
+ // We are a nested window
+ VideoWidget *fs = new VideoWidget(NULL, camera, this);
+ fs->showFullScreen();
+ fs->setFixedWidth(config->readInt("pixel_width"));
+ fs->setFixedHeight(config->readInt("pixel_height"));
+ camera->resize(fs->width(), fs->height());
}
- camera->resize(width(), height());
}
#endif /* USE_GUI */