1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00
emacs/src/xwidget.h

244 lines
6.6 KiB
C
Raw Normal View History

/* Support for embedding graphical components in a buffer.
2022-01-01 07:45:51 +00:00
Copyright (C) 2011-2022 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#ifndef XWIDGET_H_INCLUDED
#define XWIDGET_H_INCLUDED
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 19:15:05 +00:00
#include "lisp.h"
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 19:15:05 +00:00
struct glyph_matrix;
struct glyph_string;
struct xwidget;
struct xwidget_view;
struct window;
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 19:15:05 +00:00
#ifdef HAVE_XWIDGETS
Add xwidget support for macOS Co-authored-by: Jaesup Kwak <veshboo@gmail.com> * configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}". * etc/NEWS: Mention new feature. * etc/TODO: Remove done TODO to implement xwidget in NeXTstep port. * lisp/xwidget.el (xwidget-webkit-clone-and-split-below) (xwidget-webkit-clone-and-split-right): New procedures. (xwidget-webkit-callback): Remove call to 'xwidget-webkit-adjust-size-to-window' as adjusting xwidget size is handled in 'x_draw_xwidget_glyph_string'. (xwidget-webkit-enable-plugins): New variable. * nextstep/templates/Info.plist.in: Add 'NSAppTransportSecurity'. * src/Makefile.in: Add nsxwidget.o for compilation. * src/emacs.c (main): Move conditional call to 'syms_of_xwidget'. * src/nsterm.m (ns_draw_glyph_string): Add case for 'XWIDGET_GLYPH'. (note_mouse_movement mouseMoved): Make it easy to resize window by dragging mode-line or vertical separator adjacent to large glyph. * src/nsxwidget.h src/nsxwidget.m: Newly added files, xwidget webkit backend for macOS Cocoa. * src/xwidget.c (Fmake_xwidget, xwidget_init_view) (x_draw_xwidget_glyph_string, xwidget_is_web_view) (Fxwidget_webkit_goto_uri, Fxwidget_webkit_zoom, Fxwidget_resize) (Fxwidget_size_request, Fdelete_xwidget_view, xwidget_end_redisplay) (kill_buffer_xwidgets): Add macOS Cocoa specific functions and code with 'NS_IMPL_COCOA' and guard GTK specific functions and code with 'USE_GTK'. (x_draw_xwidget_glyph_string): Handle adjusting xwidget size. * src/xwidget.h (xwidget, xwidget_view): Add macOS Cocoa specific fields with 'NS_IMPL_COCOA' and guard GTK specific fields with USE_GTK.
2020-08-12 10:12:34 +00:00
#if defined (USE_GTK)
#include <gtk/gtk.h>
#ifndef HAVE_PGTK
#include <X11/Xlib.h>
#include "xterm.h"
#else
#include "pgtkterm.h"
#endif
Add xwidget support for macOS Co-authored-by: Jaesup Kwak <veshboo@gmail.com> * configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}". * etc/NEWS: Mention new feature. * etc/TODO: Remove done TODO to implement xwidget in NeXTstep port. * lisp/xwidget.el (xwidget-webkit-clone-and-split-below) (xwidget-webkit-clone-and-split-right): New procedures. (xwidget-webkit-callback): Remove call to 'xwidget-webkit-adjust-size-to-window' as adjusting xwidget size is handled in 'x_draw_xwidget_glyph_string'. (xwidget-webkit-enable-plugins): New variable. * nextstep/templates/Info.plist.in: Add 'NSAppTransportSecurity'. * src/Makefile.in: Add nsxwidget.o for compilation. * src/emacs.c (main): Move conditional call to 'syms_of_xwidget'. * src/nsterm.m (ns_draw_glyph_string): Add case for 'XWIDGET_GLYPH'. (note_mouse_movement mouseMoved): Make it easy to resize window by dragging mode-line or vertical separator adjacent to large glyph. * src/nsxwidget.h src/nsxwidget.m: Newly added files, xwidget webkit backend for macOS Cocoa. * src/xwidget.c (Fmake_xwidget, xwidget_init_view) (x_draw_xwidget_glyph_string, xwidget_is_web_view) (Fxwidget_webkit_goto_uri, Fxwidget_webkit_zoom, Fxwidget_resize) (Fxwidget_size_request, Fdelete_xwidget_view, xwidget_end_redisplay) (kill_buffer_xwidgets): Add macOS Cocoa specific functions and code with 'NS_IMPL_COCOA' and guard GTK specific functions and code with 'USE_GTK'. (x_draw_xwidget_glyph_string): Handle adjusting xwidget size. * src/xwidget.h (xwidget, xwidget_view): Add macOS Cocoa specific fields with 'NS_IMPL_COCOA' and guard GTK specific fields with USE_GTK.
2020-08-12 10:12:34 +00:00
#elif defined (NS_IMPL_COCOA) && defined (__OBJC__)
#import <AppKit/NSView.h>
#import "nsxwidget.h"
#endif
#ifdef HAVE_XINPUT2
#include <X11/extensions/XInput2.h>
#endif
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 19:15:05 +00:00
struct xwidget
{
union vectorlike_header header;
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 19:15:05 +00:00
/* Auxiliary data. */
Lisp_Object plist;
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 19:15:05 +00:00
/* The widget type. */
Lisp_Object type;
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 19:15:05 +00:00
/* The buffer where the xwidget lives. */
Lisp_Object buffer;
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 19:15:05 +00:00
/* A title used for button labels, for instance. */
Lisp_Object title;
/* Vector of currently executing scripts with callbacks. */
Lisp_Object script_callbacks;
/* Here ends the Lisp part. script_callbacks is the marker field. */
int height;
int width;
uint32_t xwidget_id;
char *find_text;
Add xwidget support for macOS Co-authored-by: Jaesup Kwak <veshboo@gmail.com> * configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}". * etc/NEWS: Mention new feature. * etc/TODO: Remove done TODO to implement xwidget in NeXTstep port. * lisp/xwidget.el (xwidget-webkit-clone-and-split-below) (xwidget-webkit-clone-and-split-right): New procedures. (xwidget-webkit-callback): Remove call to 'xwidget-webkit-adjust-size-to-window' as adjusting xwidget size is handled in 'x_draw_xwidget_glyph_string'. (xwidget-webkit-enable-plugins): New variable. * nextstep/templates/Info.plist.in: Add 'NSAppTransportSecurity'. * src/Makefile.in: Add nsxwidget.o for compilation. * src/emacs.c (main): Move conditional call to 'syms_of_xwidget'. * src/nsterm.m (ns_draw_glyph_string): Add case for 'XWIDGET_GLYPH'. (note_mouse_movement mouseMoved): Make it easy to resize window by dragging mode-line or vertical separator adjacent to large glyph. * src/nsxwidget.h src/nsxwidget.m: Newly added files, xwidget webkit backend for macOS Cocoa. * src/xwidget.c (Fmake_xwidget, xwidget_init_view) (x_draw_xwidget_glyph_string, xwidget_is_web_view) (Fxwidget_webkit_goto_uri, Fxwidget_webkit_zoom, Fxwidget_resize) (Fxwidget_size_request, Fdelete_xwidget_view, xwidget_end_redisplay) (kill_buffer_xwidgets): Add macOS Cocoa specific functions and code with 'NS_IMPL_COCOA' and guard GTK specific functions and code with 'USE_GTK'. (x_draw_xwidget_glyph_string): Handle adjusting xwidget size. * src/xwidget.h (xwidget, xwidget_view): Add macOS Cocoa specific fields with 'NS_IMPL_COCOA' and guard GTK specific fields with USE_GTK.
2020-08-12 10:12:34 +00:00
#if defined (USE_GTK)
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 19:15:05 +00:00
/* For offscreen widgets, unused if not osr. */
GtkWidget *widget_osr;
GtkWidget *widgetwindow_osr;
struct frame *embedder;
struct xwidget_view *embedder_view;
guint hit_result;
Add xwidget support for macOS Co-authored-by: Jaesup Kwak <veshboo@gmail.com> * configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}". * etc/NEWS: Mention new feature. * etc/TODO: Remove done TODO to implement xwidget in NeXTstep port. * lisp/xwidget.el (xwidget-webkit-clone-and-split-below) (xwidget-webkit-clone-and-split-right): New procedures. (xwidget-webkit-callback): Remove call to 'xwidget-webkit-adjust-size-to-window' as adjusting xwidget size is handled in 'x_draw_xwidget_glyph_string'. (xwidget-webkit-enable-plugins): New variable. * nextstep/templates/Info.plist.in: Add 'NSAppTransportSecurity'. * src/Makefile.in: Add nsxwidget.o for compilation. * src/emacs.c (main): Move conditional call to 'syms_of_xwidget'. * src/nsterm.m (ns_draw_glyph_string): Add case for 'XWIDGET_GLYPH'. (note_mouse_movement mouseMoved): Make it easy to resize window by dragging mode-line or vertical separator adjacent to large glyph. * src/nsxwidget.h src/nsxwidget.m: Newly added files, xwidget webkit backend for macOS Cocoa. * src/xwidget.c (Fmake_xwidget, xwidget_init_view) (x_draw_xwidget_glyph_string, xwidget_is_web_view) (Fxwidget_webkit_goto_uri, Fxwidget_webkit_zoom, Fxwidget_resize) (Fxwidget_size_request, Fdelete_xwidget_view, xwidget_end_redisplay) (kill_buffer_xwidgets): Add macOS Cocoa specific functions and code with 'NS_IMPL_COCOA' and guard GTK specific functions and code with 'USE_GTK'. (x_draw_xwidget_glyph_string): Handle adjusting xwidget size. * src/xwidget.h (xwidget, xwidget_view): Add macOS Cocoa specific fields with 'NS_IMPL_COCOA' and guard GTK specific fields with USE_GTK.
2020-08-12 10:12:34 +00:00
#elif defined (NS_IMPL_COCOA)
# ifdef __OBJC__
/* For offscreen widgets, unused if not osr. */
NSView *xwWidget;
XwWindow *xwWindow;
/* Used only for xwidget types (such as webkit2) enforcing 1 to 1
relationship between model and view. */
struct xwidget_view *xv;
# else
void *xwWidget;
void *xwWindow;
struct xwidget_view *xv;
# endif
#endif
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 19:15:05 +00:00
/* Kill silently if Emacs is exited. */
bool_bf kill_without_query : 1;
} GCALIGNED_STRUCT;
struct xwidget_view
{
union vectorlike_header header;
Lisp_Object model;
Lisp_Object w;
/* Here ends the lisp part. "w" is the marker field. */
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 19:15:05 +00:00
/* If touched by redisplay. */
bool redisplayed;
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 19:15:05 +00:00
/* The "live" instance isn't drawn. */
bool hidden;
enum glyph_row_area area;
Add xwidget support for macOS Co-authored-by: Jaesup Kwak <veshboo@gmail.com> * configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}". * etc/NEWS: Mention new feature. * etc/TODO: Remove done TODO to implement xwidget in NeXTstep port. * lisp/xwidget.el (xwidget-webkit-clone-and-split-below) (xwidget-webkit-clone-and-split-right): New procedures. (xwidget-webkit-callback): Remove call to 'xwidget-webkit-adjust-size-to-window' as adjusting xwidget size is handled in 'x_draw_xwidget_glyph_string'. (xwidget-webkit-enable-plugins): New variable. * nextstep/templates/Info.plist.in: Add 'NSAppTransportSecurity'. * src/Makefile.in: Add nsxwidget.o for compilation. * src/emacs.c (main): Move conditional call to 'syms_of_xwidget'. * src/nsterm.m (ns_draw_glyph_string): Add case for 'XWIDGET_GLYPH'. (note_mouse_movement mouseMoved): Make it easy to resize window by dragging mode-line or vertical separator adjacent to large glyph. * src/nsxwidget.h src/nsxwidget.m: Newly added files, xwidget webkit backend for macOS Cocoa. * src/xwidget.c (Fmake_xwidget, xwidget_init_view) (x_draw_xwidget_glyph_string, xwidget_is_web_view) (Fxwidget_webkit_goto_uri, Fxwidget_webkit_zoom, Fxwidget_resize) (Fxwidget_size_request, Fdelete_xwidget_view, xwidget_end_redisplay) (kill_buffer_xwidgets): Add macOS Cocoa specific functions and code with 'NS_IMPL_COCOA' and guard GTK specific functions and code with 'USE_GTK'. (x_draw_xwidget_glyph_string): Handle adjusting xwidget size. * src/xwidget.h (xwidget, xwidget_view): Add macOS Cocoa specific fields with 'NS_IMPL_COCOA' and guard GTK specific fields with USE_GTK.
2020-08-12 10:12:34 +00:00
#if defined (USE_GTK)
#ifndef HAVE_PGTK
Display *dpy;
Window wdesc;
GdkWindow *last_crossing_window;
guint last_crossing_cursor_signal;
GtkWidget *passive_grab;
guint passive_grab_destruction_signal;
guint passive_grab_drag_signal;
#else
struct pgtk_display_info *dpyinfo;
GtkWidget *widget;
#endif
Emacs_Cursor cursor;
struct frame *frame;
cairo_surface_t *cr_surface;
cairo_t *cr_context;
int just_resized;
Add xwidget support for macOS Co-authored-by: Jaesup Kwak <veshboo@gmail.com> * configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}". * etc/NEWS: Mention new feature. * etc/TODO: Remove done TODO to implement xwidget in NeXTstep port. * lisp/xwidget.el (xwidget-webkit-clone-and-split-below) (xwidget-webkit-clone-and-split-right): New procedures. (xwidget-webkit-callback): Remove call to 'xwidget-webkit-adjust-size-to-window' as adjusting xwidget size is handled in 'x_draw_xwidget_glyph_string'. (xwidget-webkit-enable-plugins): New variable. * nextstep/templates/Info.plist.in: Add 'NSAppTransportSecurity'. * src/Makefile.in: Add nsxwidget.o for compilation. * src/emacs.c (main): Move conditional call to 'syms_of_xwidget'. * src/nsterm.m (ns_draw_glyph_string): Add case for 'XWIDGET_GLYPH'. (note_mouse_movement mouseMoved): Make it easy to resize window by dragging mode-line or vertical separator adjacent to large glyph. * src/nsxwidget.h src/nsxwidget.m: Newly added files, xwidget webkit backend for macOS Cocoa. * src/xwidget.c (Fmake_xwidget, xwidget_init_view) (x_draw_xwidget_glyph_string, xwidget_is_web_view) (Fxwidget_webkit_goto_uri, Fxwidget_webkit_zoom, Fxwidget_resize) (Fxwidget_size_request, Fdelete_xwidget_view, xwidget_end_redisplay) (kill_buffer_xwidgets): Add macOS Cocoa specific functions and code with 'NS_IMPL_COCOA' and guard GTK specific functions and code with 'USE_GTK'. (x_draw_xwidget_glyph_string): Handle adjusting xwidget size. * src/xwidget.h (xwidget, xwidget_view): Add macOS Cocoa specific fields with 'NS_IMPL_COCOA' and guard GTK specific fields with USE_GTK.
2020-08-12 10:12:34 +00:00
#elif defined (NS_IMPL_COCOA)
# ifdef __OBJC__
XvWindow *xvWindow;
NSView *emacswindow;
# else
void *xvWindow;
void *emacswindow;
# endif
#endif
int x;
int y;
int clip_right;
int clip_bottom;
int clip_top;
int clip_left;
long handler_id;
} GCALIGNED_STRUCT;
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 19:15:05 +00:00
#endif
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 19:15:05 +00:00
/* Test for xwidget pseudovector. */
#define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET)
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 19:15:05 +00:00
#define XXWIDGET(a) (eassert (XWIDGETP (a)), \
Use native alignment to access Lisp object data Instead of using __builtin_assume_aligned (P, GCALIGNMENT) to tell GCC that P has alignment 8, use (T *) P where T is the type of the pointed-to object, to tell GCC that P has native alignment. This is simpler, matches the intent better, and should help simplify future improvements. Some of these changes are to pacify gcc -Wnull-dereference, since GCC is smarter about pointers now that Emacs no longer uses __builtin_assume_aligned; these minor changes should improve code efficiency slightly. On Fedora 28 x86-64 with default optimization this patch shrinks the size of the Emacs text segment by 0.36%. * src/conf_post.h (__has_builtin, __builtin_assume_aligned): Remove; no longer used. * src/dbusbind.c (XD_OBJECT_TO_DBUS_TYPE): Pacify -Wnull-dereference by using XCAR instead of CAR_SAFE and XCDR instead of CDR_SAFE when this is safe. * src/fileio.c (Fexpand_file_name): * src/font.c (clear_font_cache): Pacify -Wnull-dereference by removing unnecessary NILP test. * src/keyboard.c (xevent_start): New function. (read_char, read_key_sequence): Pacify -Wnull-dereference by using xevent_start instead of EVENT_START. * src/lisp.h (lisp_h_XUNTAG): Remove; XUNTAG is always a macro now, since it can no longer be implemented as a function. (XUNTAG): New third argument CTYPE. All uses changed. Cast result to CTYPE * instead of using __builtin_assume_aligned. Simplify by using LISP_WORD_TAG. (LISP_WORD_TAG): New macro. (TAG_PTR): Use it. * src/menu.c (x_popup_menu_1): Pacify -Wnull-dereference by using XCAR instead of Fcar and XCDR instead of Fcdr where this is safe.
2018-06-10 17:13:45 +00:00
XUNTAG (a, Lisp_Vectorlike, struct xwidget))
#define XWIDGET_LIVE_P(w) (!NILP ((w)->buffer))
#define CHECK_XWIDGET(x) \
CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x)
#define CHECK_LIVE_XWIDGET(x) \
CHECK_TYPE ((XWIDGETP (x) \
&& XWIDGET_LIVE_P (XXWIDGET (x))), \
Qxwidget_live_p, x)
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 19:15:05 +00:00
/* Test for xwidget_view pseudovector. */
#define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW)
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 19:15:05 +00:00
#define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P (a)), \
Use native alignment to access Lisp object data Instead of using __builtin_assume_aligned (P, GCALIGNMENT) to tell GCC that P has alignment 8, use (T *) P where T is the type of the pointed-to object, to tell GCC that P has native alignment. This is simpler, matches the intent better, and should help simplify future improvements. Some of these changes are to pacify gcc -Wnull-dereference, since GCC is smarter about pointers now that Emacs no longer uses __builtin_assume_aligned; these minor changes should improve code efficiency slightly. On Fedora 28 x86-64 with default optimization this patch shrinks the size of the Emacs text segment by 0.36%. * src/conf_post.h (__has_builtin, __builtin_assume_aligned): Remove; no longer used. * src/dbusbind.c (XD_OBJECT_TO_DBUS_TYPE): Pacify -Wnull-dereference by using XCAR instead of CAR_SAFE and XCDR instead of CDR_SAFE when this is safe. * src/fileio.c (Fexpand_file_name): * src/font.c (clear_font_cache): Pacify -Wnull-dereference by removing unnecessary NILP test. * src/keyboard.c (xevent_start): New function. (read_char, read_key_sequence): Pacify -Wnull-dereference by using xevent_start instead of EVENT_START. * src/lisp.h (lisp_h_XUNTAG): Remove; XUNTAG is always a macro now, since it can no longer be implemented as a function. (XUNTAG): New third argument CTYPE. All uses changed. Cast result to CTYPE * instead of using __builtin_assume_aligned. Simplify by using LISP_WORD_TAG. (LISP_WORD_TAG): New macro. (TAG_PTR): Use it. * src/menu.c (x_popup_menu_1): Pacify -Wnull-dereference by using XCAR instead of Fcar and XCDR instead of Fcdr where this is safe.
2018-06-10 17:13:45 +00:00
XUNTAG (a, Lisp_Vectorlike, struct xwidget_view))
#define CHECK_XWIDGET_VIEW(x) \
CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x)
#define XG_XWIDGET "emacs_xwidget"
#define XG_XWIDGET_VIEW "emacs_xwidget_view"
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 19:15:05 +00:00
#ifdef HAVE_XWIDGETS
void syms_of_xwidget (void);
bool valid_xwidget_spec_p (Lisp_Object);
void xwidget_view_delete_all_in_window (struct window *);
void x_draw_xwidget_glyph_string (struct glyph_string *);
struct xwidget *lookup_xwidget (Lisp_Object spec);
void xwidget_end_redisplay (struct window *, struct glyph_matrix *);
void kill_buffer_xwidgets (Lisp_Object);
Add xwidget support for macOS Co-authored-by: Jaesup Kwak <veshboo@gmail.com> * configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}". * etc/NEWS: Mention new feature. * etc/TODO: Remove done TODO to implement xwidget in NeXTstep port. * lisp/xwidget.el (xwidget-webkit-clone-and-split-below) (xwidget-webkit-clone-and-split-right): New procedures. (xwidget-webkit-callback): Remove call to 'xwidget-webkit-adjust-size-to-window' as adjusting xwidget size is handled in 'x_draw_xwidget_glyph_string'. (xwidget-webkit-enable-plugins): New variable. * nextstep/templates/Info.plist.in: Add 'NSAppTransportSecurity'. * src/Makefile.in: Add nsxwidget.o for compilation. * src/emacs.c (main): Move conditional call to 'syms_of_xwidget'. * src/nsterm.m (ns_draw_glyph_string): Add case for 'XWIDGET_GLYPH'. (note_mouse_movement mouseMoved): Make it easy to resize window by dragging mode-line or vertical separator adjacent to large glyph. * src/nsxwidget.h src/nsxwidget.m: Newly added files, xwidget webkit backend for macOS Cocoa. * src/xwidget.c (Fmake_xwidget, xwidget_init_view) (x_draw_xwidget_glyph_string, xwidget_is_web_view) (Fxwidget_webkit_goto_uri, Fxwidget_webkit_zoom, Fxwidget_resize) (Fxwidget_size_request, Fdelete_xwidget_view, xwidget_end_redisplay) (kill_buffer_xwidgets): Add macOS Cocoa specific functions and code with 'NS_IMPL_COCOA' and guard GTK specific functions and code with 'USE_GTK'. (x_draw_xwidget_glyph_string): Handle adjusting xwidget size. * src/xwidget.h (xwidget, xwidget_view): Add macOS Cocoa specific fields with 'NS_IMPL_COCOA' and guard GTK specific fields with USE_GTK.
2020-08-12 10:12:34 +00:00
/* Defined in 'xwidget.c'. */
void store_xwidget_event_string (struct xwidget *xw,
const char *eventname,
const char *eventstr);
void store_xwidget_download_callback_event (struct xwidget *xw,
const char *url,
const char *mimetype,
const char *filename);
Add xwidget support for macOS Co-authored-by: Jaesup Kwak <veshboo@gmail.com> * configure.ac: Allow '--with-xwidgets' for "${NS_IMPL_COCOA}". * etc/NEWS: Mention new feature. * etc/TODO: Remove done TODO to implement xwidget in NeXTstep port. * lisp/xwidget.el (xwidget-webkit-clone-and-split-below) (xwidget-webkit-clone-and-split-right): New procedures. (xwidget-webkit-callback): Remove call to 'xwidget-webkit-adjust-size-to-window' as adjusting xwidget size is handled in 'x_draw_xwidget_glyph_string'. (xwidget-webkit-enable-plugins): New variable. * nextstep/templates/Info.plist.in: Add 'NSAppTransportSecurity'. * src/Makefile.in: Add nsxwidget.o for compilation. * src/emacs.c (main): Move conditional call to 'syms_of_xwidget'. * src/nsterm.m (ns_draw_glyph_string): Add case for 'XWIDGET_GLYPH'. (note_mouse_movement mouseMoved): Make it easy to resize window by dragging mode-line or vertical separator adjacent to large glyph. * src/nsxwidget.h src/nsxwidget.m: Newly added files, xwidget webkit backend for macOS Cocoa. * src/xwidget.c (Fmake_xwidget, xwidget_init_view) (x_draw_xwidget_glyph_string, xwidget_is_web_view) (Fxwidget_webkit_goto_uri, Fxwidget_webkit_zoom, Fxwidget_resize) (Fxwidget_size_request, Fdelete_xwidget_view, xwidget_end_redisplay) (kill_buffer_xwidgets): Add macOS Cocoa specific functions and code with 'NS_IMPL_COCOA' and guard GTK specific functions and code with 'USE_GTK'. (x_draw_xwidget_glyph_string): Handle adjusting xwidget size. * src/xwidget.h (xwidget, xwidget_view): Add macOS Cocoa specific fields with 'NS_IMPL_COCOA' and guard GTK specific fields with USE_GTK.
2020-08-12 10:12:34 +00:00
void store_xwidget_js_callback_event (struct xwidget *xw,
Lisp_Object proc,
Lisp_Object argument);
extern struct xwidget *xwidget_from_id (uint32_t id);
#ifdef HAVE_X_WINDOWS
struct xwidget_view *xwidget_view_from_window (Window wdesc);
void xwidget_expose (struct xwidget_view *xv);
extern void lower_frame_xwidget_views (struct frame *f);
#endif
#ifndef NS_IMPL_COCOA
extern void kill_frame_xwidget_views (struct frame *f);
#endif
#ifdef HAVE_X_WINDOWS
extern void xwidget_button (struct xwidget_view *, bool, int,
int, int, int, Time);
extern void xwidget_motion_or_crossing (struct xwidget_view *,
const XEvent *);
#ifdef HAVE_XINPUT2
extern void xwidget_motion_notify (struct xwidget_view *, double,
double, double, double, uint, Time);
extern void xwidget_scroll (struct xwidget_view *, double, double,
double, double, uint, Time, bool);
#ifdef HAVE_USABLE_XI_GESTURE_PINCH_EVENT
extern void xwidget_pinch (struct xwidget_view *, XIGesturePinchEvent *);
#endif
#endif
#endif
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 19:15:05 +00:00
#else
INLINE_HEADER_BEGIN
INLINE void syms_of_xwidget (void) {}
INLINE bool valid_xwidget_spec_p (Lisp_Object obj) { return false; }
INLINE void xwidget_view_delete_all_in_window (struct window *w) {}
INLINE void x_draw_xwidget_glyph_string (struct glyph_string *s) { eassume (0); }
INLINE struct xwidget *lookup_xwidget (Lisp_Object obj) { eassume (0); }
INLINE void xwidget_end_redisplay (struct window *w, struct glyph_matrix *m) {}
INLINE void kill_buffer_xwidgets (Lisp_Object buf) {}
INLINE_HEADER_END
#endif
#endif /* XWIDGET_H_INCLUDED */