diff options
Diffstat (limited to 'uisimulator/common/lcd-common.c')
-rw-r--r-- | uisimulator/common/lcd-common.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c index 7d40f36b0f..52db776856 100644 --- a/uisimulator/common/lcd-common.c +++ b/uisimulator/common/lcd-common.c | |||
@@ -22,8 +22,15 @@ | |||
22 | * | 22 | * |
23 | ****************************************************************************/ | 23 | ****************************************************************************/ |
24 | 24 | ||
25 | #include "config.h" | ||
25 | #include "lcd.h" | 26 | #include "lcd.h" |
26 | #include "lcd-sdl.h" | 27 | |
28 | #ifdef HAVE_LCD_ENABLE | ||
29 | static bool lcd_enabled = false; | ||
30 | #endif | ||
31 | #ifdef HAVE_LCD_SLEEP | ||
32 | static bool lcd_sleeping = true; | ||
33 | #endif | ||
27 | 34 | ||
28 | void lcd_set_flip(bool yesno) | 35 | void lcd_set_flip(bool yesno) |
29 | { | 36 | { |
@@ -64,3 +71,49 @@ void lcd_remote_set_invert_display(bool invert) | |||
64 | (void)invert; | 71 | (void)invert; |
65 | } | 72 | } |
66 | #endif | 73 | #endif |
74 | |||
75 | #ifdef HAVE_LCD_SLEEP | ||
76 | void lcd_sleep(void) | ||
77 | { | ||
78 | lcd_sleeping = true; | ||
79 | } | ||
80 | |||
81 | void lcd_awake(void) | ||
82 | { | ||
83 | if (lcd_sleeping) | ||
84 | { | ||
85 | lcd_activation_call_hook(); | ||
86 | lcd_sleeping = false; | ||
87 | } | ||
88 | } | ||
89 | #endif | ||
90 | #ifdef HAVE_LCD_ENABLE | ||
91 | void lcd_enable(bool on) | ||
92 | { | ||
93 | if (on && !lcd_enabled) | ||
94 | { | ||
95 | #ifdef HAVE_LCD_SLEEP | ||
96 | /* lcd_awake will handle the activation call */ | ||
97 | lcd_awake(); | ||
98 | #else | ||
99 | lcd_activation_call_hook(); | ||
100 | #endif | ||
101 | } | ||
102 | lcd_enabled = on; | ||
103 | } | ||
104 | #endif | ||
105 | |||
106 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
107 | bool lcd_active(void) | ||
108 | { | ||
109 | bool retval = false; | ||
110 | #ifdef HAVE_LCD_ENABLE | ||
111 | retval = lcd_enabled; | ||
112 | #endif | ||
113 | #ifdef HAVE_LCD_SLEEP | ||
114 | if (!retval) | ||
115 | retval = !lcd_sleeping; | ||
116 | #endif | ||
117 | return retval; | ||
118 | } | ||
119 | #endif | ||