diff options
| author | YAMAMOTO Mitsuharu | 2013-05-20 17:27:56 +0900 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2013-05-20 17:27:56 +0900 |
| commit | 91e8418bab03b89854e2223a3974c30ba14e2d5e (patch) | |
| tree | 55de72c55e7a49bf01bfe3c0ba877300d86f656c /src | |
| parent | 33c0f65b6f763969923c4c03c7d97724fc56545c (diff) | |
| download | emacs-91e8418bab03b89854e2223a3974c30ba14e2d5e.tar.gz emacs-91e8418bab03b89854e2223a3974c30ba14e2d5e.zip | |
Sync x-server-* and x-display-* functions on NS with those on X11.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 17 | ||||
| -rw-r--r-- | src/nsfns.m | 307 | ||||
| -rw-r--r-- | src/nsterm.m | 24 |
3 files changed, 191 insertions, 157 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 56ee8f659bc..88a9405786b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -5,6 +5,23 @@ | |||
| 5 | (Fx_display_mm_width, Fx_display_mm_height): Mention | 5 | (Fx_display_mm_width, Fx_display_mm_height): Mention |
| 6 | `display-monitor-attributes-list' in docstrings. | 6 | `display-monitor-attributes-list' in docstrings. |
| 7 | 7 | ||
| 8 | * nsfns.m (ns_get_screen): Remove function. All uses removed. | ||
| 9 | (check_ns_display_info): Sync with check_x_display_info in xfns.c. | ||
| 10 | (Fx_server_max_request_size, Fx_server_vendor, Fx_server_version) | ||
| 11 | (Fx_display_screens, Fx_display_mm_width, Fx_display_mm_height) | ||
| 12 | (Fx_display_backing_store, Fx_display_visual_class) | ||
| 13 | (Fx_display_save_under, Fx_close_connection, Fxw_display_color_p) | ||
| 14 | (Fx_display_grayscale_p, Fx_display_pixel_width) | ||
| 15 | (Fx_display_pixel_height, Fx_display_planes) | ||
| 16 | (Fx_display_color_cells): Sync args and docstrings with xfns.c. | ||
| 17 | (Fx_display_screens): Don't confuse X11 screens with NS screens. | ||
| 18 | (Fx_display_mm_width, Fx_display_mm_height) | ||
| 19 | (Fx_display_pixel_width, Fx_display_pixel_width): Return width or | ||
| 20 | height for all physical monitors as in X11. | ||
| 21 | |||
| 22 | * nsterm.m (x_display_pixel_width, x_display_pixel_height): Return | ||
| 23 | pixel width or height for all physical monitors as in X11. | ||
| 24 | |||
| 8 | 2013-05-18 Paul Eggert <eggert@cs.ucla.edu> | 25 | 2013-05-18 Paul Eggert <eggert@cs.ucla.edu> |
| 9 | 26 | ||
| 10 | Port --enable-gcc-warnings to clang. | 27 | Port --enable-gcc-warnings to clang. |
diff --git a/src/nsfns.m b/src/nsfns.m index 497a856aa10..7643c8b6e1d 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -113,44 +113,45 @@ static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; | |||
| 113 | 113 | ||
| 114 | ========================================================================== */ | 114 | ========================================================================== */ |
| 115 | 115 | ||
| 116 | /* Let the user specify an Nextstep display with a frame. | 116 | /* Let the user specify a Nextstep display with a Lisp object. |
| 117 | nil stands for the selected frame--or, if that is not an Nextstep frame, | 117 | OBJECT may be nil, a frame or a terminal object. |
| 118 | nil stands for the selected frame--or, if that is not a Nextstep frame, | ||
| 118 | the first Nextstep display on the list. */ | 119 | the first Nextstep display on the list. */ |
| 120 | |||
| 119 | static struct ns_display_info * | 121 | static struct ns_display_info * |
| 120 | check_ns_display_info (Lisp_Object frame) | 122 | check_ns_display_info (Lisp_Object object) |
| 121 | { | 123 | { |
| 122 | if (NILP (frame)) | 124 | struct ns_display_info *dpyinfo = NULL; |
| 125 | |||
| 126 | if (NILP (object)) | ||
| 123 | { | 127 | { |
| 124 | struct frame *f = SELECTED_FRAME (); | 128 | struct frame *sf = XFRAME (selected_frame); |
| 125 | if (FRAME_NS_P (f) && FRAME_LIVE_P (f) ) | 129 | |
| 126 | return FRAME_NS_DISPLAY_INFO (f); | 130 | if (FRAME_NS_P (sf) && FRAME_LIVE_P (sf)) |
| 131 | dpyinfo = FRAME_NS_DISPLAY_INFO (sf); | ||
| 127 | else if (x_display_list != 0) | 132 | else if (x_display_list != 0) |
| 128 | return x_display_list; | 133 | dpyinfo = x_display_list; |
| 129 | else | 134 | else |
| 130 | error ("Nextstep windows are not in use or not initialized"); | 135 | error ("Nextstep windows are not in use or not initialized"); |
| 131 | } | 136 | } |
| 132 | else if (INTEGERP (frame)) | 137 | else if (TERMINALP (object)) |
| 133 | { | 138 | { |
| 134 | struct terminal *t = get_terminal (frame, 1); | 139 | struct terminal *t = get_terminal (object, 1); |
| 135 | 140 | ||
| 136 | if (t->type != output_ns) | 141 | if (t->type != output_ns) |
| 137 | error ("Terminal %"pI"d is not a Nextstep display", XINT (frame)); | 142 | error ("Terminal %d is not a Nextstep display", t->id); |
| 138 | 143 | ||
| 139 | return t->display_info.ns; | 144 | dpyinfo = t->display_info.ns; |
| 140 | } | 145 | } |
| 141 | else if (STRINGP (frame)) | 146 | else if (STRINGP (object)) |
| 142 | return ns_display_info_for_name (frame); | 147 | dpyinfo = ns_display_info_for_name (object); |
| 143 | else | 148 | else |
| 144 | { | 149 | { |
| 145 | FRAME_PTR f; | 150 | FRAME_PTR f = decode_window_system_frame (object); |
| 146 | 151 | dpyinfo = FRAME_NS_DISPLAY_INFO (f); | |
| 147 | CHECK_LIVE_FRAME (frame); | ||
| 148 | f = XFRAME (frame); | ||
| 149 | if (! FRAME_NS_P (f)) | ||
| 150 | error ("non-Nextstep frame used"); | ||
| 151 | return FRAME_NS_DISPLAY_INFO (f); | ||
| 152 | } | 152 | } |
| 153 | return NULL; /* shut compiler up */ | 153 | |
| 154 | return dpyinfo; | ||
| 154 | } | 155 | } |
| 155 | 156 | ||
| 156 | 157 | ||
| @@ -170,35 +171,6 @@ ns_get_window (Lisp_Object maybeFrame) | |||
| 170 | } | 171 | } |
| 171 | 172 | ||
| 172 | 173 | ||
| 173 | static NSScreen * | ||
| 174 | ns_get_screen (Lisp_Object screen) | ||
| 175 | { | ||
| 176 | struct frame *f; | ||
| 177 | struct terminal *terminal; | ||
| 178 | |||
| 179 | if (EQ (Qt, screen)) /* not documented */ | ||
| 180 | return [NSScreen mainScreen]; | ||
| 181 | |||
| 182 | terminal = get_terminal (screen, 1); | ||
| 183 | if (terminal->type != output_ns) | ||
| 184 | return NULL; | ||
| 185 | |||
| 186 | if (NILP (screen)) | ||
| 187 | f = SELECTED_FRAME (); | ||
| 188 | else if (FRAMEP (screen)) | ||
| 189 | f = XFRAME (screen); | ||
| 190 | else | ||
| 191 | { | ||
| 192 | struct ns_display_info *dpyinfo = terminal->display_info.ns; | ||
| 193 | f = dpyinfo->x_focus_frame | ||
| 194 | ? dpyinfo->x_focus_frame : dpyinfo->x_highlight_frame; | ||
| 195 | } | ||
| 196 | |||
| 197 | return ((f && FRAME_NS_P (f)) ? [[FRAME_NS_VIEW (f) window] screen] | ||
| 198 | : NULL); | ||
| 199 | } | ||
| 200 | |||
| 201 | |||
| 202 | /* Return the X display structure for the display named NAME. | 174 | /* Return the X display structure for the display named NAME. |
| 203 | Open a new connection if necessary. */ | 175 | Open a new connection if necessary. */ |
| 204 | struct ns_display_info * | 176 | struct ns_display_info * |
| @@ -1586,9 +1558,9 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | |||
| 1586 | Sx_server_max_request_size, | 1558 | Sx_server_max_request_size, |
| 1587 | 0, 1, 0, | 1559 | 0, 1, 0, |
| 1588 | doc: /* This function is a no-op. It is only present for completeness. */) | 1560 | doc: /* This function is a no-op. It is only present for completeness. */) |
| 1589 | (Lisp_Object display) | 1561 | (Lisp_Object terminal) |
| 1590 | { | 1562 | { |
| 1591 | check_ns_display_info (display); | 1563 | check_ns_display_info (terminal); |
| 1592 | /* This function has no real equivalent under NeXTstep. Return nil to | 1564 | /* This function has no real equivalent under NeXTstep. Return nil to |
| 1593 | indicate this. */ | 1565 | indicate this. */ |
| 1594 | return Qnil; | 1566 | return Qnil; |
| @@ -1596,11 +1568,15 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | |||
| 1596 | 1568 | ||
| 1597 | 1569 | ||
| 1598 | DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, | 1570 | DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, |
| 1599 | doc: /* Return the vendor ID string of Nextstep display server DISPLAY. | 1571 | doc: /* Return the "vendor ID" string of Nextstep display server TERMINAL. |
| 1600 | DISPLAY should be either a frame or a display name (a string). | 1572 | \(Labeling every distributor as a "vendor" embodies the false assumption |
| 1601 | If omitted or nil, the selected frame's display is used. */) | 1573 | that operating systems cannot be developed and distributed noncommercially.) |
| 1602 | (Lisp_Object display) | 1574 | The optional argument TERMINAL specifies which display to ask about. |
| 1575 | TERMINAL should be a terminal object, a frame or a display name (a string). | ||
| 1576 | If omitted or nil, that stands for the selected frame's display. */) | ||
| 1577 | (Lisp_Object terminal) | ||
| 1603 | { | 1578 | { |
| 1579 | check_ns_display_info (terminal); | ||
| 1604 | #ifdef NS_IMPL_GNUSTEP | 1580 | #ifdef NS_IMPL_GNUSTEP |
| 1605 | return build_string ("GNU"); | 1581 | return build_string ("GNU"); |
| 1606 | #else | 1582 | #else |
| @@ -1610,16 +1586,17 @@ If omitted or nil, the selected frame's display is used. */) | |||
| 1610 | 1586 | ||
| 1611 | 1587 | ||
| 1612 | DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, | 1588 | DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, |
| 1613 | doc: /* Return the version numbers of the server of DISPLAY. | 1589 | doc: /* Return the version numbers of the server of display TERMINAL. |
| 1614 | The value is a list of three integers: the major and minor | 1590 | The value is a list of three integers: the major and minor |
| 1615 | version numbers of the X Protocol in use, and the distributor-specific | 1591 | version numbers of the X Protocol in use, and the distributor-specific release |
| 1616 | release number. See also the function `x-server-vendor'. | 1592 | number. See also the function `x-server-vendor'. |
| 1617 | 1593 | ||
| 1618 | The optional argument DISPLAY specifies which display to ask about. | 1594 | The optional argument TERMINAL specifies which display to ask about. |
| 1619 | DISPLAY should be either a frame or a display name (a string). | 1595 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 1620 | If omitted or nil, that stands for the selected frame's display. */) | 1596 | If omitted or nil, that stands for the selected frame's display. */) |
| 1621 | (Lisp_Object display) | 1597 | (Lisp_Object terminal) |
| 1622 | { | 1598 | { |
| 1599 | check_ns_display_info (terminal); | ||
| 1623 | /*NOTE: it is unclear what would best correspond with "protocol"; | 1600 | /*NOTE: it is unclear what would best correspond with "protocol"; |
| 1624 | we return 10.3, meaning Panther, since this is roughly the | 1601 | we return 10.3, meaning Panther, since this is roughly the |
| 1625 | level that GNUstep's APIs correspond to. | 1602 | level that GNUstep's APIs correspond to. |
| @@ -1631,56 +1608,66 @@ If omitted or nil, that stands for the selected frame's display. */) | |||
| 1631 | 1608 | ||
| 1632 | 1609 | ||
| 1633 | DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, | 1610 | DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, |
| 1634 | doc: /* Return the number of screens on Nextstep display server DISPLAY. | 1611 | doc: /* Return the number of screens on Nextstep display server TERMINAL. |
| 1635 | DISPLAY should be a frame, the display name as a string, or a terminal ID. | 1612 | The optional argument TERMINAL specifies which display to ask about. |
| 1636 | If omitted or nil, the selected frame's display is used. */) | 1613 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 1637 | (Lisp_Object display) | 1614 | If omitted or nil, that stands for the selected frame's display. |
| 1638 | { | ||
| 1639 | int num; | ||
| 1640 | |||
| 1641 | check_ns_display_info (display); | ||
| 1642 | num = [[NSScreen screens] count]; | ||
| 1643 | 1615 | ||
| 1644 | return (num != 0) ? make_number (num) : Qnil; | 1616 | Note: "screen" here is not in Nextstep terminology but in X11's. For |
| 1617 | the number of physical monitors, use `(length | ||
| 1618 | (display-monitor-attributes-list TERMINAL))' instead. */) | ||
| 1619 | (Lisp_Object terminal) | ||
| 1620 | { | ||
| 1621 | check_ns_display_info (terminal); | ||
| 1622 | return make_number (1); | ||
| 1645 | } | 1623 | } |
| 1646 | 1624 | ||
| 1647 | 1625 | ||
| 1648 | DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, | 1626 | DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0, |
| 1649 | 0, 1, 0, | 1627 | doc: /* Return the height in millimeters of the Nextstep display TERMINAL. |
| 1650 | doc: /* Return the height of Nextstep display server DISPLAY, in millimeters. | 1628 | The optional argument TERMINAL specifies which display to ask about. |
| 1651 | DISPLAY should be a frame, the display name as a string, or a terminal ID. | 1629 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 1652 | If omitted or nil, the selected frame's display is used. */) | 1630 | If omitted or nil, that stands for the selected frame's display. |
| 1653 | (Lisp_Object display) | 1631 | |
| 1632 | On \"multi-monitor\" setups this refers to the height in millimeters for | ||
| 1633 | all physical monitors associated with TERMINAL. To get information | ||
| 1634 | for each physical monitor, use `display-monitor-attributes-list'. */) | ||
| 1635 | (Lisp_Object terminal) | ||
| 1654 | { | 1636 | { |
| 1655 | check_ns_display_info (display); | 1637 | struct ns_display_info *dpyinfo = check_ns_display_info (terminal); |
| 1656 | return make_number ((int) | 1638 | |
| 1657 | ([ns_get_screen (display) frame].size.height/(92.0/25.4))); | 1639 | return make_number (x_display_pixel_height (dpyinfo) / (92.0/25.4)); |
| 1658 | } | 1640 | } |
| 1659 | 1641 | ||
| 1660 | 1642 | ||
| 1661 | DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, | 1643 | DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, |
| 1662 | 0, 1, 0, | 1644 | doc: /* Return the width in millimeters of the Nextstep display TERMINAL. |
| 1663 | doc: /* Return the width of Nextstep display server DISPLAY, in millimeters. | 1645 | The optional argument TERMINAL specifies which display to ask about. |
| 1664 | DISPLAY should be a frame, the display name as a string, or a terminal ID. | 1646 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 1665 | If omitted or nil, the selected frame's display is used. */) | 1647 | If omitted or nil, that stands for the selected frame's display. |
| 1666 | (Lisp_Object display) | 1648 | |
| 1649 | On \"multi-monitor\" setups this refers to the width in millimeters for | ||
| 1650 | all physical monitors associated with TERMINAL. To get information | ||
| 1651 | for each physical monitor, use `display-monitor-attributes-list'. */) | ||
| 1652 | (Lisp_Object terminal) | ||
| 1667 | { | 1653 | { |
| 1668 | check_ns_display_info (display); | 1654 | struct ns_display_info *dpyinfo = check_ns_display_info (terminal); |
| 1669 | return make_number ((int) | 1655 | |
| 1670 | ([ns_get_screen (display) frame].size.width/(92.0/25.4))); | 1656 | return make_number (x_display_pixel_width (dpyinfo) / (92.0/25.4)); |
| 1671 | } | 1657 | } |
| 1672 | 1658 | ||
| 1673 | 1659 | ||
| 1674 | DEFUN ("x-display-backing-store", Fx_display_backing_store, | 1660 | DEFUN ("x-display-backing-store", Fx_display_backing_store, |
| 1675 | Sx_display_backing_store, 0, 1, 0, | 1661 | Sx_display_backing_store, 0, 1, 0, |
| 1676 | doc: /* Return whether the Nextstep display DISPLAY supports backing store. | 1662 | doc: /* Return an indication of whether the Nextstep display TERMINAL does backing store. |
| 1677 | The value may be `buffered', `retained', or `non-retained'. | 1663 | The value may be `buffered', `retained', or `non-retained'. |
| 1678 | DISPLAY should be a frame, the display name as a string, or a terminal ID. | 1664 | The optional argument TERMINAL specifies which display to ask about. |
| 1679 | If omitted or nil, the selected frame's display is used. */) | 1665 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 1680 | (Lisp_Object display) | 1666 | If omitted or nil, that stands for the selected frame's display. */) |
| 1667 | (Lisp_Object terminal) | ||
| 1681 | { | 1668 | { |
| 1682 | check_ns_display_info (display); | 1669 | check_ns_display_info (terminal); |
| 1683 | switch ([ns_get_window (display) backingType]) | 1670 | switch ([ns_get_window (terminal) backingType]) |
| 1684 | { | 1671 | { |
| 1685 | case NSBackingStoreBuffered: | 1672 | case NSBackingStoreBuffered: |
| 1686 | return intern ("buffered"); | 1673 | return intern ("buffered"); |
| @@ -1697,17 +1684,19 @@ If omitted or nil, the selected frame's display is used. */) | |||
| 1697 | 1684 | ||
| 1698 | DEFUN ("x-display-visual-class", Fx_display_visual_class, | 1685 | DEFUN ("x-display-visual-class", Fx_display_visual_class, |
| 1699 | Sx_display_visual_class, 0, 1, 0, | 1686 | Sx_display_visual_class, 0, 1, 0, |
| 1700 | doc: /* Return the visual class of the Nextstep display server DISPLAY. | 1687 | doc: /* Return the visual class of the Nextstep display TERMINAL. |
| 1701 | The value is one of the symbols `static-gray', `gray-scale', | 1688 | The value is one of the symbols `static-gray', `gray-scale', |
| 1702 | `static-color', `pseudo-color', `true-color', or `direct-color'. | 1689 | `static-color', `pseudo-color', `true-color', or `direct-color'. |
| 1703 | DISPLAY should be a frame, the display name as a string, or a terminal ID. | 1690 | |
| 1704 | If omitted or nil, the selected frame's display is used. */) | 1691 | The optional argument TERMINAL specifies which display to ask about. |
| 1705 | (Lisp_Object display) | 1692 | TERMINAL should a terminal object, a frame or a display name (a string). |
| 1693 | If omitted or nil, that stands for the selected frame's display. */) | ||
| 1694 | (Lisp_Object terminal) | ||
| 1706 | { | 1695 | { |
| 1707 | NSWindowDepth depth; | 1696 | NSWindowDepth depth; |
| 1708 | 1697 | ||
| 1709 | check_ns_display_info (display); | 1698 | check_ns_display_info (terminal); |
| 1710 | depth = [ns_get_screen (display) depth]; | 1699 | depth = [[[NSScreen screens] objectAtIndex:0] depth]; |
| 1711 | 1700 | ||
| 1712 | if ( depth == NSBestDepth (NSCalibratedWhiteColorSpace, 2, 2, YES, NULL)) | 1701 | if ( depth == NSBestDepth (NSCalibratedWhiteColorSpace, 2, 2, YES, NULL)) |
| 1713 | return intern ("static-gray"); | 1702 | return intern ("static-gray"); |
| @@ -1727,14 +1716,14 @@ If omitted or nil, the selected frame's display is used. */) | |||
| 1727 | 1716 | ||
| 1728 | DEFUN ("x-display-save-under", Fx_display_save_under, | 1717 | DEFUN ("x-display-save-under", Fx_display_save_under, |
| 1729 | Sx_display_save_under, 0, 1, 0, | 1718 | Sx_display_save_under, 0, 1, 0, |
| 1730 | doc: /* Return t if DISPLAY supports the save-under feature. | 1719 | doc: /* Return t if TERMINAL supports the save-under feature. |
| 1731 | The optional argument DISPLAY specifies which display to ask about. | 1720 | The optional argument TERMINAL specifies which display to ask about. |
| 1732 | DISPLAY should be a frame, the display name as a string, or a terminal ID. | 1721 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 1733 | If omitted or nil, the selected frame's display is used. */) | 1722 | If omitted or nil, that stands for the selected frame's display. */) |
| 1734 | (Lisp_Object display) | 1723 | (Lisp_Object terminal) |
| 1735 | { | 1724 | { |
| 1736 | check_ns_display_info (display); | 1725 | check_ns_display_info (terminal); |
| 1737 | switch ([ns_get_window (display) backingType]) | 1726 | switch ([ns_get_window (terminal) backingType]) |
| 1738 | { | 1727 | { |
| 1739 | case NSBackingStoreBuffered: | 1728 | case NSBackingStoreBuffered: |
| 1740 | return Qt; | 1729 | return Qt; |
| @@ -1782,11 +1771,13 @@ terminate Emacs if we can't open the connection. | |||
| 1782 | 1771 | ||
| 1783 | DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection, | 1772 | DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection, |
| 1784 | 1, 1, 0, | 1773 | 1, 1, 0, |
| 1785 | doc: /* Close the connection to the current Nextstep display server. | 1774 | doc: /* Close the connection to TERMINAL's Nextstep display server. |
| 1786 | DISPLAY should be a frame, the display name as a string, or a terminal ID. */) | 1775 | For TERMINAL, specify a terminal object, a frame or a display name (a |
| 1787 | (Lisp_Object display) | 1776 | string). If TERMINAL is nil, that stands for the selected frame's |
| 1777 | terminal. */) | ||
| 1778 | (Lisp_Object terminal) | ||
| 1788 | { | 1779 | { |
| 1789 | check_ns_display_info (display); | 1780 | check_ns_display_info (terminal); |
| 1790 | [NSApp terminate: NSApp]; | 1781 | [NSApp terminate: NSApp]; |
| 1791 | return Qnil; | 1782 | return Qnil; |
| 1792 | } | 1783 | } |
| @@ -2269,13 +2260,13 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, | |||
| 2269 | 2260 | ||
| 2270 | DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, | 2261 | DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, |
| 2271 | doc: /* Internal function called by `display-color-p', which see. */) | 2262 | doc: /* Internal function called by `display-color-p', which see. */) |
| 2272 | (Lisp_Object display) | 2263 | (Lisp_Object terminal) |
| 2273 | { | 2264 | { |
| 2274 | NSWindowDepth depth; | 2265 | NSWindowDepth depth; |
| 2275 | NSString *colorSpace; | 2266 | NSString *colorSpace; |
| 2276 | 2267 | ||
| 2277 | check_ns_display_info (display); | 2268 | check_ns_display_info (terminal); |
| 2278 | depth = [ns_get_screen (display) depth]; | 2269 | depth = [[[NSScreen screens] objectAtIndex:0] depth]; |
| 2279 | colorSpace = NSColorSpaceFromDepth (depth); | 2270 | colorSpace = NSColorSpaceFromDepth (depth); |
| 2280 | 2271 | ||
| 2281 | return [colorSpace isEqualToString: NSDeviceWhiteColorSpace] | 2272 | return [colorSpace isEqualToString: NSDeviceWhiteColorSpace] |
| @@ -2284,19 +2275,19 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, | |||
| 2284 | } | 2275 | } |
| 2285 | 2276 | ||
| 2286 | 2277 | ||
| 2287 | DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, | 2278 | DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, |
| 2288 | Sx_display_grayscale_p, 0, 1, 0, | 2279 | 0, 1, 0, |
| 2289 | doc: /* Return t if the Nextstep display supports shades of gray. | 2280 | doc: /* Return t if the Nextstep display supports shades of gray. |
| 2290 | Note that color displays do support shades of gray. | 2281 | Note that color displays do support shades of gray. |
| 2291 | The optional argument DISPLAY specifies which display to ask about. | 2282 | The optional argument TERMINAL specifies which display to ask about. |
| 2292 | DISPLAY should be either a frame, a display name (a string), or terminal ID. | 2283 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 2293 | If omitted or nil, that stands for the selected frame's display. */) | 2284 | If omitted or nil, that stands for the selected frame's display. */) |
| 2294 | (Lisp_Object display) | 2285 | (Lisp_Object terminal) |
| 2295 | { | 2286 | { |
| 2296 | NSWindowDepth depth; | 2287 | NSWindowDepth depth; |
| 2297 | 2288 | ||
| 2298 | check_ns_display_info (display); | 2289 | check_ns_display_info (terminal); |
| 2299 | depth = [ns_get_screen (display) depth]; | 2290 | depth = [[[NSScreen screens] objectAtIndex:0] depth]; |
| 2300 | 2291 | ||
| 2301 | return NSBitsPerPixelFromDepth (depth) > 1 ? Qt : Qnil; | 2292 | return NSBitsPerPixelFromDepth (depth) > 1 ? Qt : Qnil; |
| 2302 | } | 2293 | } |
| @@ -2304,27 +2295,37 @@ If omitted or nil, that stands for the selected frame's display. */) | |||
| 2304 | 2295 | ||
| 2305 | DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, | 2296 | DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, |
| 2306 | 0, 1, 0, | 2297 | 0, 1, 0, |
| 2307 | doc: /* Return the width in pixels of the Nextstep display DISPLAY. | 2298 | doc: /* Return the width in pixels of the Nextstep display TERMINAL. |
| 2308 | The optional argument DISPLAY specifies which display to ask about. | 2299 | The optional argument TERMINAL specifies which display to ask about. |
| 2309 | DISPLAY should be either a frame, a display name (a string), or terminal ID. | 2300 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 2310 | If omitted or nil, that stands for the selected frame's display. */) | 2301 | If omitted or nil, that stands for the selected frame's display. |
| 2311 | (Lisp_Object display) | 2302 | |
| 2303 | On \"multi-monitor\" setups this refers to the pixel width for all | ||
| 2304 | physical monitors associated with TERMINAL. To get information for | ||
| 2305 | each physical monitor, use `display-monitor-attributes-list'. */) | ||
| 2306 | (Lisp_Object terminal) | ||
| 2312 | { | 2307 | { |
| 2313 | check_ns_display_info (display); | 2308 | struct ns_display_info *dpyinfo = check_ns_display_info (terminal); |
| 2314 | return make_number ((int) [ns_get_screen (display) frame].size.width); | 2309 | |
| 2310 | return make_number (x_display_pixel_width (dpyinfo)); | ||
| 2315 | } | 2311 | } |
| 2316 | 2312 | ||
| 2317 | 2313 | ||
| 2318 | DEFUN ("x-display-pixel-height", Fx_display_pixel_height, | 2314 | DEFUN ("x-display-pixel-height", Fx_display_pixel_height, |
| 2319 | Sx_display_pixel_height, 0, 1, 0, | 2315 | Sx_display_pixel_height, 0, 1, 0, |
| 2320 | doc: /* Return the height in pixels of the Nextstep display DISPLAY. | 2316 | doc: /* Return the height in pixels of the Nextstep display TERMINAL. |
| 2321 | The optional argument DISPLAY specifies which display to ask about. | 2317 | The optional argument TERMINAL specifies which display to ask about. |
| 2322 | DISPLAY should be either a frame, a display name (a string), or terminal ID. | 2318 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 2323 | If omitted or nil, that stands for the selected frame's display. */) | 2319 | If omitted or nil, that stands for the selected frame's display. |
| 2324 | (Lisp_Object display) | 2320 | |
| 2321 | On \"multi-monitor\" setups this refers to the pixel height for all | ||
| 2322 | physical monitors associated with TERMINAL. To get information for | ||
| 2323 | each physical monitor, use `display-monitor-attributes-list'. */) | ||
| 2324 | (Lisp_Object terminal) | ||
| 2325 | { | 2325 | { |
| 2326 | check_ns_display_info (display); | 2326 | struct ns_display_info *dpyinfo = check_ns_display_info (terminal); |
| 2327 | return make_number ((int) [ns_get_screen (display) frame].size.height); | 2327 | |
| 2328 | return make_number (x_display_pixel_height (dpyinfo)); | ||
| 2328 | } | 2329 | } |
| 2329 | 2330 | ||
| 2330 | struct MonitorInfo { | 2331 | struct MonitorInfo { |
| @@ -2547,27 +2548,27 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 2547 | 2548 | ||
| 2548 | DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, | 2549 | DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, |
| 2549 | 0, 1, 0, | 2550 | 0, 1, 0, |
| 2550 | doc: /* Return the number of bitplanes of the Nextstep display DISPLAY. | 2551 | doc: /* Return the number of bitplanes of the Nextstep display TERMINAL. |
| 2551 | The optional argument DISPLAY specifies which display to ask about. | 2552 | The optional argument TERMINAL specifies which display to ask about. |
| 2552 | DISPLAY should be either a frame, a display name (a string), or terminal ID. | 2553 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 2553 | If omitted or nil, that stands for the selected frame's display. */) | 2554 | If omitted or nil, that stands for the selected frame's display. */) |
| 2554 | (Lisp_Object display) | 2555 | (Lisp_Object terminal) |
| 2555 | { | 2556 | { |
| 2556 | check_ns_display_info (display); | 2557 | check_ns_display_info (terminal); |
| 2557 | return make_number | 2558 | return make_number |
| 2558 | (NSBitsPerPixelFromDepth ([ns_get_screen (display) depth])); | 2559 | (NSBitsPerPixelFromDepth ([[[NSScreen screens] objectAtIndex:0] depth])); |
| 2559 | } | 2560 | } |
| 2560 | 2561 | ||
| 2561 | 2562 | ||
| 2562 | DEFUN ("x-display-color-cells", Fx_display_color_cells, | 2563 | DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, |
| 2563 | Sx_display_color_cells, 0, 1, 0, | 2564 | 0, 1, 0, |
| 2564 | doc: /* Returns the number of color cells of the Nextstep display DISPLAY. | 2565 | doc: /* Returns the number of color cells of the Nextstep display TERMINAL. |
| 2565 | The optional argument DISPLAY specifies which display to ask about. | 2566 | The optional argument TERMINAL specifies which display to ask about. |
| 2566 | DISPLAY should be either a frame, a display name (a string), or terminal ID. | 2567 | TERMINAL should be a terminal object, a frame or a display name (a string). |
| 2567 | If omitted or nil, that stands for the selected frame's display. */) | 2568 | If omitted or nil, that stands for the selected frame's display. */) |
| 2568 | (Lisp_Object display) | 2569 | (Lisp_Object terminal) |
| 2569 | { | 2570 | { |
| 2570 | struct ns_display_info *dpyinfo = check_ns_display_info (display); | 2571 | struct ns_display_info *dpyinfo = check_ns_display_info (terminal); |
| 2571 | /* We force 24+ bit depths to 24-bit to prevent an overflow. */ | 2572 | /* We force 24+ bit depths to 24-bit to prevent an overflow. */ |
| 2572 | return make_number (1 << min (dpyinfo->n_planes, 24)); | 2573 | return make_number (1 << min (dpyinfo->n_planes, 24)); |
| 2573 | } | 2574 | } |
diff --git a/src/nsterm.m b/src/nsterm.m index f5b48ee4b11..e882f00e977 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -3913,15 +3913,31 @@ x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y) | |||
| 3913 | int | 3913 | int |
| 3914 | x_display_pixel_height (struct ns_display_info *dpyinfo) | 3914 | x_display_pixel_height (struct ns_display_info *dpyinfo) |
| 3915 | { | 3915 | { |
| 3916 | NSScreen *screen = [NSScreen mainScreen]; | 3916 | NSArray *screens = [NSScreen screens]; |
| 3917 | return [screen frame].size.height; | 3917 | NSEnumerator *enumerator = [screens objectEnumerator]; |
| 3918 | NSScreen *screen; | ||
| 3919 | NSRect frame; | ||
| 3920 | |||
| 3921 | frame = NSZeroRect; | ||
| 3922 | while ((screen = [enumerator nextObject]) != nil) | ||
| 3923 | frame = NSUnionRect (frame, [screen frame]); | ||
| 3924 | |||
| 3925 | return NSHeight (frame); | ||
| 3918 | } | 3926 | } |
| 3919 | 3927 | ||
| 3920 | int | 3928 | int |
| 3921 | x_display_pixel_width (struct ns_display_info *dpyinfo) | 3929 | x_display_pixel_width (struct ns_display_info *dpyinfo) |
| 3922 | { | 3930 | { |
| 3923 | NSScreen *screen = [NSScreen mainScreen]; | 3931 | NSArray *screens = [NSScreen screens]; |
| 3924 | return [screen frame].size.width; | 3932 | NSEnumerator *enumerator = [screens objectEnumerator]; |
| 3933 | NSScreen *screen; | ||
| 3934 | NSRect frame; | ||
| 3935 | |||
| 3936 | frame = NSZeroRect; | ||
| 3937 | while ((screen = [enumerator nextObject]) != nil) | ||
| 3938 | frame = NSUnionRect (frame, [screen frame]); | ||
| 3939 | |||
| 3940 | return NSWidth (frame); | ||
| 3925 | } | 3941 | } |
| 3926 | 3942 | ||
| 3927 | 3943 | ||