Mercurial > emacs
comparison src/xfns.c @ 6790:ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
(x_window): Separate into two alternative definitions.
Call x_calc_absolute_position here.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 10 Apr 1994 06:04:33 +0000 |
parents | 3122395ded44 |
children | 3096a6f7fffb |
comparison
equal
deleted
inserted
replaced
6789:67bb36e8e602 | 6790:ee8090b47ea6 |
---|---|
1553 } | 1553 } |
1554 } | 1554 } |
1555 | 1555 |
1556 #ifdef HAVE_X11 | 1556 #ifdef HAVE_X11 |
1557 /* Calculate the desired size and position of this window, | 1557 /* Calculate the desired size and position of this window, |
1558 or set rubber-band prompting if none. */ | 1558 and return the attributes saying which aspects were specified. |
1559 | |
1560 This function does not make the coordinates positive. */ | |
1559 | 1561 |
1560 #define DEFAULT_ROWS 40 | 1562 #define DEFAULT_ROWS 40 |
1561 #define DEFAULT_COLS 80 | 1563 #define DEFAULT_COLS 80 |
1562 | 1564 |
1563 static int | 1565 static int |
1606 { | 1608 { |
1607 CHECK_NUMBER (tem0, 0); | 1609 CHECK_NUMBER (tem0, 0); |
1608 CHECK_NUMBER (tem1, 0); | 1610 CHECK_NUMBER (tem1, 0); |
1609 f->display.x->top_pos = XINT (tem0); | 1611 f->display.x->top_pos = XINT (tem0); |
1610 f->display.x->left_pos = XINT (tem1); | 1612 f->display.x->left_pos = XINT (tem1); |
1611 x_calc_absolute_position (f); | 1613 if (f->display.x->top_pos < 0) |
1614 window_prompting |= YNegative; | |
1615 if (f->display.x->left_pos < 0) | |
1616 window_prompting |= YNegative; | |
1612 window_prompting |= USPosition; | 1617 window_prompting |= USPosition; |
1613 } | 1618 } |
1614 else if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | 1619 else if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
1615 error ("Must specify *both* top and left corners"); | 1620 error ("Must specify *both* top and left corners"); |
1616 | 1621 |
1711 } | 1716 } |
1712 UNBLOCK_INPUT; | 1717 UNBLOCK_INPUT; |
1713 } | 1718 } |
1714 #endif | 1719 #endif |
1715 | 1720 |
1716 /* Create and set up the X window or widget for frame F. */ | 1721 #ifdef USE_X_TOOLKIT |
1722 | |
1723 /* Create and set up the X widget for frame F. */ | |
1717 | 1724 |
1718 static void | 1725 static void |
1719 #ifdef USE_X_TOOLKIT | |
1720 x_window (f, window_prompting, minibuffer_only) | 1726 x_window (f, window_prompting, minibuffer_only) |
1721 struct frame *f; | 1727 struct frame *f; |
1722 long window_prompting; | 1728 long window_prompting; |
1723 int minibuffer_only; | 1729 int minibuffer_only; |
1724 #else /* not USE_X_TOOLKIT */ | |
1725 x_window (f) | |
1726 struct frame *f; | |
1727 #endif /* not USE_X_TOOLKIT */ | |
1728 { | 1730 { |
1729 XClassHint class_hints; | 1731 XClassHint class_hints; |
1730 XSetWindowAttributes attributes; | 1732 XSetWindowAttributes attributes; |
1731 unsigned long attribute_mask; | 1733 unsigned long attribute_mask; |
1732 | 1734 |
1733 #ifdef USE_X_TOOLKIT | |
1734 Widget shell_widget; | 1735 Widget shell_widget; |
1735 Widget pane_widget; | 1736 Widget pane_widget; |
1736 Widget screen_widget; | 1737 Widget screen_widget; |
1737 char* name; | 1738 char* name; |
1738 Arg al [25]; | 1739 Arg al [25]; |
1791 { | 1792 { |
1792 int len; | 1793 int len; |
1793 char *tem, shell_position[32]; | 1794 char *tem, shell_position[32]; |
1794 Arg al[2]; | 1795 Arg al[2]; |
1795 int ac = 0; | 1796 int ac = 0; |
1796 int menubar_size = | 1797 int menubar_size |
1797 (f->display.x->menubar_widget | 1798 = (f->display.x->menubar_widget |
1798 ? (f->display.x->menubar_widget->core.height | 1799 ? (f->display.x->menubar_widget->core.height |
1799 + f->display.x->menubar_widget->core.border_width) | 1800 + f->display.x->menubar_widget->core.border_width) |
1800 : 0); | 1801 : 0); |
1801 | 1802 |
1802 if (window_prompting & USPosition) | 1803 if (window_prompting & USPosition) |
1803 sprintf (shell_position, "=%dx%d%c%d%c%d", PIXEL_WIDTH (f), | 1804 { |
1804 PIXEL_HEIGHT (f) + menubar_size, | 1805 int left = f->display.x->left_pos; |
1805 '+', f->display.x->left_pos, | 1806 int xneg = left < 0; |
1806 '+', f->display.x->top_pos); | 1807 int top = f->display.x->top_pos; |
1808 int yneg = top < 0; | |
1809 if (left < 0) | |
1810 left = -left; | |
1811 if (top < 0) | |
1812 top = -top; | |
1813 sprintf (shell_position, "=%dx%d%c%d%c%d", PIXEL_WIDTH (f), | |
1814 PIXEL_HEIGHT (f) + menubar_size, | |
1815 (xneg ? '-' : '+'), left, | |
1816 (yneg ? '-' : '+'), top); | |
1817 } | |
1807 else | 1818 else |
1808 sprintf (shell_position, "=%dx%d", PIXEL_WIDTH (f), | 1819 sprintf (shell_position, "=%dx%d", PIXEL_WIDTH (f), |
1809 PIXEL_HEIGHT (f) + menubar_size); | 1820 PIXEL_HEIGHT (f) + menubar_size); |
1810 len = strlen (shell_position) + 1; | 1821 len = strlen (shell_position) + 1; |
1811 tem = (char *) xmalloc (len); | 1822 tem = (char *) xmalloc (len); |
1812 strncpy (tem, shell_position, len); | 1823 strncpy (tem, shell_position, len); |
1813 XtSetArg (al[ac], XtNgeometry, tem); ac++; | 1824 XtSetArg (al[ac], XtNgeometry, tem); ac++; |
1814 XtSetValues (shell_widget, al, ac); | 1825 XtSetValues (shell_widget, al, ac); |
1815 } | 1826 } |
1816 | 1827 |
1817 | 1828 x_calc_absolute_position (f); |
1829 | |
1818 XtManageChild (pane_widget); | 1830 XtManageChild (pane_widget); |
1819 XtRealizeWidget (shell_widget); | 1831 XtRealizeWidget (shell_widget); |
1820 | 1832 |
1821 FRAME_X_WINDOW (f) = XtWindow (screen_widget); | 1833 FRAME_X_WINDOW (f) = XtWindow (screen_widget); |
1822 | 1834 |
1841 XChangeWindowAttributes (XtDisplay (shell_widget), XtWindow (shell_widget), | 1853 XChangeWindowAttributes (XtDisplay (shell_widget), XtWindow (shell_widget), |
1842 attribute_mask, &attributes); | 1854 attribute_mask, &attributes); |
1843 | 1855 |
1844 XtMapWidget (screen_widget); | 1856 XtMapWidget (screen_widget); |
1845 | 1857 |
1858 /* x_set_name normally ignores requests to set the name if the | |
1859 requested name is the same as the current name. This is the one | |
1860 place where that assumption isn't correct; f->name is set, but | |
1861 the X server hasn't been told. */ | |
1862 { | |
1863 Lisp_Object name; | |
1864 int explicit = f->explicit_name; | |
1865 | |
1866 f->explicit_name = 0; | |
1867 name = f->name; | |
1868 f->name = Qnil; | |
1869 x_set_name (f, name, explicit); | |
1870 } | |
1871 | |
1872 XDefineCursor (XDISPLAY FRAME_X_WINDOW (f), | |
1873 f->display.x->text_cursor); | |
1874 | |
1875 UNBLOCK_INPUT; | |
1876 | |
1877 if (FRAME_X_WINDOW (f) == 0) | |
1878 error ("Unable to create window"); | |
1879 } | |
1880 | |
1846 #else /* not USE_X_TOOLKIT */ | 1881 #else /* not USE_X_TOOLKIT */ |
1847 | 1882 |
1883 /* Create and set up the X window for frame F. */ | |
1884 | |
1885 x_window (f) | |
1886 struct frame *f; | |
1887 | |
1888 { | |
1889 XClassHint class_hints; | |
1890 XSetWindowAttributes attributes; | |
1891 unsigned long attribute_mask; | |
1892 | |
1893 x_calc_absolute_position (f); | |
1848 | 1894 |
1849 attributes.background_pixel = f->display.x->background_pixel; | 1895 attributes.background_pixel = f->display.x->background_pixel; |
1850 attributes.border_pixel = f->display.x->border_pixel; | 1896 attributes.border_pixel = f->display.x->border_pixel; |
1851 attributes.bit_gravity = StaticGravity; | 1897 attributes.bit_gravity = StaticGravity; |
1852 attributes.backing_store = NotUseful; | 1898 attributes.backing_store = NotUseful; |
1884 f->display.x->wm_hints.flags |= InputHint; | 1930 f->display.x->wm_hints.flags |= InputHint; |
1885 XSetWMHints (x_current_display, FRAME_X_WINDOW (f), &f->display.x->wm_hints); | 1931 XSetWMHints (x_current_display, FRAME_X_WINDOW (f), &f->display.x->wm_hints); |
1886 XSetWMProtocols (x_current_display, FRAME_X_WINDOW (f), | 1932 XSetWMProtocols (x_current_display, FRAME_X_WINDOW (f), |
1887 &Xatom_wm_delete_window, 1); | 1933 &Xatom_wm_delete_window, 1); |
1888 | 1934 |
1889 #endif /* not USE_X_TOOLKIT */ | |
1890 | 1935 |
1891 /* x_set_name normally ignores requests to set the name if the | 1936 /* x_set_name normally ignores requests to set the name if the |
1892 requested name is the same as the current name. This is the one | 1937 requested name is the same as the current name. This is the one |
1893 place where that assumption isn't correct; f->name is set, but | 1938 place where that assumption isn't correct; f->name is set, but |
1894 the X server hasn't been told. */ | 1939 the X server hasn't been told. */ |
1908 UNBLOCK_INPUT; | 1953 UNBLOCK_INPUT; |
1909 | 1954 |
1910 if (FRAME_X_WINDOW (f) == 0) | 1955 if (FRAME_X_WINDOW (f) == 0) |
1911 error ("Unable to create window"); | 1956 error ("Unable to create window"); |
1912 } | 1957 } |
1958 | |
1959 #endif /* not USE_X_TOOLKIT */ | |
1913 | 1960 |
1914 /* Handle the icon stuff for this window. Perhaps later we might | 1961 /* Handle the icon stuff for this window. Perhaps later we might |
1915 want an x_set_icon_position which can be called interactively as | 1962 want an x_set_icon_position which can be called interactively as |
1916 well. */ | 1963 well. */ |
1917 | 1964 |