diff options
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/hosted/android/lcd-android.c | 26 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/lcd-sdl.c | 6 |
2 files changed, 32 insertions, 0 deletions
diff --git a/firmware/target/hosted/android/lcd-android.c b/firmware/target/hosted/android/lcd-android.c index 78b1f12f7f..f4ef7b5e75 100644 --- a/firmware/target/hosted/android/lcd-android.c +++ b/firmware/target/hosted/android/lcd-android.c | |||
@@ -35,6 +35,8 @@ static jmethodID java_lcd_update; | |||
35 | static jmethodID java_lcd_update_rect; | 35 | static jmethodID java_lcd_update_rect; |
36 | 36 | ||
37 | static bool display_on; | 37 | static bool display_on; |
38 | static int dpi; | ||
39 | static int scroll_threshold; | ||
38 | 40 | ||
39 | void lcd_init_device(void) | 41 | void lcd_init_device(void) |
40 | { | 42 | { |
@@ -77,6 +79,20 @@ void lcd_init_device(void) | |||
77 | RockboxFramebuffer_class, | 79 | RockboxFramebuffer_class, |
78 | "java_lcd_update_rect", | 80 | "java_lcd_update_rect", |
79 | "(IIII)V"); | 81 | "(IIII)V"); |
82 | |||
83 | jmethodID get_dpi = e->GetMethodID(env_ptr, | ||
84 | RockboxFramebuffer_class, | ||
85 | "getDpi", "()I"); | ||
86 | |||
87 | jmethodID get_scroll_threshold | ||
88 | = e->GetMethodID(env_ptr, | ||
89 | RockboxFramebuffer_class, | ||
90 | "getScrollThreshold", "()I"); | ||
91 | |||
92 | dpi = e->CallIntMethod(env_ptr, RockboxFramebuffer_instance, | ||
93 | get_dpi); | ||
94 | scroll_threshold = e->CallIntMethod(env_ptr, RockboxFramebuffer_instance, | ||
95 | get_scroll_threshold); | ||
80 | display_on = true; | 96 | display_on = true; |
81 | } | 97 | } |
82 | 98 | ||
@@ -101,6 +117,16 @@ bool lcd_active(void) | |||
101 | return display_on; | 117 | return display_on; |
102 | } | 118 | } |
103 | 119 | ||
120 | int lcd_get_dpi(void) | ||
121 | { | ||
122 | return dpi; | ||
123 | } | ||
124 | |||
125 | int touchscreen_get_scroll_threshold(void) | ||
126 | { | ||
127 | return scroll_threshold; | ||
128 | } | ||
129 | |||
104 | /* | 130 | /* |
105 | * (un)block lcd updates. | 131 | * (un)block lcd updates. |
106 | * | 132 | * |
diff --git a/firmware/target/hosted/sdl/lcd-sdl.c b/firmware/target/hosted/sdl/lcd-sdl.c index 15e4ba95c3..96b1a04aa6 100644 --- a/firmware/target/hosted/sdl/lcd-sdl.c +++ b/firmware/target/hosted/sdl/lcd-sdl.c | |||
@@ -111,3 +111,9 @@ void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end, | |||
111 | SDL_SetPalette(surface, SDL_LOGPAL|SDL_PHYSPAL, palette, first, steps); | 111 | SDL_SetPalette(surface, SDL_LOGPAL|SDL_PHYSPAL, palette, first, steps); |
112 | } | 112 | } |
113 | 113 | ||
114 | int lcd_get_dpi(void) | ||
115 | { | ||
116 | /* TODO: find a way to query it from the OS, SDL doesn't support it | ||
117 | * directly; for now assume the more or less standard 96 */ | ||
118 | return 96; | ||
119 | } | ||