Permalink
Browse files

Fixes: NB#234652 - System banners should be blocked during video reco…

…rding

Bug: NB#234652 - System banners should be blocked during video recording
RevBy: Pankaj Saharan
  • Loading branch information...
1 parent 9206deb commit 3d7ed9a15e1cee41017f4b091d3efcfe13934695 Vesa Halttunen committed Jun 20, 2011
View
@@ -6,6 +6,7 @@ system-ui (1.1.0~1) unstable; urgency=low
* Fixes: NB#255218 - Status Menu open/close transition is incorrect
* Fixes: NB#265924 - Nasty white flicker when powering off the device
* Fixes: NB#263307 - Button §qtn_tui_clear§ is clipped in notification toolbar in Russian Language
+ * Fixes: NB#234652 - System banners should be blocked during video recording
-- Janne Sakko <ext-janne.2.sakko@nokia.com> Wed, 08 Jun 2011 17:52:12 +0300
View
@@ -35,14 +35,21 @@ This sink will create a transparent window of type \b _NET_WM_TYPE_NOTIFICATION
\subsubsection disabling_previews Disabling notification previews
MCompositorNotificationSink can be prevented from showing its window and the banners in two ways:
-- Globally, by setting the GConf key /desktop/meego/notifications/previews_enabled to false. This disables previews for both application and system notifications.
-- On a per window basis, by setting the _MEEGOTOUCH_NOTIFICATION_PREVIEWS_DISABLED window property to a non-zero value e.g.
+- Globally, by setting the GConf key /desktop/meego/notifications/previews_enabled to false. This disables previews for both application and system notifications and is only to be used for testing purposes.
+- On a per window basis, by setting the _MEEGOTOUCH_NOTIFICATION_PREVIEWS_DISABLED window property to one of the supported values:
+ - 0: all previews enabled
+ - 1: application notification previews disabled
+ - 2: system notification previews disabled
+ - 3: application and system notification previews disabled
+
+The code to disable the previews on a per window basis is as follows:
+
\code
MWindow win;
unsigned char data = 1;
-XChangeProperty(QX11Info::display(), win.internalWindId(), XInternAtom(QX11Info::display(), "_MEEGOTOUCH_NOTIFICATION_PREVIEWS_DISABLED", False),
+XChangeProperty(QX11Info::display(), win.effectiveWinId(), XInternAtom(QX11Info::display(), "_MEEGOTOUCH_NOTIFICATION_PREVIEWS_DISABLED", False),
XA_INTEGER, 8, PropModeReplace, &data, 1);
-\endcode \note Previews for system notifications can not be disabled this way.
+\endcode
\subsection NGFNotificationSink
\c NGFNotificationSink (Non Graphical Notification Sink) integrates to the low level notification framework libngf to produce the required notification sound, vibrations, led indications etc. The \c NGFNotificationSink uses the \c feedbackId key from the event type to determine which feedback to request from the \c libngf.
@@ -86,9 +86,13 @@ void MCompositorNotificationSink::addNotification(const Notification &notificati
return;
}
- if (allPreviewsDisabled || (notification.type() != Notification::SystemEvent && (sinkDisabled || currentApplicationHasPreviewsDisabled()))) {
+ // Check whether notification previews are disabled in current conditions
+ PreviewMode previewMode = currentApplicationPreviewMode();
+ if (allPreviewsDisabled ||
+ (notification.type() == Notification::ApplicationEvent && (sinkDisabled || (previewMode & ApplicationEventsDisabled) != 0)) ||
+ (notification.type() == Notification::SystemEvent && (previewMode & SystemEventsDisabled) != 0)) {
// Notification previews are disabled
- if (notification.type() != Notification::SystemEvent) {
+ if (notification.type() == Notification::ApplicationEvent) {
// Transfer the notification onwards immediately
emit notificationAdded(notification);
} else {
@@ -298,13 +302,13 @@ void MCompositorNotificationSink::updateImage(MBanner *infoBanner, const Notific
}
}
-bool MCompositorNotificationSink::currentApplicationHasPreviewsDisabled()
+MCompositorNotificationSink::PreviewMode MCompositorNotificationSink::currentApplicationPreviewMode()
{
Atom actualType;
int actualFormat;
unsigned long numItemsReturn, bytesLeft;
unsigned char *data = NULL;
- bool previewsDisabled = false;
+ PreviewMode previewMode = AllEventsEnabled;
Display *display = QX11Info::display();
@@ -319,10 +323,10 @@ bool MCompositorNotificationSink::currentApplicationHasPreviewsDisabled()
notificationPreviewsDisabledAtom, 0L, 1L, False, XA_INTEGER,
&actualType, &actualFormat, &numItemsReturn, &bytesLeft, &data);
if (result == Success && numItemsReturn) {
- previewsDisabled = *(int *)data != 0;
+ previewMode = (PreviewMode)(*(int *)data);
X11Wrapper::XFree(data);
}
}
- return previewsDisabled;
+ return previewMode;
}
@@ -45,6 +45,14 @@ class MCompositorNotificationSink : public WidgetNotificationSink
Q_OBJECT
public:
+ //! Supported preview modes
+ enum PreviewMode {
+ AllEventsEnabled = 0,
+ ApplicationEventsDisabled,
+ SystemEventsDisabled,
+ AllEventsDisabled
+ };
+
/*!
* Constructs a new MCompositorNotificationSink.
*/
@@ -138,10 +146,12 @@ private slots:
/*!
* Find the current application window id through a root window property
- * and then check a property on that window to determine whether
- * notifications should be shown on that window or not.
+ * and then check a property on that window to determine whether different
+ * kinds of notifications should be shown on that window or not.
+ *
+ * \return the preview mode for the current application
*/
- bool currentApplicationHasPreviewsDisabled();
+ PreviewMode currentApplicationPreviewMode();
//! The set of all notification IDs known by this sink. Needed to know also about those notifications which do not have banners anymore.
QSet<uint> notificationIds;
@@ -849,10 +849,16 @@ void Ut_MCompositorNotificationSink::testNotificationPreviewsDisabledForApplicat
QTest::addColumn<bool>("system");
QTest::addColumn<bool>("windowshown");
- QTest::newRow("property not set, window shown") << false << 0 << false << true;
- QTest::newRow("property set to zero, window shown") << true << 0 << false << true;
- QTest::newRow("property set to non-zero, window not shown") << true << 1 << false << false;
- QTest::newRow("property set to non-zero, window shown for system notification") << true << 1 << true << true;
+ QTest::newRow("property not set, window shown for application notification") << false << 0 << false << true;
+ QTest::newRow("property not set, window shown for system notification") << false << 0 << true << true;
+ QTest::newRow("property set to 0, window shown for application notification") << true << 0 << false << true;
+ QTest::newRow("property set to 0, window shown for system notification") << true << 0 << true << true;
+ QTest::newRow("property set to 1, window not shown for application notification") << true << 1 << false << false;
+ QTest::newRow("property set to 1, window shown for system notification") << true << 1 << true << true;
+ QTest::newRow("property set to 2, window shown for application notification") << true << 2 << false << true;
+ QTest::newRow("property set to 2, window not shown for system notification") << true << 2 << true << false;
+ QTest::newRow("property set to 3, window not shown for application notification") << true << 3 << false << false;
+ QTest::newRow("property set to 3, window not shown for system notification") << true << 3 << true << false;
}
void Ut_MCompositorNotificationSink::testNotificationPreviewsDisabledForApplication()

0 comments on commit 3d7ed9a

Please sign in to comment.