Made the volume, mute and power keys work when a menu is active, too

This commit is contained in:
Klaus Schmidinger 2001-09-23 14:36:38 +02:00
parent 34e6eaad58
commit 0ed710a843
3 changed files with 110 additions and 100 deletions

View File

@ -139,3 +139,6 @@ Rolf Hakenes <hakenes@hippomi.de>
Andreas Vitting <Andreas@huji.de>
for providing code that closes all unused file descriptors in the child
process of a pipe (used in cPipe)
Matthias Weingart <matthias@pentax.boerde.de>
for fixing handling of the volume, mute and power keys when menus are active

View File

@ -784,3 +784,5 @@ Video Disk Recorder Revision History
- Writing the current time (as seen by VDR) into the log file when starting
a timer recording (this may help debugging cases where timers don't start
at the expected time).
- Made the volume, mute and power keys work when a menu is active, too (thanks
to Matthias Weingart).

55
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.78 2001/09/23 10:59:29 kls Exp $
* $Id: vdr.c 1.79 2001/09/23 14:33:39 kls Exp $
*/
#define _GNU_SOURCE
@ -367,7 +367,33 @@ int main(int argc, char *argv[])
EITScanner.Activity();
LastActivity = time(NULL);
}
if (*Interact && key != kPower) {
// Keys that must work independent of any interactive mode:
switch (key) {
// Volume Control:
case kVolUp|k_Repeat:
case kVolUp:
case kVolDn|k_Repeat:
case kVolDn:
cDvbApi::PrimaryDvbApi->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA);
break;
case kMute:
cDvbApi::PrimaryDvbApi->ToggleMute();
break;
// Power off:
case kPower: isyslog(LOG_INFO, "Power button pressed");
DELETENULL(*Interact);
if (!Shutdown) {
Interface->Error(tr("Can't shutdown - option '-s' not given!"));
break;
}
if (cRecordControls::Active()) {
if (Interface->Confirm(tr("Recording - shut down anyway?")))
ForceShutdown = true;
}
LastActivity = 1; // not 0, see below!
break;
default:
if (*Interact) {
switch ((*Interact)->ProcessKey(key)) {
case osMenu: DELETENULL(Menu);
Menu = new cMenuMain(ReplayControl);
@ -407,6 +433,7 @@ int main(int argc, char *argv[])
}
}
else {
// Key functions in "normal" viewing mode:
switch (key) {
// Toggle channels:
case k0: {
@ -441,32 +468,10 @@ int main(int argc, char *argv[])
case kMenu: Menu = new cMenuMain(ReplayControl); break;
// Viewing Control:
case kOk: LastChannel = -1; break; // forces channel display
// Volume Control:
case kVolUp|k_Repeat:
case kVolUp:
case kVolDn|k_Repeat:
case kVolDn:
cDvbApi::PrimaryDvbApi->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA);
break;
case kMute:
cDvbApi::PrimaryDvbApi->ToggleMute();
break;
// Power off:
case kPower: isyslog(LOG_INFO, "Power button pressed");
DELETENULL(*Interact);
if (!Shutdown) {
Interface->Error(tr("Can't shutdown - option '-s' not given!"));
break;
}
if (cRecordControls::Active()) {
if (Interface->Confirm(tr("Recording - shut down anyway?")))
ForceShutdown = true;
}
LastActivity = 1; // not 0, see below!
break;
default: break;
}
}
}
if (!Menu) {
EITScanner.Process();
cVideoCutter::Active();