summaryrefslogtreecommitdiff
path: root/src/xterm.c
Commit message (Collapse)AuthorAgeFilesLines
* Rework C source files to avoid ^(Paul Eggert2016-03-101-2/+2
| | | | | | | | Work around Bug#22884 by rewording comments and strings to avoid ‘(’ at the start of a line unless it starts a function. This change is a short-term hack; in the longer run we plan to fix cc-mode’s performance for C files that have ‘(’ at the start of a line in a comment or string.
* Pacify --enable-gcc-warnings --with-cairoPaul Eggert2016-01-231-3/+2
| | | | | | | | | | | | | | | | | Problem reported by Alexander Kuleshov in: http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg01289.html * src/gtkutil.c (xg_get_page_setup): Use switch rather than if-then-else. * src/image.c (COLOR_TABLE_SUPPORT): Define directly rather than via #define and optional later #undef. (lookup_rgb_color) [USE_CAIRO && ENABLE_CHECKING]: Crash when the pixel is undefined, as there is a genuine bug here (Bug#22442). * src/image.c (tiff_load, gif_load, svg_load_image) (x_kill_gs_process) [USE_CAIRO]: * src/xterm.c (x_draw_fringe_bitmap) [USE_CAIRO]: Omit unused locals, or move them to where they’re needed. (x_clear_area1): Now ATTRIBUTE_UNUSED.
* xwidgets style cleanupPaul Eggert2016-01-221-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjust the newly-added Xwidgets code so that it uses a more-typical Emacs style. This should not affect behavior, except that in a few places it adds runtime checks that Lisp arguments are of the proper type, and in one place it uses more-precise arithmetic. * src/buffer.c, src/dispnew.c, src/emacs.c, src/emacsgtkfixed.c: * src/emacs.c, src/print.c, src/window.c, src/xdisp.c, src/xterm.c: Include xwidget.h unconditionally. * src/buffer.c (Fkill_buffer): * src/dispnew.c (update_window): * src/emacs.c (main): * src/print.c (print_object): * src/window.c (Fdelete_window_internal): * src/xdisp.c (handle_single_display_spec, push_it, pop_it) (get_next_element, set_iterator_to_next, next_element_from_xwidget) (dump_glyph, calc_pixel_width_or_height, BUILD_GLYPH_STRINGS_XW) (BUILD_GLYPH_STRINGS, x_produce_glyphs, get_window_cursor_type): * src/xterm.c (x_draw_glyph_string, x_draw_bar_cursor): Call xwidget functions and macros without worrying about HAVE_XWIDGETS when the code is a no-op on non-xwidget platforms. * src/dispextern.h (XWIDGET_GLYPH, struct glyph_string.xwidget) (IT_XWIDGET, GET_FROM_XWIDGET, struct it.u.xwidget) (struct it.xwidget): * src/lisp.h (PVEC_XWIDGET, PVEC_XWIDGET_VIEW): Always define. * src/emacsgtkfixed.h: Omit unnecessary comment. * src/keyboard.c: Fix spacing. * src/xdisp.c (BUILD_XWIDGET_GLYPH_STRING, produce_xwidget_glyph): Define to be a no-op if not HAVE_XWIDGETS. * src/xwidget.c: Include xwidget.h first (after config.h) to make sure that it can stand by itself. (Fmake_xwidget, Fxwidget_webkit_execute_script): Fix typo in doc string. (Fmake_xwidget): Check type of args. (Fmake_xwidget, offscreen_damage_event) (webkit_document_load_finished_cb, webkit_download_cb) (webkit_new_window_policy_decision_requested_cb) (webkit_navigation_policy_decision_requested_cb) (xwidget_osr_draw_cb, xwidget_osr_event_forward) (xwidget_osr_event_set_embedder, xwidget_init_view): Omit unnecessary casts. * src/xwidget.c (Fmake_xwidget, xwidget_hidden) (xwidget_show_view, xwidget_hide_view) (x_draw_xwidget_glyph_string, xwidget_start_redisplay, xwidget_touch) (xwidget_touched): * src/xwidget.h (struct xwidget.kill_without_query) (struct xwidget_view.redisplayed, struct xwidget_view.hidden): Use bool for boolean. * src/xwidget.c (store_xwidget_event_string, Fxwidget_size_request): Simplify by using list functions. (WEBKIT_FN_INIT): Omit unnecessary test for nil. (Fxwidget_resize): Check type of integer args before doing any work. Check that they are nonnegative. (Fxwidget_set_adjustment): Check type of integer arg. Avoid redundant call to gtk_scrolled_window_get_vadjustment. Simplify. Use double, not float. (Fxwidget_info, Fxwidget_view_info): Simplify by using CALLN. (valid_xwidget_spec_p): Simplify. (xwidget_spec_value): Omit unused arg FOUND. All callers changed. * src/xwidget.h: Include lisp.h first, so that includers do not need to worry about doing that before including this file. Make this .h file safe to include even on non-HAVE_XWIDGETS configurations, to simplify the includers. (x_draw_xwidget_glyph_string, syms_of_xwidget, valid_xwidget_spec_p) (xwidget_end_redisplay, lookup_xwidget) (xwidget_view_delete_all_in_window, kill_buffer_xwidgets): Now a no-op if !HAVE_XWIDGETS, to simplify callers. (struct glyph_matrix, struct glyph_string, struct xwidget) (struct xwidget_view, struct window): New forward or incomplete decls, so that includers need not assume the corresponding .h files are already included, or that HAVE_XWIDGETS is defined. (struct xwidget_type, xwidget_from_id): Remove; unused.
* Support for the new Xwidget feature.Joakim Verona2016-01-191-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: (HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES): * xterm.c (x_draw_glyph_string, x_draw_bar_cursor): * xdisp.c: (handle_display_spec, handle_single_display_spec, push_it) (pop_it, set_iterator_to_next, dump_glyph) (calc_pixel_width_or_height, fill_xwidget_glyph_string) (BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS) (produce_xwidget_glyph, x_produce_glyphs) (get_window_cursor_type): * window.c (Fdelete_window_internal): * termhooks.h (e): * print.c (print_object): * lisp.h (ptrdiff_t): * keyboard.c (kbd_buffer_get_event, make_lispy_event) (syms_of_keyboard): * emacs.c (main): * dispnew.c (update_window, scrolling_window): * dispextern.h (g, i): * Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS) (GIR_LIBS, ALL_CFLAGS, base_obj, LIBES): * keyboard.c (kbd_buffer_get_event): * emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate) (emacs_fixed_class_init): Add case for an xwidget view. * xwidget.c, xwidget.h, xwidget.el: New files for xwidgets Co-authored-by: Grégoire Jadi <daimrod@gmail.com> Various improvements to the Xwidget feature. * xwidgets.c: * emacsgtkfixed.c: * xwidget.el:
* Update copyright year to 2016Paul Eggert2016-01-011-1/+1
| | | | Run admin/update-copyright.
* Clean up cairo printing codeYAMAMOTO Mitsuharu2015-12-311-9/+7
| | | | | | | | | | * src/gtkutil.c (xg_get_page_setup): Use listn. * src/xfns.c (Fx_export_frames, Fx_print_frames_dialog): Doc fix. Use decode_window_system_frame and FRAME_VISIBLE_P. (Fx_print_frames_dialog): Use redisplay_preserve_echo_area instead of Fdisplay. * src/xterm.c (x_cr_export_frames): Use redisplay_preserve_echo_area instead of Fdisplay. Temporarily unblock_input around QUIT.
* Port recent XCB changes to 64-bit ‘long int’Paul Eggert2015-11-131-5/+11
| | | | | | | | | | | | | | | | For historical reasons, libX11 represents 32-bit values like Atoms as ‘long int’ even on platforms where ‘long int’ is 64 bits. XCB doesn’t do that, so adapt the recent XCB code to behave properly on 64-bit platforms. Also, fix what appears to be a bug in the interpretation of xcb_get_property_value_length, at least on my Fedora platform which is running libxcb-1.11-5.fc21. * src/xfns.c (x_real_pos_and_offsets): * src/xterm.c (get_current_wm_state): xcb_get_property_value_length returns a byte count, not a word count. For 32-bit quantities, xcb_get_property_value returns a vector of 32-bit words, not of (possibly 64-bit) long int. Backport.
* Enable use of XCB for checking window manager stateKen Raeburn2015-11-121-8/+37
| | | | | | | * src/xterm.c (get_current_wm_state) [USE_XCB]: Use XCB calls instead of XGetWindowProperty plus error-catching, since we can explicitly check for errors in the XCB version. This eliminates 3 XSync calls on top of the round-trip actually fetching the information.
* Detect XCB and save a connection handleKen Raeburn2015-11-121-0/+25
| | | | | | | | | | * configure.ac: If using X11, check for XCB libraries and header. * src/Makefile.in (XCB_LIBS): Define. (LIBX_EXTRA): Include it. * src/xterm.h [USE_XCB]: Include X11/Xlib-xcb.h. (struct x_display_info) [USE_XCB]: Add an XCB connection handle field. * src/xterm.c (x_term_init) [USE_XCB]: Initialize the new field.
* Use INT_ADD_WRAPV etc. to check integer overflowPaul Eggert2015-11-081-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string): * src/buffer.c (record_overlay_string, overlay_strings): * src/casefiddle.c (casify_object): * src/ccl.c (Fccl_execute_on_string): * src/character.c (char_width, c_string_width, lisp_string_width) (count_size_as_multibyte, string_escape_byte8): * src/coding.c (coding_alloc_by_realloc, produce_chars): * src/data.c (arith_driver): * src/dispnew.c (realloc_glyph_pool, init_display): * src/editfns.c (styled_format): * src/fns.c (Ffillarray): * src/ftfont.c (ftfont_shape_by_flt): * src/gnutls.c (gnutls_hex_string): * src/gtkutil.c (get_utf8_string): * src/image.c (x_to_xcolors, x_detect_edges, png_load_body): * src/keymap.c (Fkey_description): * src/lisp.h (SAFE_ALLOCA_LISP): * src/term.c (encode_terminal_code): * src/tparam.c (tparam1): * src/xselect.c (x_property_data_to_lisp): * src/xsmfns.c (smc_save_yourself_CB): * src/xterm.c (x_term_init): When checking for integer overflow, prefer INT_MULTIPLY_WRAPV to more-complicated code involving division and/or INT_MULTIPLY_OVERFLOW, and similarly for INT_ADD_WRAPV and subtraction and/or INT_ADD_OVERFLOW. * src/casefiddle.c (casify_object): Simplify multibyte size check. * src/character.c: Remove some obsolete ‘#ifdef emacs’s. * src/data.c (arith_driver): Also check for division overflow, as that’s now possible given that the accumulator can now contain any Emacs integer. * src/lisp.h (lisp_word_count): Remove; no longer used.
* Avoid division by zero crash observed by Yuan MEI.Martin Rudalics2015-11-061-0/+4
| | | | | | | | | See http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html. * src/dispnew.c (required_matrix_height, required_matrix_width): Avoid division by zero. * src/xterm.c (x_term_init): Init dpyinfo->smallest_font_height and dpyinfo->smallest_char_width to 1.
* Include-file cleanup for src directoryPaul Eggert2015-10-201-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Omit ‘#include "foo.h"’ unless the file needs foo.h (Bug#21707). In a few cases, add ‘#include "foo.h"’ if the file needs foo.h but does not include it directly. As a general rule, a source file should include foo.h if it needs the interfaces that foo.h defines. * src/alloc.c: Don’t include process.h. Include dispextern.h, systime.h. * src/atimer.c: Don’t include blockinput.h. * src/buffer.c: Include coding.h, systime.h. Don’t include keyboard.h, coding.h. * src/callint.c: Don’t include commands.h, keymap.h. * src/callproc.c: Don’t include character.h, ccl.h, composite.h, systty.h, termhooks.h. * src/casetab.c: Don’t include character.h. * src/category.c: Don’t include charset.h, keymap.h. * src/ccl.h: Don’t include character.h. * src/character.c: Don’t include charset.h. * src/charset.c: Don’t include disptab.h. * src/chartab.c: Don’t include ccl.h. * src/cm.c: Don’t include frame.h, termhooks.h. * src/cmds.c: Don’t include window.h, dispextern.h. * src/coding.c: Don’t include window.h, frame.h. * src/composite.c: Include composite.h. Don’t include window.h, font.h. * src/data.c: Don’t include syssignal.h, termhooks.h, font.h. * src/dbusbind.c: Don’t include frame.h. * src/decompress.c: Don’t include character.h. * src/dired.c: Don’t include character.h, commands.h, charset.h. * src/dispnew.c: Don’t include character.h, indent.h, intervals.h, process.h, timespec.h. Include systime.h. * src/doc.c: Include coding.h. Don’t include keyboard.h. * src/editfns.c: Include composite.h. Don’t include frame.h. * src/emacs.c: Include fcntl.h, coding.h. Don’t include commands.h, systty.h.. * src/fileio.c: Don’t include intervals.h, dispextern.h. Include composite.h. * src/filelock.c: Don’t include character.h, systime.h. * src/fns.c: Don’t include time.h, commands.h, keyboard.h, keymap.h, frame.h, blockinput.h, xterm.h. Include composite.h. * src/font.c: Include termhooks.h. * src/font.h: Don’t include ccl.h, frame.h. Add forward decls of struct composition_it, struct face, struct glyph_string. * src/fontset.c: Don’t include buffer.h, ccl.h, keyboard.h, intervals.h, window.h, termhooks.h. * src/frame.c: Don’t include character.h, commands.h, font.h. * src/frame.h: Don’t include dispextern.h. * src/fringe.c: Don’t include character.h. * src/ftcrfont.c: Don’t include dispextern.h, frame.h, character.h, charset.h, fontset.h. * src/ftfont.c: Don’t include frame.h, blockinput.h, coding.h, fontset.h. * src/ftxfont.c: Don’t include dispextern.h, character.h, charset.h, fontset.h. * src/gfilenotify.c: Don’t include frame.h, process.h. * src/gtkutil.c: Include dispextern.h, frame.h, systime.h. Don’t include syssignal.h, buffer.h, charset.h, font.h. * src/gtkutil.h: Don’t include frame.h. * src/image.c: Include fcntl.h and stdio.h instead of sysstdio.h. Don’t include character.h. * src/indent.c: Don’t include keyboard.h, termchar.h. * src/inotify.c: Don’t include character.h, frame.h. * src/insdel.c: Include composite.h. Don’t include blockinput.h. * src/intervals.c: Don’t include character.h, keyboard.h. * src/intervals.h: Don’t include dispextern.h, composite.h. * src/keyboard.c: Don’t include sysstdio.h, disptab.h, puresize.h. Include coding.h. * src/keyboard.h: Don’t incldue systime.h. * src/keymap.c: Don’t include charset.h, frame.h. * src/lread.c: Include dispextern.h and systime.h. Don’t include frame.h. Include systime.h. * src/macros.c: Don’t include commands.h, character.h, buffer.h. * src/menu.c: Include character.h, coding.h. Don’t include dispextern.h. * src/menu.h: Don’t include systime.h. * src/minibuf.c: Don’t include commands.h, dispextern.h, syntax.h, intervals.h, termhooks.h. * src/print.c: Include coding.h. Don’t include keyboard.h, window.h, dispextern.h, termchar.h, termhooks.h, font.h. Add forward decl of struct terminal. * src/process.c: Don’t include termhooks.h, commands.h, dispextern.h, composite.h. * src/region-cache.c: Don’t include character.h. * src/scroll.c: Don’t include keyboard.h, window.h. * src/search.c: Don’t include category.h, commands.h. * src/sound.c: Don’t include dispextern.h. * src/syntax.c: Don’t include command.h, keymap.h. * src/sysdep.c: Don’t include window.h, dispextern.h. * src/systime.h: Use ‘#ifdef emacs’, not ‘#ifdef EMACS_LISP_H’, * src/term.c: Don’t include systty.h, intervals.h, xterm.h. * src/terminal.c: Include character.h. Don’t include charset.h, coding.h. * src/textprop.c: Don’t include character.h. * src/undo.c: Don’t include character.h, commands.h, window.h. * src/unexsol.c: Don’t include character.h, charset.h. * src/widget.c: Include widget.h. Don’t include keyboard.h, window.h, dispextern.h, blockinput.h, character.h, font.h. * src/widgetprv.h: Don’t include widget.h. * src/window.c: Don’t include character.h, menu.h, intervals.h. * src/xdisp.c: Include composite.h, systime.h. Don’t include macros.h, process.h. * src/xfaces.c: Don’t include charset.h, keyboard.h, termhooks.h, intervals.h. * src/xfns.c: Don’t include menu.h, character.h, intervals.h, epaths.h, fontset.h, systime.h, atimer.h, termchar.h. * src/xfont.c: Don’t include dispextern.h, fontset.h, ccl.h. * src/xftfont.c: Don’t include dispextern.h, character.h, fontset.h. * src/xgselect.c: Don’t include timespec.h, frame.h. Include systime.h. * src/xgselect.h: Don’t include time.h. Use a forward decl to struct timespec instead. * src/xmenu.c: Don’t include keymap.h, character.h, charset.h, dispextern.h. Include systime.h. * src/xml.c: Don’t include character.h. * src/xrdb.c [USE_MOTIF]: Don’t include keyboard.h. * src/xselect.c: Don’t include dispextern.h, character.h, buffer.h, process.h. * src/xsmfns.c: Don’t include systime.h, sysselect.h. * src/xterm.c: Don’t include syssignal.h, charset.h, disptab.h, intervals.h process.h, keymap.h, xgselect.h. Include composite.h.
* Spelling fixesPaul Eggert2015-10-141-1/+1
| | | | | | * configure.ac (bitmapdir): Fix misspelling of bmd_acc. * test/automated/coding-tests.el (ert-test-coding-bogus-coding-systems): Fix misspelling of nonexistent file name.
* Do process ConfigureNotify events indicating size changes.Ken Raeburn2015-10-131-1/+6
| | | | | * src/xterm.c (handle_one_xevent): If consecutive ConfigureNotify events don't have the same size, process each one.
* Allow setting frame pixel sizes from frame parameters (Bug#21415)Martin Rudalics2015-10-131-22/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also fix some misfeatures in frame (re-)sizing code, add more debugging information and remove some dead code. * lisp/frame.el (frame-notice-user-settings, make-frame): Change parameter names when setting `frame-size-history'. (frame--size-history): New function. * src/frame.c (frame_inhibit_resize): If frame has not been made yet, return t if inhibit_horizontal_resize or inhibit_vertical_resize bit have been set. (adjust_frame_size): Simplify. (make_frame): Initialize inhibit_horizontal_resize, inhibit_vertical_resize, tool_bar_redisplayed, tool_bar_resized. (Fframe_after_make_frame): Reset inhibit_horizontal_resize and inhibit_vertical_resize slots. (x_set_frame_parameters): Handle `text-pixels' specification for width and height parameters. Don't consider new_height or new_width changes. Call adjust_frame_size instead of Fset_frame_size. (x_figure_window_size): Two new arguments x_width and y_width returning frame's figures width and height. Calculate tool bar height before frame sizes so SET_FRAME_HEIGHT can pick it up. Handle `text-pixels' specification for width and height parameters. (Qtext_pixels, Qx_set_frame_parameters, Qset_frame_size) (Qx_set_window_size_1, Qx_set_window_size_2) (Qx_set_window_size_3, Qx_set_menu_bar_lines) (Qupdate_frame_menubar, Qfree_frame_menubar_1) (Qfree_frame_menubar_2): New symbols. * src/frame.h (structure frame): New booleans tool_bar_redisplayed, tool_bar_resized, inhibit_horizontal_resize, inhibit_vertical_resize. (x_figure_window_size): Update external declaration. * src/gtkutil.c (xg_frame_set_char_size): Set size hints before calling gtk_window_resize. (update_frame_tool_bar): Make inhibiting of frame resizing more discriminative. Set tool_bar_resized bit. * src/nsfns.m (x_set_tool_bar_lines): Make inhibiting of frame resizing more discriminative. Call adjust_frame_size instead of x_set_window_size. (Fx_create_frame): Handle x_width and x_height if set by x_figure_window_size. * src/nsterm.m (x_set_window_size): For GNUSTEP build don't subtract 3 from tool bar height. (x_set_window_size): Add frame_size_history_add call. (x_new_font): Call adjust_frame_size instead of x_set_window_size. * src/w32fns.c (x_change_tool_bar_height): Reset tool_bar_redisplayed and tool_bar_resized bits when adding tool bar. Make inhibiting of frame resizing more discriminative. (w32_wnd_proc): Remove dead code in WM_WINDOWPOSCHANGING case. (Fx_create_frame): Handle x_width and x_height if set by x_figure_window_size. Set size hints before adjusting frame size. (x_create_tip_frame): Adjust x_figure_window_size call. * src/w32term.c (x_set_window_size): Add frame_size_history_add call. * src/widget.c (set_frame_size): Remove dead code. Add frame_size_history_add call. When frame_resize_pixelwise is t use FRAME_PIXEL_WIDTH and FRAME_PIXEL_HEIGHT instead of pixel_width and pixel_height. (update_various_frame_slots): Remove dead code. (EmacsFrameResize): Add more information in frame_size_history_add call. (EmacsFrameQueryGeometry): Round only when frame_resize_pixelwise is not set. * src/xdisp.c (redisplay_tool_bar): Set tool_bar_redisplayed bits. * src/xfns.c (x_set_menu_bar_lines): Change argument name. (x_change_tool_bar_height): Reset tool_bar_redisplayed and tool_bar_resized bits when adding tool bar. Make inhibiting of frame resizing more discriminative. (Fx_create_frame): Handle x_width and x_height if set by x_figure_window_size. Set size hints before adjusting frame size. (x_create_tip_frame): Adjust x_figure_window_size call. * src/xmenu.c (update_frame_menubar): Don't handle Lucid specially. (set_frame_menubar): On Lucid never add core-border-width to avoid that adding XtNinternalBorderWidth adds it again. (free_frame_menubar): Handle frame_inhibit_resize true for Motif. * src/xterm.c (x_new_font): In non-toolkit case handle size change of menu bar. (x_set_window_size_1): Fix calls to frame_size_history_add. (x_wm_set_size_hint): Remove dead code. Set size_hints.min_width and size_hints.min_height to base_width and base_height.
* Handle an opaque-move X11 window manager operation more efficiently.Ken Raeburn2015-10-111-13/+41
| | | | | | * src/xterm.c (handle_one_xevent): If a ConfigureNotify event is followed by more ConfigureNotify events for the same window, process only the last one.
* Add x_catch_errors_with_handler.Ken Raeburn2015-10-111-1/+15
| | | | | | | | | | | | * src/xterm.c (struct x_error_message_stack): Add new fields for a callback function and associated data pointer. (x_error_catcher): If the callback function is set, call it after saving the error message string. (x_catch_errors_with_handler): Renamed from x_catch_errors but now accepts a callback function and data pointer. (x_catch_errors): Now a wrapper function. * src/xterm.h (x_special_error_handler): New typedef. (x_catch_errors_with_handler): Declare.
* Introduce x_uncatch_errors_after_check to reduce XSync calls.Ken Raeburn2015-10-111-3/+25
| | | | | | | | | | | | | | | Both x_had_errors_p and x_check_errors call XSync, so if they're immediately followed by x_uncatch_errors, its XSync call will be redundant, resulting in a wasted round trip to the X server. * src/xterm.c (x_uncatch_errors_after_check): New routine; a copy of x_uncatch_errors without the XSync call. (XTmouse_position, x_wm_supports): * src/xfns.c (x_set_mouse_color): * src/xmenu.c (Fx_menu_bar_open_internal): * src/xselect.c (x_own_selection, x_get_foreign_selection): (Fx_get_atom_name): Call it instead of x_uncatch_errors. * src/xterm.h (x_uncatch_errors_after_check): Declare.
* Fix problems caught with --enable-gcc-warningsPaul Eggert2015-10-081-1/+0
| | | | | | | * src/image.c (lookup_rgb_color): * src/xfns.c (x_defined_color): * src/xterm.c (x_parse_color): Remove unused locals.
* Reduce some unnecessary X calls.Ken Raeburn2015-10-081-4/+0
| | | | | | | | | * src/xfns.c (x_real_pos_and_offsets): Remove a redundant XGetGeometry call. If border width is wanted, get it from the XGetGeometry call instead of calling XGetWindowAttributes on the same window. Skip some X calls if we've already detected an error from the X server. * src/xterm.c (x_wm_supports): Delete x_sync before x_had_errors_p. (handle_one_xevent): Delete XSync call before x_uncatch_errors.
* Reduce color allocation/query traffic in the TrueColor case.Ken Raeburn2015-10-081-6/+71
| | | | | | | | | | | | | | | | | | | | | | | | When working with an X visual with TrueColor class, pixel values can be generated from the RGB values according to mask value provided by the server on connection. Some of the image-handling code was already doing this. * src/xterm.h (x_make_truecolor_pixel): New function; code taken from lookup_rgb_color. (x_mutable_colormap): New function. * src/image.c (lookup_rgb_color): Move pixel composition code to x_make_truecolor_pixel. (x_kill_gs_process): Call x_mutable_colormap. * src/xfaces.c (x_free_colors, x_free_dpy_colors): Call x_mutable_colormap. * src/xftfont.c (xftfont_get_colors): Call x_query_colors. * src/xterm.c (x_query_colors): For a TrueColor display, decompose the pixel value into RGB values directly, and don't send a request to the server. (x_alloc_nearest_color): For a TrueColor display, construct the pixel value with x_make_truecolor_pixel. (x_copy_color): For an immutable color map, just return the provided pixel value.
* Cache XParseColor results in the X display info structure.Ken Raeburn2015-10-081-0/+56
| | | | | | | | | | | | | | | | | | | With repeated lookups of foreground and background colors for multiple faces per frame, we issue a lot of redundant color name lookups to the X server, waiting every time for the response. On a remote network with, say, 30ms round-trip time, this can add nearly a full second to creation of a new frame. * src/gtkutil.c (xg_check_special_colors): Call x_parse_color. * src/image.c (get_spec_bg_or_alpha_as_argb): (xpm_init_color_cache, xpm_lookup_color): * src/xfns.c (x_defined_color): * src/xterm.c (x_parse_color): New function; caches color names not starting with "#" in the display-info structure. (x_delete_display): Delete the cache content. * src/xterm.h (struct color_name_cache_entry): New type. (x_parse_color): Declare. (struct x_display_info): Add a new field for the cache.
* Prefer CALLN in a few more placesPaul Eggert2015-09-231-4/+2
| | | | | | | * src/macfont.m (macfont_set_family_cache): * src/nsterm.m (append2): * src/xterm.c (x_cr_export_frames): Prefer CALLN to allocating the arg arrays by hand.
* Add -Wswitch to --enable-gcc-warningsPaul Eggert2015-09-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | Make --enable-gcc-warnings a bit pickier, by also using -Wswitch. * configure.ac (WERROR_CFLAGS): Don’t add -Wno-switch. * lib-src/etags.c (main, consider_token, C_entries): * src/coding.c (encode_invocation_designation): * src/data.c (Ftype_of): * src/eval.c (Fdefvaralias, default_toplevel_binding) (Fbacktrace__locals, mark_specpdl): * src/lisp.h (record_xmalloc): * src/syntax.c (scan_lists, scan_sexps_forward): * src/window.c (window_relative_x_coord): * src/xdisp.c (push_it, pop_it): * src/xterm.c (xg_scroll_callback, x_check_fullscreen): Error out or do nothing (as appropriate) if a switch statement with an enum value does not cover all of the enum. * src/dispextern.h (struct iterator_stack_entry.u.comp): Remove unused member discovered by using -Wswitch. * src/lisp.h (record_xmalloc): Add a ‘+ 0’ to pacify -Wswitch. * src/vm-limit.c (check_memory_limits): Simplify warning-diagnostic computation by using a table.
* Don't call do_pending_window_change in signal handlers (Bug#21380)Martin Rudalics2015-08-311-2/+0
| | | | | | | * src/gtkutil.c (xg_frame_resized): * src/xterm.c (x_set_window_size): * src/w32term.c (x_set_window_size): Don't call do_pending_window_change.
* Assume GC_MARK_STACK == GC_MAKE_GCPROS_NOOPSPaul Eggert2015-08-261-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the need for GCPRO1 etc. Suggested by Stefan Monnier in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00918.html * doc/lispref/internals.texi (Writing Emacs Primitives): * etc/NEWS: Document the change. * src/alloc.c (gcprolist, dump_zombies, MAX_ZOMBIES, zombies) (nzombies, ngcs, avg_zombies, max_live, max_zombies, avg_live) (Fgc_status, check_gcpros, relocatable_string_data_p, gc-precise): * src/bytecode.c (mark_byte_stack) [BYTE_MARK_STACK]: * src/eval.c (gcpro_level) [DEBUG_GCPRO]: * src/lisp.h (struct handler.gcpro, struct gcpro, GC_MARK_STACK) (GC_USE_GCPROS_AS_BEFORE, GC_MAKE_GCPROS_NOOPS) (GC_MARK_STACK_CHECK_GCPROS, GC_USE_GCPROS_CHECK_ZOMBIES) (BYTE_MARK_STACK, GCPRO1, GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6) (GCPRO7, UNGCPRO, RETURN_UNGCPRO): Remove. All uses removed. The code now assumes GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS. * src/bytecode.c (relocate_byte_stack): Rename from unmark_byte_stack, since it now only relocates. All callers changed. * src/frame.c (make_frame): Add an IF_LINT to pacify GCC 5.2 with GCPROs removed. * src/systime.h: Use EMACS_LISP_H as the canary instead of GCPRO1. * test/automated/finalizer-tests.el (finalizer-basic) (finalizer-circular-reference, finalizer-cross-reference) (finalizer-error): * test/automated/generator-tests.el (cps-test-iter-close-finalizer): Remove tests, as they depend on gc-precise.
* Fix full-screen code when there is no window manager (Bug#21317)Pip Cet2015-08-241-6/+21
| | | | | | | | | | | | * src/xterm.h (x_wm_supports): Declare external. * src/xterm.c (wm_suppports): Rename to `x_wm_supports', export. (do_ewmh_fullscreen, x_ewmh_activate_frame): Adjust for rename. (x_check_fullscreen): Call `x_wm_set_size_hint', restore `fullscreen' frame parameter. * gtkutil.c (x_wm_set_size_hint): Set size hints when running without a window manager. Copyright-paperwork-exempt: yes
* Fix C99 incompatibilities in Cairo codePaul Eggert2015-06-251-1/+1
| | | | | | * src/image.c (xpm_load) [USE_CAIRO]: * src/xterm.c (x_cr_accumulate_data) [USE_CAIRO]: Fix pointer signedness problem.
* Fix bug that munged selection infoPaul Eggert2015-06-231-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some optimizing C compilers, copying a structure did not copy the padding bytes between elements, and the type punning between struct input_data and struct selection_input_data did not work. Change the C code to use a proper union type instead. Problem reported by YAMAMOTO Mitsuharu (Bug#20756). * src/keyboard.c (kbd_buffer, kbd_fetch_ptr, kbd_store_ptr) (readable_events, discard_mouse_events, kbd_buffer_events_waiting) (kbd_buffer_get_event, process_special_events, stuff_buffered_input) (mark_kboards): Use union buffered_input_event, not struct input_event. (clear_event, deliver_input_available_signal, process_special_events): Remove unnecessary forward decls. (kbd_buffer_store_buffered_event): New function, mostly just the old kbd_buffer_store_event_hold, except its argument is of type union buffered_input_event, not struct input_event. (kbd_buffer_unget_event): Define only if HAVE_X11, since it's not needed otherwise. Argument is now of type struct selection_input_event *, not struct input_event *. All callers changed. (clear_event): Arg is now of type union buffered_input_event *, not struct input_event *. All callers changed. * src/keyboard.h [HAVE_X11]: Include "xterm.h". (union buffered_input_event): New type. (kbd_buffer_store_event_hold): Now an inline function, defined here. * src/termhooks.h (EVENT_KIND_WIDTH): New constant. (struct input_event): Use it. * src/xselect.c (struct selection_event_queue): Make elements be of type struct selection_input_event, not struct input_event. (selection_input_event_equal): New static function. (x_queue_event): Use it. (x_queue_event, x_decline_selection_request) (x_selection_current_request, x_reply_selection_request) (x_handle_selection_request, x_handle_selection_clear) (x_handle_selection_event): Use struct selection_input_event, not struct input_event. All callers changed. (x_convert_selection): Omit unused first arg. All callers changed. (Fx_disown_selection_internal): Omit unnecessary union. * src/xterm.c (handle_one_xevent): Use new union buffered_input_event rather than rolling our own equivalent. Prefer sie.kind when setting up that kind of structure. Call kbd_buffer_store_buffered_event, not kbd_buffer_store_event_hold. * src/xterm.h (struct selection_input_event: Use EVENT_KIND_WIDTH. (SELECTION_EVENT_DISPLAY, SELECTION_EVENT_DPYINFO) (SELECTION_EVENT_REQUESTOR, SELECTION_EVENT_SELECTION) (SELECTION_EVENT_TARGET, SELECTION_EVENT_PROPERTY) (SELECTION_EVENT_TIME, x_handle_selection_event): Arg is now of type struct selection_input_event *) not struct input_event *. All callers changed.
* Fix display when a font claims large values of ascent and descentEli Zaretskii2015-06-061-2/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug#20628. * src/xdisp.c (get_phys_cursor_geometry): Correct the Y coordinate of a hollow cursor glyph when the original glyph's ascent is too small. (get_font_ascent_descent, normal_char_ascent_descent) (normal_char_height): New functions. (handle_single_display_spec, append_space_for_newline) (calc_pixel_width_or_height, produce_stretch_glyph) (calc_line_height_property): Use normal_char_ascent_descent and normal_char_height. (x_produce_glyphs): When font-global values of ascent and descent are too large, use per-character glyph metrics instead, if possible. But don't allow the glyph row's ascent and descent values become smaller than the values from the metrics of the font's "normal" character. * src/xftfont.c (xftfont_draw): * src/w32font.c (w32font_draw): Correct the values of ascent and descent used to draw glyphless characters' hex code in a box. * src/xterm.c (x_draw_glyph_string_background): * src/xdisp.c (x_produce_glyphs): * src/w32term.c (x_draw_glyph_string_background): * src/nsterm.m (ns_maybe_dumpglyphs_background): Use FONT_TOO_HIGH to detect fonts whose global ascent and descent values are too large to be used in layout decision, and redraw the background when that happens. * src/dispextern.h (FONT_TOO_HIGH): New macro. (get_font_ascent_descent): Add prototype. * src/xterm.c (x_new_font): * src/w32term.c (x_new_font): * src/nsterm.m (x_new_font): * src/font.c (font_open_entity): * src/composite.c (composition_gstring_width): Use get_font_ascent_descent to obtain reasonable values for ascent and descent of a font.
| * Attempt to fix crashes due to accesses beyond glyph matrix endEli Zaretskii2015-05-311-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (x_produce_glyphs): When it->ascent and it->descent are determined from per-character metrics, don't let the max_ascent and max_descent become smaller than values returned by normal_char_ascent_descent, to avoid unpleasant dynamic resizing of screen line heights when text changes. * src/xterm.c (x_new_font) * src/w32term.c (x_new_font): Call get_font_ascent_descent to obtain a reasonable value for FRAME_LINE_HEIGHT, even when a font claims very large value for its height. * src/font.c (font_open_entity): Call get_font_ascent_descent to obtain a reasonable value for FRAME_SMALLEST_FONT_HEIGHT, even when a font claims very large value for its height.
| * Fix display of glyphless characters with problematic fontsEli Zaretskii2015-05-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/w32term.c (x_draw_glyph_string_background): Force redraw of glyph string background also when the font in use claims preposterously large global height value. Helps to remove artifacts left from previous displays when glyphless characters are displayed as hex code in a box. * src/xterm.c (x_draw_glyph_string_background): Force redraw of glyph string background also when the font in use claims preposterously large global height value. Helps to remove artifacts left from previous displays when glyphless characters are displayed as hex code in a box. * src/w32font.c (w32font_draw): Fix background drawing for glyphless characters that display as acronyms or hex codes in a box. * src/xftfont.c (xftfont_draw): Fix background drawing for glyphless characters that display as acronyms or hex codes in a box. * src/xdisp.c (produce_glyphless_glyph): Compute reasonable values for it->ascent and it->descent when the font claims preposterously large global values. (FONT_TOO_HIGH): Move from here... * src/dispextern.h (FONT_TOO_HIGH): ...to here.
* | Undo removal of x_clear_area call on expose for GTK3 or cairo.YAMAMOTO Mitsuharu2015-06-051-1/+1
| | | | | | | | | | * src/xterm.c (handle_one_xevent) [HAVE_GTK3 || USE_CAIRO]: Clear exposed area. (Bug#20677)
* | Undo previous changes in non-toolkit scroll bar drawing.YAMAMOTO Mitsuharu2015-06-031-2/+2
| | | | | | | | | | * src/xterm.c (x_scroll_bar_set_handle, x_scroll_bar_expose) [!USE_TOOLKIT_SCROLL_BARS]: Draw into scroll bar window. (Bug#20668)
* | Avoid grave accent quoting in stderr diagnosticsPaul Eggert2015-05-311-2/+2
|/ | | | | | | | | | | | | | | | | | | A few Emacs diagnostics go directly to stderr, and so can't easily contain curved quotes (as non-UTF-8 locales might mishandle them). Instead of bothering to add support for this rarity, reword the diagnostics so that they don't use grave accent to quote. * src/alloc.c (mark_memory): Fix comment. * src/buffer.c (init_buffer): * src/dispnew.c (init_display): * src/emacs.c (main, sort_args): * src/lread.c (dir_warning): * src/term.c (init_tty): * src/unexmacosx.c (unexec): * src/xfns.c (select_visual): * src/xterm.c (cvt_string_to_pixel, x_io_error_quitter): Reword stderr diagnostics to avoid quoting `like this'. * src/unexmacosx.c: Include errno.h. * src/xfns.c (select_visual): Encode value for locale.
* Fix --without-toolkit-scroll-bars builds.Glenn Morris2015-05-231-4/+3
| | | | | | | * src/xterm.c (x_scroll_bar_set_handle) [!USE_TOOLKIT_SCROLL_BARS]: Add new argument to x_clear_area1. (XTset_horizontal_scroll_bar) [!USE_TOOLKIT_SCROLL_BARS]: Update x_clear_area arguments.
* Pacify --enable-gcc-warningsPaul Eggert2015-05-231-36/+1
| | | | | | | | | | | | | | | | | | | | | | * src/frame.h (x_query_color): Remove redundant extern decl. * src/ftcrfont.c (ftcrfont_glyph_extents, ftcrfont_list) (ftcrfont_match, ftcrfont_open, ftcrfont_close) (ftcrfont_text_extents, ftcrfont_draw): * src/xterm.c (x_set_window_size_1, *x_color_cells, x_update_end) (XTframe_up_to_date, x_clear_area1, x_clear_frame) (x_ins_del_lines, frame_highlight, frame_unhighlight) (x_new_focus_frame, x_focus_changed, XTframe_rehighlight) (x_draw_hollow_cursor, x_draw_bar_cursor, x_flush, x_update_begin) (x_update_window_begin, x_connection_closed) (x_set_clip_rectangles, x_reset_clip_rectangles, x_fill_rectangle) (x_draw_rectangle, x_fill_trapezoid_for_relief, x_clear_window) (*x_gc_get_ext_data, x_extension_initialize) (x_cr_accumulate_data): Remove redundant static decl. Many of these GCC doesn't complain about, but we might as well clean out the duplication while we're in the neighborhood. * src/xterm.c (x_fill_trapezoid_for_relief): Remove decl of nonexistent function.
* Merge branch 'master' into cairoJan D2015-05-231-4/+5
|\
| * Fix integer-valued `mouse-highlight' (Bug#20590)Johan Bockgård2015-05-171-3/+4
| | | | | | | | * src/xterm.c (handle_one_xevent) [USE_GTK]: Fix ifdef scope.
| * Spelling fixesPaul Eggert2015-05-171-1/+1
| |
* | Fixes to compile cairo branch without cairo.old-branches/cairocairoJan D2015-05-231-0/+2
| | | | | | | | | | | | | | | | * src/gtkutil.c (xg_update_scrollbar_pos): x_clear_area takes frame as first argument. * src/xterm.c (handle_one_xevent): Surround x_cr_destroy_surface with USE_CAIRO.
* | Merge branch 'master' into cairoJan D2015-05-171-6/+9
|\ \ | |/
| * Add comment that x_shift_glyphs_for_insert is never called.Jan D2015-05-171-1/+4
| | | | | | | | | | * xterm.c (x_shift_glyphs_for_insert, x_redisplay_interface): Add comment that this function is never called.
| * Don't access display after i/o error (Bug#19147).Jan D2015-05-141-4/+5
| | | | | | | | | | | | | | * xterm.c (x_connection_closed): Add third arg ioerror. If ioerror, set display to 0 (Bug#19147). (x_error_quitter): Call x_connection_closed with third arg false. (x_io_error_quitter): Call x_connection_closed with third arg true.
* | Merge branch 'master' into cairoJan D2015-04-261-3/+3
|\ \ | |/
| * Port --enable-gcc-warnings to GCC 5.1 x86-64Paul Eggert2015-04-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib-src/ebrowse.c (dump_sym): * lib-src/hexl.c (main): * src/ccl.c (ccl_driver): * src/character.c (string_escape_byte8): * src/dbusbind.c (xd_retrieve_arg, xd_add_watch): * src/gnutls.c (Fgnutls_boot): * src/gtkutil.c (xg_check_special_colors): * src/image.c (x_build_heuristic_mask): * src/print.c (safe_debug_print, print_object): * src/term.c (produce_glyphless_glyph): * src/xdisp.c (get_next_display_element) (produce_glyphless_glyph): * src/xterm.c (x_draw_glyphless_glyph_string_foreground): Don't use a signed format to print an unsigned integer, or vice versa. GCC 5.1's new -Wformat-signedness option warns about this. * src/image.c (png_load_body, jpeg_load_body): Silence a bogus setjump diagnostic from GCC 5.1 (GCC bug 54561).
| * Assume C89 offsetof in xterm.c, xlwmenu.cPaul Eggert2015-04-141-2/+2
| | | | | | | | | | | | * lwlib/xlwmenu.c (offset): * src/xterm.c (cvt_string_to_pixel_args): Use offsetof, not XtOffset.
* | x_free_cr_resources: Renamed from x_prepare_for_xlibdraw.Jan D2015-04-121-7/+7
| | | | | | | | | | | | | | * src/xterm.c (x_free_cr_resources): Renamed from x_prepare_for_xlibdraw. (x_cr_draw_frame, x_cr_export_frames, x_shift_glyphs_for_insert) (x_free_frame_resources): Rename x_prepare_for_xlibdraw to x_free_cr_resources.
* | Handle specified bg in images. Use generic libpng code for PNG:s.Jan D2015-04-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/image.c (get_spec_bg_or_alpha_as_argb) (create_cairo_image_surface): New functions when USE_CAIRO. (xpm_load): Call the above functions. Handle XPM without mask when USE_CAIRO. (png_load_body): Handle USE_CAIRO case. (png_load): Remove USE_CAIRO specific fuction, modify png_load_body instead. (jpeg_load_body): Call create_cairo_image_surface. (gif_load, svg_load_image): Handle specified background, call create_cairo_image_surface. * src/xterm.c (x_draw_image_glyph_string): Added missing USE_CAIRO.
* | Tool tips for menus did not show any text.Jan D2015-04-031-0/+4
| | | | | | | | | | * src/xterm.c (x_update_begin): Don't create any surface for non-visible tip frames, the geometry may be wrong.