--- Begin Message ---
Subject: |
23.0.60; x-display-color-cells returns 20 on w32 remote desktop |
Date: |
Sat, 21 Jun 2008 22:27:50 +0100 |
When I run Emacs on my Windows machine and look at it with Remote
Desktop Connection on my Mac the modeline faces are black and white.
This is because the `mode-line' face is defined as inverse-video for
displays with less than 88 colors, and `x-display-color-cells' returns
20 when using RDC.
Here's a hacky patch that I installed locally. It probably needs more
work before it's suitable for inclusion. I first tried just checking
whether `cap' was less than 21 rather than checking for a negative
value, but then the function would return the wrong number of colors.
I had to use GetDeviceCaps to work out the color depth.
*** w32fns.c.~1.331.~ Wed Jun 18 2008 07:05:15 PM
--- w32fns.c Tue Jun 17 2008 05:59:23 PM
***************
*** 6711,6719 ****
/* We force 24+ bit depths to 24-bit, both to prevent an overflow
and because probably is more meaningful on Windows anyway */
! if (cap < 0)
! cap = 1 << min (dpyinfo->n_planes * dpyinfo->n_cbits, 24);
!
--- 6710,6721 ----
cap = GetDeviceCaps (hdc, NUMCOLORS);
/* We force 24+ bit depths to 24-bit, both to prevent an overflow
and because probably is more meaningful on Windows anyway */
! /* Remote Desktop often returns 20 for NUMCOLORS device capability
! when it can display more */
! if (cap < 21)
! cap = 1 << min (GetDeviceCaps (hdc, BITSPIXEL)
! * GetDeviceCaps (hdc, PLANES), 24);
ReleaseDC (dpyinfo->root_window, hdc);
return make_number (cap);
In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
of 2008-06-21 on GOLDEN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: ENG
value of $XMODIFIERS: nil
locale-coding-system: cp1252
default-enable-multibyte-characters: t
Major mode: Text
Minor modes in effect:
delete-selection-mode: t
tooltip-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
global-auto-composition-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
[elided]
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
65536 [2 times]
Quit
Mark set
--- End Message ---