aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 8860a21e670..2dfb8dfccab 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5108,12 +5108,18 @@ FRAME. Default is to change on the edit X window. */)
5108 } 5108 }
5109 else 5109 else
5110 { 5110 {
5111 ptrdiff_t elsize;
5112
5111 CHECK_STRING (value); 5113 CHECK_STRING (value);
5112 data = SDATA (value); 5114 data = SDATA (value);
5113 if (INT_MAX < SBYTES (value)) 5115 if (INT_MAX < SBYTES (value))
5114 error ("VALUE too long"); 5116 error ("VALUE too long");
5115 nelements = SBYTES (value); 5117
5116 element_format = 8; /* ignore any provided format */ 5118 /* See comment above about longs and format=32 */
5119 elsize = element_format == 32 ? sizeof (long) : element_format >> 3;
5120 if (SBYTES (value) % elsize != 0)
5121 error ("VALUE must contain an integral number of octets for FORMAT");
5122 nelements = SBYTES (value) / elsize;
5117 } 5123 }
5118 5124
5119 block_input (); 5125 block_input ();
@@ -5224,7 +5230,8 @@ x_window_property_intern (struct frame *f,
5224 } 5230 }
5225 5231
5226 if (NILP (vector_ret_p)) 5232 if (NILP (vector_ret_p))
5227 prop_value = make_string ((char *) tmp_data, (actual_format / 8) * actual_size); 5233 prop_value = make_string ((char *) tmp_data,
5234 (actual_format >> 3) * actual_size);
5228 else 5235 else
5229 prop_value = x_property_data_to_lisp (f, 5236 prop_value = x_property_data_to_lisp (f,
5230 tmp_data, 5237 tmp_data,
@@ -5353,14 +5360,29 @@ Otherwise, the return value is a vector with the following fields:
5353 prop_atom, 0, 0, False, AnyPropertyType, 5360 prop_atom, 0, 0, False, AnyPropertyType,
5354 &actual_type, &actual_format, &actual_size, 5361 &actual_type, &actual_format, &actual_size,
5355 &bytes_remaining, &tmp_data); 5362 &bytes_remaining, &tmp_data);
5363 if (rc == Success /* no invalid params */
5364 && actual_format == 0 /* but prop not found */
5365 && NILP (source)
5366 && target_window != FRAME_OUTER_WINDOW (f))
5367 {
5368 /* analogous behavior to x-window-property: if property isn't found
5369 on the frame's inner window and no alternate window id was
5370 provided, try the frame's outer window. */
5371 target_window = FRAME_OUTER_WINDOW (f);
5372 rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window,
5373 prop_atom, 0, 0, False, AnyPropertyType,
5374 &actual_type, &actual_format, &actual_size,
5375 &bytes_remaining, &tmp_data);
5376 }
5377
5356 if (rc == Success && actual_format != 0) 5378 if (rc == Success && actual_format != 0)
5357 { 5379 {
5358 XFree (tmp_data); 5380 XFree (tmp_data);
5359 5381
5360 prop_attr = Fmake_vector (make_number (3), Qnil); 5382 prop_attr = make_uninit_vector (3);
5361 ASET (prop_attr, 0, make_number (actual_type)); 5383 ASET (prop_attr, 0, make_number (actual_type));
5362 ASET (prop_attr, 1, make_number (actual_format)); 5384 ASET (prop_attr, 1, make_number (actual_format));
5363 ASET (prop_attr, 2, make_number (bytes_remaining / (actual_format / 8))); 5385 ASET (prop_attr, 2, make_number (bytes_remaining / (actual_format >> 3)));
5364 } 5386 }
5365 5387
5366 unblock_input (); 5388 unblock_input ();