X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b57c1741abfb95da1dc6c165339551daff2ca3e1..20038f8ab75dd1551412a43cd58520c483c22921:/src/xterm.c diff --git a/src/xterm.c b/src/xterm.c index 28856cfe19..ada1160ec9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -95,10 +95,6 @@ along with GNU Emacs. If not, see . */ #endif #ifdef USE_X_TOOLKIT -#if !defined (NO_EDITRES) -#define HACK_EDITRES -extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *); -#endif /* not NO_EDITRES */ /* Include toolkit specific headers for the scroll bar widget. */ @@ -991,8 +987,7 @@ static void x_update_begin (struct frame *f) { #ifdef USE_CAIRO - if (! NILP (tip_frame) && XFRAME (tip_frame) == f - && ! FRAME_VISIBLE_P (f)) + if (FRAME_TOOLTIP_P (f) && ! FRAME_VISIBLE_P (f)) return; if (! FRAME_CR_SURFACE (f)) @@ -1062,7 +1057,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1) struct frame *f = XFRAME (WINDOW_FRAME (w)); struct face *face; - face = FACE_FROM_ID (f, VERTICAL_BORDER_FACE_ID); + face = FACE_FROM_ID_OR_NULL (f, VERTICAL_BORDER_FACE_ID); if (face) XSetForeground (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc, face->foreground); @@ -1081,9 +1076,11 @@ static void x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - struct face *face = FACE_FROM_ID (f, WINDOW_DIVIDER_FACE_ID); - struct face *face_first = FACE_FROM_ID (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID); - struct face *face_last = FACE_FROM_ID (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID); + struct face *face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID); + struct face *face_first + = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID); + struct face *face_last + = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID); unsigned long color = face ? face->foreground : FRAME_FOREGROUND_PIXEL (f); unsigned long color_first = (face_first ? face_first->foreground @@ -1505,7 +1502,7 @@ x_set_mouse_face_gc (struct glyph_string *s) /* What face has to be used last for the mouse face? */ face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id; - face = FACE_FROM_ID (s->f, face_id); + face = FACE_FROM_ID_OR_NULL (s->f, face_id); if (face == NULL) face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); @@ -2156,6 +2153,7 @@ static const XColor * x_color_cells (Display *dpy, int *ncells) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); + eassume (dpyinfo); if (dpyinfo->color_cells == NULL) { @@ -2352,17 +2350,19 @@ x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color) equal to a cached pixel color recorded earlier, there was a change in the colormap, so clear the color cache. */ struct x_display_info *dpyinfo = x_display_info_for_display (dpy); - XColor *cached_color; + eassume (dpyinfo); - if (dpyinfo->color_cells - && (cached_color = &dpyinfo->color_cells[color->pixel], - (cached_color->red != color->red - || cached_color->blue != color->blue - || cached_color->green != color->green))) + if (dpyinfo->color_cells) { - xfree (dpyinfo->color_cells); - dpyinfo->color_cells = NULL; - dpyinfo->ncolor_cells = 0; + XColor *cached_color = &dpyinfo->color_cells[color->pixel]; + if (cached_color->red != color->red + || cached_color->blue != color->blue + || cached_color->green != color->green) + { + xfree (dpyinfo->color_cells); + dpyinfo->color_cells = NULL; + dpyinfo->ncolor_cells = 0; + } } } @@ -7605,7 +7605,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, goto done; } -#ifdef HACK_EDITRES +#ifdef X_TOOLKIT_EDITRES if (event->xclient.message_type == dpyinfo->Xatom_editres) { f = any; @@ -7614,7 +7614,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, NULL, (XEvent *) event, NULL); goto done; } -#endif /* HACK_EDITRES */ +#endif /* X_TOOLKIT_EDITRES */ if (event->xclient.message_type == dpyinfo->Xatom_DONE || event->xclient.message_type == dpyinfo->Xatom_PAGE) @@ -7838,11 +7838,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, case UnmapNotify: /* Redo the mouse-highlight after the tooltip has gone. */ - if (event->xunmap.window == tip_window) - { - tip_window = 0; - x_redo_mouse_highlight (dpyinfo); - } + if (dpyinfo->x_tooltip_frame + && FRAME_X_WINDOW (dpyinfo->x_tooltip_frame) == event->xunmap.window) + x_redo_mouse_highlight (dpyinfo); f = x_top_window_to_frame (dpyinfo, event->xunmap.window); if (f) /* F may no longer exist if @@ -8432,7 +8430,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, #ifdef USE_X_TOOLKIT /* Tip frames are pure X window, set size for them. */ - if (! NILP (tip_frame) && XFRAME (tip_frame) == f) + if (FRAME_TOOLTIP_P (f)) { if (FRAME_PIXEL_HEIGHT (f) != configureEvent.xconfigure.height || FRAME_PIXEL_WIDTH (f) != configureEvent.xconfigure.width) @@ -9388,7 +9386,7 @@ static char *error_msg; /* Handle the loss of connection to display DPY. ERROR_MESSAGE is the text of an error message that lead to the connection loss. */ -static void +static _Noreturn void x_connection_closed (Display *dpy, const char *error_message, bool ioerror) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); @@ -9486,9 +9484,6 @@ For details, see etc/PROBLEMS.\n", unbind_to (idx, Qnil); clear_waiting_for_input (); - /* Tell GCC not to suggest attribute 'noreturn' for this function. */ - IF_LINT (if (! terminal_list) return; ) - /* Here, we absolutely have to use a non-local exit (e.g. signal, throw, longjmp), because returning from this function would get us back into Xlib's code which will directly call `exit'. */ @@ -9554,7 +9549,7 @@ x_error_quitter (Display *display, XErrorEvent *event) It kills all frames on the display that we lost touch with. If that was the only one, it prints an error message and kills Emacs. */ -static int +static _Noreturn int x_io_error_quitter (Display *display) { char buf[256]; @@ -9562,7 +9557,7 @@ x_io_error_quitter (Display *display) snprintf (buf, sizeof buf, "Connection lost to X server '%s'", DisplayString (display)); x_connection_closed (display, buf, true); - return 0; + assume (false); } /* Changing the font of the frame. */ @@ -9616,7 +9611,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) /* Don't change the size of a tip frame; there's no point in doing it because it's done in Fx_show_tip, and it leads to problems because the tip frame has no widget. */ - if (NILP (tip_frame) || XFRAME (tip_frame) != f) + if (!FRAME_TOOLTIP_P (f)) { adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, @@ -10691,7 +10686,7 @@ x_set_window_size (struct frame *f, bool change_gravity, /* The following breaks our calculations. If it's really needed, think of something else. */ #if false - if (NILP (tip_frame) || XFRAME (tip_frame) != f) + if (!FRAME_TOOLTIP_P (f)) { int text_width, text_height; @@ -11342,6 +11337,8 @@ x_free_frame_resources (struct frame *f) dpyinfo->x_focus_event_frame = 0; if (f == dpyinfo->x_highlight_frame) dpyinfo->x_highlight_frame = 0; + if (f == dpyinfo->x_tooltip_frame) + dpyinfo->x_tooltip_frame = 0; if (f == hlinfo->mouse_face_mouse_frame) reset_mouse_highlight (hlinfo);