comparison src/xfns.c @ 6604:bb11213734d6

(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only. Don't pass top_pos and left_pos to XtCreatePopupShell. Call initialize_frame_menubar before creating the Emacs frame if it is not the minibuffer. Call XtManageChild for the menubar widget if any. Compute some geometry management. (Fx_create_frame): Pass window_prompting and minibuffer_only to x_window. Don't call x_wm_set_size_hint. Don't call initialize_frame_menubar.
author Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
date Thu, 31 Mar 1994 14:49:42 +0000
parents d9d9ab5951dd
children 35e857d14d40
comparison
equal deleted inserted replaced
6603:ec7c89180b65 6604:bb11213734d6
1697 #endif 1697 #endif
1698 1698
1699 /* Create and set up the X window or widget for frame F. */ 1699 /* Create and set up the X window or widget for frame F. */
1700 1700
1701 static void 1701 static void
1702 #ifdef USE_X_TOOLKIT
1703 x_window (f, window_prompting, minibuffer_only)
1704 struct frame *f;
1705 long window_prompting;
1706 int minibuffer_only;
1707 #else /* not USE_X_TOOLKIT */
1702 x_window (f) 1708 x_window (f)
1703 struct frame *f; 1709 struct frame *f;
1710 #endif /* not USE_X_TOOLKIT */
1704 { 1711 {
1705 XClassHint class_hints; 1712 XClassHint class_hints;
1706 XSetWindowAttributes attributes; 1713 XSetWindowAttributes attributes;
1707 unsigned long attribute_mask; 1714 unsigned long attribute_mask;
1708 1715
1722 name = "emacs"; 1729 name = "emacs";
1723 1730
1724 ac = 0; 1731 ac = 0;
1725 XtSetArg (al[ac], XtNallowShellResize, 1); ac++; 1732 XtSetArg (al[ac], XtNallowShellResize, 1); ac++;
1726 XtSetArg (al[ac], XtNinput, 1); ac++; 1733 XtSetArg (al[ac], XtNinput, 1); ac++;
1727 XtSetArg (al[ac], XtNx, f->display.x->left_pos); ac++;
1728 XtSetArg (al[ac], XtNy, f->display.x->top_pos); ac++;
1729 shell_widget = XtCreatePopupShell ("shell", 1734 shell_widget = XtCreatePopupShell ("shell",
1730 topLevelShellWidgetClass, 1735 topLevelShellWidgetClass,
1731 Xt_app_shell, al, ac); 1736 Xt_app_shell, al, ac);
1732 1737
1738 f->display.x->widget = shell_widget;
1733 /* maybe_set_screen_title_format (shell_widget); */ 1739 /* maybe_set_screen_title_format (shell_widget); */
1734 1740
1735 1741
1736 ac = 0; 1742 ac = 0;
1737 XtSetArg (al[ac], XtNborderWidth, 0); ac++; 1743 XtSetArg (al[ac], XtNborderWidth, 0); ac++;
1738 pane_widget = XtCreateWidget ("pane", 1744 pane_widget = XtCreateWidget ("pane",
1739 panedWidgetClass, 1745 panedWidgetClass,
1740 shell_widget, al, ac); 1746 shell_widget, al, ac);
1747
1748 f->display.x->column_widget = pane_widget;
1749
1750 if (!minibuffer_only)
1751 initialize_frame_menubar (f);
1741 1752
1742 /* mappedWhenManaged to false tells to the paned window to not map/unmap 1753 /* mappedWhenManaged to false tells to the paned window to not map/unmap
1743 * the emacs screen when changing menubar. This reduces flickering a lot. 1754 * the emacs screen when changing menubar. This reduces flickering a lot.
1744 */ 1755 */
1745 1756
1752 screen_widget = XtCreateWidget (name, 1763 screen_widget = XtCreateWidget (name,
1753 emacsFrameClass, 1764 emacsFrameClass,
1754 pane_widget, al, ac); 1765 pane_widget, al, ac);
1755 1766
1756 f->display.x->edit_widget = screen_widget; 1767 f->display.x->edit_widget = screen_widget;
1757 f->display.x->widget = shell_widget;
1758 f->display.x->column_widget = pane_widget;
1759 1768
1769 if (f->display.x->menubar_widget)
1770 XtManageChild (f->display.x->menubar_widget);
1760 XtManageChild (screen_widget); 1771 XtManageChild (screen_widget);
1772
1773 /* Do some needed geometry management. */
1774 {
1775 int len;
1776 char *tem, shell_position[32];
1777 Arg al[2];
1778 int ac = 0;
1779
1780 if (window_prompting & USPosition)
1781 sprintf (shell_position, "=%dx%d%c%d%c%d", PIXEL_WIDTH (f),
1782 PIXEL_HEIGHT (f) + f->display.x->menubar_widget->core.height
1783 + f->display.x->menubar_widget->core.border_width,
1784 '+', f->display.x->left_pos,
1785 '+', f->display.x->top_pos);
1786 else
1787 sprintf (shell_position, "=%dx%d", PIXEL_WIDTH (f),
1788 PIXEL_HEIGHT (f) + f->display.x->menubar_widget->core.height
1789 + f->display.x->menubar_widget->core.border_width);
1790 len = strlen (shell_position) + 1;
1791 tem = (char *) xmalloc (len);
1792 strncpy (tem, shell_position, len);
1793 XtSetArg (al[ac], XtNgeometry, tem); ac++;
1794 XtSetValues (shell_widget, al, ac);
1795 }
1796
1797
1761 XtManageChild (pane_widget); 1798 XtManageChild (pane_widget);
1762 XtRealizeWidget (shell_widget); 1799 XtRealizeWidget (shell_widget);
1763 1800
1764 FRAME_X_WINDOW (f) = XtWindow (screen_widget); 1801 FRAME_X_WINDOW (f) = XtWindow (screen_widget);
1765 1802
2095 "borderColor", "BorderColor", string); 2132 "borderColor", "BorderColor", string);
2096 2133
2097 f->display.x->parent_desc = ROOT_WINDOW; 2134 f->display.x->parent_desc = ROOT_WINDOW;
2098 window_prompting = x_figure_window_size (f, parms); 2135 window_prompting = x_figure_window_size (f, parms);
2099 2136
2137 #ifdef USE_X_TOOLKIT
2138 x_window (f, window_prompting, minibuffer_only);
2139 #else
2100 x_window (f); 2140 x_window (f);
2141 #endif
2101 x_icon (f, parms); 2142 x_icon (f, parms);
2102 x_make_gc (f); 2143 x_make_gc (f);
2103 init_frame_faces (f); 2144 init_frame_faces (f);
2104 2145
2105 /* We need to do this after creating the X window, so that the 2146 /* We need to do this after creating the X window, so that the
2123 change_frame_size (f, height, width, 1, 0); 2164 change_frame_size (f, height, width, 1, 0);
2124 2165
2125 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (0), 2166 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (0),
2126 "menuBarLines", "MenuBarLines", number); 2167 "menuBarLines", "MenuBarLines", number);
2127 2168
2169 /* With the toolkit, the geometry management is done in x_window. */
2170 #ifndef USE_X_TOOLKIT
2128 tem0 = x_get_arg (parms, Qleft, 0, 0, number); 2171 tem0 = x_get_arg (parms, Qleft, 0, 0, number);
2129 tem1 = x_get_arg (parms, Qtop, 0, 0, number); 2172 tem1 = x_get_arg (parms, Qtop, 0, 0, number);
2130 BLOCK_INPUT; 2173 BLOCK_INPUT;
2131 x_wm_set_size_hint (f, window_prompting, 1, XINT (tem0), XINT (tem1)); 2174 x_wm_set_size_hint (f, window_prompting, 1, XINT (tem0), XINT (tem1));
2132 UNBLOCK_INPUT; 2175 UNBLOCK_INPUT;
2176 #endif /* USE_X_TOOLKIT */
2133 2177
2134 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean); 2178 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean);
2135 f->no_split = minibuffer_only || EQ (tem, Qt); 2179 f->no_split = minibuffer_only || EQ (tem, Qt);
2136 2180
2137 /* It is now ok to make the frame official 2181 /* It is now ok to make the frame official
2138 even if we get an error below. 2182 even if we get an error below.
2139 And the frame needs to be on Vframe_list 2183 And the frame needs to be on Vframe_list
2140 or making it visible won't work. */ 2184 or making it visible won't work. */
2141 Vframe_list = Fcons (frame, Vframe_list); 2185 Vframe_list = Fcons (frame, Vframe_list);
2142
2143 #ifdef USE_X_TOOLKIT
2144 /* Compute the size of the menubar and display it. */
2145 initialize_frame_menubar (f);
2146 #endif /* USE_X_TOOLKIT */
2147 2186
2148 /* Make the window appear on the frame and enable display, 2187 /* Make the window appear on the frame and enable display,
2149 unless the caller says not to. */ 2188 unless the caller says not to. */
2150 { 2189 {
2151 Lisp_Object visibility; 2190 Lisp_Object visibility;