X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a3f1b3d53032adbbccbfba8de6d2a70fe7211de3..d3155315c85212f224fc5df0239182dafdfd6284:/src/xterm.c?ds=sidebyside diff --git a/src/xterm.c b/src/xterm.c index 6e7ef366d5..4f5dfed9ae 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -214,34 +214,16 @@ enum xembed_message XEMBED_ACTIVATE_ACCELERATOR = 14 }; +static void x_free_cr_resources (struct frame *); static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *); -static void x_set_window_size_1 (struct frame *, bool, int, int); static void x_raise_frame (struct frame *); static void x_lower_frame (struct frame *); -static const XColor *x_color_cells (Display *, int *); static int x_io_error_quitter (Display *); static struct terminal *x_create_terminal (struct x_display_info *); -static void x_update_end (struct frame *); -static void XTframe_up_to_date (struct frame *); -static void x_clear_area1 (Display *, Window, int, int, int, int, int); -static void x_clear_frame (struct frame *); -static _Noreturn void x_ins_del_lines (struct frame *, int, int); -static void frame_highlight (struct frame *); -static void frame_unhighlight (struct frame *); -static void x_new_focus_frame (struct x_display_info *, struct frame *); -static void x_focus_changed (int, int, struct x_display_info *, - struct frame *, struct input_event *); -static void XTframe_rehighlight (struct frame *); static void x_frame_rehighlight (struct x_display_info *); -static void x_draw_hollow_cursor (struct window *, struct glyph_row *); -static void x_draw_bar_cursor (struct window *, struct glyph_row *, int, - enum text_cursor_kinds); static void x_clip_to_row (struct window *, struct glyph_row *, enum glyph_row_area, GC); -static void x_flush (struct frame *f); -static void x_update_begin (struct frame *); -static void x_update_window_begin (struct window *); static struct scroll_bar *x_window_to_scroll_bar (Display *, Window, int); static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, enum scroll_bar_part *, @@ -261,9 +243,6 @@ static int handle_one_xevent (struct x_display_info *, #if ! (defined USE_X_TOOLKIT || defined USE_MOTIF) static int x_dispatch_event (XEvent *, Display *); #endif -/* Don't declare this _Noreturn because we want no - interference with debugging failing X calls. */ -static void x_connection_closed (Display *, const char *); static void x_wm_set_window_state (struct frame *, int); static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t); static void x_initialize (void); @@ -329,21 +308,7 @@ record_event (char *locus, int type) #endif -static void x_free_cr_resources (struct frame *); -static void x_set_clip_rectangles (struct frame *, GC, XRectangle *, int); -static void x_reset_clip_rectangles (struct frame *, GC); -static void x_fill_rectangle (struct frame *, GC, int, int, int, int); -static void x_draw_rectangle (struct frame *, GC, int, int, int, int); -static void x_fill_trapezoid_for_relief (struct frame *, GC, int, int, - int, int, int); -static void x_clear_window (struct frame *); - #ifdef USE_CAIRO -static struct x_gc_ext_data *x_gc_get_ext_data (struct frame *, GC, int); -static void x_extension_initialize (struct x_display_info *); -static cairo_status_t x_cr_accumulate_data (void *, - const unsigned char *, - unsigned int); #define FRAME_CR_CONTEXT(f) ((f)->output_data.x->cr_context) #define FRAME_CR_SURFACE(f) ((f)->output_data.x->cr_surface) @@ -1955,7 +1920,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) { sprintf (buf, "%0*X", glyph->u.glyphless.ch < 0x10000 ? 4 : 6, - glyph->u.glyphless.ch); + glyph->u.glyphless.ch + 0u); str = buf; } @@ -2048,9 +2013,9 @@ x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap static XtConvertArgRec cvt_string_to_pixel_args[] = { - {XtWidgetBaseOffset, (XtPointer) XtOffset (Widget, core.screen), + {XtWidgetBaseOffset, (XtPointer) offsetof (WidgetRec, core.screen), sizeof (Screen *)}, - {XtWidgetBaseOffset, (XtPointer) XtOffset (Widget, core.colormap), + {XtWidgetBaseOffset, (XtPointer) offsetof (WidgetRec, core.colormap), sizeof (Colormap)} }; @@ -3664,7 +3629,9 @@ x_draw_glyph_string (struct glyph_string *s) static void x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by) { - x_free_cr_resources (f); +/* Never called on a GUI frame, see + http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00456.html +*/ XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f), f->output_data.x->normal_gc, x, y, width, height, @@ -6434,7 +6401,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, x_clear_area1 (FRAME_X_DISPLAY (f), w, VERTICAL_SCROLL_BAR_LEFT_BORDER, VERTICAL_SCROLL_BAR_TOP_BORDER, - inside_width, start); + inside_width, start, False); /* Change to proper foreground color if one is specified. */ if (f->output_data.x->scroll_bar_foreground_pixel != -1) @@ -6459,7 +6426,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, x_clear_area1 (FRAME_X_DISPLAY (f), w, VERTICAL_SCROLL_BAR_LEFT_BORDER, VERTICAL_SCROLL_BAR_TOP_BORDER + end, - inside_width, inside_height - end); + inside_width, inside_height - end, False); } unblock_input (); @@ -6693,8 +6660,7 @@ XTset_horizontal_scroll_bar (struct window *w, int portion, int whole, int posit int area_height = WINDOW_CONFIG_SCROLL_BAR_HEIGHT (w); int rest = area_height - height; if (rest > 0 && width > 0) - x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - left, top, width, rest); + x_clear_area (f, left, top, width, rest); } /* Move/size the scroll bar window. */ @@ -7845,17 +7811,18 @@ handle_one_xevent (struct x_display_info *dpyinfo, f = any; -#if ! defined (USE_GTK) /* If mouse-highlight is an integer, input clears out mouse highlighting. */ if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) +#if ! defined (USE_GTK) && (f == 0 - || !EQ (f->tool_bar_window, hlinfo->mouse_face_window))) + || !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) +#endif + ) { clear_mouse_face (hlinfo); hlinfo->mouse_face_hidden = true; } -#endif #if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS if (f == 0) @@ -8324,7 +8291,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, { xg_frame_resized (f, event->xconfigure.width, event->xconfigure.height); +#ifdef USE_CAIRO x_cr_destroy_surface (f); +#endif f = 0; } #endif @@ -9249,7 +9218,7 @@ static char *error_msg; the text of an error message that lead to the connection loss. */ static void -x_connection_closed (Display *dpy, const char *error_message) +x_connection_closed (Display *dpy, const char *error_message, bool ioerror) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); Lisp_Object frame, tail; @@ -9268,6 +9237,7 @@ x_connection_closed (Display *dpy, const char *error_message) dpyinfo->reference_count++; dpyinfo->terminal->reference_count++; } + if (ioerror) dpyinfo->display = 0; /* First delete frames whose mini-buffers are on frames that are on the dead display. */ @@ -9405,7 +9375,7 @@ x_error_quitter (Display *display, XErrorEvent *event) XGetErrorText (display, event->error_code, buf, sizeof (buf)); sprintf (buf1, "X protocol error: %s on protocol request %d", buf, event->request_code); - x_connection_closed (display, buf1); + x_connection_closed (display, buf1, false); } @@ -9420,7 +9390,7 @@ x_io_error_quitter (Display *display) snprintf (buf, sizeof buf, "Connection lost to X server `%s'", DisplayString (display)); - x_connection_closed (display, buf); + x_connection_closed (display, buf, true); return 0; } @@ -12251,7 +12221,7 @@ static struct redisplay_interface x_redisplay_interface = x_draw_window_cursor, x_draw_vertical_window_border, x_draw_window_divider, - x_shift_glyphs_for_insert, + x_shift_glyphs_for_insert, /* Never called; see comment in function. */ x_show_hourglass, x_hide_hourglass };