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

Diff of /emacs/src/xfns.c

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

revision 1.629 by jhd, Mon Feb 7 12:50:16 2005 UTC revision 1.630 by jhd, Mon Feb 7 20:00:07 2005 UTC
# Line 4067  Value is VALUE.  */) Line 4067  Value is VALUE.  */)
4067          data = (unsigned char *) xmalloc (nelements);          data = (unsigned char *) xmalloc (nelements);
4068        else if (element_format == 16)        else if (element_format == 16)
4069          data = (unsigned char *) xmalloc (nelements*2);          data = (unsigned char *) xmalloc (nelements*2);
4070        else        else /* format == 32 */
4071          data = (unsigned char *) xmalloc (nelements*4);          /* The man page for XChangeProperty:
4072                   "If the specified format is 32, the property data must be a
4073                    long array."
4074               This applies even if long is more than 64 bits.  The X library
4075               converts to 32 bits before sending to the X server.  */
4076            data = (unsigned char *) xmalloc (nelements * sizeof(long));
4077    
4078        x_fill_property_data (FRAME_X_DISPLAY (f), value, data, element_format);        x_fill_property_data (FRAME_X_DISPLAY (f), value, data, element_format);
4079      }      }
# Line 4203  no value of TYPE.  */) Line 4208  no value of TYPE.  */)
4208                                 (unsigned char **) &tmp_data);                                 (unsigned char **) &tmp_data);
4209        if (rc == Success && tmp_data)        if (rc == Success && tmp_data)
4210          {          {
4211              /* The man page for XGetWindowProperty says:
4212                 "If the returned format is 32, the returned data is represented
4213                 as a long array and should be cast to that type to obtain the
4214                 elements."
4215                 This applies even if long is more than 32 bits, the X library
4216                 converts from 32 bit elements received from the X server to long
4217                 and passes the long array to us.  Thus, for that case bcopy can not
4218                 be used.  We convert to a 32 bit type here, because so much code
4219                 assume on that.
4220    
4221                 The bytes and offsets passed to XGetWindowProperty refers to the
4222                 property and those are indeed in 32 bit quantities if format is
4223                 32.  */
4224    
4225              if (actual_format == 32 && actual_format < BITS_PER_LONG)
4226                {
4227                  unsigned long i;
4228                  int  *idata = (int *) tmp_data;
4229                  long *ldata = (long *) tmp_data;
4230    
4231                  for (i = 0; i < actual_size; ++i)
4232                    idata[i]= (int) ldata[i];
4233                }
4234    
4235            if (NILP (vector_ret_p))            if (NILP (vector_ret_p))
4236              prop_value = make_string (tmp_data, size);              prop_value = make_string (tmp_data, size);
4237            else            else

Legend:
Removed from v.1.629  
changed lines
  Added in v.1.630

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