aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add some primitive momentum-based precision scrollingPo Lu2021-12-021-7/+11
| | | | | | | | | | | | | | | | | | The algorithm used to scroll the display kinetically is very simple and needs improvement. Someone should work on that eventually. * lisp/pixel-scroll.el (pixel-scroll-precision-use-momentum): New user option. (pixel-scroll-precision-mode-map): Add `pixel-scroll-start-momentum'. (pixel-scroll-kinetic-state): (pixel-scroll-accumulate-velocity): (pixel-scroll-calculate-velocity): New functions. (pixel-scroll-start-momentum): New command. * src/xterm.c (handle_one_xevent): Fix touch-end event generation.
* Add `touch-end' event typePo Lu2021-12-021-13/+22
| | | | | | | | | | | | | | | | | | * etc/NEWS: * doc/lispref/commands.texi (Misc Events): Document new `touch-end' event type. * lisp/bindings.el: Ignore touch-end events by default. * src/keyboard.c (make_lispy_event): Add support for TOUCH_END_EVENT events. (syms_of_keyboard): New symbol `touch-end'. * src/termhooks.h (enum event_kind): New member `TOUCH_END_EVENT'. * src/xterm.c (handle_one_xevent): Send touch-end events when appropriate.
* Support precision mouse scrolling on MS-WindowsEli Zaretskii2021-12-011-8/+1
| | | | | | | | | | | | | | | | | | | | | | * src/w32fns.c (w32_wnd_proc): Pass the WM_SETTINGCHANGE message to the Lisp thread. * src/w32term.c (w32_construct_mouse_wheel): Support mice with precision scrolling wheel. (w32_get_mouse_wheel_vertical_delta): New function. (w32_read_socket): When the WM_SETTINGCHANGE is received, call 'w32_get_mouse_wheel_vertical_delta'. (w32_initialize): Call 'w32_get_mouse_wheel_vertical_delta' at startup. * src/nsterm.m (syms_of_nsterm): * src/haikuterm.c (syms_of_haikuterm): * src/xterm.c (syms_of_xterm): Remove window-system specific variables for coalescing mwheel events. * src/keyboard.c (syms_of_keyboard) <mwheel-coalesce-scroll-events>: New variable, to replace the above platform-specific ones. * doc/lispref/commands.texi (Misc Events): Improve wording of the description of mouse-wheel events.
* Allow non-float values in x-scroll-event-delta-factorPo Lu2021-11-301-2/+2
| | | | | * src/xterm.c (handle_one_xevent): Use XFLOATINT instead of XFLOAT_DATA.
* Allow customizing the pixel delta of wheel events on XPo Lu2021-11-291-0/+9
| | | | | | | * lisp/cus-start.el: Add `x-scroll-event-delta-factor'. * src/xterm.c (handle_one_xevent): Apply scroll event delta factor to wheel events with pixel data. (Vx_scroll_event_delta_factor): New user option.
* Update XKB map on MappingNotifyPo Lu2021-11-291-0/+5
| | | | | * src/xterm.c (handle_one_xevent): Update XKB map when X tells us the keyboard map has been updated.
* Set motion event time when handling XI2 motion eventsPo Lu2021-11-271-0/+1
| | | | | * src/xterm.c (handle_one_xevent): Set motion event time when handling XI_Motion.
* Explain confusing aspects of XInput 2 scroll wheel reportingPo Lu2021-11-261-1/+42
| | | | | | | | * src/xterm.c (x_init_master_valuators): Explain how XInput 2 reports scroll wheel movement. (handle_one_xevent): Explain why XI2 scroll valuators are reset after each enter events.
* Make XInput 2 builds work without cairoPo Lu2021-11-261-0/+3
| | | | | * src/xterm.c: Move some defines around so XI2 code doesn't get ifdef'd out if Cairo is disabled.
* Set serial when filtering XI_KeyPress eventsPo Lu2021-11-251-1/+1
| | | | | | | This fixes fcitx flicker for whatever reason. * src/xterm.c (handle_one_xevent): Set serial when filtering XI_KeyPress events.
* Add support for pixel wheel deltas on NSPo Lu2021-11-251-1/+1
| | | | | | * src/xterm.c (x_coalesce_scroll_events): Update doc string. * src/nsterm.c (- mouseDown): Report pixel scroll deltas. (x_coalesce_scroll_events): New variable
* Use only effective modifiers when handling XI2 button eventsPo Lu2021-11-241-4/+1
| | | | | * src/xterm.c (handle_one_xevent): Use mods.effective when constructing button events.
* Fix compilation with XInput 2 but without XKBPo Lu2021-11-231-2/+0
| | | | | * src/xterm.c (handle_one_xevent): Remove extraneous conditional.
* Only reset scroll valuators on real enter eventsPo Lu2021-11-231-2/+6
| | | | | * src/xterm.c (handle_one_xevent): Test event detail and mode before resetting scroll valuators.
* Fix XI2 keysym translationPo Lu2021-11-231-34/+19
| | | | | * src/xterm.c (handle_one_xevent): Handle XI_KeyPress events that can't be translated into strings.
* Move XI2 event filtering to a more appropriate locationPo Lu2021-11-221-25/+30
| | | | | * src/xterm.c (handle_one_xevent): Filter all key press events even if no frame is found.
* Use more precise test for emulated wheel events in XI2Po Lu2021-11-221-2/+6
| | | | | * src/xterm.c (handle_one_xevent): Ignore button events that have XIPointerEmulated set.
* Also filter XI_KeyRelease eventsPo Lu2021-11-221-0/+19
| | | | | * src/xterm.c (handle_one_xevent): Also filter XI_KeyRelease events through the X input method.
* Use only effective modifiers for XI2 key press eventsPo Lu2021-11-221-4/+1
| | | | | * src/xterm.c (handle_one_xevent): Use only effective modifiers in XI_KeyPress events.
* Report time in XInput 2 button eventsPo Lu2021-11-211-0/+1
| | | | | * src/xterm.c (handle_one_xevent): Report time in XI button events.
* Fix documentation string of x_coalesce_scroll_eventsPo Lu2021-11-211-1/+1
| | | | | * src/xterm.c (x_coalesce_scroll_events): Update doc string to reflect that this option is now supported under Haiku.
* Allow handling smooth scroll events in xwidgetsPo Lu2021-11-211-0/+32
| | | | | | | | * src/xterm.c (handle_one_xevent): Pass through XI2 motion events to xwidgets. * src/xterm.c (xwidget_button): Don't handle legacy scroll events on XInput 2. (xwidget_motion_notify, xwidget_scroll): New functions.
* Add XInput 2 input method supportPo Lu2021-11-211-43/+102
| | | | | * src/xterm.c (handle_one_xevent): Let input methods filter events first before trying to handle an XI2 key press event.
* Add support for the Haiku operating system and its window systemPo Lu2021-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .gitignore: Add binaries specific to Haiku. * Makefie.in (HAVE_BE_APP): New variable. (install-arch-dep): Install Emacs and Emacs.pdmp when using Haiku. * configure.ac: Detect and configure for Haiku and various related configurations. (be-app, be-freetype, be-cairo): New options. (HAVE_BE_APP, HAIKU_OBJ, HAIKU_CXX_OBJ) (HAIKU_LIBS, HAIKU_CFLAGS): New variables. (HAIKU, HAVE_TINY_SPEED_T): New define. (emacs_config_features): Add BE_APP. * doc/emacs/Makefile.in (EMACSSOURCES): Add Haiku appendix. * doc/emacs/emacs.texi: Add Haiku appendix to menus and include it. * doc/emacs/haiku.texi: New Haiku appendix. * doc/lispref/display.texi (Defining Faces, Window Systems): Explain meaning of `haiku' as a window system identifier. (haiku-use-system-tooltips): Explain meaning of system tooltips on Haiku. * doc/lispref/frames.texi (Multiple Terminals): Explain meaning of haiku as a display type. (Frame Layout): Clarify section for Haiku frames. (Size Parameters): Explain limitations of fullwidth and fullheight on Haiku. (Management Parameters): Explain limitations of inhibiting double buffering on builds with Cairo, and the inability of frames with no-accept-focus to receive keyboard input on Haiku. (Font and Color Parameters): Explain the different font backends available on Haiku. (Raising and Lowering): Explain that lowering and restacking frames doesn't work on Haiku. (Child Frames): Explain oddities of child frame visibility on Haiku. * doc/lispref/os.texi (System Environment): Explain meaning of haiku. * etc/MACHINES: Add appropriate notices for Haiku. * etc/NEWS: Document changes. * etc/PROBLEMS: Document font spacing bug on Haiku. * lib-src/Makefile.in: Build be-resources binary on Haiku. (CXX, CXXFLAGS, NON_CXX_FLAGS, ALL_CXXFLAGS) (HAVE_BE_APP, HAIKU_LIBS, HAIKU_CFLAGS): New variables. (DONT_INSTALL): Add be-resources binary if on Haiku. (be-resources): New target. * lib-src/be_resources: Add helper binary for setting resources on the Emacs application. * lib-src/emacsclient.c (decode_options): Set alt_display to "be" on Haiku. * lisp/cus-edit.el (custom-button, custom-button-mouse) (custom-button-unraised, custom-button-pressed): Update face definitions for Haiku. * lisp/cus-start.el: Add haiku-debug-on-fatal-error and haiku-use-system-tooltips. * lisp/faces.el (face-valid-attribute-values): Clarify attribute comment for Haiku. (tool-bar): Add appropriate toolbar color for Haiku. * lisp/frame.el (haiku-frame-geometry) (haiku-mouse-absolute-pixel-position) (haiku-set-mouse-absolute-pixel-position) (haiku-frame-edges) (haiku-frame-list-z-order): New function declarations. (frame-geometry, frame-edges) (mouse-absolute-pixel-position) (set-mouse-absolute-pixel-position) (frame-list-z-order): Call appropriate window system functions on Haiku. (display-mouse-p, display-graphic-p) (display-images-p, display-pixel-height) (display-pixel-width, display-mm-height) (display-mm-width, display-backing-store) (display-save-under, display-planes) (display-color-cells, display-visual-class): Update type tests for Haiku. * lisp/international/mule-cmds.el (set-coding-system-map): Also prevent set-terminal-coding-system from appearing in the menu bar on Haiku. * lisp/loadup.el: Load Haiku-specific files when built with Haiku, and don't rename newly built Emacs on Haiku as BFS doesn't support hard links. * lisp/menu-bar.el (menu-bar-open): Add for Haiku. * lisp/mwheel.el (mouse-wheel-down-event): Expect wheel-up on Haiku. (mouse-wheel-up-event): Expect wheel-down on Haiku. (mouse-wheel-left-event): Expect wheel-left on Haiku. (mouse-wheel-right-event): Expect wheel-right on Haiku. * lisp/net/browse-url.el (browse-url--browser-defcustom-type): Add option for WebPositive. (browse-url-webpositive-program): New variable. (browse-url-default-program): Search for WebPositive. (browse-url-webpositive): New function. * lisp/net/eww.el (eww-form-submit, eww-form-file) (eww-form-checkbox, eww-form-select): Define faces appropriately for Haiku. * lisp/term/haiku-win.el: New file. * lisp/tooltip.el (menu-or-popup-active-p): New function declaration. (tooltip-show-help): Don't use tooltips on Haiku when a menu is active. * lisp/version.el (haiku-get-version-string): New function declaration. (emacs-version): Add Haiku version string if appropriate. * src/Makefile.in: Also produce binary named "Emacs" with Haiku resources set. (CXX, HAIKU_OBJ, HAIKU_CXX_OBJ, HAIKU_LIBS) (HAIKU_CFLAGS, HAVE_BE_APP, NON_CXX_FLAGS) (ALL_CXX_FLAGS): New variables. (.SUFFIXES): Add .cc. (.cc.o): New target. (base_obj): Add Haiku C objects. (doc_obj, obj): Split objects that should scanned for documentation into doc_obj. (SOME_MACHINE_OBJECTS): Add appropriate Haiku C objects. (all): Depend on Emacs and Emacs.pdmp on Haiku. (LIBES): Add Haiku libraries. (gl-stamp) ($(etc)/DOC): Scan doc_obj instead of obj (temacs$(EXEEXT): Use C++ linker on Haiku. (ctagsfiles3): New variable. (TAGS): Scan C++ files. * src/alloc.c (garbage_collect): Mark Haiku display. * src/dispextern.h (HAVE_NATIVE_TRANSFORMS): Also enable on Haiku. (struct image): Add fields for Haiku transforms. (RGB_PIXEL_COLOR): Define to unsigned long on Haiku as well. (sit_for): Also check USABLE_SIGPOLL. (init_display_interactive): Set initial window system to Haiku on Haiku builds. * src/emacs.c (main): Define Haiku syms and init haiku clipboard. (shut_down_emacs): Quit BApplication on Haiku and trigger debug on aborts if haiku_debug_on_fatal_error. (Vsystem_type): Update docstring. * src/fileio.c (next-read-file-uses-dialog-p): Enable on Haiku. * src/filelock.c (WTMP_FILE): Only define if BOOT_TIME is also defined. * src/floatfns.c (double_integer_scale): Work around Haiku libroot brain damage. * src/font.c (syms_of_font): Define appropriate font driver symbols for Haiku builds with various options. * src/font.h: Also enable ftcrfont on Haiku builds with Cairo. (font_data_structures_may_be_ill_formed): Also enable on Haiku builds that have Cairo. * src/frame.c (Fframep): Update doc-string for Haiku builds and return haiku if appropriate. (syms_of_frame): New symbol `haiku'. * src/frame.h (struct frame): Add output data for Haiku. (FRAME_HAIKU_P): New macro. (FRAME_WINDOW_P): Test for Haiku frames as well. * src/ftcrfont.c (RED_FROM_ULONG, GREEN_FROM_ULONG) (BLUE_FROM_ULONG): New macros. (ftcrfont_draw): Add haiku specific code for Haiku builds with Cairo. * src/ftfont.c (ftfont_open): Set face. (ftfont_has_char, ftfont_text_extents): Work around crash. (syms_of_ftfont): New symbol `mono'. * src/ftfont.h (struct font_info): Enable Cairo-specific fields for Cairo builds on Haiku. * src/haiku_draw_support.cc: * src/haiku_font_support.cc: * src/haiku_io.c: * src/haiku_select.cc: * src/haiku_support.cc: * src/haiku_support.h: * src/haikufns.c: * src/haikufont.c: * src/haikugui.h: * src/haikuimage.c: * src/haikumenu.c: * src/haikuselect.c: * src/haikuselect.h: * src/haikuterm.c: * src/haikuterm.h: Add new files for Haiku windowing support. * src/haiku.c: Add new files for Haiku operating system support. * src/image.c: Implement image transforms and native XPM support on Haiku. (GET_PIXEL, PUT_PIXEL, NO_PIXMAP) (PIX_MASK_RETAIN, PIX_MASK_DRAW) (RGB_TO_ULONG, RED_FROM_ULONG, GREEN_FROM_ULONG) (BLUE_FROM_ULONG, RED16_FROM_ULONG, GREEN16_FROM_ULONG) (BLUE16_FROM_ULONG): Define to appropriate values on Haiku. (image_create_bitmap_from_data): Add Haiku support. (image_create_bitmap_from_file): Add TODO on Haiku. (free_bitmap_record): Free bitmap on Haiku. (image_size_in_bytes): Implement for Haiku bitmaps. (image_set_transform): Implement on Haiku. (image_create_x_image_and_pixmap_1): Implement on Haiku, 24-bit or 1-bit only. (image_destroy_x_image, image_get_x_image): Use correct img and pixmap values on Haiku. (lookup_rgb_color): Use correct macro on Haiku. (image_to_emacs_colors): Implement on Haiku. (image_disable_image): Disable on Haiku. (image_can_use_native_api): Test for translator presence on Haiku. (native_image_load): Use translator on Haiku. (imagemagick_load_image): Add Haiku-specific quirks. (Fimage_transforms_p): Allow rotate90 on Haiku. (image_types): Enable native XPM support on Haiku. (syms_of_image): Enable XPM images on Haiku. * src/keyboard.c (kbd_buffer_get_event) (handle_async_input, handle_input_available_signal) (handle_user_signal, Fset_input_interrupt_mode) (init_keyboard): Check for USABLE_SIGPOLL along with USABLE_SIGIO. * src/lisp.h (pD): Work around broken Haiku headers. (HAVE_EXT_MENU_BAR): Define on Haiku. (handle_input_available_signal): Enable if we just have SIGPOLL as well. * src/menu.c (have_boxes): Return true on Haiku. (single_menu_item): Enable toolkit menus on Haiku. (find_and_call_menu_selection): Also enable on Haiku. * src/process.c (keyboard_bit_set): Enable with only usable SIGPOLL. (wait_reading_process_output): Test for SIGPOLL as well as SIGIO availability. * src/sound.c (sound_perror, vox_open) (vox_configure, vox_close): Enable for usable SIGPOLL as well. * src/sysdep.c (sys_subshell): Enable for usable SIGPOLL. (reset_sigio): Make conditional on F_SETOWN. (request_sigio, unrequest_sigio) (emacs_sigaction_init): Also handle SIGPOLLs. (init_sys_modes): Disable TCXONC usage on Haiku, as it doesn't have any ttys other than pseudo ttys, which don't support C-s/C-q flow control, and causes compiler warnings. (speeds): Disable high speeds if HAVE_TINY_SPEED_T. * src/termhooks.h (enum output_method): Add output_haiku. (struct terminal): Add Haiku display info. (TERMINAL_FONT_CACHE): Enable for Haiku. * src/terminal.c (Fterminal_live_p): Return `haiku' if appropriate. * src/verbose.mk.in (AM_V_CXX, AM_V_CXXLD): New logging variables. * src/xdisp.c (redisplay_internal) (note_mouse_highlight): Return on Haiku if a popup is activated. (display_menu_bar): Return on Haiku if frame is a Haiku frame. * src/xfaces.c (GCGraphicsExposures): Enable correctly on Haiku. (x_create_gc): Enable dummy GC code on Haiku. * src/xfns.c (x-server-version, x-file-dialog): Add Haiku specifics to doc strings. * src/xterm.c (syms_of_xterm): Add Haiku information to doc string.
* Prevent crashes when scrolling in an unknown Window on XI2Po Lu2021-11-201-9/+8
| | | | | * src/xterm.c (handle_one_xevent): Fix XI2 frame lookup to handle foreign windows.
* Fix a comment in XInput related codePo Lu2021-11-201-1/+1
| | | | | * src/xterm.c (x_term_init): Fix comment to say "XInput 2.1" instead of "XInput 1.1".
* Expose pixel-wise wheel events to LispPo Lu2021-11-201-11/+30
| | | | | | | | | | | | | | * doc/lispref/commands.texi (Misc Events): Document changes to wheel events. * src/keyboard.c (make_lispy_event): Handle wheel events with pixel delta data. * src/termhooks.h (WHEEL_EVENT): Document changes to WHEEL_EVENT args. * src/xfns.c (syms_of_xfns): Declare new symbols. * src/xterm.c (handle_one_xevent): Give wheel events pixel delta data. (x_coalesce_scroll_events): New user option.
* Add support for event processing via XInput 2Po Lu2021-11-201-4/+1103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Add an option to use XInput 2 if available. * src/Makefile.in (XINPUT_LIBS, XINPUT_CFLAGS): New variables. (EMACS_CFLAGS): Add Xinput CFLAGS. (LIBES): Add XInput libs. * src/xmenu.c (popup_activated_flag): Expose flag if XInput 2 is available. * src/xfns.c (x_window): Set XInput 2 event mask. (setup_xi_event_mask): New function. (syms_of_xfns): Provide XInput 2 feature. * src/xterm.c (x_detect_focus_change): Handle XInput 2 GenericEvents. (handle_one_xevent): Handle XInput 2 events. (x_term_init): Ask the server for XInput 2 support and set xkb_desc if available. (x_delete_terminal): Free XKB kb desc if it exists, and free XI2 devices if they exist. (xi_grab_or_ungrab_device) (xi_reset_scroll_valuators_for_device_id) (x_free_xi_devices, x_init_master_valuators): New functions. (x_get_scroll_valuator_delta): New function. (init_xterm): Don't tell GTK to only use Core Input when built with XInput 2 support. * src/xterm.h (struct x_display_info): Add fields for XKB and XI2 support. * src/gtkutil.c (xg_event_is_for_menubar): Handle XIDeviceEvents. (xg_is_menu_window): New function. (xg_event_is_for_scrollbar): Handle XIDeviceEvents. * etc/NEWS: Document changes. * lisp/mwheel.el (mouse-wheel-down-alternate-event) (mouse-wheel-up-alternate-event) (mouse-wheel-left-alternate-event) (mouse-wheel-right-alternate-event): New user options. (mouse-wheel-text-scale) (mwheel-scroll): Test for alternate events. (mouse-wheel--setup-bindings): Set up bindings for alternate buttons.
* Lower xwidget views owned by parent when lowering framePo Lu2021-11-161-0/+7
| | | | | | | | * src/xterm.c (x_lower_frame): Lower parent frame's xwidget views as well. * src/xwidget.h (lower_frame_xwidget_views): * src/xwidget.c (lower_frame_xwidget_views): New function.
* Stop assuming xwidget views will only be displayed in TEXT_AREAPo Lu2021-11-151-1/+1
| | | | | | | | | | * src/xterm.c (x_scroll_run): Use view->area when calculating xwidget view clipping. * src/xwidget.c (x_draw_xwidget_glyph_string): Set view->area to s->area and use that instead. * src/xwidget.h (struct xwidget_view): Add glyph row area field.
* Fix scroll event test in handle_one_xeventPo Lu2021-11-131-4/+2
| | | | | * src/xterm.c (handle_one_xevent): Test for scroll wheel button correctly in xwidget code.
* Don't emit SELECT_WINDOW_EVENT when an xwidget is scrolledPo Lu2021-11-131-1/+3
| | | | | | * src/xterm.c (handle_one_event): Don't select xwidget window on button event if the button pressed actually represents the scroll wheel.
* Revert "Add support for event processing via XInput 2"Po Lu2021-11-101-1082/+4
| | | | This reverts commit 346cfc81247e6bf8e727a27b42f44f2389bd1269.
* Add support for event processing via XInput 2oldosfan2021-11-101-4/+1082
| | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Add an option to use XInput 2 if available * src/Makefile.in (XINPUT_LIBS, XINPUT_CFLAGS): New variables (EMACS_CFLAGS): Add Xinput CFLAGS (LIBES): Add XInput libs * src/xmenu.c (popup_activated_flag): Expose flag if XInput 2 is available * src/xfns.c (x_window): Set XInput 2 event mask * src/xterm.c (x_detect_focus_change): Handle XInput 2 GenericEvents (handle_one_xevent): Handle XInput 2 events (x_term_init): Ask the server for XInput 2 support and set xkb_desc if available (x_delete_terminal): Free XKB kb desc if it exists, and free XI2 devices if they exist (x_free_xi_devices, x_init_master_valuators): New functions (x_get_scroll_valuator_delta): New function (init_xterm): Don't tell GTK to only use Core Input when built with XInput 2 support * src/xterm.h (struct x_display_info): Add fields for XKB and XI2 support * src/gtkutil.c (xg_event_is_for_menubar): Handle XIDeviceEvents (xg_is_menu_window): New function (xg_event_is_for_scrollbar): Handle XIDeviceEvents
* Fix flicker when setting hscroll of xwidgetPo Lu2021-11-091-10/+14
| | | | | * src/xterm.c (x_scroll_run): Use original height of xwidget instead of window height and set cairo surface size (bug#51697).
* Really fix xwidget scroll optimization and clipPo Lu2021-11-091-7/+16
| | | | | | * src/xterm.c (x_scroll_run): Improve clip detection. * src/xwidget.c (xv_do_draw): Use cairo_translate. (xwidget_motion_or_crossing): Use correct fields (bug#51681).
* Ensure that the x_show_hourglass is seenLars Ingebrigtsen2021-11-071-0/+2
| | | | | * src/xterm.c (x_show_hourglass): Ensure that the hourglass is seen (bug#51649).
* Remove too-agressive window refresh in the hourglass codeLars Ingebrigtsen2021-11-071-1/+0
| | | | | * src/xterm.c (x_show_hourglass): Don't force a spurious refresh (bug#51649).
* Select window when clicking on an xwidget viewPo Lu2021-11-071-0/+6
| | | | | * src/xterm.c (handle_one_xevent): Select window when clicking on an xwidget view.
* Fix xwidget scrollingPo Lu2021-11-071-4/+2
| | | | * src/xterm.c (x_scroll_run): Use from_y and height.
* Handle crossing events on xwidget windows correctlyPo Lu2021-11-071-0/+13
| | | | | | | | | * src/xterm.c (handle_one_xevent): Clear help and mouse face when handling xwidget entry events. * src/xwidget.c (xwidget_motion_or_crossing): Add device to crossing events. (x_draw_xwidget_glyph_string): Add EnterWindowMask and LeaveWindowMask.
* Implement function for sending events to widgetsPo Lu2021-11-071-2/+2
| | | | | | | | | | | | * doc/lispref/display.texi (Xwidgets): Document changes. * src/keyboard.c (lispy_function_keys): Make non-static on X. * src/keyboard.h (lispy_function_keys): Expose lispy_function_keys on X. * src/xterm.c (x_emacs_to_x_modifiers): Export function. * src/xterm.h (x_emacs_to_x_modifiers): Likewise. * src/xwidget.c (Fxwidget_perform_lispy_event) (find_suitable_keyboard): New functions. (syms_of_xwidget): Define new subr.
* Allow xwidgets to accept motion and button eventsPo Lu2021-11-071-0/+41
| | | | | | | | | | | | | | | * src/xterm.c (handle_one_xevent): Pass through some events to xwidgets. * src/xwidget.c (synthesize_focus_in_event) (find_suitable_pointer, xwidget_button_1) (xwidget_button, xwidget_motion_or_crossing): New functions. (xwidget_view_from_window): Draw offscreen window instead of the widget. (x_draw_xwidget_glyph_string): Set appropriate event masks. * src/xwidget.h (xwidget_button, xwidget_motion_or_crossing): New functions.
* Destroy xwidgets when destroying framesPo Lu2021-11-071-0/+4
| | | | | | | | | | | | * src/xterm.c (x_free_frame_resources): Make sure to kill xwidget views. * src/xwidget.c (Fmake_xwidget): Attach damage event signal. (offscreen_damage_event): Operate on xwidgets and not individual views. (xwidget_init_view): Don't attach damage event signal here. (Fdelete_xwidget_view): Destroy window correctly and stop removing damage event signal. (kill_frame_xwidget_views): New function. * src/xwidget.c (kill_frame_xwidget_views): New function.
* Enable scrolling optimization for xwidgetsPo Lu2021-11-071-0/+82
| | | | | | | | | | | | | | | | | | | * src/dispextern.h (struct glyph): Store xwidget ID instead of a reference. * src/dispnew.c (scrolling_window): Enable scrolling optimization on xwidget builds. * src/xdisp.c (fill_xwidget_glyph_string, produce_xwidget_glyph): Obtain xwidget from ID. * src/xterm.c (x_scroll_run): Scroll xwidget windows. * src/xwidget.c (id_to_xwidget_map, xwidget_counter): New xwidget variables. (Fmake_xwidget): Assign each xwidget a unique ID, and keep track of that ID. (xwidget_from_id): New function. (syms_of_xwidget): Initialize id_to_xwidget_map. (xwidget_end_redisplay): Lookup xwidgets via ID. * src/xwidget.h (struct xwidget): Add ID field. (xwidget_from_id): New function.
* Use an X window to display xwidgets on X11Po Lu2021-11-071-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Emacs draws using X11 primitives, Emacs drawing operations can erase the GtkDrawingArea used to draw the offscreen widget, which leads to unpleasant flickering effects, all of which can be prevented by creating a native X window and drawing to that instead. * src/xterm.c (x_window_to_frame): Return xwidget window if appropriate. (handle_one_xevent): Handle xwidget expose events. * src/xwidget.c (x_window_to_xvw_map): New variable. (xwidget_view_from_window): New function. (xwidget_show_view, xwidget_hide_view) (offscreen_damage_event): Move to drawing xwidgets with X windows. (xv_do_draw) (xwidget_expose): New function. (xwidget_osr_draw_cb, xwidget_osr_event_forward) (xwidget_osr_event_set_embedder): Removed. (xwidget_init_view): Replace use of GtkDrawingArea with that of an X window. (x_draw_xwidget_glyph_string): Prevent xwidget views from constantly generating expose events, and use an X window instead of a GtkDrawingArea. (syms_of_xwidget): Initialize x_window_to_xwv_map. src/xwidget.h (struct xwidget_view): Replace GTK widgets with X-related fields. (xwidget_view_from_window, xwidget_expose): New functions.
* Redisplay after changing to the hourglass mouse pointerLars Ingebrigtsen2021-10-271-0/+1
| | | | | | * src/xterm.c (x_show_hourglass): Do a redisplay after changing to the hourglass pointer -- otherwise it won't be displayed until a keyboard/mouse event arrives (bug#19776).
* Fix minor issues with text display when cursor is in mouse facePo Lu2021-10-171-16/+0
| | | | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (get_cursor_offset_for_mouse_face): Don't calculate offsets for the glyph the cursor is on, and move some logic to get_glyph_pixel_width_delta_for_mouse_face. (fill_composite_glyph_string) (fill_gstring_glyph_string) (fill_glyphless_glyph_string) (fill_glyph_string) (fill_image_glyph_string) (fill_xwidget_glyph_string) (fill_stretch_glyph_string): Set s->face to mouse face whenever appropriate. (get_glyph_pixel_width_delta_for_mouse_face): New function. (set_glyph_string_background_width): Update background width and s->width to take into account differing :box properties of the mouse face, when producing strings for the cursor. (erase_phys_cursor): Redraw mouse face when erasing a cursor on top of the mouse face. * src/xterm.c (x_set_mouse_face_gc): Stop setting s->face when under mouse face because redisplay now does that for us. * src/w32term.c (w32_set_mouse_face_gc): Likewise.
* Tweak x_connection_closed when I/O errorPaul Eggert2021-10-031-1/+2
| | | | | | * src/xterm.c (x_connection_closed): Don’t dereference dpyinfo in the unlikely case where it is null and ioerror is true. This pacifies gcc 11.2.1 -Wanalyzer-null-dereference.
* Port unused decls to C2xPaul Eggert2021-10-031-1/+1
| | | | | * src/conf_post.h (ATTRIBUTE_UNUSED): Remove. All uses replaced by MAYBE_UNUSED, and moved to start as needed for C2x.