diff options
| author | Po Lu | 2024-04-23 15:57:45 +0800 |
|---|---|---|
| committer | Po Lu | 2024-04-23 15:57:45 +0800 |
| commit | cd7456e00d719d32c203c71b4e23c98b0c4e1967 (patch) | |
| tree | 496bdb8d0a1f49aa4668d68c08e2f9309fd1868a /src/androidfns.c | |
| parent | b9c191d690fd5d1480858469df23cc4509996fae (diff) | |
| download | emacs-cd7456e00d719d32c203c71b4e23c98b0c4e1967.tar.gz emacs-cd7456e00d719d32c203c71b4e23c98b0c4e1967.zip | |
Enable configuring Emacs for "pseudo-grayscale" systems on Android
* doc/emacs/android.texi (Android Windowing): Document how to
configure Emacs for monochrome displays.
* src/androidfns.c (Fx_display_visual_class): Return
Qstatic_gray when n_planes is smaller than 24.
(Fandroid_get_connection): Set n_planes by the value of
android_display_planes.
(syms_of_androidfns): <Qstatic_gray>: New function.
* src/androidterm.c (android_alloc_nearest_color): Allocate
monochrome colors similarly to the X server.
(android_query_colors): Fix typos.
(android_draw_fringe_bitmap): Create bitmaps of n_image_planes
depth.
(android_term_init): Initialize n_image_planes to 24.
(syms_of_androidterm) <android_display_planes>: New variable.
* src/androidterm.h (struct android_display_info): New field
`n_image_planes'.
* src/image.c (n_planes) [HAVE_ANDROID]: Define to
n_image_planes.
Diffstat (limited to 'src/androidfns.c')
| -rw-r--r-- | src/androidfns.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/androidfns.c b/src/androidfns.c index 9f7ac8b69b2..b6df7ae0677 100644 --- a/src/androidfns.c +++ b/src/androidfns.c | |||
| @@ -1345,7 +1345,12 @@ DEFUN ("x-display-visual-class", Fx_display_visual_class, | |||
| 1345 | doc: /* SKIP: real doc in xfns.c. */) | 1345 | doc: /* SKIP: real doc in xfns.c. */) |
| 1346 | (Lisp_Object terminal) | 1346 | (Lisp_Object terminal) |
| 1347 | { | 1347 | { |
| 1348 | check_android_display_info (terminal); | 1348 | struct android_display_info *dpyinfo; |
| 1349 | |||
| 1350 | dpyinfo = check_android_display_info (terminal); | ||
| 1351 | |||
| 1352 | if (dpyinfo->n_planes < 24) | ||
| 1353 | return Qstatic_gray; | ||
| 1349 | 1354 | ||
| 1350 | return Qtrue_color; | 1355 | return Qtrue_color; |
| 1351 | } | 1356 | } |
| @@ -1805,7 +1810,16 @@ Android, so there is no equivalent of `x-open-connection'. */) | |||
| 1805 | terminal = Qnil; | 1810 | terminal = Qnil; |
| 1806 | 1811 | ||
| 1807 | if (x_display_list) | 1812 | if (x_display_list) |
| 1808 | XSETTERMINAL (terminal, x_display_list->terminal); | 1813 | { |
| 1814 | XSETTERMINAL (terminal, x_display_list->terminal); | ||
| 1815 | |||
| 1816 | /* Update the display's bit depth from | ||
| 1817 | `android_display_planes'. */ | ||
| 1818 | x_display_list->n_planes | ||
| 1819 | = (android_display_planes > 8 | ||
| 1820 | ? 24 : (android_display_planes > 1 | ||
| 1821 | ? android_display_planes : 1)); | ||
| 1822 | } | ||
| 1809 | 1823 | ||
| 1810 | return terminal; | 1824 | return terminal; |
| 1811 | #endif | 1825 | #endif |
| @@ -3479,6 +3493,7 @@ syms_of_androidfns (void) | |||
| 3479 | { | 3493 | { |
| 3480 | /* Miscellaneous symbols used by some functions here. */ | 3494 | /* Miscellaneous symbols used by some functions here. */ |
| 3481 | DEFSYM (Qtrue_color, "true-color"); | 3495 | DEFSYM (Qtrue_color, "true-color"); |
| 3496 | DEFSYM (Qstatic_gray, "static-color"); | ||
| 3482 | DEFSYM (Qwhen_mapped, "when-mapped"); | 3497 | DEFSYM (Qwhen_mapped, "when-mapped"); |
| 3483 | 3498 | ||
| 3484 | DEFVAR_LISP ("x-pointer-shape", Vx_pointer_shape, | 3499 | DEFVAR_LISP ("x-pointer-shape", Vx_pointer_shape, |