From fc8b62222c103fc43465a773cb0e2394f8eeed14 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 29 Sep 2011 10:28:28 +0300 Subject: [PATCH] Send key events to the active window when tlw in qpa event is null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie055918276d716b0f4f23b6a9d34c23c5459d960 Reviewed-on: http://codereview.qt-project.org/5777 Reviewed-by: Qt Sanity Bot Reviewed-by: Jørgen Lind --- src/gui/kernel/qguiapplication.cpp | 2 ++ src/gui/kernel/qwindowsysteminterface_qpa_p.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 77b04bc057..bfa60fa657 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -636,6 +636,8 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e) { QWindow *window = e->window.data(); + if (e->nullWindow) + window = QGuiApplication::activeWindow(); if (!window) return; diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 352092d066..77c219737d 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -128,8 +128,9 @@ public: class UserEvent : public WindowSystemEvent { public: UserEvent(QWindow * w, ulong time, EventType t) - : WindowSystemEvent(t), window(w), timestamp(time) { } + : WindowSystemEvent(t), window(w), nullWindow(w == 0), timestamp(time) { } QWeakPointer window; + bool nullWindow; unsigned long timestamp; };