From f83bba741b3b1647c986262ef8136435962e67a4 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 29 Feb 2012 01:31:56 +0000 Subject: [PATCH] Port state machine for menu button to 5.0. --- Tweak.mm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Tweak.mm b/Tweak.mm index c4c0eb3..21b26cb 100644 --- a/Tweak.mm +++ b/Tweak.mm @@ -150,11 +150,14 @@ MSInstanceMessageHook0(BOOL, SBAwayController, handleMenuButtonTap) { return YES; } -MSInstanceMessageHook0(void, SBAwayController, _undimScreen) { - menu_ = false; - [[cydgets_ objectAtIndex:active_] enableCydget:self]; - [[[self awayView] window] makeKeyWindow]; - return MSOldCall(); +MSInstanceMessageHook0(void, SBAwayController, undimScreen) { + if ([self isDimmed]) { + menu_ = false; + [[cydgets_ objectAtIndex:active_] enableCydget:self]; + [[[self awayView] window] makeKeyWindow]; + } + + MSOldCall(); } static void Deactivate_(SBAwayController *self) { @@ -167,7 +170,7 @@ MSInstanceMessageHook1(void, SBAwayController, dimScreen, BOOL, dim) { MSOldCall(dim); } -MSInstanceMessageHook1(void, SpringBoard, menuButtonUp, GSEventRef, event) { +MSInstanceMessageHook1(void, SpringBoard, menuButtonDown, GSEventRef, event) { menu_ = true; MSOldCall(event); } -- 2.45.2