fix up back button and menu toggling
diff --git a/default_recovery_ui.c b/default_recovery_ui.c
index 991f376..2c39a78 100644
--- a/default_recovery_ui.c
+++ b/default_recovery_ui.c
@@ -18,6 +18,7 @@
 
 #include "recovery_ui.h"
 #include "common.h"
+#include "extendedcommands.h"
 
 char* MENU_HEADERS[] = { "Android system recovery utility",
                          "",
@@ -36,7 +37,8 @@
     int alt = key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT];
     if (alt && key_code == KEY_L)
         return 1;
-    return key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END;
+    // allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
+    return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
 }
 
 int device_reboot_now(volatile char* key_pressed, int key_code) {
@@ -57,9 +59,12 @@
             case KEY_ENTER:
             case BTN_MOUSE:
                 return SELECT_ITEM;
-            case KEY_BACKSPACE:
+            
+            case KEY_POWER:
             case KEY_END:
-                return GO_BACK;
+            case KEY_BACKSPACE:
+                if (!get_allow_toggle_display())
+                    return GO_BACK;
         }
     }