aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2003-06-05 00:01:03 +0000
committerJason Rumney2003-06-05 00:01:03 +0000
commit5a8a15ecc83b56de6680db1def48c02ac6fde518 (patch)
treec8249729e126b73853b8d7f2a486cc4333a33b85 /src
parent26d7389d544b0316dd581719138ef82b020f5b17 (diff)
downloademacs-5a8a15ecc83b56de6680db1def48c02ac6fde518.tar.gz
emacs-5a8a15ecc83b56de6680db1def48c02ac6fde518.zip
(add_system_logical_colors_to_map): New function.
(Fx_open_connection): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/w32fns.c58
2 files changed, 62 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 89a0544cb59..471a31495a2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12003-06-05 Jason Rumney <jasonr@gnu.org>
2
3 * w32fns.c (add_system_logical_colors_to_map): New function.
4 (Fx_open_connection): Use it.
5
12003-06-04 Jason Rumney <jasonr@gnu.org> 62003-06-04 Jason Rumney <jasonr@gnu.org>
2 7
3 * termhooks.h (enum event_kind): Remove MOUSE_WHEEL_EVENT. 8 * termhooks.h (enum event_kind): Remove MOUSE_WHEEL_EVENT.
diff --git a/src/w32fns.c b/src/w32fns.c
index 1d53740e961..db87c7f9480 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -239,6 +239,10 @@ Lisp_Object Qw32_charset_mac;
239Lisp_Object Qw32_charset_unicode; 239Lisp_Object Qw32_charset_unicode;
240#endif 240#endif
241 241
242/* Prefix for system colors. */
243#define SYSTEM_COLOR_PREFIX "System"
244#define SYSTEM_COLOR_PREFIX_LEN (sizeof (SYSTEM_COLOR_PREFIX) - 1)
245
242/* State variables for emulating a three button mouse. */ 246/* State variables for emulating a three button mouse. */
243#define LMOUSE 1 247#define LMOUSE 1
244#define MMOUSE 2 248#define MMOUSE 2
@@ -1077,6 +1081,56 @@ w32_color_map_lookup (colorname)
1077 return ret; 1081 return ret;
1078} 1082}
1079 1083
1084
1085static void
1086add_system_logical_colors_to_map (system_colors)
1087 Lisp_Object *system_colors;
1088{
1089 HKEY colors_key;
1090
1091 /* Other registry operations are done with input blocked. */
1092 BLOCK_INPUT;
1093
1094 /* Look for "Control Panel/Colors" under User and Machine registry
1095 settings. */
1096 if (RegOpenKeyEx (HKEY_CURRENT_USER, "Control Panel\\Colors", 0,
1097 KEY_READ, &colors_key) == ERROR_SUCCESS
1098 || RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Control Panel\\Colors", 0,
1099 KEY_READ, &colors_key) == ERROR_SUCCESS)
1100 {
1101 /* List all keys. */
1102 char color_buffer[64];
1103 char full_name_buffer[MAX_PATH + SYSTEM_COLOR_PREFIX_LEN];
1104 int index = 0;
1105 DWORD name_size, color_size;
1106 char *name_buffer = full_name_buffer + SYSTEM_COLOR_PREFIX_LEN;
1107
1108 name_size = sizeof (full_name_buffer) - SYSTEM_COLOR_PREFIX_LEN;
1109 color_size = sizeof (color_buffer);
1110
1111 strcpy (full_name_buffer, SYSTEM_COLOR_PREFIX);
1112
1113 while (RegEnumValueA (colors_key, index, name_buffer, &name_size,
1114 NULL, NULL, color_buffer, &color_size)
1115 == ERROR_SUCCESS)
1116 {
1117 int r, g, b;
1118 if (sscanf (color_buffer, " %u %u %u", &r, &g, &b) == 3)
1119 *system_colors = Fcons (Fcons (build_string (full_name_buffer),
1120 make_number (RGB (r, g, b))),
1121 *system_colors);
1122
1123 name_size = sizeof (full_name_buffer) - SYSTEM_COLOR_PREFIX_LEN;
1124 color_size = sizeof (color_buffer);
1125 index++;
1126 }
1127 RegCloseKey (colors_key);
1128 }
1129
1130 UNBLOCK_INPUT;
1131}
1132
1133
1080COLORREF 1134COLORREF
1081x_to_w32_color (colorname) 1135x_to_w32_color (colorname)
1082 char * colorname; 1136 char * colorname;
@@ -1268,7 +1322,6 @@ x_to_w32_color (colorname)
1268 return ret; 1322 return ret;
1269} 1323}
1270 1324
1271
1272void 1325void
1273w32_regenerate_palette (FRAME_PTR f) 1326w32_regenerate_palette (FRAME_PTR f)
1274{ 1327{
@@ -6774,6 +6827,9 @@ terminate Emacs if we can't open the connection. */)
6774 if (NILP (Vw32_color_map)) 6827 if (NILP (Vw32_color_map))
6775 Vw32_color_map = Fw32_default_color_map (); 6828 Vw32_color_map = Fw32_default_color_map ();
6776 6829
6830 /* Merge in system logical colors. */
6831 add_system_logical_colors_to_map (&Vw32_color_map);
6832
6777 if (! NILP (xrm_string)) 6833 if (! NILP (xrm_string))
6778 xrm_option = (unsigned char *) SDATA (xrm_string); 6834 xrm_option = (unsigned char *) SDATA (xrm_string);
6779 else 6835 else