diff options
Diffstat (limited to 'src/xfns.c')
-rw-r--r-- | src/xfns.c | 73 |
1 files changed, 54 insertions, 19 deletions
diff --git a/src/xfns.c b/src/xfns.c index aa66c017f3c..2fe08e0a458 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -48,6 +48,7 @@ Boston, MA 02111-1307, USA. */ #include "systime.h" #include "termhooks.h" #include "atimer.h" +#include "termchar.h" #ifdef HAVE_X_WINDOWS @@ -260,6 +261,17 @@ check_x_display_info (frame) else error ("X windows are not in use or not initialized"); } + else if (INTEGERP (frame)) + { + struct display *d = get_display (XINT (frame)); + + if (!d) + wrong_type_argument (Qdisplay_live_p, frame); + if (d->type != output_x_window) + error ("Display %d is not an X display", XINT (frame)); + + dpyinfo = d->display_info.x; + } else if (STRINGP (frame)) dpyinfo = x_display_info_for_name (frame); else @@ -1383,10 +1395,8 @@ x_set_tool_bar_lines (f, value, oldval) below the menu bar. */ if (FRAME_X_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0) { - updating_frame = f; - clear_frame (); + clear_frame (f); clear_current_matrices (f); - updating_frame = NULL; } /* If the tool bar gets smaller, the internal border below it @@ -1433,10 +1443,10 @@ x_set_scroll_bar_foreground (f, value, oldval) if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f)) { /* Remove all scroll bars because they have wrong colors. */ - if (condemn_scroll_bars_hook) - (*condemn_scroll_bars_hook) (f); - if (judge_scroll_bars_hook) - (*judge_scroll_bars_hook) (f); + if (FRAME_DISPLAY (f)->condemn_scroll_bars_hook) + (*FRAME_DISPLAY (f)->condemn_scroll_bars_hook) (f); + if (FRAME_DISPLAY (f)->judge_scroll_bars_hook) + (*FRAME_DISPLAY (f)->judge_scroll_bars_hook) (f); update_face_from_frame_parameter (f, Qscroll_bar_foreground, value); redraw_frame (f); @@ -1482,10 +1492,10 @@ x_set_scroll_bar_background (f, value, oldval) if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f)) { /* Remove all scroll bars because they have wrong colors. */ - if (condemn_scroll_bars_hook) - (*condemn_scroll_bars_hook) (f); - if (judge_scroll_bars_hook) - (*judge_scroll_bars_hook) (f); + if (FRAME_DISPLAY (f)->condemn_scroll_bars_hook) + (*FRAME_DISPLAY (f)->condemn_scroll_bars_hook) (f); + if (FRAME_DISPLAY (f)->judge_scroll_bars_hook) + (*FRAME_DISPLAY (f)->judge_scroll_bars_hook) (f); update_face_from_frame_parameter (f, Qscroll_bar_background, value); redraw_frame (f); @@ -2900,13 +2910,13 @@ This function is an internal primitive--use `make-frame' instead. */) Lisp_Object parent; struct kboard *kb; - check_x (); - /* Use this general default value to start with until we know if this frame has a specified name. */ Vx_resource_name = Vinvocation_name; - display = x_get_arg (dpyinfo, parms, Qdisplay, 0, 0, RES_TYPE_STRING); + display = x_get_arg (dpyinfo, parms, Qdisplay_id, 0, 0, RES_TYPE_NUMBER); + if (EQ (display, Qunbound)) + display = x_get_arg (dpyinfo, parms, Qdisplay, 0, 0, RES_TYPE_STRING); if (EQ (display, Qunbound)) display = Qnil; dpyinfo = check_x_display_info (display); @@ -2956,6 +2966,9 @@ This function is an internal primitive--use `make-frame' instead. */) /* Note that X Windows does support scroll bars. */ FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; + f->display = dpyinfo->frame_display; + f->display->reference_count++; + f->output_method = output_x_window; f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); bzero (f->output_data.x, sizeof (struct x_output)); @@ -3045,6 +3058,8 @@ This function is an internal primitive--use `make-frame' instead. */) specbind (Qx_resource_name, name); } + Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qx), Qnil)); + /* Extract the window parameters from the supplied values that are needed to determine window geometry. */ { @@ -3846,8 +3861,10 @@ x_display_info_for_name (name) CHECK_STRING (name); - if (! EQ (Vwindow_system, intern ("x"))) - error ("Not using X Windows"); +#if 0 + if (! EQ (Vinitial_window_system, intern ("x"))) + error ("Not using X Windows"); /* That doesn't stop us anymore. */ +#endif for (dpyinfo = x_display_list, names = x_display_name_list; dpyinfo; @@ -3894,8 +3911,10 @@ terminate Emacs if we can't open the connection. */) if (! NILP (xrm_string)) CHECK_STRING (xrm_string); - if (! EQ (Vwindow_system, intern ("x"))) - error ("Not using X Windows"); +#if 0 + if (! EQ (Vinitial_window_system, intern ("x"))) + error ("Not using X Windows"); /* That doesn't stop us anymore. */ +#endif if (! NILP (xrm_string)) xrm_option = (unsigned char *) SDATA (xrm_string); @@ -4487,6 +4506,7 @@ x_create_tip_frame (dpyinfo, parms, text) && !EQ (name, Qunbound) && !NILP (name)) error ("Invalid frame name--not a string or nil"); + Vx_resource_name = name; frame = Qnil; @@ -4508,6 +4528,9 @@ x_create_tip_frame (dpyinfo, parms, text) FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; record_unwind_protect (unwind_create_tip_frame, frame); + f->display = dpyinfo->frame_display; + f->display->reference_count++; + /* By setting the output method, we're essentially saying that the frame is live, as per FRAME_LIVE_P. If we get a signal from this point on, x_destroy_window might screw up reference @@ -4541,6 +4564,16 @@ x_create_tip_frame (dpyinfo, parms, text) Lisp_Object black; struct gcpro gcpro1; + /* Function x_decode_color can signal an error. Make + sure to initialize color slots so that we won't try + to free colors we haven't allocated. */ + f->output_data.x->foreground_pixel = -1; + f->output_data.x->background_pixel = -1; + f->output_data.x->cursor_pixel = -1; + f->output_data.x->cursor_foreground_pixel = -1; + f->output_data.x->border_pixel = -1; + f->output_data.x->mouse_pixel = -1; + black = build_string ("black"); GCPRO1 (black); f->output_data.x->foreground_pixel @@ -4616,7 +4649,7 @@ x_create_tip_frame (dpyinfo, parms, text) x_default_parameter (f, parms, Qborder_width, make_number (2), "borderWidth", "BorderWidth", RES_TYPE_NUMBER); - /* This defaults to 2 in order to match xterm. We recognize either + /* This defaults to 1 in order to match xterm. We recognize either internalBorderWidth or internalBorder (which is what xterm calls it). */ if (NILP (Fassq (Qinternal_border_width, parms))) @@ -4731,6 +4764,8 @@ x_create_tip_frame (dpyinfo, parms, text) Qnil)); } + Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qx), Qnil)); + f->no_split = 1; UNGCPRO; |