1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-20 19:42:53 -08:00
Commit graph

307 commits

Author SHA1 Message Date
Po Lu
ba063f8141 Send scroll stop events to xwidgets when built with XInput 2
* src/xwidget.c (xwidget_scroll): Set xg_event->scroll.is_stop
when appropriate.
2021-12-03 14:31:20 +08:00
Po Lu
3ce591804b Fix xwidget popups on XI2 again
* src/xwidget.c (xwidget_button_1): Release seat grab.
2021-11-28 13:43:19 +08:00
Po Lu
bd321f78eb Fix xwidget popups on XI2
* src/gtkutil.c (xg_is_menu_window): Determine whether wdesc
is a menu generated by a menu bar more reliably.

* src/xwidget.c (xwidget_button_1): Release all XI2 grabs on
click.
2021-11-28 13:14:13 +08:00
Po Lu
9324efac48 Make `xwidget-display-event' a special event as well
* doc/lispref/commands.texi (Xwidget Events): Document that
`xwidget-display-event' is a special event, and that it should
be handled through callbacks.

* etc/NEWS: Update NEWS entry.

* lisp/xwidget.el (xwidget-webkit-new-session)
(xwidget-webkit-import-widget): Attach display callback.
(xwidget-webkit-display-event): Call display callback instead.
(xwidget-webkit-display-callback): New function.

* src/keyboard.c (make_lispy_event): Store
source information for XWIDGET_DISPLAY_EVENT correctly.

* src/xwidget.c (store_xwidget_display_event): Store
source of the display request.
(webkit_ready_to_show): Store source if available.
(webkit_create_cb_1): Store source if available.
(kill_xwidget): Remove dead widget from internal_xwidget_list.
2021-11-22 10:47:29 +08:00
Po Lu
f094120360 Implement `pick_embedded_child' for offscreen xwidgets
* src/xwidget.c (pick_embedded_child): New function.
(Fmake_xwidget): Connect `pick-embedded-child' signal
to offscreen window.
2021-11-21 17:39:29 +08:00
Po Lu
b6570602cc Attach download-started signals to correct WebKit context
* src/xwidget.c (Fmake_xwidget): Use correct context.
2021-11-21 11:14:14 +08:00
Po Lu
39f3604e22 Allow handling smooth scroll events in xwidgets
* 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.
2021-11-21 11:06:02 +08:00
Po Lu
3b68662a82 Fix xwidgets with XInput 2 builds
* src/xwidget.c (Fmake_xwidget): Refrain from synthesizing
a focus event here on XI2 builds.
(Fxwidget_perform_lispy_event): Try to set embedder on XI2
builds and do nothing otherwise.
(synthesize_focus_in_event): Use focus_change.window as opposed
to any.window.
(x_draw_xwidget_glyph_string): Synthesize focus event here
instead on XI2 builds.
2021-11-20 19:56:22 +08:00
Po Lu
fbf361f593 Allow terminating page loading operations in webkit xwidgets
* doc/lispref/display.texi (Xwidgets): Document new function.
* etc/NEWS: Announce `xwidget-webkit-stop-loading'.
* src/xwidget.c (Fxwidget_webkit_stop_loading): New function.
(syms_of_xwidget): Define new subr.
2021-11-20 18:24:43 +08:00
Eli Zaretskii
eb86c33c46 Fix documentation of last commit
* lisp/xwidget.el (xwidget-webkit-cookie-file): Don't use "path"
for file names in the doc string.  Improve wording and markup of
the doc string.

* src/xwidget.c (Fxwidget_webkit_set_cookie_storage_file):
* doc/lispref/display.texi (Xwidgets): Don't use "path" for file
names.

* etc/NEWS: Improve the wording of the entry about
'xwidget-webkit-cookie-file'.
2021-11-19 15:41:48 +02:00
Po Lu
b4f0c4c694 Allow controlling where xwidget-webkit stores cookies
* doc/lispref/display.texi (Xwidgets): Document new function.
* etc/NEWS: Announce `xwidget-webkit-cookie-file' and
`xwidget-webkit-set-cookie-storage-file'.

* lisp/xwidget.el (xwidget-webkit-cookie-file): New user
option.
(xwidget-webkit-new-session): Set cookie storage file.

* src/xwidget.c (Fmake_xwidget): Create new context for
each unrelated widget.
(Fxwidget_webkit_set_cookie_storage_file): New function.
(syms_of_xwidget): Define new subr.
2021-11-19 20:04:08 +08:00
Po Lu
24c67435ea Use CHECK_LIVE_XWIDGET in xwidget-webkit-estimated-load-progress
* src/xwidget.c (Fxwidget_webkit_estimated_load_progress): Check
for live xwidgets instead.
2021-11-19 19:18:48 +08:00
Po Lu
5bab113486 Add `xwidget-webkit-estimated-load-progress'
* doc/lispref/display.texi (Xwidgets): Document new function.
* etc/NEWS: Announce new function.

