1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

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> Andreas Vitting <Andreas@huji.de>
for providing code that closes all unused file descriptors in the child for providing code that closes all unused file descriptors in the child
process of a pipe (used in cPipe) 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 - 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 a timer recording (this may help debugging cases where timers don't start
at the expected time). 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 * 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 #define _GNU_SOURCE
@ -367,7 +367,33 @@ int main(int argc, char *argv[])
EITScanner.Activity(); EITScanner.Activity();
LastActivity = time(NULL); 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)) { switch ((*Interact)->ProcessKey(key)) {
case osMenu: DELETENULL(Menu); case osMenu: DELETENULL(Menu);
Menu = new cMenuMain(ReplayControl); Menu = new cMenuMain(ReplayControl);
@ -407,6 +433,7 @@ int main(int argc, char *argv[])
} }
} }
else { else {
// Key functions in "normal" viewing mode:
switch (key) { switch (key) {
// Toggle channels: // Toggle channels:
case k0: { case k0: {
@ -441,32 +468,10 @@ int main(int argc, char *argv[])
case kMenu: Menu = new cMenuMain(ReplayControl); break; case kMenu: Menu = new cMenuMain(ReplayControl); break;
// Viewing Control: // Viewing Control:
case kOk: LastChannel = -1; break; // forces channel display 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; default: break;
} }
} }
}
if (!Menu) { if (!Menu) {
EITScanner.Process(); EITScanner.Process();
cVideoCutter::Active(); cVideoCutter::Active();