/[emacs]/emacs/src/w32fns.c
ViewVC logotype

Diff of /emacs/src/w32fns.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.216 by kfstorm, Sat May 24 22:05:34 2003 UTC revision 1.217 by jasonr, Wed Jun 4 23:59:46 2003 UTC
# Line 239  Lisp_Object Qw32_charset_mac; Line 239  Lisp_Object Qw32_charset_mac;
239  Lisp_Object Qw32_charset_unicode;  Lisp_Object Qw32_charset_unicode;
240  #endif  #endif
241    
242    /* Prefix for system colors.  */
243    #define SYSTEM_COLOR_PREFIX "System"
244    #define SYSTEM_COLOR_PREFIX_LEN (sizeof (SYSTEM_COLOR_PREFIX) - 1)
245    
246  /* State variables for emulating a three button mouse. */  /* State variables for emulating a three button mouse. */
247  #define LMOUSE 1  #define LMOUSE 1
248  #define MMOUSE 2  #define MMOUSE 2
# Line 1077  w32_color_map_lookup (colorname) Line 1081  w32_color_map_lookup (colorname)
1081    return ret;    return ret;
1082  }  }
1083    
1084    
1085    static void
1086    add_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    
1134  COLORREF  COLORREF
1135  x_to_w32_color (colorname)  x_to_w32_color (colorname)
1136       char * colorname;       char * colorname;
# Line 1268  x_to_w32_color (colorname) Line 1322  x_to_w32_color (colorname)
1322    return ret;    return ret;
1323  }  }
1324    
   
1325  void  void
1326  w32_regenerate_palette (FRAME_PTR f)  w32_regenerate_palette (FRAME_PTR f)
1327  {  {
# Line 6774  terminate Emacs if we can't open the con Line 6827  terminate Emacs if we can't open the con
6827    if (NILP (Vw32_color_map))    if (NILP (Vw32_color_map))
6828      Vw32_color_map = Fw32_default_color_map ();      Vw32_color_map = Fw32_default_color_map ();
6829    
6830      /* Merge in system logical colors.  */
6831      add_system_logical_colors_to_map (&Vw32_color_map);
6832    
6833    if (! NILP (xrm_string))    if (! NILP (xrm_string))
6834      xrm_option = (unsigned char *) SDATA (xrm_string);      xrm_option = (unsigned char *) SDATA (xrm_string);
6835    else    else

Legend:
Removed from v.1.216  
changed lines
  Added in v.1.217

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26