From patchwork Mon Jan 16 20:14:00 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Udo Richter X-Patchwork-Id: 12163 Received: from mail.gmx.net ([213.165.64.21]) by www.linuxtv.org with smtp (Exim 4.50) id 1EyalL-0004FJ-D0 for vdr@linuxtv.org; Mon, 16 Jan 2006 21:15:35 +0100 Received: (qmail invoked by alias); 16 Jan 2006 20:15:04 -0000 Received: from p548A2F1E.dip0.t-ipconnect.de (EHLO [192.168.73.1]) [84.138.47.30] by mail.gmx.net (mp027) with SMTP; 16 Jan 2006 21:15:04 +0100 X-Authenticated: #1417946 Message-ID: <43CBFE88.4060305@gmx.de> Date: Mon, 16 Jan 2006 21:14:00 +0100 From: Udo Richter User-Agent: Thunderbird 1.5 (Windows/20060115) MIME-Version: 1.0 To: vdr@linuxtv.org X-Y-GMX-Trusted: 0 Subject: [vdr] Behavior of Menu key, next round X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2006 20:15:35 -0000 Status: O X-Status: X-Keywords: X-UID: 7240 Hi list, After the release of 1.3.39, the menu key debate has cooled down again, and now I'll do another attempt on intuitive behavior. Comments are of course welcome, as this is just one possible solution of many. I really like to close things like OSDTeletext using the menu key, using the new behavior. However, for example if I switch to some channel and directly want to start OSDTT again, I'm annoyed because I have to press menu twice, one time to dismiss the channel status, one time to open the menu. My suggestion is to let the OSD decide about how the menu key behaves, so that some more informational OSDs can directly open the menu. The attached patch does that by adding cOsdObject::menuKeyAction that can be set to one of the following values: menuKeyAlwaysCloses: Close this OSD if the menu key is pressed, and don't open the main menu. This is set for VDR native menus. menuKeyAlwaysOpens: Close this OSD and open the main menu always. This is set for status displays like channel display, volume control and replay 'cutmarks' control. menuKeyConfigurable: For compatibility sake, this decides based on the "Menu button closes" setup option. This is the default for plugins, and is used for the audio track menu. To summarize, with "Menu button closes" disabled, the patch should behave as 1.3.37. With "Menu button closes" enabled, behavior is as 1.3.39, except for channel display, volume control and replay control. Plugins and patches that re-open the OSD quickly (like subtitles), or only show additional information, may set menuKeyAction to menuKeyAlwaysOpens. Don't forget to rebuild your plugins after applying the attached patch! Cheers, Udo diff -au vdr-1.3.39-old/menu.c vdr-1.3.39/menu.c --- vdr-1.3.39-old/menu.c 2006-01-15 19:35:23.000000000 +0100 +++ vdr-1.3.39/menu.c 2006-01-16 19:07:06.000000000 +0100 @@ -3021,6 +3021,7 @@ timeout = Switched || Setup.TimeoutRequChInfo; channel = Channels.GetByNumber(Number); lastPresent = lastFollowing = NULL; + menuKeyAction = menuKeyAlwaysOpens; if (channel) { DisplayChannel(); DisplayInfo(); @@ -3035,6 +3036,7 @@ group = -1; number = 0; lastPresent = lastFollowing = NULL; + menuKeyAction = menuKeyAlwaysOpens; lastTime.Set(); withInfo = Setup.ShowInfoOnChSwitch; displayChannel = Skins.Current()->DisplayChannel(withInfo); @@ -3223,6 +3225,7 @@ :cOsdObject(true) { currentDisplayVolume = this; + menuKeyAction = menuKeyAlwaysOpens; timeout.Set(cDevice::PrimaryDevice()->IsMute() ? MUTETIMEOUT : VOLUMETIMEOUT); displayVolume = Skins.Current()->DisplayVolume(); Show(); @@ -3712,6 +3715,7 @@ lastSpeed = -1; timeoutShow = 0; timeSearchActive = false; + menuKeyAction = menuKeyAlwaysOpens; marks.Load(fileName); cRecording Recording(fileName); cStatus::MsgReplaying(this, Recording.Name(), Recording.FileName(), true); diff -au vdr-1.3.39-old/osdbase.c vdr-1.3.39/osdbase.c --- vdr-1.3.39-old/osdbase.c 2006-01-08 12:40:02.000000000 +0100 +++ vdr-1.3.39/osdbase.c 2006-01-16 19:04:56.000000000 +0100 @@ -76,6 +76,7 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4) { isMenu = true; + menuKeyAction = menuKeyAlwaysCloses; digit = 0; hasHotkeys = false; title = NULL; diff -au vdr-1.3.39-old/osdbase.h vdr-1.3.39/osdbase.h --- vdr-1.3.39-old/osdbase.h 2006-01-06 12:55:30.000000000 +0100 +++ vdr-1.3.39/osdbase.h 2006-01-16 19:14:25.000000000 +0100 @@ -66,16 +66,20 @@ virtual eOSState ProcessKey(eKeys Key); }; +enum eMenuKeyBehavior { menuKeyAlwaysCloses, menuKeyConfigurable, menuKeyAlwaysOpens }; + class cOsdObject { friend class cOsdMenu; private: bool isMenu; protected: bool needsFastResponse; + eMenuKeyBehavior menuKeyAction; public: - cOsdObject(bool FastResponse = false) { isMenu = false; needsFastResponse = FastResponse; } + cOsdObject(bool FastResponse = false) { isMenu = false; needsFastResponse = FastResponse; menuKeyAction = menuKeyConfigurable; } virtual ~cOsdObject() {} bool NeedsFastResponse(void) { return needsFastResponse; } + eMenuKeyBehavior MenuKeyAction(void) { return menuKeyAction; } bool IsMenu(void) { return isMenu; } virtual void Show(void); virtual eOSState ProcessKey(eKeys Key) { return osUnknown; } diff -au vdr-1.3.39-old/vdr.c vdr-1.3.39/vdr.c --- vdr-1.3.39-old/vdr.c 2006-01-15 14:31:57.000000000 +0100 +++ vdr-1.3.39/vdr.c 2006-01-16 19:41:44.000000000 +0100 @@ -791,13 +791,12 @@ // Menu control: case kMenu: { key = kNone; // nobody else needs to see this key - bool WasOpen = Interact != NULL; - bool WasMenu = Interact && Interact->IsMenu(); + eMenuKeyBehavior MenuAction = (Interact) ? (Interact->MenuKeyAction()) : (menuKeyAlwaysOpens); if (Menu) DELETE_MENU; else if (cControl::Control() && cOsd::IsOpen()) cControl::Control()->Hide(); - if (!WasOpen || !WasMenu && !Setup.MenuButtonCloses) + if (MenuAction == menuKeyAlwaysOpens || MenuAction == menuKeyConfigurable && !Setup.MenuButtonCloses) Menu = new cMenuMain; } break;