diff options
| author | Gerd Moellmann | 1999-08-18 12:04:53 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-08-18 12:04:53 +0000 |
| commit | 495fa05e41e1d9455b6f9e218d35a81b252e9542 (patch) | |
| tree | 276fcb96b18fff868979676e7e4131528d2ea068 /src | |
| parent | 5f999b0b9c2aa7e74533c644e1e49d0df3823a72 (diff) | |
| download | emacs-495fa05e41e1d9455b6f9e218d35a81b252e9542.tar.gz emacs-495fa05e41e1d9455b6f9e218d35a81b252e9542.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/src/xfns.c b/src/xfns.c index 5a1b201f0e6..835b36922cc 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3234,12 +3234,9 @@ x_window (f, window_prompting, minibuffer_only) | |||
| 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 */ |
| @@ -3747,6 +3744,9 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 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 |
| @@ -3754,16 +3754,20 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 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, |
| @@ -3785,30 +3789,35 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 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; |
| @@ -3827,6 +3836,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3827 | ; | 3836 | ; |
| 3828 | } | 3837 | } |
| 3829 | 3838 | ||
| 3839 | UNGCPRO; | ||
| 3830 | return unbind_to (count, frame); | 3840 | return unbind_to (count, frame); |
| 3831 | } | 3841 | } |
| 3832 | 3842 | ||