summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c1
-rw-r--r--displaymessage.c32
-rw-r--r--displaymessage.h3
-rw-r--r--setup.c1
4 files changed, 27 insertions, 10 deletions
diff --git a/config.c b/config.c
index 6bcd139..c883473 100644
--- a/config.c
+++ b/config.c
@@ -189,6 +189,7 @@ void cNopacityConfig::LoadDefaults(void) {
conf.insert(std::pair<std::string, int>("fontReplay", 0));
//DisplayMessage
conf.insert(std::pair<std::string, int>("messageFadeTime", 300));
+ conf.insert(std::pair<std::string, int>("messageFadeOutTime", 300));
conf.insert(std::pair<std::string, int>("messageWidth", 90));
conf.insert(std::pair<std::string, int>("messageHeight", 10));
conf.insert(std::pair<std::string, int>("messageBorderBottom", 10));
diff --git a/displaymessage.c b/displaymessage.c
index db88ae5..01094ad 100644
--- a/displaymessage.c
+++ b/displaymessage.c
@@ -4,8 +4,7 @@
#include "helpers.h"
cNopacityDisplayMessage::cNopacityDisplayMessage(void) : cThread("DisplayMessage") {
- FadeTime = config.GetValue("messageFadeTime");
- FrameTime = FadeTime / 10;
+ fadeout = false;
int top = geoManager->osdTop + geoManager->osdHeight - geoManager->messageHeight - config.GetValue("messageBorderBottom");
int left = geoManager->osdLeft + (geoManager->osdWidth - geoManager->messageWidth) / 2;
osd = CreateOsd(left, top, geoManager->messageWidth, geoManager->messageHeight);
@@ -13,9 +12,17 @@ cNopacityDisplayMessage::cNopacityDisplayMessage(void) : cThread("DisplayMessage
}
cNopacityDisplayMessage::~cNopacityDisplayMessage() {
- Cancel(-1);
- while (Active())
+ if (config.GetValue("messageFadeOutTime")) {
+ fadeout = true;
+ Start();
+ }
+ int count = 0;
+ while (Active()) {
cCondWait::SleepMs(10);
+ count++;
+ if (count > 150)
+ Cancel(1);
+ }
delete messageBox;
delete osd;
}
@@ -23,27 +30,36 @@ cNopacityDisplayMessage::~cNopacityDisplayMessage() {
void cNopacityDisplayMessage::SetMessage(eMessageType Type, const char *Text) {
delete messageBox;
messageBox = new cNopacityMessageBox(osd, cRect(0, 0, geoManager->messageWidth, geoManager->messageHeight), Type, Text);
- if (FadeTime) {
+ if (config.GetValue("messageFadeTime")) {
messageBox->SetAlpha(0);
Start();
}
}
void cNopacityDisplayMessage::Flush(void) {
+ if (Running())
+ return;
osd->Flush();
}
void cNopacityDisplayMessage::Action(void) {
+ int x = (fadeout) ? 255 : 0;
+ int FadeTime = (fadeout) ? config.GetValue("messageFadeOutTime") : config.GetValue("messageFadeTime");
+ int FrameTime = FadeTime / 10;
+ uint64_t First = cTimeMs::Now();
+ cPixmap::Lock();
+ cPixmap::Unlock();
uint64_t Start = cTimeMs::Now();
+ dsyslog ("skinnopacity: First Lock(): %lims \n", Start - First);
while (Running()) {
uint64_t Now = cTimeMs::Now();
- cPixmap::Lock();
double t = std::min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = std::abs(x - (int(t * ALPHA_OPAQUE)));
+ cPixmap::Lock();
messageBox->SetAlpha(Alpha);
- cPixmap::Unlock();
if (Running())
osd->Flush();
+ cPixmap::Unlock();
int Delta = cTimeMs::Now() - Now;
if (Running() && (Delta < FrameTime))
cCondWait::SleepMs(FrameTime - Delta);
diff --git a/displaymessage.h b/displaymessage.h
index c3fc13c..c893762 100644
--- a/displaymessage.h
+++ b/displaymessage.h
@@ -10,8 +10,7 @@ class cNopacityDisplayMessage : public cSkinDisplayMessage , cThread {
private:
cOsd *osd;
cNopacityMessageBox *messageBox;
- int FrameTime;
- int FadeTime;
+ bool fadeout;
virtual void Action(void);
public:
cNopacityDisplayMessage(void);
diff --git a/setup.c b/setup.c
index 840d92b..912f615 100644
--- a/setup.c
+++ b/setup.c
@@ -485,6 +485,7 @@ void cNopacitySetupMessageDisplay::Set(void) {
Clear();
Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), tmpConf->GetValueRef("messageFadeTime"), 0, 1000));
+ Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), tmpConf->GetValueRef("messageFadeOutTime"), 0, 1000));
Add(new cMenuEditIntItem(tr("Width of Message Display (Percent of OSD Height)"), tmpConf->GetValueRef("messageWidth"), 30, 100));
Add(new cMenuEditIntItem(tr("Height of Message Display (Percent of OSD Height)"), tmpConf->GetValueRef("messageHeight"), 5, 100));
Add(new cMenuEditIntItem(tr("Bottom Border Height"), tmpConf->GetValueRef("messageBorderBottom"), 0, 1000));