diff options
| author | Jan Djärv | 2004-03-01 12:51:33 +0000 |
|---|---|---|
| committer | Jan Djärv | 2004-03-01 12:51:33 +0000 |
| commit | 334faa08fc2b292e3ef5d2237a71834561b20c5a (patch) | |
| tree | 234936d30c860edd956ecea48cb64188d259a892 | |
| parent | bb62616fbe07bc46dc0a47eaadb0abf0fbab2d07 (diff) | |
| download | emacs-334faa08fc2b292e3ef5d2237a71834561b20c5a.tar.gz emacs-334faa08fc2b292e3ef5d2237a71834561b20c5a.zip | |
* xfns.c (Fx_display_color_cells): Use number of planes to calculate
how many colors can be displayed.
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xfns.c | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 742e2c3dabc..bd641e8f6fb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2004-03-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xfns.c (Fx_display_color_cells): Use number of planes to calculate | ||
| 4 | how many colors can be displayed. | ||
| 5 | |||
| 1 | 2004-03-01 Kenichi Handa <handa@m17n.org> | 6 | 2004-03-01 Kenichi Handa <handa@m17n.org> |
| 2 | 7 | ||
| 3 | * editfns.c (Ftranslate_region): Handle multibyte chars in TABLE | 8 | * editfns.c (Ftranslate_region): Handle multibyte chars in TABLE |
diff --git a/src/xfns.c b/src/xfns.c index a3e885bac74..3028a61018c 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3758,8 +3758,17 @@ If omitted or nil, that stands for the selected frame's display. */) | |||
| 3758 | { | 3758 | { |
| 3759 | struct x_display_info *dpyinfo = check_x_display_info (display); | 3759 | struct x_display_info *dpyinfo = check_x_display_info (display); |
| 3760 | 3760 | ||
| 3761 | return make_number (DisplayCells (dpyinfo->display, | 3761 | int nr_planes = DisplayPlanes (dpyinfo->display, |
| 3762 | XScreenNumberOfScreen (dpyinfo->screen))); | 3762 | XScreenNumberOfScreen (dpyinfo->screen)); |
| 3763 | |||
| 3764 | /* Truncate nr_planes to 24 to avoid integer overflow. | ||
| 3765 | Some displays says 32, but only 24 bits are actually significant. | ||
| 3766 | There are only very few and rare video cards that have more than | ||
| 3767 | 24 significant bits. Also 24 bits is more than 16 million colors, | ||
| 3768 | it "should be enough for everyone". */ | ||
| 3769 | if (nr_planes > 24) nr_planes = 24; | ||
| 3770 | |||
| 3771 | return make_number (1 << nr_planes); | ||
| 3763 | } | 3772 | } |
| 3764 | 3773 | ||
| 3765 | DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | 3774 | DEFUN ("x-server-max-request-size", Fx_server_max_request_size, |