Commit graph

172 commits

Author SHA1 Message Date
YAMAMOTO Mitsuharu
278c8a7ef7 * src/xwidget.c (Fxwidget_resize): Fix inappropriate use of XFASTINT. 2016-03-27 18:00:08 +09:00
Eli Zaretskii
e70ee9d680 Fix scrolling upwards with 'xwidget-webkit-browse-url'
* src/xwidget.c (Fxwidget_set_adjustment): Use CHECK_NUMBER instead
of CHECK_NATNUM.  Suggested by Shayan Pirani <shayanpirani@gmail.com>.
(Bug#22918)
2016-03-25 12:51:57 +03:00
Paul Eggert
7352c6c695 Rework C source files to avoid ^(
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.
2016-03-10 07:59:19 -08:00
Paul Eggert
b250d2996a Spelling fix 2016-01-30 20:16:20 -08:00
Glenn Morris
9dec01d291 ; Spelling fixes (American spelling) 2016-01-25 18:24:09 -05:00
Paul Eggert
a528a60f48 Spelling fixes 2016-01-25 08:09:09 -08:00
Paul Eggert
2f505ff792 * src/xwidget.c (Fxwidget_set_adjustment): Fix doc string quoting typo. 2016-01-24 17:25:26 -08:00
Paul Eggert
7c3d742c35 xwidgets style cleanup
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.
2016-01-22 11:15:31 -08:00
Paul Eggert
9d7265ba1a Don’t export C symbols not used elsewhere
These were recently added, mostly as part of xwidget code.
* src/emacsgtkfixed.c (emacs_fixed_get_type): Now static.
(EMACS_FIXED, EMACS_FIXED_GET_CLASS):
Now static functions here, not macros in emacsgtkfixed.h.
* src/emacsgtkfixed.h (EMACS_TYPE_FIXED):
Remove.  All uses replaced by definiens.
(EMACS_FIXED, EMACS_FIXED_GET_CLASS):
Remove; these are now static functions in emacsgtkfixed.c.
(EMACS_FIXED_CLASS, EMACS_IS_FIXED, EMACS_IS_FIXED_CLASS):
Remove; unused.
(emacs_fixed_get_type): Remove decl; no longer extern.
* src/xwidget.c (offscreen_damage_event)
(webkit_mime_type_policy_typedecision_requested_cb)
(webkit_new_window_policy_decision_requested_cb)
(webkit_navigation_policy_decision_requested_cb)
(xwidget_spec_value, xwidget_view_lookup)
(xwidget_start_redisplay, xwidget_touch):
Now static.
* src/xwidget.h (xwidget_start_redisplay, xwidget_touch):
Remove decls.
2016-01-20 14:55:57 -08:00
Paul Eggert
2388fa7498 Port to platforms with gtk3 but not webkitgtk3
I ran into this problem on my Fedora 23 installation;
Emacs configured but did not build when --with-xwidgets was specified.
* configure.ac (HAVE_WEBKIT, HAVE_GIR): Omit unnecessary initializations.
(DOES_XWIDGETS_USE_GIR): New var.
If --with-xwidgets is specified, report an error if not
doable, to be consistent with the other --with options.
Require webkitgtk3 to use Xwidgets, as the Xwidgets code does
not work at all without webkitgtk3.  Simplify use of
EMACS_CHECK_MODULES.  Output message about gobject
introspection only if xwidgets are used.
* etc/NEWS: Users need webkitgtk3, not merely webkit.
* src/xwidget.c (syms_of_xwidget): Don’t worry about HAVE_WEBKIT_OSR,
since this file is no longer compiled if webkitgtk3 is not available.
2016-01-20 11:06:35 -08:00
Glenn Morris
ea41538278 Trivial doc copyedits.
* src/xwidget.c (Fmake_xwidget, Fget_buffer_xwidgets)
(Fxwidget_webkit_get_title, Fxwidget_resize)
(Fxwidget_set_adjustment, Fxwidgetp, Fxwidget_view_p)
(Fxwidget_info, Fxwidget_view_lookup)
(Fset_xwidget_query_on_exit_flag): Trivial doc copyedits.
2016-01-19 18:42:47 -05:00
Glenn Morris
c7441cd7d8 ; Add 2016 to copyright years of new files. 2016-01-19 16:00:34 -05:00
Joakim Verona
7c1f66a94b Support for the new Xwidget feature.
* 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:
2016-01-19 20:58:22 +01:00
Paul Eggert
241260cc28 Revert changes installed by xwidgets merge 2015-02-01 11:45:15 -08:00
Joakim Verona
069f101ecf Cleanup 2015-01-21 23:11:01 +01:00
Joakim Verona
0609e9003d cleanup 2015-01-21 22:43:14 +01:00
Joakim Verona
35471ba2e3 Implement native scrolling of the webkit xwidget
It is now possible to use native scrolling with the webkit view.
There is also a new function xwidget-set-adjustment,
which can manipulate the viewport.
2015-01-20 00:48:41 +01:00
Joakim Verona
a1124bc117 Update to new DEFSYM strategy
Update to new DEFSYM strategy which was slightly tricky.
2015-01-11 20:20:37 +01:00
jave
66ae0ec9dd Added two CHECK_STRING of arguments
Suggested by Eli Zaretski
2015-01-07 16:12:04 +01:00
jave
1048722e20 Doc strings, and whitespace 2009-01-01 00:03:26 +01:00
Joakim Verona
d92d0dd4f2 fixes: PREPARE_FACE_FOR_DISPLAY was removed, DEFUN less lenient 2014-06-23 10:04:07 +02:00
root
a4354e5eb5 remove FRAME_PTR 2013-08-12 22:12:40 +02:00
Joakim Verona
2427b15992 Merge pull request #14 from daimrod/offscreen_forward_events
Offscreen forward events
2013-07-25 14:16:20 -07:00
Grégoire Jadi
5558a52357 * src/xwidget.c (xwidget_init_view): Pass the view rather than the model
to the callback for "clicked" event so we can retrive the frame and remove
an old TODO.
(buttonclick_handler): Get the frame from the window.
2013-07-25 15:34:02 +02:00
Grégoire Jadi
45219ddc21 * src/xwidget.c (Fmake_xwidget): Force each widget to be shown. 2013-07-25 15:33:12 +02:00
Grégoire Jadi
7ec36b1609 * src/xwidget.c: Remove old code. 2013-07-25 15:33:12 +02:00
Grégoire Jadi
c569331a8e * src/xwidget.c (xwidget_init_view): Transfer embedder ownership when the
pointer enter a widget, not on motion.
2013-07-25 15:33:11 +02:00
Grégoire Jadi
b42d152ed0 * src/xwidget.c (xwidget_init_view): Transfer all events. 2013-07-25 15:33:11 +02:00
Grégoire Jadi
51c4de37c4 * src/xwidget.c: Implement events forwarding with the set_embedder strategy. 2013-07-25 15:33:11 +02:00
Grégoire Jadi
ede647400e * src/xwidget.c (xwidget_init_view): Remove dead code. 2013-07-25 15:33:11 +02:00
Grégoire Jadi
c778c80daf * src/xwidget.c: Redraw only the views on damage-event. 2013-07-25 15:33:11 +02:00
Grégoire Jadi
bd0b9e4aa5 * src/xwidget.c (Fmake_xwidget): Remove dead code. 2013-07-25 15:33:11 +02:00
Grégoire Jadi
5677ff6cfc Always store GTK Widget as GtkWidget*.
* src/xwidget.h (struct xwidget): GtkContainer -> GtkWidget for
widgetwindow_osr.
(struct xwidget_view): GtkContainer -> GtkWidget for widgetwindow and
emacswindow.
2013-07-25 15:33:10 +02:00
Joakim Verona
11221267ec Merge pull request #9 from daimrod/quickfix-cairo-view
* src/xwidget.c (xwidget_init_view): Prevent an error while displaying a
2013-07-18 13:12:45 -07:00
Grégoire Jadi
84d73d4c04 * src/xwidget.c (xwidget_init_view): Prevent an error while displaying a
xwidget of type `cairo' but doesn't do anything useful.
2013-07-18 19:51:36 +02:00
Grégoire Jadi
1eea231d3e * src/xwidget.c (Fset_frame_visible): Hack to force a frame to be
considered as visible to trigger the display engine.
* lisp/xwidget.el (xwidget-display): Force the display engine to create a
xwidget_view of the given xwidget.
2013-07-18 14:12:03 +02:00
Grégoire Jadi
808dcb446d * src/xwidget.c (Fxwidget_info): Fix a regression introduced in commit
b4e1725be1b96b5335a12d34fdd81b99dededf54.
2013-07-18 11:48:14 +02:00
Grégoire Jadi
a425ea6523 * src/xwidget.c (Fxwidget_delete_zombies): Re-implemented in Lisp.
Note: It is not longer necessary to delete xwidget with killed buffer
here because it is done automatically when a buffer is killed.
(Fdelete_xwidget_view): New function to delete the given
xwidget-view.
* lisp/xwidget.el (xwidget-delete-zombies): Re-implementation.
* src/xwidget.c (Fxwidget_delete_zombies): Re-implemented in Lisp. Note: It is not longer necessary to delete xwidget with killed buffer here because it is done automatically when a buffer is killed. (Fdelete_xwidget_view): New function to delete the given xwidget-view. * lisp/xwidget.el (xwidget-delete-zombies): New implementation.
2013-07-18 11:48:13 +02:00
Grégoire Jadi
5a422d95aa * src/xwidget.c (Fmake_xwidget): Set the initial value of `query-on-exit'
flag to t (kill_without_query = !query-on-exit).
2013-07-16 19:39:21 +02:00
Grégoire Jadi
b849935e98 * src/xwidget.c: Add a `query-on-exit' flag to determine whether we can
kill xwidget when the buffer is killed without confirmation.
(Fset_xwidget_query_on_exit_flag): New function to set the `query-on-exit'
flag.
(Fxwidget_query_on_exit_flag): New function to retrieve the value of the
`query-on-exit' flag.
(Fmake_xwidget): Set the `query-on-exit' flag to t by default.
* src/xwidget.h (xwidget): Add new field `kill_without_query'.
* lisp/xwidget.el (xwidget-kill-buffer-query-function): Ask for
confirmation before killing the buffer if a xwidget is present only if its
`query-on-exit' flag is enabled.
2013-07-16 19:39:20 +02:00
Grégoire Jadi
53e2976867 * src/xwidget.c (kill_buffer_xwidgets): Cleanup OSR GtkWidget when xwidget
are freed.
2013-07-16 19:39:19 +02:00
Grégoire Jadi
360a89e080 * src/xwidget.c (Fxwidget_view_lookup): Bring `xwidget-view-lookup' to the
Lisp side.
(xwidget_view_lookup): `xwidget_view_lookup' is just a wrapper around
`xwidget-view-lookup' to convert from `struct *' to `Lisp_Object'.
2013-07-16 19:39:19 +02:00
Grégoire Jadi
aa61edd309 * src/xwidget.c (Fxwidget_view_model, Fxwidget_view_window): Add accessors
to xwidget_view components.
2013-07-16 19:39:19 +02:00
Grégoire Jadi
bbc0bc1c25 * src/xwidget.c: Fix indentation. 2013-07-16 19:39:18 +02:00
Grégoire Jadi
54eb6c1071 * src/xwidget.h src/xwidget.c (valid_xwidget_spec_p): Renamed
`valid_xwidget_p' to `valid_xwidget_p'.
(XWIDGETP): Rename `XXWIDGETP' to `XWIDGETP' and `XXWIDGET_VIEW_P' to
`XWIDGET_VIEW_P'. The old `XWIDGETP' is now implemented solely in
`valid_xwidget_spec_p'.
(CHECK_XWIDGET): New macro to check whether the argument is a xwidget.
(CHECK_XWIDGET_VIEW): New macro to check whether the argument is a
xwidget_view.
* src/print.c src/xdisp.c: Take into account the new names.
2013-07-16 19:39:18 +02:00
Grégoire Jadi
204e1a81bc * src/xwidget.c: Replace xwidget_views by Vxwidget_view_list.
xwidget_views was an hardcoded array of fixed lenght of `struct
xwidget_view', Vxwidget_view_list is a list of Lisp_Object.

* src/xwidget.h (xwidget_view): Remove member `initialized'.

This field was only used to determine whether a given xwidget_view was
initialized or not in `xwidget_views'. Now only initialized xwidget_view
are stored in Vxwidget_view_list.
2013-06-28 21:18:47 +02:00
Grégoire Jadi
7a76a0ab44 * src/xwidget.c: Fix access to w in xwidget_view (now a Lisp_Object)
* src/xwidget.h (xwidget_view): Convert member `w' to Lisp_Object.
2013-06-28 21:18:47 +02:00
Grégoire Jadi
663f996777 * src/xwidget.c (Fmake_xwidget): Use XSETXWIDGET instead of XSETPSEUDOVECTOR. 2013-06-28 17:16:47 +02:00
Grégoire Jadi
098e59dc13 * src/xwidget.h (xwidget_view): Convert member `model' to Lisp_Object.
(XXWIDGET_VIEW_P, XXWIDGET_VIEW): Add standard macros to manipulate xwidget_view.
* src/xwidget.c: Fix access to model in xwidget_view (now a Lisp_Object).
2013-06-28 17:16:27 +02:00
Grégoire Jadi
da95bc007d Handle xwidgets like processes and delete them when their buffer is killed.
* lisp/xwidget.el (xwidget-kill-buffer-query-function): New function to
query a user before killing a buffer with xwidgets in it.

This function is stored in `kill-buffer-query-functions' and called from
`kill-buffer'.
* src/buffer.c (Fkill_buffer): Call `kill_buffer_xwidgets'.
* src/xwidget.c (kill_buffer_xwidgets): Delete xwidgets attached to the
specified buffer.
* src/xwidget.h (kill_buffer_xwidgets): Add definition.
2013-06-24 10:22:45 +02:00