aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Colascione2012-10-08 10:44:42 -0800
committerDaniel Colascione2012-10-08 10:44:42 -0800
commit821812e2477f45ac5f2572dd7d469b8408e351aa (patch)
tree4807f1dfe184bbc5479bc10914750ef1c32a1a9b
parent1337353856dbf0dcfe8378ccf96f26442eee73e9 (diff)
downloademacs-821812e2477f45ac5f2572dd7d469b8408e351aa.tar.gz
emacs-821812e2477f45ac5f2572dd7d469b8408e351aa.zip
* w32fns.c (Fx_display_color_cells): Instead of using NCOLORS,
which is broke under remote desktop, calculating the number of colors available for a display based on the display's number of planes and number of bits per pixel per plane. (bug#10397).
-rw-r--r--src/ChangeLog7
-rw-r--r--src/w32fns.c18
2 files changed, 12 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 122e0d19655..1d90b7bb9e1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12012-10-08 Daniel Colascione <dancol@dancol.org>
2
3 * w32fns.c (Fx_display_color_cells): Instead of using NCOLORS,
4 which is broke under remote desktop, calculating the number of
5 colors available for a display based on the display's number of
6 planes and number of bits per pixel per plane. (bug#10397).
7
12012-10-08 Juanma Barranquero <lekktu@gmail.com> 82012-10-08 Juanma Barranquero <lekktu@gmail.com>
2 9
3 * makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now 10 * makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now
diff --git a/src/w32fns.c b/src/w32fns.c
index e728d19a9b3..ff8e5fef439 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4642,22 +4642,14 @@ If omitted or nil, that stands for the selected frame's display. */)
4642 (Lisp_Object display) 4642 (Lisp_Object display)
4643{ 4643{
4644 struct w32_display_info *dpyinfo = check_x_display_info (display); 4644 struct w32_display_info *dpyinfo = check_x_display_info (display);
4645 HDC hdc;
4646 int cap; 4645 int cap;
4647 4646
4648 hdc = GetDC (dpyinfo->root_window); 4647 /* Don't use NCOLORS: it returns incorrect results under remote
4649 if (dpyinfo->has_palette) 4648 * desktop. We force 24+ bit depths to 24-bit, both to prevent an
4650 cap = GetDeviceCaps (hdc, SIZEPALETTE); 4649 * overflow and because probably is more meaningful on Windows
4651 else 4650 * anyway. */
4652 cap = GetDeviceCaps (hdc, NUMCOLORS);
4653
4654 /* We force 24+ bit depths to 24-bit, both to prevent an overflow
4655 and because probably is more meaningful on Windows anyway */
4656 if (cap < 0)
4657 cap = 1 << min (dpyinfo->n_planes * dpyinfo->n_cbits, 24);
4658
4659 ReleaseDC (dpyinfo->root_window, hdc);
4660 4651
4652 cap = 1 << min (dpyinfo->n_planes * dpyinfo->n_cbits, 24);
4661 return make_number (cap); 4653 return make_number (cap);
4662} 4654}
4663 4655