aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Rudalics2016-08-22 08:41:31 +0200
committerMartin Rudalics2016-08-22 08:41:31 +0200
commitaed22ca32344c21c5868a451d1afe969642a3ba5 (patch)
tree5d327ba0140e03f630da41b62da0dcb921bea70c /src
parentdc491c3df305a73908fe8de20b7c428a5b38c846 (diff)
parent7a6b3d0fb793864a1f5deb5a22de78a4dced652d (diff)
downloademacs-aed22ca32344c21c5868a451d1afe969642a3ba5.tar.gz
emacs-aed22ca32344c21c5868a451d1afe969642a3ba5.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src')
-rw-r--r--src/charset.c2
-rw-r--r--src/frame.c4
-rw-r--r--src/xfns.c60
-rw-r--r--src/xselect.c63
4 files changed, 111 insertions, 18 deletions
diff --git a/src/charset.c b/src/charset.c
index 05469aa2650..0c831f13591 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1401,7 +1401,7 @@ check_iso_charset_parameter (Lisp_Object dimension, Lisp_Object chars,
1401 1401
1402 int final_ch = XFASTINT (final_char); 1402 int final_ch = XFASTINT (final_char);
1403 if (! ('0' <= final_ch && final_ch <= '~')) 1403 if (! ('0' <= final_ch && final_ch <= '~'))
1404 error ("Invalid FINAL-CHAR '%c', it should be '0'..'~'", final_ch); 1404 error ("Invalid FINAL-CHAR `%c', it should be `0'..`~'", final_ch);
1405 1405
1406 return chars_flag; 1406 return chars_flag;
1407} 1407}
diff --git a/src/frame.c b/src/frame.c
index 2dbbb37289b..2b7ee3b7c3c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2412,7 +2412,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2412 if (WINDOWP (val)) 2412 if (WINDOWP (val))
2413 { 2413 {
2414 if (!MINI_WINDOW_P (XWINDOW (val))) 2414 if (!MINI_WINDOW_P (XWINDOW (val)))
2415 error ("The 'minibuffer' parameter does not specify a valid minibuffer window"); 2415 error ("The `minibuffer' parameter does not specify a valid minibuffer window");
2416 else if (FRAME_MINIBUF_ONLY_P (f)) 2416 else if (FRAME_MINIBUF_ONLY_P (f))
2417 { 2417 {
2418 if (EQ (val, FRAME_MINIBUF_WINDOW (f))) 2418 if (EQ (val, FRAME_MINIBUF_WINDOW (f)))
@@ -2442,7 +2442,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2442 only nil was specified as new value. */ 2442 only nil was specified as new value. */
2443 val = old_val; 2443 val = old_val;
2444 else if (!EQ (old_val, val)) 2444 else if (!EQ (old_val, val))
2445 error ("Can't change the 'minibuffer' parameter of this frame"); 2445 error ("Can't change the `minibuffer' parameter of this frame");
2446 } 2446 }
2447 } 2447 }
2448 } 2448 }
diff --git a/src/xfns.c b/src/xfns.c
index ccea20eef96..8860a21e670 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5113,6 +5113,7 @@ FRAME. Default is to change on the edit X window. */)
5113 if (INT_MAX < SBYTES (value)) 5113 if (INT_MAX < SBYTES (value))
5114 error ("VALUE too long"); 5114 error ("VALUE too long");
5115 nelements = SBYTES (value); 5115 nelements = SBYTES (value);
5116 element_format = 8; /* ignore any provided format */
5116 } 5117 }
5117 5118
5118 block_input (); 5119 block_input ();
@@ -5223,7 +5224,7 @@ x_window_property_intern (struct frame *f,
5223 } 5224 }
5224 5225
5225 if (NILP (vector_ret_p)) 5226 if (NILP (vector_ret_p))
5226 prop_value = make_string ((char *) tmp_data, actual_size); 5227 prop_value = make_string ((char *) tmp_data, (actual_format / 8) * actual_size);
5227 else 5228 else
5228 prop_value = x_property_data_to_lisp (f, 5229 prop_value = x_property_data_to_lisp (f,
5229 tmp_data, 5230 tmp_data,
@@ -5310,6 +5311,62 @@ no value of TYPE (always string in the MS Windows case). */)
5310 return prop_value; 5311 return prop_value;
5311} 5312}
5312 5313
5314DEFUN ("x-window-property-attributes", Fx_window_property_attributes, Sx_window_property_attributes,
5315 1, 3, 0,
5316 doc: /* Retrieve metadata about window property PROP on FRAME.
5317If FRAME is nil or omitted, use the selected frame.
5318If SOURCE is non-nil, get the property on that window instead of from
5319FRAME. The number 0 denotes the root window.
5320
5321Return value is nil if FRAME hasn't a property with name PROP.
5322Otherwise, the return value is a vector with the following fields:
5323
53240. The property type, as an integer. The symbolic name of
5325 the type can be obtained with `x-get-atom-name'.
53261. The format of each element; one of 8, 16, or 32.
53272. The length of the property, in number of elements. */)
5328 (Lisp_Object prop, Lisp_Object frame, Lisp_Object source)
5329{
5330 struct frame *f = decode_window_system_frame (frame);
5331 Window target_window = FRAME_X_WINDOW (f);
5332 Atom prop_atom;
5333 Lisp_Object prop_attr = Qnil;
5334 Atom actual_type;
5335 int actual_format;
5336 unsigned long actual_size, bytes_remaining;
5337 unsigned char *tmp_data = NULL;
5338 int rc;
5339
5340 CHECK_STRING (prop);
5341
5342 if (! NILP (source))
5343 {
5344 CONS_TO_INTEGER (source, Window, target_window);
5345 if (! target_window)
5346 target_window = FRAME_DISPLAY_INFO (f)->root_window;
5347 }
5348
5349 block_input ();
5350
5351 prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False);
5352 rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window,
5353 prop_atom, 0, 0, False, AnyPropertyType,
5354 &actual_type, &actual_format, &actual_size,
5355 &bytes_remaining, &tmp_data);
5356 if (rc == Success && actual_format != 0)
5357 {
5358 XFree (tmp_data);
5359
5360 prop_attr = Fmake_vector (make_number (3), Qnil);
5361 ASET (prop_attr, 0, make_number (actual_type));
5362 ASET (prop_attr, 1, make_number (actual_format));
5363 ASET (prop_attr, 2, make_number (bytes_remaining / (actual_format / 8)));
5364 }
5365
5366 unblock_input ();
5367 return prop_attr;
5368}
5369
5313/*********************************************************************** 5370/***********************************************************************
5314 Tool tips 5371 Tool tips
5315 ***********************************************************************/ 5372 ***********************************************************************/
@@ -6966,6 +7023,7 @@ When using Gtk+ tooltips, the tooltip face is not used. */);
6966 defsubr (&Sx_change_window_property); 7023 defsubr (&Sx_change_window_property);
6967 defsubr (&Sx_delete_window_property); 7024 defsubr (&Sx_delete_window_property);
6968 defsubr (&Sx_window_property); 7025 defsubr (&Sx_window_property);
7026 defsubr (&Sx_window_property_attributes);
6969 7027
6970 defsubr (&Sxw_display_color_p); 7028 defsubr (&Sxw_display_color_p);
6971 defsubr (&Sx_display_grayscale_p); 7029 defsubr (&Sx_display_grayscale_p);
diff --git a/src/xselect.c b/src/xselect.c
index 8de436f119d..156888a540b 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1612,11 +1612,24 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
1612 /* Convert a single 16-bit number or a small 32-bit number to a Lisp_Int. 1612 /* Convert a single 16-bit number or a small 32-bit number to a Lisp_Int.
1613 If the number is 32 bits and won't fit in a Lisp_Int, 1613 If the number is 32 bits and won't fit in a Lisp_Int,
1614 convert it to a cons of integers, 16 bits in each half. 1614 convert it to a cons of integers, 16 bits in each half.
1615
1616 INTEGER is a signed type, CARDINAL is unsigned.
1617 Assume any other types are unsigned as well.
1615 */ 1618 */
1616 else if (format == 32 && size == sizeof (int)) 1619 else if (format == 32 && size == sizeof (int))
1617 return INTEGER_TO_CONS (((int *) data) [0]); 1620 {
1621 if (type == XA_INTEGER)
1622 return INTEGER_TO_CONS (((int *) data) [0]);
1623 else
1624 return INTEGER_TO_CONS (((unsigned int *) data) [0]);
1625 }
1618 else if (format == 16 && size == sizeof (short)) 1626 else if (format == 16 && size == sizeof (short))
1619 return make_number (((short *) data) [0]); 1627 {
1628 if (type == XA_INTEGER)
1629 return make_number (((short *) data) [0]);
1630 else
1631 return make_number (((unsigned short *) data) [0]);
1632 }
1620 1633
1621 /* Convert any other kind of data to a vector of numbers, represented 1634 /* Convert any other kind of data to a vector of numbers, represented
1622 as above (as an integer, or a cons of two 16 bit integers.) 1635 as above (as an integer, or a cons of two 16 bit integers.)
@@ -1626,11 +1639,22 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
1626 ptrdiff_t i; 1639 ptrdiff_t i;
1627 Lisp_Object v = make_uninit_vector (size / 2); 1640 Lisp_Object v = make_uninit_vector (size / 2);
1628 1641
1629 for (i = 0; i < size / 2; i++) 1642 if (type == XA_INTEGER)
1630 { 1643 {
1631 short j = ((short *) data) [i]; 1644 for (i = 0; i < size / 2; i++)
1632 ASET (v, i, make_number (j)); 1645 {
1633 } 1646 short j = ((short *) data) [i];
1647 ASET (v, i, make_number (j));
1648 }
1649 }
1650 else
1651 {
1652 for (i = 0; i < size / 2; i++)
1653 {
1654 unsigned short j = ((unsigned short *) data) [i];
1655 ASET (v, i, make_number (j));
1656 }
1657 }
1634 return v; 1658 return v;
1635 } 1659 }
1636 else 1660 else
@@ -1638,11 +1662,22 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
1638 ptrdiff_t i; 1662 ptrdiff_t i;
1639 Lisp_Object v = make_uninit_vector (size / X_LONG_SIZE); 1663 Lisp_Object v = make_uninit_vector (size / X_LONG_SIZE);
1640 1664
1641 for (i = 0; i < size / X_LONG_SIZE; i++) 1665 if (type == XA_INTEGER)
1642 { 1666 {
1643 int j = ((int *) data) [i]; 1667 for (i = 0; i < size / X_LONG_SIZE; i++)
1644 ASET (v, i, INTEGER_TO_CONS (j)); 1668 {
1645 } 1669 int j = ((int *) data) [i];
1670 ASET (v, i, INTEGER_TO_CONS (j));
1671 }
1672 }
1673 else
1674 {
1675 for (i = 0; i < size / X_LONG_SIZE; i++)
1676 {
1677 unsigned int j = ((unsigned int *) data) [i];
1678 ASET (v, i, INTEGER_TO_CONS (j));
1679 }
1680 }
1646 return v; 1681 return v;
1647 } 1682 }
1648} 1683}
@@ -2296,13 +2331,13 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
2296 if (format == 8) 2331 if (format == 8)
2297 { 2332 {
2298 if ((1 << 8) < val && val <= X_ULONG_MAX - (1 << 7)) 2333 if ((1 << 8) < val && val <= X_ULONG_MAX - (1 << 7))
2299 error ("Out of 'char' range"); 2334 error ("Out of `char' range");
2300 *d08++ = val; 2335 *d08++ = val;
2301 } 2336 }
2302 else if (format == 16) 2337 else if (format == 16)
2303 { 2338 {
2304 if ((1 << 16) < val && val <= X_ULONG_MAX - (1 << 15)) 2339 if ((1 << 16) < val && val <= X_ULONG_MAX - (1 << 15))
2305 error ("Out of 'short' range"); 2340 error ("Out of `short' range");
2306 *d16++ = val; 2341 *d16++ = val;
2307 } 2342 }
2308 else 2343 else