* src/xwidget.c (Fxwidget_webkit_estimated_load_progress): New
function.
(syms_of_xwidget): Define new subr.
2021-11-19 17:48:57 +08:00
Po Lu
3b2421e6a7 Prevent subprocess hangs in xwidget
* src/xwidget.c (Fmake_xwidget, Fxwidget_webkit_goto_url): Use
`catch_child_signal' instead of trying to preserve the previous
signal handler.
2021-11-17 21:32:52 +08:00
Po Lu
9ae741750c Don't draw xwidgets that have just been resized
This serves to eliminate the huge black bar displayed when the
offscreen widget has been resized (and as such the damage event
signal is sent), but the X window hasn't.

* src/xwidget.c (xv_do_draw): Don't draw xwidgets that have
just been resized.
(x_draw_xwidget_glyph_string)
(xwidget_init_view): Clear just_resized.

(Fxwidget_resize): Set just_resized first, then queue allocate.
2021-11-17 20:34:30 +08:00
Po Lu
8d0c19fb0c Lower xwidget views owned by parent when lowering frame
* 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.
2021-11-16 17:51:07 +08:00
Po Lu
7cfc3f34bb Prevent xwidget windows from obscuring child frames
* src/xwidget.c (x_draw_xwidget_glyph_string): Lower view window
when creating it.
2021-11-16 09:32:37 +08:00
Po Lu
367cf464a1 Fix documentation string
* src/xwidget.c (Vxwidget_list, Vxwidget_views_list): Fix
horrid doc string.
2021-11-16 09:32:37 +08:00
Po Lu
d5a4772712 Fix xwidget-webkit-back-forward-list
* src/xwidget.c (Fxwidget_webkit_back_forward_list): Use correct
list variable in loop.
2021-11-15 13:43:55 +08:00
Po Lu
d9e91da769 Stop assuming xwidget views will only be displayed in TEXT_AREA
* 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.
2021-11-15 09:27:31 +08:00
Po Lu
c3f53d2604 Expose xwidget navigation history to Lisp code
* doc/lispref/display.texi (Xwidgets): Document changes.
* etc/NEWS: Announce new function.
* src/xwidget.c (Fxwidget_webkit_back_forward_list): New
function.
(syms_of_xwidget): Define new subr.
2021-11-14 17:45:23 +08:00
Po Lu
609bc1d33a Add `kill-xwidget'
* doc/lispref/display.texi (Xwidgets): Document 'kill-xwidget'.
* src/xwidget.c (kill_xwidget, Fkill_xwidget): New function.
(syms_of_xwidget): Define new subr.
(kill_buffer_xwidgets): Use `kill_xwidget' instead.
2021-11-14 17:42:16 +08:00
Po Lu
9627b731c0 Fix crash in xwidget_end_redisplay
* src/xwidget.c (xwidget_end_redisplay): Always test if xv is
NULL.
2021-11-14 10:00:40 +08:00
Po Lu
dafebe37eb Use GTK native file choosers in xwidget callback
* src/xwidget.c (run_file_chooser_cb): Use GtkFileChooserNative
instead.
2021-11-13 15:38:12 +08:00
Po Lu
a5008352c4 Prevent NULL-pointer dereference on xwidget callback error
* src/xwidget.c (webkit_javascript_finished_cb): Check if
`error' is NULL before freeing it.
2021-11-13 13:02:09 +08:00
Po Lu
eb4567e5be Fix file chooser hangs inside xwidget-webkit
* src/xwidget.c (run_file_chooser_cb): New function that runs
a nested event loop instead of acting asynchronously.
(Fmake_xwidget): Attach file chooser signal.
2021-11-13 11:24:13 +08:00
Po Lu
e9a68b1de5 Remove obsolete comment
The comment probably dated back to when xwidgets supported
many other GTK+ widgets with other data.  In the current
implementation of xwidgets, everything that should be freed
is already freed in `kill_buffer_xwidgets'.

* src/xwidget.c (kill_buffer_xwidgets): Remove outdated TODO.
2021-11-12 14:31:36 +08:00
Po Lu
070d6297ca Fix doc string for xwidget-webkit-load-html
* src/xwidget.c (Fxwidget_webkit_load_html): Fix doc string.
2021-11-12 14:16:31 +08:00
Po Lu
df2438d369 Fix potential NULL dereference in xwidget-webkit-uri
* src/xwidget.c (Fxwidget_webkit_uri): Don't assume
webkit_web_view_get_uri will always return a valid string.
2021-11-12 11:19:30 +08:00
Po Lu
372824a8bf Check for WebKit xwidgets inside all xwidget-webkit functions
This is done in preparation for the introduction of other
xwidgets, such as media xwidgets, even though there are
only WebKit widgets at present.

* src/xwidget.c (CHECK_WEBKIT_XWIDGET): New macro.
(WEBKIT_FN_INIT): Use CHECK_WEBKIT_XWIDGET.

(Fxwidget_webkit_search, Fxwidget_webkit_next_result)
(Fxwidget_webkit_previous_result)
(Fxwidget_webkit_finish_search)
(Fxwidget_webkit_load_html): Check that xwidget is a WebKit
widget.
2021-11-12 10:40:03 +08:00
Po Lu
fe0f7bddb6 Prevent crashes from Lisp code modifying xwidget-list
* src/xwidget.c (internal_xwidget_view_list)
(internal_xwidget_list): New variable.

(find_xwidget_for_offscreen_window)
(define_cursors, offscreen_damage_event)
(webkit_ready_to_show, xwidget_init_view)
(Fxwidget_resize, Fdelete_xwidget_view)
(Fxwidget_view_lookup, xwidget_spec_value)
(lookup_xwidget, xwidget_end_redisplay)
(kill_frame_xwidget_views, kill_buffer_xwidgets)
(Fmake_xwidget, Fget_buffer_xwidgets): Use internal list.

(syms_of_xwidget): Initialize internal xwidget lists.
2021-11-12 09:53:30 +08:00
Po Lu
554a875493 Prevent crashes in xwidgets whose buffers have been killed
* doc/lispref/display.texi (Xwidgets): Explain meaning of killed
xwidgets.
* src/xwidget.c (Fxwidget_live_p): New function.
(Fxwidget_perform_lispy_event, WEBKIT_FN_INIT)
(Fxwidget_resize, Fxwidget_size_request)
(Fxwidget_info, Fxwidget_plist)
(Fset_xwidget_buffer, Fset_xwidget_plist)
(Fset_xwidget_query_on_exit_flag)
(Fxwidget_query_on_exit_flag)
(Fxwidget_webkit_search)
(Fxwidget_webkit_next_result)
(Fxwidget_webkit_previous_result)
(Fxwidget_webkit_finish_search)
(Fxwidget_webkit_load_html): Check for live xwidgets instead of
just xwidgets.

(xwidget_button, xwidget_motion_or_crossing)
(xv_do_draw, x_draw_xwidget_glyph_string)
(Fdelete_xwidget_view): Ignore killed xwidgets.

(syms_of_xwidget): Define new symbols and subrs and define
appropriate weakness of id_to_xwidget map.
(kill_buffer_xwidgets): Check live xwidgets instead of
killed xwidgets, set xwidget buffer to nil, and rely on GC to
free the hash table for us instead.

* src/xwidget.h (XWIDGET_LIVE_P, CHECK_LIVE_XWIDGET): New
macros.
2021-11-12 08:17:41 +08:00
Po Lu
3d253fa3aa Add `xwidget-webkit-load-html'
* doc/lispref/display.texi (Xwidgets): Document new function.
* etc/NEWS: Announce new function.
* src/xwidget.c (Fxwidget_webkit_load_html): New function.
(syms_of_xwidget): Define new subr.
2021-11-11 08:31:09 +08:00
Po Lu
4d99388c16 Prevent GDK warning about missing event devices in most cases
* src/xwidget.c (synthesize_focus_in_event): Set event device to
selected frame's pointer if it's an X frame.
2021-11-10 19:43:53 +08:00
Po Lu
32d1a735ce Remove obsolete limitation
* src/xwidget.c (Fxwidget_webkit_goto_history): Accept any fixnum as
REL-POS, to be consistent with docstring.
2021-11-10 15:47:56 +08:00
Po Lu
465ec29926 Fix incorrect offset calculation for clipped xwidget views
* src/xwidget.c (from_embedder, to_embedder): Remove incorrect
adjustment of position by view clipping.
2021-11-10 14:29:54 +08:00
Po Lu
9653cbf355 Fix invisible content in WebKit dialogs
* src/xwidget.c (webkit_script_dialog_cb): Use custom label instead of
dialog box title to display message.
2021-11-10 14:19:15 +08:00
Po Lu
1e5eb566cc Set embedder correctly to fix menus appearing in the wrong location
* src/xwidget.c (record_osr_embedder, from_embedder, to_embedder): New
functions.
(Fmake_xwidget): Attach from-embedder and to-embedder signals.
(find_widget_for_offscreen_window): New function.
(xwidget_button, xwidget_motion_or_crossing): Set embedder on event.
(Fdelete_xwidget_view): Remove embedder status if applicable.

