aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2026 to copyright years.Sean Whitton2026-01-011-1/+1
|
* Add functions to set frame size and position in one compound stepMartin Rudalics2025-12-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * lisp/frame.el (set-frame-size-and-position): New function. * src/frame.c (adjust_frame_size): Handle requests to set size and position. (Fset_frame_size_and_position_pixelwise): New function. * src/gtkutil.c (xg_frame_set_size_and_position): New function. (xg_wm_set_size_hint): Handle any non-NorthWestGravity values for child frames only. Some GTK implementations don't like them. * src/gtkutil.h (xg_frame_set_size_and_position.): Add external declaration. * src/termhooks.h (set_window_size_and_position_hook): New hook. * src/w32term.c (w32_set_window_size_and_position): New function. (w32_create_terminal): Make it the Microsoft Windows API set_window_size_and_position_hook. * src/xterm.c (x_set_window_size_and_position_1) (x_set_window_size_and_position): New functions. (x_create_terminal): Make x_set_window_size_and_position the set_window_size_and_position_hook for the X protocol. * src/xterm.h (x_set_window_size_and_position): Add external declaration. * etc/NEWS: Announce new functions.
* Port back to GTK2Paul Eggert2025-12-091-1/+1
| | | | | | | Problem reported by Sven Joachim in: https://lists.gnu.org/r/emacs-devel/2025-12/msg00225.html * src/xterm.c (xi_frame_selected_for): Also define if !(defined USE_GTK && defined HAVE_GTK3).
* ; Fix a typo in xterm.[ch].Eli Zaretskii2025-12-091-1/+1
|
* Fix some C symbol extern visibilityPaul Eggert2025-12-081-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make some C symbols static if they don’t need to be extern. Also, remove a couple of functions that were discovered to be unused as a result of this process, and mark two extern functions intended to be usable from GDB. * src/buffer.c (previous_overlay_change): * src/composite.c (composition_lisp_table): * src/fileio.c (file_name_directory): * src/frame.c (check_tty): * src/insdel.c (adjust_markers_for_insert): * src/keyboard.c (unread_switch_frame, read_char) (requeued_events_pending_p): * src/sysdep.c (renameat_noreplace) [!HAVE_ANDROID]: * src/textconv.c (get_conversion_field) [!HAVE_ANDROID]: * src/treesit.c (TREESIT_BOB_LINECOL, TREESIT_TS_POINT_1_0) (treesit_buf_tracks_linecol_p, make_treesit_parser) (make_treesit_node): * src/xdisp.c (x_y_to_hpos_vpos): * src/xfaces.c (load_color) [!MSDOS]: * src/xfns.c (x_real_pos_and_offsets): * src/xterm.c (x_dnd_do_unsupported_drop): Now static. Move up if necessary. * src/coding.c (utf8_string_p): * src/keyboard.c (detect_input_pending_ignore_squeezables): Remove; unused. * src/frame.c (gui_set_alpha): * src/textconv.c (start_batch_edit, end_batch_edit, commit_text) (finish_composing_text, set_composing_text) (set_composing_region, textconv_set_point_and_mark) (delete_surrounding_text, request_point_update) (textconv_barrier, replace_text, get_extracted_text) (get_surrounding_text): * src/xdisp.c (gui_union_rectangles): * src/xterm.c (xi_frame_selected_for): Define only if needed. * src/treesit.c (treesit_debug_print_parser_list) (treesit_debug_print_linecol): Declare EXTERNALLY_VISIBLE. * src/xdisp.c (x_y_to_column_row): New function, defined only if needed. All external callers to x_y_to_hpos_vpos changed.
* Fix handling of visibility on tty frames (Bug#76031)Martin Rudalics2025-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/frame.h (FRAME_REDISPLAY_P): Remove. Use the new function frame_redisplay_p instead. Extern frame_redisplay_p. * src/frame.c (frame_redisplay_p): New function to replace FRAME_REDISPLAY_P macro. (make_terminal_frame): Don't tinker with frame visibility and don't make the new frame the terminal's top frame. (do_switch_frame): Make sure frame switched to and any of its ancestors are visible. Don't reset the visibility of other frames. (other_frames): Do not assume tty frames are by default visible. (Fmake_frame_invisible): When making the selected tty frame invisible, explicitly select the next visible frame. * src/dispnew.c (Fredraw_display): Use frame_redisplay_p instead of FRAME_REDISPLAY_P. * src/xdisp.c (clear_garbaged_frames, echo_area_display) (prepare_menu_bars, redisplay_internal, display_and_set_cursor) (gui_clear_cursor): Use frame_redisplay_p instead of FRAME_REDISPLAY_P. * src/keyboard.c (tty_read_avail_input): When storing an event and the selected frame is a child frame whose root is its terminal's top frame, set the frame_or_window slot to the child frame since otherwise the next switch frame event will select the top frame instead.
* Update copyright year to 2025Paul Eggert2025-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* On X, avoid reporting unrepresentable touch IDs to LispPo Lu2024-06-011-6/+9
| | | | | | | | | | | * src/xterm.c (xi_link_touch_point): Assign a Lisp-representable identifier to the new touch point and return the same. (xi_unlink_touch_point): New arg LOCAL_DETAIL. Return such an identifier if there is a matching touch point record. (handle_one_xevent): Adjust as is proper. * src/xterm.h (struct xi_touch_point_t) <local_detail>: New field. Reorder fields for alignment.
* Pacify gcc -Wmissing-variable-declarationsPaul Eggert2024-05-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is a new warning diagnostic in GCC 14. * lib-src/etags.c (mercury_heuristics_ratio): * src/pgtkselect.c, src/xselect.c (selection_request_stack): * src/xselect.c (outstanding_transfers): * src/xterm.c (pending_selection_requests) (x_dnd_waiting_for_motif_finish_display): Now static. * lib-src/make-docfile.c (close_emacs_globals): Arrange for lispsym to be declared with extern first, when compiling lread.c. * src/alloc.c (gdb_make_enums_visible) [__GNUC__]: * src/emacs.c (RCS_Id): * src/keyboard.c (stop_character): * src/print.c (print_output_debug_flag): Now declared with extern first. * src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN) [MAIN_PROGRAM]: Arrange for ID to be declared extern first. * src/lisp.h (garbage_collection_inhibited): * src/xterm.h (x_frame_parm_handlers): Declare here, so that its interface is properly checked. Other decls removed.
* Pacify GCC 14 -Wnull-dereferencePaul Eggert2024-04-301-0/+2
| | | | | | * src/xterm.c (x_dpyinfo): New function, which acts like x_display_info_for_display except it always returns nonnull. This simplifies callers and pacifies GCC 14. All callers changed.
* Be more systematic about parens in C source codePaul Eggert2024-01-201-3/+3
| | | | | | | | | Be more systematic about putting space before paren in calls, and in avoiding unnecessary parentheses in macros. This was partly inspired by my wading through gcc -E output while debugging something else, and seeing too many parens. This patch does not change the generated .o files on my platform.
* Merge from savannah/emacs-29Po Lu2024-01-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
| |
* | Merge remote-tracking branch 'origin/master' into feature/androidPo Lu2023-07-181-5/+57
|\ \
| * | Expose the ``cancellation'' of touch events to LispPo Lu2023-07-181-5/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/commands.texi (Touchscreen Events): * etc/NEWS: Describe new event parameter `canceled'. * src/keyboard.c (make_lispy_event) <TOUCHSCREEN_END_EVENT>: If event->modifiers, set canceled to t. * src/termhooks.h (enum event_kind): Describe meaning of modifiers in TOUCHSCREEN_END_EVENTs. * src/xfns.c (setup_xi_event_mask): Select for XI_TouchOwnership. * src/xterm.c (xi_link_touch_point): Round X and Y and clear ownership. (xi_unlink_touch_point): Return 1 if the touch point is not owned by Emacs, 2 otherwise. (handle_one_xevent): Handle XI_TouchOwnership events and report ownership correctly. * src/xterm.h (enum xi_touch_ownership): New enum. Write commentary on XI touch sequence ownership. (struct xi_touch_point_t): Use integer X and Y. New field `ownership'. Adjust for alignment.
* | | Merge remote-tracking branch 'origin/master' into feature/androidPo Lu2023-05-221-6/+5
|\ \ \ | |/ /
| * | Plug various leaks and fix input method initializationPo Lu2023-05-221-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/image.c (free_bitmap_record): Free bm->name correctly even if the display connection has been closed. * src/xfns.c (x_window): Use dpyinfo-specific `use_xim' flag. * src/xterm.c (use_xim): Remove global variable. (xim_destroy_callback): Free `xim_styles' if present, and set it to NULL to be on the safe side. (xim_open_dpy): Consult dpyinfo->use_xim instead. Don't leak `xim_styles' if an IM was previously opened. (xim_initialize): Use dpyinfo-specific `use_xim' flag. (xim_close_dpy): Check if `dpyinfo->xim_callback_data' is set before unregistering the instantiation callback. (x_term_init): Determine whether or not to use XIM for each display opened, instead of using the resources of the last display opened to toggle a global flag. (x_delete_terminal): Always call `image_destroy_all_bitmaps' and `xim_close_dpy'. Free storage used to hold bitmap records. * src/xterm.h (struct x_display_info): New field `use_xim'.
* | | Update Android portPo Lu2023-01-261-0/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * INSTALL.android: Describe that apksigner is also required. * configure.ac: Correctly add cross/Makefile to SUBDIR_MAKEFILES. * cross/Makefile.in: (config.status): Depend on $(top_srcdir)/config.status. * doc/emacs/input.texi (On-Screen Keyboards): Document how to quit without a physical keyboard. * java/org/gnu/emacs/EmacsNative.java (EmacsNative): New function `quit'. * java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): New field `lastVolumeButtonPress'. (onKeyDown): Quit if necessary. * m4/ndk-build.m4 (ndk_where_cc): Fix search if CC is not a single word. * src/android.c (android_open): Remove unused variable. (quit): New function. * src/androidmenu.c (android_process_events_for_menu): Allow quitting the menu. * src/xterm.c (handle_one_xevent, x_term_init, syms_of_xterm): Implement features described above, so they work on free operating systems. * src/xterm.h (struct x_display_info): New fields `quit_keysym', `quit_keysym_time'.
* | Correctly handle touches on the tool barPo Lu2023-01-171-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xterm.c (xi_link_touch_point): New argument `frame'. Set new field `touchpoint->frame' to it. (xi_unlink_touch_points): New function. (xi_disable_devices): Clear the tool bar device on frames whose tool bar device matches this field. (handle_one_xevent): If an XI_TouchBegin event lands on the tool bar, then simulate a pointer click. Ignore future events from that touchpoint from there onwards. (x_make_frame_invisible, x_free_frame_resources): Unlink touch points associated with the frame. * src/xterm.h (struct xi_touch_point_t): New field `frame'. (struct x_output): New fields for keeping track of tool bar touches.
* | Merge from origin/emacs-29Eli Zaretskii2023-01-011-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | cae528457c ; Add 2023 to copyright years. b394359261 Improve documentation of 'isearch-open-overlay-temporary' ab3210e709 Document 'use-package' in the 2 main manuals # Conflicts: # etc/refcards/ru-refcard.tex # lib/explicit_bzero.c # m4/explicit_bzero.m4
| * ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
| |
* | Redisplay "invisible" frames that are actually visible on modern XPo Lu2022-12-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/NEWS: Document that "invisible" frames are now redisplayed if the compositing manager is still displaying it as part of a thumbnail out of Emacs's control. * src/dispnew.c (Fredraw_display): Use FRAME_REDISPLAY_P. * src/frame.h (FRAME_REDISPLAY_P): New macro. * src/xdisp.c (clear_garbaged_frames, echo_area_display) (prepare_menu_bars, redisplay_internal, display_and_set_cursor) (gui_clear_cursor): Use FRAME_REDISPLAY_P to determine whether or not a frame should be redisplayed. * src/xfns.c (Fx_create_frame): Set visibility state initially. * src/xterm.c (handle_one_xevent): Likewise. * src/xterm.h (struct x_output): New field `visibility_state'.
* | Handle selection transfer errors earlierPo Lu2022-12-151-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xselect.c (x_decline_selection_request, struct transfer) (struct x_selection_request, x_cancel_selection_transfer) (x_start_selection_transfer, x_continue_selection_transfer): Give the right serial to x_ignore_errors_for_next_request. (x_handle_selection_error): New function. (x_reply_selection_request): Give the right serial to x_ignore_errors_for_next_request. * src/xterm.c (x_ignore_errors_for_next_request): New arg `selection_serial'. All callers changed. (x_error_handler): Call selection error handler. * src/xterm.h (struct x_failable_request): New field `selection_serial'.
* | ; * src/xterm.h: Fix minor copyeditsPo Lu2022-12-091-2/+2
| |
* | ; Minor copyedits of the latest xterm changeEli Zaretskii2022-12-071-2/+2
| | | | | | | | | | * src/xterm.h (struct x_display_info): Fix a comment. * src/xterm.c (syms_of_xterm) <x-detect-server-trust>: Doc fix.
* | Fix some more problems with running Emacs as untrustedPo Lu2022-12-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | * etc/PROBLEMS (X security problems): Describe new variable. * src/xfns.c (append_wm_protocols): Don't support ping when it does not work. * src/xterm.c (x_wm_supports_1): Don't support anything when untrusted. (x_term_init): Implement Vx_detect_server_trust. (syms_of_xterm): New variable `x-detect-server-trust'. * src/xterm.h (struct x_display_info): New field `untrusted'.
* | Make Emacs build with Xfixes support on old versions of the libraryPo Lu2022-12-041-1/+17
| | | | | | | | | | | | | | | | | | | | | | * src/xterm.c (xfixes_toggle_visible_pointer): (x_toggle_visible_pointer): (XTtoggle_invisible_pointer, x_term_init): Disable code requiring fixes 4.0 or later when the fixes library is older. * src/xterm.h: Define missing types needed by other extensions when the fixes library is too old. * configure.ac: Allow building with any version of the Xfixes extension library.
* | More behind the scenes transparent speedups around xselect.cPo Lu2022-12-021-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (display_menu_bar): Fix compiler warning about NULL pointer dereference. * src/xfns.c (Fx_begin_drag): Use x_intern_atoms. (Fx_change_window_property): Pass dpyinfo to x_fill_property_data. * src/xselect.c (lisp_data_to_selection_data): Use x_intern_atoms instead of syncing for each atom. (x_fill_property_data, x_send_client_event): Use x_intern_cached_atom. * src/xterm.c (x_intern_atoms): New function. * src/xterm.h: Update prototypes.
* | Finish up last change with more speedupsPo Lu2022-12-011-0/+6
| | | | | | | | | | | | * src/xterm.c (x_atom_refs): * src/xterm.h (struct x_display_info): Add some new atoms to be interned at connection setup.
* | Speed up handling X selection requestsPo Lu2022-12-011-0/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/NEWS: Announce speedup. * src/alloc.c (garbage_collect): Call mark_xselect. * src/xftfont.c (xftfont_end_for_frame): Fix crash on display IO error. * src/xselect.c (struct selection_data, struct transfer): New structures. (outstading_transfers): New variable. (SELECTED_EVENTS, x_selection_request_lisp_error): Stop checking cs->nofree. (x_catch_errors_unwind): Delete function. (c_size_for_format, x_size_for_format, selection_data_for_offset) (selection_data_size, transfer_selecting_event) (x_continue_selection_transfer, x_remove_selection_transfers) (x_selection_transfer_timeout): New functions. (x_reply_selection_request): When handling selection requests, never wait for property notifications synchronously. Instead, write out the selection data as the client reads it from the event loop. (x_handle_selection_request, x_convert_selection) (x_handle_property_notify, x_get_window_property) (lisp_data_to_selection_data): Don't ever use pointers to Lisp string data! Instead, just store the string object itself. (syms_of_xselect): Initialize outstanding transfer list. (syms_of_xselect_for_pdumper): * src/xterm.c (x_delete_display): Remove outstanding selection transfers. * src/xterm.h: Update prototypes.
* Make frame synchronization more robustPo Lu2022-11-271-0/+6
| | | | | | | | * src/xterm.c (x_sync_wait_for_frame_drawn_event) (x_sync_handle_frame_drawn): Only cancel frame synchronization if hanging twice or more in a row. * src/xterm.h (struct x_output, FRAME_X_DRAW_JUST_HUNG): New flag.
* Add knob to make `mouse-position' faster on XPo Lu2022-11-181-13/+8
| | | | | | | | | * etc/PROBLEMS (Improving performance with slow X connections): Add new advice. * src/xterm.c (XTmouse_position): Add alternative implementations for slow connections. (syms_of_xterm): Add new variable to enable them. * src/xterm.h (struct x_display_info): Update commentary.
* More fixes to last changePo Lu2022-11-151-1/+1
| | | | | | | * lisp/dynamic-setting.el (font-setting-change-default-font): Call `reconsider-frame-fonts'. * src/frame.c (Freconsider_frame_fonts): New function. (syms_of_frame): Add new function.
* Simplify scroll valuator reset handlingPo Lu2022-10-281-5/+18
| | | | | | | | | | * src/xterm.c (xi_populate_device_from_info) (xi_reset_scroll_valuators_for_device_id, xi_handle_device_changed) (handle_one_xevent): * src/xterm.h (struct xi_scroll_valuator_t): Get rid of `pending_enter_reset', which was extremely convoluted and kept hitting server bugs. Now, valuators are reset upon all crossing events.
* Fix drag-and-drop bugs on Lucid buildPo Lu2022-10-251-0/+4
| | | | | | | | | | | | | | | | | Also, optimize Fx_translate_coordinates to avoid excessive calls to _XReply. * lisp/x-dnd.el (x-dnd-get-drop-rectangle): Return empty drop rectangle if posn-area. * src/xfns.c (Fx_translate_coordinates): Accept arg `require_child'. If not set, allow optimizations based on cached position data. * src/xselect.c (x_handle_dnd_message): Use x_translate_coordinates. * src/xterm.c (x_translate_coordinates): Export function. (x_handle_translate_coordinates): New function. (handle_one_xevent): Fix coding style. * src/xterm.h: Update prototypes.
* Reduce duplicate code for creating "special windows"Po Lu2022-10-231-2/+1
| | | | | | | | * src/xterm.c (x_create_special_window): Define on all non-GTK builds and all builds with XFixes. (x_update_frame_user_time_window): Use x_create_special_window. Also write a comment explaining what user time windows are. * src/xterm.h: Fix style of `x_parse_color' prototype.
* Fix pieces of code being too expensive over slow network connectionsPo Lu2022-10-171-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/menu-bar.el (menu-bar-edit-menu): Test buffer-read-only before gui-backend-selection-exists-p. This places the less expensive condition before the more expensive one. * src/xfns.c (compute_tip_xy): Use cached monitor attributes whenever available. (Fx_show_tip): Remove code that really did nothing. (Fx_backspace_delete_keys_p): Do not download the entire keymap from the server upon creating a frame. * src/xmenu.c (create_and_show_popup_menu): Use x_translate_coordinates_to_root. (x_menu_show): Use x_translate_coordinates_to_root. * src/xselect.c (Fx_selection_exists_p): If a temporary selection owner can be found, use it. * src/xterm.c (x_translate_coordinates_to_root) (x_handle_selection_monitor_event, x_find_selection_owner): New functions. These functions try to avoid downloading data from the X server in places that are called very often (i.e. during tool bar updates.) (handle_one_xevent): Handle selection notify events. Also catch some mistakes found. Fetch all kinds of key names as well. (x_create_special_window): New function. (x_term_init, x_delete_display): Ask for all key names. Also, passively monitor selections that are given to `x-selection-exists-p' during redisplay, so we do not have to ask the server about them upon each redisplay. (syms_of_xterm): New variable `x-fast-selection-list'. * src/xterm.h (struct x_monitored_selection): New structure. (X_INVALID_WINDOW): New define. (struct x_display_info): New fields for selection monitoring. Also, record the fixes extension base.
* Fix multiple sources of flicker under XPo Lu2022-10-161-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | Fix three kinds of flicker. The first is if you do: (while t (sit-for 1) (redraw-display)) and press a key, the frame will turn blank until you C-g. The second is where handling async input happens in the middle of drawing and causes a buffer flip to happen. The third is where unmapping the hourglass window causes exposures. * src/dispnew.c (redraw_frame): Garbage the frame if it is a window system frame. * src/xterm.c (x_update_begin): Clear complete flag. (x_flip_and_flush, XTframe_up_to_date): Set complete flag. (x_show_hourglass): Fix hourglass window class. (flush_dirty_back_buffer_on): Rename to x_flush_dirty_back_buffer_on. (x_flush_dirty_back_buffer_on): Check if the frame is complete before trying to flip. (handle_one_xevent): Flush frames in a more detailed fashion. * src/xterm.h (struct x_output): New flag `complete'. (FRAME_X_COMPLETE_P): New macro.
* Fix coding systems used for X input methodsPo Lu2022-10-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | * doc/emacs/mule.texi (International): Refer to X Coding as well. (Communication Coding): Document that locale-coding-system is not always used on X to decode keyboard input. (X Coding): New node. * etc/NEWS: Announce change to input method coding resolution. * lisp/term/x-win.el (x-get-input-coding-system): New function. * src/coding.c (syms_of_coding): Update doc string of locale-coding-system. * src/xfns.c (struct x_xim_text_conversion_data) (x_xim_text_to_utf8_unix_1, x_xim_text_to_utf8_unix_2) (x_xim_text_to_utf8_unix): Accept dpyinfo. Use the coding system specified inside if possible. (xic_preedit_draw_callback): Pass dpyinfo. * src/xterm.c (handle_one_xevent): Use XIM coding system for IM input. (xim_open_dpy): Try to determine the input method coding system. (mark_xterm): Mark `xim_coding'. (syms_of_xterm): New variable `x-input-coding-system'. * src/xterm.h (struct x_display_info): New field `xim_coding'. (FRAME_X_XIM_CODING): New macro.
* Optimize coordinate translation during event handlingPo Lu2022-09-271-0/+9
| | | | | | | | | | | | | | | | | | | These changes noticeably improve turning the mouse wheel on top of scroll bars etc over slow network connections. * src/xterm.c (x_dnd_note_self_position, x_dnd_note_self_wheel) (x_dnd_note_self_drop): Use x_translate_coordinates. (x_compute_root_window_offset): New function for calculating and caching root window offsets of edit window. (x_translate_coordinates): New function. Use cached values whenever possible. (xi_compute_root_window_offset) (xi_compute_root_window_offset_pinch): New wrappers for XI2 events. (x_construct_mouse_click, handle_one_xevent): Use x_translate_coordinates wherever appropriate. * src/xterm.h (struct x_output): New fields for keeping track of the root window offset of the edit window.
* Reduce complexity of scroll bar window protection codePo Lu2022-09-241-9/+0
| | | | | | | | | | | | | | | | | | | | It turns out my previous theories of why ClientMessages were generated were wrong, and they are just generated so we can set finish to X_EVENT_GOTO_OUT to have them delivered immediately. This allows for the code to be simplified greatly, by not unpacking pointers to the raw window into the client messages. * src/xterm.c (x_unprotect_window_for_callback): Return the window removed from the queue, or nil if none. (x_scroll_bar_to_input_event) (x_horizontal_scroll_bar_to_input_event): Use window provided by x_unprotect_window_for_callback. (handle_one_xevent): Pass dpyinfo to functions that need it. (x_free_frame_resources): Remove "first scroll bar request" code. * src/xterm.h (struct x_display_info): Likewise.
* Fix more toolkit scroll bar window protection issuesPo Lu2022-09-231-0/+9
| | | | | | | | | * src/xterm.c (handle_one_xevent): Ignore outdated scroll bar events. (x_free_frame_resources): Clear protected windows and invalidate previous scroll bar events. * src/xterm.h (struct x_display_info): New field `first_valid_scroll_bar_req'.
* Correctly handle frame synchronization on fullscreen KWinPo Lu2022-09-061-1/+2
| | | | | | | | | * src/xfns.c (x_set_use_frame_synchronization): Announce that we do not want the compositor to unredirect the frame while fullscreen. * src/xterm.c (x_atom_refs): New atom `_NET_WM_BYPASS_COMPOSITOR'. * src/xterm.h (struct x_display_info): Likewise.
* Prevent crashes when embedding Emacs in a nonexistent parentPo Lu2022-09-021-2/+2
| | | | | | | | | | | | * src/xfns.c (x_window, Fx_create_frame): Handle X errors while trying to reparent the frame onto an explicitly specified parent. * src/xterm.c (handle_one_xevent): Handle unparenting embedded windows correctly. This only works if the embedder is aware of the fixes extension and has put the window into the right save set. (x_embed_frame): New function. * src/xterm.h (FRAME_X_EMBEDDED_P): Fix coding style.
* ; * src/xterm.h (struct x_display_info): Update comment.Po Lu2022-08-261-1/+2
|
* Fix overflows in HAVE_XSYNC timestamp handlingPaul Eggert2022-08-251-5/+5
| | | | | | | | | | | | | | | | | | | | | | | Also, port to platforms lacking CLOCK_MONOTONIC and int64_t, and use 0 more consistently to represent missing timestamps. * src/xterm.h (struct x_display_info): Omit server_time_monotonic_p and server_time_offset if !HAVE_CLOCK_GETTIME since they are unused in that case. * src/xterm.h (struct x_display_info, struct x_output): * src/xterm.c (x_sync_get_monotonic_time) (x_sync_current_monotonic_time, x_sync_note_frame_times): Use int_fast64_t instead of int64_t as POSIX doesn't guarantee the latter. Similarly for uint_fast64_t. (x_sync_get_monotonic_time, x_sync_current_monotonic_time) (x_sync_note_frame_times, x_display_set_last_user_time): Check for integer overflow in time arithmetic. (CLOCK_MONOTONIC): Define to CLOCK_REALTIME if absent. (x_sync_current_monotonic_time): Check for clock_gettime failure and fall back on CLOCK_REALTIME if CLOCK_MONOTONIC does not work, which POSIX allows. (x_sync_current_monotonic_time, x_sync_note_frame_times) (x_display_set_last_user_time): Use 0 more consistently to represent missing timestamps.
* Fix various problems with mouse highlight on XI2 buildsPo Lu2022-08-251-0/+6
| | | | | | | | | | * src/dispextern.h (reset_mouse_highlight): Fix coding style. * src/xterm.c (xi_position_changed): New functions. (xi_report_motion_window_clear, handle_one_xevent): Don't report motion events if the pixel position did not actually change. * src/xterm.h (struct xi_device_t): New fields `last_motion_window', `last_motion_x' and `last_motion_y'.
* Make frame synchronization conditional on clock_gettimePo Lu2022-08-231-1/+2
| | | | | | | | | * src/xfns.c (x_set_parent_frame) (x_set_use_frame_synchronization): * src/xterm.c (x_update_begin, show_back_buffer, x_update_end) (x_display_set_last_user_time, handle_one_xevent): * src/xterm.h (struct x_output): Define out vsync code when !HAVE_CLOCK_GETTIME. (bug#57346)
* Make frame synchronization conditional on clock_gettimePo Lu2022-08-231-1/+1
| | | | | | | | | * src/xfns.c (x_set_parent_frame) (x_set_use_frame_synchronization): * src/xterm.c (x_update_begin, show_back_buffer, x_update_end) (x_display_set_last_user_time, handle_one_xevent): * src/xterm.h (struct x_output): Define out vsync code when !HAVE_CLOCK_GETTIME.
* Improve handling of pointer focus under the input extensionPo Lu2022-08-081-3/+28
| | | | | | | | | | | | | | | | | | * src/xfns.c (x_relative_mouse_position) (Fx_mouse_absolute_pixel_position, compute_tip_xy): Use x_query_pointer instead of XQueryPointer. * src/xterm.c (xi_populate_device_from_info): Set new attachment field. (xi_handle_focus_change): Set client pointer. (xi_focus_handle_for_device, xi_handle_interaction): Use attached keyboard device to handle focus. (x_query_pointer): New function. (XTmouse_position, x_scroll_bar_report_motion) (x_horizontal_scroll_bar_report_motion, handle_one_xevent): Use x_query_pointer instead of XQueryPointer. (x_term_init): Initialize client pointer device. * src/xterm.h (struct xi_device_t): New field `attachment'. (struct x_display_info): New field `client_pointer_device'.