comparison src/xfns.c @ 25320:107c9221181c

(x_window) [USE_X_TOOLKIT]: Remove test for FRAME_X_WINDOW (f) being null at the of the function. If widgets cannot be created we will already have crashed earlier. Call lw_set_main_areas with a null menu-bar widget, so that we have a reasonable default. (Fx_create_frame): Rearranged so that Lisp errors during frame initialization cause less damage. Initialize menu bar widget here.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 18 Aug 1999 12:04:53 +0000
parents 64b742df49ca
children 2de1796b006b
comparison
equal deleted inserted replaced
25319:f9b3511a51c4 25320:107c9221181c
3232 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 3232 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
3233 f->output_data.x->text_cursor); 3233 f->output_data.x->text_cursor);
3234 3234
3235 UNBLOCK_INPUT; 3235 UNBLOCK_INPUT;
3236 3236
3237 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) 3237 /* This is a no-op, except under Motif. Make sure main areas are
3238 initialize_frame_menubar (f); 3238 set to something reasonable, in case we get an error later. */
3239 lw_set_main_areas (pane_widget, f->output_data.x->menubar_widget, frame_widget); 3239 lw_set_main_areas (pane_widget, 0, frame_widget);
3240
3241 if (FRAME_X_WINDOW (f) == 0)
3242 error ("Unable to create window");
3243 } 3240 }
3244 3241
3245 #else /* not USE_X_TOOLKIT */ 3242 #else /* not USE_X_TOOLKIT */
3246 3243
3247 /* Create and set up the X window for frame F. */ 3244 /* Create and set up the X window for frame F. */
3745 f->output_data.x->win_gravity = NorthWestGravity; 3742 f->output_data.x->win_gravity = NorthWestGravity;
3746 } 3743 }
3747 3744
3748 f->output_data.x->size_hint_flags = window_prompting; 3745 f->output_data.x->size_hint_flags = window_prompting;
3749 3746
3747 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
3748 f->no_split = minibuffer_only || EQ (tem, Qt);
3749
3750 /* Create the X widget or window. Add the toolbar height to the 3750 /* Create the X widget or window. Add the toolbar height to the
3751 initial frame height so that the user gets a text display area of 3751 initial frame height so that the user gets a text display area of
3752 the size he specified with -g or via .Xdefaults. Later changes 3752 the size he specified with -g or via .Xdefaults. Later changes
3753 of the toolbar height don't change the frame size. This is done 3753 of the toolbar height don't change the frame size. This is done
3754 so that users can create tall Emacs frames without having to 3754 so that users can create tall Emacs frames without having to
3755 guess how tall the toolbar will get. */ 3755 guess how tall the toolbar will get. */
3756 f->height += FRAME_TOOLBAR_LINES (f); 3756 f->height += FRAME_TOOLBAR_LINES (f);
3757
3757 #ifdef USE_X_TOOLKIT 3758 #ifdef USE_X_TOOLKIT
3758 x_window (f, window_prompting, minibuffer_only); 3759 x_window (f, window_prompting, minibuffer_only);
3759 #else 3760 #else
3760 x_window (f); 3761 x_window (f);
3761 #endif 3762 #endif
3763
3762 x_icon (f, parms); 3764 x_icon (f, parms);
3763 x_make_gc (f); 3765 x_make_gc (f);
3764 3766
3765 call1 (Qface_set_after_frame_default, frame); 3767 /* Now consider the frame official. */
3766 3768 FRAME_X_DISPLAY_INFO (f)->reference_count++;
3769 Vframe_list = Fcons (frame, Vframe_list);
3770
3767 /* We need to do this after creating the X window, so that the 3771 /* We need to do this after creating the X window, so that the
3768 icon-creation functions can say whose icon they're describing. */ 3772 icon-creation functions can say whose icon they're describing. */
3769 x_default_parameter (f, parms, Qicon_type, Qnil, 3773 x_default_parameter (f, parms, Qicon_type, Qnil,
3770 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); 3774 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL);
3771 3775
3783 height = f->height; 3787 height = f->height;
3784 f->height = 0; 3788 f->height = 0;
3785 SET_FRAME_WIDTH (f, 0); 3789 SET_FRAME_WIDTH (f, 0);
3786 change_frame_size (f, height, width, 1, 0); 3790 change_frame_size (f, height, width, 1, 0);
3787 3791
3788 /* Tell the server what size and position, etc, we want, 3792 /* Set up faces after all frame parameters are known. */
3789 and how badly we want them. */ 3793 call1 (Qface_set_after_frame_default, frame);
3794
3795 #ifdef USE_X_TOOLKIT
3796 /* Create the menu bar. */
3797 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
3798 {
3799 /* If this signals an error, we haven't set size hints for the
3800 frame and we didn't make it visible. */
3801 initialize_frame_menubar (f);
3802
3803 /* This is a no-op, except under Motif where it arranges the
3804 main window for the widgets on it. */
3805 lw_set_main_areas (f->output_data.x->column_widget,
3806 f->output_data.x->menubar_widget,
3807 f->output_data.x->edit_widget);
3808 }
3809 #endif /* USE_X_TOOLKIT */
3810
3811 /* Tell the server what size and position, etc, we want, and how
3812 badly we want them. This should be done after we have the menu
3813 bar so that its size can be taken into account. */
3790 BLOCK_INPUT; 3814 BLOCK_INPUT;
3791 x_wm_set_size_hint (f, window_prompting, 0); 3815 x_wm_set_size_hint (f, window_prompting, 0);
3792 UNBLOCK_INPUT; 3816 UNBLOCK_INPUT;
3793 3817
3794 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); 3818 /* Make the window appear on the frame and enable display, unless
3795 f->no_split = minibuffer_only || EQ (tem, Qt); 3819 the caller says not to. However, with explicit parent, Emacs
3796 3820 cannot control visibility, so don't try. */
3797 UNGCPRO;
3798
3799 /* It is now ok to make the frame official
3800 even if we get an error below.
3801 And the frame needs to be on Vframe_list
3802 or making it visible won't work. */
3803 Vframe_list = Fcons (frame, Vframe_list);
3804
3805 /* Now that the frame is official, it counts as a reference to
3806 its display. */
3807 FRAME_X_DISPLAY_INFO (f)->reference_count++;
3808
3809 /* Make the window appear on the frame and enable display,
3810 unless the caller says not to. However, with explicit parent,
3811 Emacs cannot control visibility, so don't try. */
3812 if (! f->output_data.x->explicit_parent) 3821 if (! f->output_data.x->explicit_parent)
3813 { 3822 {
3814 Lisp_Object visibility; 3823 Lisp_Object visibility;
3815 3824
3816 visibility = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, 3825 visibility = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0,
3825 else 3834 else
3826 /* Must have been Qnil. */ 3835 /* Must have been Qnil. */
3827 ; 3836 ;
3828 } 3837 }
3829 3838
3839 UNGCPRO;
3830 return unbind_to (count, frame); 3840 return unbind_to (count, frame);
3831 } 3841 }
3832 3842
3833 /* FRAME is used only to get a handle on the X display. We don't pass the 3843 /* FRAME is used only to get a handle on the X display. We don't pass the
3834 display info directly because we're called from frame.c, which doesn't 3844 display info directly because we're called from frame.c, which doesn't