forked from nemomobile-graveyard/meegotouch-systemui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: NB#289336 - time is not in sync on status bar with lock screen
Bug: NB#289336 - time is not in sync on status bar with lock screen RevBy: Artem Egorkine Details: Qt didn't forward the PropertyNotify in some cases since it didn't find any widget with a matching window ID. This patch creates such a widget.
- Loading branch information
Vesa Halttunen
committed
Nov 21, 2011
1 parent
ffa8bd8
commit 0992023
Showing
13 changed files
with
342 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
system-ui (1.2.19~1) unstable; urgency=low | ||
|
||
* [UNRELEASED] | ||
* Fixes: NB#289336 - time is not in sync on status bar with lock screen | ||
|
||
-- Vesa Halttunen <[email protected]> Fri, 18 Nov 2011 15:16:16 +0200 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/*************************************************************************** | ||
** | ||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | ||
** All rights reserved. | ||
** Contact: Nokia Corporation ([email protected]) | ||
** | ||
** This file is part of systemui. | ||
** | ||
** If you have questions regarding the use of this file, please contact | ||
** Nokia at [email protected]. | ||
** | ||
** This library is free software; you can redistribute it and/or | ||
** modify it under the terms of the GNU Lesser General Public | ||
** License version 2.1 as published by the Free Software Foundation | ||
** and appearing in the file LICENSE.LGPL included in the packaging | ||
** of this file. | ||
** | ||
****************************************************************************/ | ||
|
||
#include "xeventlistenerwidget.h" | ||
#include "xeventlistener.h" | ||
|
||
XEventListenerWidget::XEventListenerWidget(QWidget *parent, Window id) : | ||
QWidget(parent) | ||
{ | ||
create(id, false, false); | ||
} | ||
|
||
XEventListenerWidget::~XEventListenerWidget() | ||
{ | ||
destroy(false, false); | ||
} | ||
|
||
bool XEventListenerWidget::x11Event(XEvent *event) | ||
{ | ||
return XEventListener::xEventFilter(event); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/*************************************************************************** | ||
** | ||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | ||
** All rights reserved. | ||
** Contact: Nokia Corporation ([email protected]) | ||
** | ||
** This file is part of systemui. | ||
** | ||
** If you have questions regarding the use of this file, please contact | ||
** Nokia at [email protected]. | ||
** | ||
** This library is free software; you can redistribute it and/or | ||
** modify it under the terms of the GNU Lesser General Public | ||
** License version 2.1 as published by the Free Software Foundation | ||
** and appearing in the file LICENSE.LGPL included in the packaging | ||
** of this file. | ||
** | ||
****************************************************************************/ | ||
|
||
#ifndef XEVENTLISTENERWIDGET_H_ | ||
#define XEVENTLISTENERWIDGET_H_ | ||
|
||
#include <QWidget> | ||
#include <X11/Xlib.h> | ||
|
||
/*! | ||
* A QWidget which listens to the X events of the given window and relays them | ||
* to the XEventListener. | ||
*/ | ||
class XEventListenerWidget : public QWidget { | ||
Q_OBJECT | ||
|
||
public: | ||
/*! | ||
* Creates an XEventListenerWidget. | ||
* | ||
* \param parent the parent widget for the widget | ||
* \param id the ID of the X window for the window to be represented by this widget | ||
*/ | ||
XEventListenerWidget(QWidget *parent, Window id); | ||
|
||
/*! | ||
* Destroys the XEventListenerWidget. | ||
*/ | ||
~XEventListenerWidget(); | ||
|
||
protected: | ||
//! \reimp | ||
virtual bool x11Event(XEvent *event); | ||
//! \reimp_end | ||
|
||
#ifdef UNIT_TEST | ||
friend class Ut_XEventListenerWidget; | ||
#endif | ||
}; | ||
|
||
#endif /* XEVENTLISTENERWIDGET_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/*************************************************************************** | ||
** | ||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | ||
** All rights reserved. | ||
** Contact: Nokia Corporation ([email protected]) | ||
** | ||
** This file is part of mhome. | ||
** | ||
** If you have questions regarding the use of this file, please contact | ||
** Nokia at [email protected]. | ||
** | ||
** This library is free software; you can redistribute it and/or | ||
** modify it under the terms of the GNU Lesser General Public | ||
** License version 2.1 as published by the Free Software Foundation | ||
** and appearing in the file LICENSE.LGPL included in the packaging | ||
** of this file. | ||
** | ||
****************************************************************************/ | ||
#ifndef XEVENTLISTENERWIDGET_STUB | ||
#define XEVENTLISTENERWIDGET_STUB | ||
|
||
#include "xeventlistenerwidget.h" | ||
#include <stubbase.h> | ||
|
||
|
||
// 1. DECLARE STUB | ||
// FIXME - stubgen is not yet finished | ||
class XEventListenerWidgetStub : public StubBase { | ||
public: | ||
virtual void XEventListenerWidgetConstructor(QWidget *parent, Window id); | ||
virtual void XEventListenerWidgetDestructor(); | ||
virtual bool x11Event(XEvent *event); | ||
}; | ||
|
||
// 2. IMPLEMENT STUB | ||
void XEventListenerWidgetStub::XEventListenerWidgetConstructor(QWidget *parent, Window id) { | ||
Q_UNUSED(parent); | ||
Q_UNUSED(id); | ||
|
||
} | ||
void XEventListenerWidgetStub::XEventListenerWidgetDestructor() { | ||
|
||
} | ||
bool XEventListenerWidgetStub::x11Event(XEvent *event) { | ||
QList<ParameterBase*> params; | ||
params.append( new Parameter<XEvent * >(event)); | ||
stubMethodEntered("x11Event",params); | ||
return stubReturnValue<bool>("x11Event"); | ||
} | ||
|
||
|
||
|
||
// 3. CREATE A STUB INSTANCE | ||
XEventListenerWidgetStub gDefaultXEventListenerWidgetStub; | ||
XEventListenerWidgetStub* gXEventListenerWidgetStub = &gDefaultXEventListenerWidgetStub; | ||
|
||
|
||
// 4. CREATE A PROXY WHICH CALLS THE STUB | ||
XEventListenerWidget::XEventListenerWidget(QWidget *parent, Window id) { | ||
gXEventListenerWidgetStub->XEventListenerWidgetConstructor(parent, id); | ||
} | ||
|
||
XEventListenerWidget::~XEventListenerWidget() { | ||
gXEventListenerWidgetStub->XEventListenerWidgetDestructor(); | ||
} | ||
|
||
bool XEventListenerWidget::x11Event(XEvent *event) { | ||
return gXEventListenerWidgetStub->x11Event(event); | ||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ut_xeventlistenerwidget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/**************************************************************************** | ||
** | ||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | ||
** All rights reserved. | ||
** Contact: Nokia Corporation ([email protected]) | ||
** | ||
** This file is part of systemui. | ||
** | ||
** If you have questions regarding the use of this file, please contact | ||
** Nokia at [email protected]. | ||
** | ||
** This library is free software; you can redistribute it and/or | ||
** modify it under the terms of the GNU Lesser General Public | ||
** License version 2.1 as published by the Free Software Foundation | ||
** and appearing in the file LICENSE.LGPL included in the packaging | ||
** of this file. | ||
** | ||
****************************************************************************/ | ||
|
||
#include <QtTest/QtTest> | ||
#include <QX11Info> | ||
#include "xeventlistenerwidget.h" | ||
#include "xeventlistener_stub.h" | ||
#include "ut_xeventlistenerwidget.h" | ||
|
||
WId qWidgetCreateWindow = 0; | ||
bool qWidgetCreateInitializeWindow = true; | ||
bool qWidgetCreateDestroyOldWindow = true; | ||
void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) | ||
{ | ||
qWidgetCreateWindow = window; | ||
qWidgetCreateInitializeWindow = initializeWindow; | ||
qWidgetCreateDestroyOldWindow = destroyOldWindow; | ||
} | ||
|
||
bool qWidgetDestroyDestroyWindow = true; | ||
bool qWidgetDestroyDestroySubWindows = true; | ||
void QWidget::destroy(bool destroyWindow, bool destroySubWindows) | ||
{ | ||
qWidgetDestroyDestroyWindow = destroyWindow; | ||
qWidgetDestroyDestroySubWindows = destroySubWindows; | ||
} | ||
|
||
void Ut_XEventListenerWidget::init() | ||
{ | ||
} | ||
|
||
void Ut_XEventListenerWidget::cleanup() | ||
{ | ||
gXEventListenerStub->stubReset(); | ||
qWidgetCreateWindow = 0; | ||
qWidgetCreateInitializeWindow = true; | ||
qWidgetCreateDestroyOldWindow = true; | ||
qWidgetDestroyDestroyWindow = true; | ||
qWidgetDestroyDestroySubWindows = true; | ||
} | ||
|
||
void Ut_XEventListenerWidget::initTestCase() | ||
{ | ||
} | ||
|
||
void Ut_XEventListenerWidget::cleanupTestCase() | ||
{ | ||
} | ||
|
||
void Ut_XEventListenerWidget::testConstructionAndDestruction() | ||
{ | ||
Qt::HANDLE window = QX11Info::appRootWindow(QX11Info::appScreen()); | ||
XEventListenerWidget *widget = new XEventListenerWidget(NULL, window); | ||
QCOMPARE(qWidgetCreateWindow, (WId)window); | ||
QCOMPARE(qWidgetCreateInitializeWindow, false); | ||
QCOMPARE(qWidgetCreateDestroyOldWindow, false); | ||
|
||
delete widget; | ||
QCOMPARE(qWidgetDestroyDestroyWindow, false); | ||
QCOMPARE(qWidgetDestroyDestroySubWindows, false); | ||
} | ||
|
||
void Ut_XEventListenerWidget::testX11Event_data() | ||
{ | ||
QTest::addColumn<bool>("returnValue"); | ||
|
||
QTest::newRow("Return true") << true; | ||
QTest::newRow("Return false") << false; | ||
} | ||
|
||
void Ut_XEventListenerWidget::testX11Event() | ||
{ | ||
QFETCH(bool, returnValue); | ||
|
||
gXEventListenerStub->stubSetReturnValue("xEventFilter", returnValue); | ||
XEventListenerWidget widget(NULL, 0); | ||
XEvent event; | ||
QCOMPARE(widget.x11Event(&event), returnValue); | ||
QCOMPARE(gXEventListenerStub->stubCallCount("xEventFilter"), 1); | ||
QCOMPARE(gXEventListenerStub->stubLastCallTo("xEventFilter").parameter<void *>(0), &event); | ||
} | ||
|
||
QTEST_MAIN(Ut_XEventListenerWidget) |
Oops, something went wrong.