* src/xwidget.h (struct xwidget): New fields `embedder' and
`embedder-view'.
2021-11-10 14:06:07 +08:00
Po Lu
912ae5de92 Prevent BadValue errors when creating tiny xwidget views
* src/xwidget.c (x_draw_glph_string): Avoid resizing xwidget views
to an invalid size (bug#51707).
2021-11-10 00:52:47 +01:00
Po Lu
606d8ffe45 Fix default target of motion events
* src/xwidget.c (xwidget_motion_or_crossing): Default to widget_osr
instead of its window (bug#51703).
2021-11-09 08:24:45 +01:00
Po Lu
e9ff213639 Make `kill_frame_xwidget_views' safe
* src/xwidget.c (kill_frame_xwidget_views): Check XWIDGET_VIEW_P
(bug#51701).
2021-11-09 07:47:17 +01:00
Lars Ingebrigtsen
a097303ebb ARGUMENTS in Fmake_xwidget is optional
* src/xwidget.c (Fmake_xwidget): The ARGUMENTS argument isn't
mandatory.
2021-11-09 05:51:37 +01:00
Po Lu
b5efdccefb Raise an error if creating an unknown xwidget type
* src/xwidget.c (Fmake_xwidget): Error if TYPE is invalid (bug#51682).
2021-11-09 05:03:47 +01:00
Po Lu
394f6b9167 Really fix xwidget scroll optimization and clip
* 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).
2021-11-09 05:02:25 +01:00
Lars Ingebrigtsen
846ff29420 Remove code what would always maximize xwidgets on Macos
* src/xwidget.c (x_draw_xwidget_glyph_string): Remove code that
would always maximize the widget on Macos (bug#51674).  This code
was probably added to work around a resizing bug that has since
been fixed.
2021-11-08 08:01:07 +01:00
Po Lu
51aa6cee2c Fix resize of xwidgets on GTK
* src/xwidget.c (Fxwidget_resize): Queue widget for re-allocation
after setting its size request (bug#51679).
2021-11-08 07:38:41 +01:00
Po Lu
553e4b74f7 Fix hang when displaying xwidget script dialog
* src/xwidget.c (webkit_script_dialog_cb): New function.
(Fmake_xwidget): Attach script callback signal (bug#51674).
2021-11-08 06:25:02 +01:00
Po Lu
73d17fd4b7 Free find text in correct procedure
* src/xwidget.c (Fxwidget_webkit_previous_result): Don't free find
text.
(Fxwidget_webkit_finish_search): Free find text here instead.
2021-11-07 15:16:53 +01:00
Po Lu
48a9621db7 Fix xwidget-webkit-goto-history
* src/xwidget.c (xwidget-webkit-goto-history): Use
WebKitBackForwardList and XFIXNUM instead of XFIXNAT (bug#51651).
2021-11-07 14:41:43 +01:00
Po Lu
cbc14f9b4e Handle WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION appropriately
* src/xwidget.c (webkit_decide_policy_cb): Send an xwidget display
event when a webpage asks to create a new window.
2021-11-07 14:14:43 +01:00