summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-02-02 12:56:03 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-02-03 16:31:07 (GMT)
commitdc7aa1a9f9cd89f726a54a88ff31731c56142eb8 (patch)
treed89879b1fdbcdba0c179acd20ad785cd9b1a18e0 /src/gui/kernel
parent00c742407859aedd34f7d2811a8408ecd15d1e14 (diff)
downloadQt-dc7aa1a9f9cd89f726a54a88ff31731c56142eb8.zip
Qt-dc7aa1a9f9cd89f726a54a88ff31731c56142eb8.tar.gz
Qt-dc7aa1a9f9cd89f726a54a88ff31731c56142eb8.tar.bz2
Qt applications not responding to WM_GETHOTKEY on windows.
On windows when an application has been started through a shortcut link, (either by double-clicking or by pressing the shortcut key assigned in the link) the STARTUPINFO contains the hotkey associated to the application. This should be set on the toplevel using WM_SETHOTKEY, so that it behaves like native applications. Task-number: QUTBUG-3426 Reviewed-by: Jens Bache-Wiig Reviewed-by: bnilsen
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/kernel/qwidget_win.cpp16
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index d3bc2d8..ff8f276 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -158,6 +158,7 @@ struct QTLWExtra {
quint32 newCounterValueLo;
#endif
#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN
+ uint hotkeyRegistered: 1; // Hot key from the STARTUPINFO has been registered.
HICON winIconBig; // internal big Windows icon
HICON winIconSmall; // internal small Windows icon
#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 10522ed..a57aacc 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -1094,6 +1094,21 @@ void QWidgetPrivate::show_sys()
return;
}
+ if (data.window_flags & Qt::Window) {
+ QTLWExtra *extra = topData();
+ if (!extra->hotkeyRegistered) {
+ // Try to set the hotkey using information from STARTUPINFO
+ STARTUPINFO startupInfo;
+ GetStartupInfo(&startupInfo);
+ // If STARTF_USEHOTKEY is set, hStdInput is the virtual keycode
+ if (startupInfo.dwFlags & 0x00000200) {
+ WPARAM hotKey = (WPARAM)startupInfo.hStdInput;
+ SendMessage(data.winid, WM_SETHOTKEY, hotKey, 0);
+ }
+ extra->hotkeyRegistered = 1;
+ }
+ }
+
int sm = SW_SHOWNORMAL;
bool fakedMaximize = false;
if (q->isWindow()) {
@@ -1687,6 +1702,7 @@ void QWidgetPrivate::deleteSysExtra()
void QWidgetPrivate::createTLSysExtra()
{
+ extra->topextra->hotkeyRegistered = 0;
extra->topextra->savedFlags = 0;
extra->topextra->winIconBig = 0;
extra->topextra->winIconSmall = 0;