summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp14
-rw-r--r--tests/manual/windowflags/previewwindow.cpp20
-rw-r--r--tests/manual/windowflags/previewwindow.h6
3 files changed, 37 insertions, 3 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index f2e66c5..3050b82 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -70,7 +70,8 @@ extern uint qGlobalPostedEventsCount();
enum {
WM_QT_SOCKETNOTIFIER = WM_USER,
- WM_QT_SENDPOSTEDEVENTS = WM_USER + 1
+ WM_QT_SENDPOSTEDEVENTS = WM_USER + 1,
+ SendPostedEventsTimerId = ~1u
};
#if defined(Q_OS_WINCE)
@@ -470,7 +471,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
}
return 0;
} else if (message == WM_TIMER) {
- if (wp == ~1u) {
+ if (wp == SendPostedEventsTimerId) {
KillTimer(d->internalHwnd, wp);
int localSerialNumber = d->serialNumber;
(void) d->wakeUps.fetchAndStoreRelease(0);
@@ -488,7 +489,14 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
if (GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER) != 0) {
// delay the next pass of sendPostedEvents() until we get the special
// WM_TIMER, which allows all pending Windows messages to be processed
- SetTimer(d->internalHwnd, ~1u, 0, 0);
+ if (SetTimer(d->internalHwnd, SendPostedEventsTimerId, 0, 0) == 0) {
+ // failed to start the timer, oops, clear wakeUps in an attempt to keep things running
+ qErrnoWarning("Qt: INTERNAL ERROR: failed to start sendPostedEvents() timer");
+ d->wakeUps.fetchAndStoreRelease(0);
+ } else {
+ // SetTimer() succeeded, nothing to do now
+ ;
+ }
} else {
// nothing pending in the queue, let sendPostedEvents go through
d->wakeUps.fetchAndStoreRelease(0);
diff --git a/tests/manual/windowflags/previewwindow.cpp b/tests/manual/windowflags/previewwindow.cpp
index 78f9fcb..31e8b3e 100644
--- a/tests/manual/windowflags/previewwindow.cpp
+++ b/tests/manual/windowflags/previewwindow.cpp
@@ -103,8 +103,18 @@ PreviewWindow::PreviewWindow(QWidget *parent)
closeButton = new QPushButton(tr("&Close"));
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+ showNormalButton = new QPushButton(tr("Show normal"));
+ connect(showNormalButton, SIGNAL(clicked()), this, SLOT(showNormal()));
+ showMaximizedButton = new QPushButton(tr("Show maximized"));
+ connect(showMaximizedButton, SIGNAL(clicked()), this, SLOT(showMaximized()));
+ showFullScreenButton = new QPushButton(tr("Show fullscreen"));
+ connect(showFullScreenButton, SIGNAL(clicked()), this, SLOT(showFullScreen()));
+
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(textEdit);
+ layout->addWidget(showNormalButton);
+ layout->addWidget(showMaximizedButton);
+ layout->addWidget(showFullScreenButton);
layout->addWidget(closeButton);
setLayout(layout);
@@ -129,8 +139,18 @@ PreviewDialog::PreviewDialog(QWidget *parent)
closeButton = new QPushButton(tr("&Close"));
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+ showNormalButton = new QPushButton(tr("Show normal"));
+ connect(showNormalButton, SIGNAL(clicked()), this, SLOT(showNormal()));
+ showMaximizedButton = new QPushButton(tr("Show maximized"));
+ connect(showMaximizedButton, SIGNAL(clicked()), this, SLOT(showMaximized()));
+ showFullScreenButton = new QPushButton(tr("Show fullscreen"));
+ connect(showFullScreenButton, SIGNAL(clicked()), this, SLOT(showFullScreen()));
+
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(textEdit);
+ layout->addWidget(showNormalButton);
+ layout->addWidget(showMaximizedButton);
+ layout->addWidget(showFullScreenButton);
layout->addWidget(closeButton);
setLayout(layout);
diff --git a/tests/manual/windowflags/previewwindow.h b/tests/manual/windowflags/previewwindow.h
index fdd21d7..fbf822b 100644
--- a/tests/manual/windowflags/previewwindow.h
+++ b/tests/manual/windowflags/previewwindow.h
@@ -62,6 +62,9 @@ public:
private:
QTextEdit *textEdit;
QPushButton *closeButton;
+ QPushButton *showNormalButton;
+ QPushButton *showMaximizedButton;
+ QPushButton *showFullScreenButton;
};
class PreviewDialog : public QDialog
@@ -76,6 +79,9 @@ public:
private:
QTextEdit *textEdit;
QPushButton *closeButton;
+ QPushButton *showNormalButton;
+ QPushButton *showMaximizedButton;
+ QPushButton *showFullScreenButton;
};
#endif