summaryrefslogtreecommitdiff
path: root/src/xwidget.h
diff options
context:
space:
mode:
authorJoakim Verona <joakim@verona.se>2016-01-19 20:27:12 +0100
committerJoakim Verona <joakim@verona.se>2016-01-19 20:58:22 +0100
commit7c1f66a94bf236a427606ef537b4629a48a1665b (patch)
tree8661f512f7bcf35bfb1e7d915e5b6ef8df6229d8 /src/xwidget.h
parent663d379bbc2fde5e9bded157365e9d48ea01c027 (diff)
downloademacs-7c1f66a94bf236a427606ef537b4629a48a1665b.tar.gz
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:
Diffstat (limited to 'src/xwidget.h')
-rw-r--r--src/xwidget.h135
1 files changed, 135 insertions, 0 deletions
diff --git a/src/xwidget.h b/src/xwidget.h
new file mode 100644
index 00000000000..493000c34fd
--- /dev/null
+++ b/src/xwidget.h
@@ -0,0 +1,135 @@
+/* Support for embedding graphical components in a buffer.
+
+Copyright (C) 2011-2015 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef XWIDGET_H_INCLUDED
+#define XWIDGET_H_INCLUDED
+
+void x_draw_xwidget_glyph_string (struct glyph_string *s);
+void syms_of_xwidget (void);
+
+//extern Lisp_Object Qxwidget;
+
+
+bool valid_xwidget_spec_p (Lisp_Object object);
+
+#include <gtk/gtk.h>
+
+
+/*
+each xwidget instance/model is described by this struct.
+
+lisp pseudovector.
+
+
+ */
+struct xwidget
+{
+ struct vectorlike_header header;
+ Lisp_Object plist; //auxilliary data
+ Lisp_Object type; //the widget type
+ Lisp_Object buffer; //buffer where xwidget lives
+ Lisp_Object title; //a title that is used for button labels for instance
+
+ //here ends the lisp part.
+ //"height" is the marker field
+ int height;
+ int width;
+
+ //for offscreen widgets, unused if not osr
+ GtkWidget *widget_osr;
+ GtkWidget *widgetwindow_osr;
+ //this is used if the widget (webkit) is to be wrapped in a scrolled window,
+ GtkWidget *widgetscrolledwindow_osr;
+ /* Non-nil means kill silently if Emacs is exited. */
+ unsigned int kill_without_query:1;
+
+};
+
+
+//struct for each xwidget view
+struct xwidget_view
+{
+ struct vectorlike_header header;
+ Lisp_Object model;
+ Lisp_Object w;
+
+ //here ends the lisp part.
+ //"redisplayed" is the marker field
+ int redisplayed; //if touched by redisplay
+
+ int hidden; //if the "live" instance isnt drawn
+
+ GtkWidget *widget;
+ GtkWidget *widgetwindow;
+ GtkWidget *emacswindow;
+ int x;
+ int y;
+ int clip_right;
+ int clip_bottom;
+ int clip_top;
+ int clip_left;
+
+
+ long handler_id;
+};
+
+/* Test for xwidget pseudovector*/
+#define XWIDGETP(x) PSEUDOVECTORP (x, PVEC_XWIDGET)
+#define XXWIDGET(a) (eassert (XWIDGETP(a)), \
+ (struct xwidget *) XUNTAG(a, Lisp_Vectorlike))
+
+#define CHECK_XWIDGET(x) \
+ CHECK_TYPE (XWIDGETP (x), Qxwidgetp, x)
+
+/* Test for xwidget_view pseudovector */
+#define XWIDGET_VIEW_P(x) PSEUDOVECTORP (x, PVEC_XWIDGET_VIEW)
+#define XXWIDGET_VIEW(a) (eassert (XWIDGET_VIEW_P(a)), \
+ (struct xwidget_view *) XUNTAG(a, Lisp_Vectorlike))
+
+#define CHECK_XWIDGET_VIEW(x) \
+ CHECK_TYPE (XWIDGET_VIEW_P (x), Qxwidget_view_p, x)
+
+struct xwidget_type
+{
+ /* A symbol uniquely identifying the xwidget type, */
+ Lisp_Object *type;
+
+ /* Check that SPEC is a valid image specification for the given
+ image type. Value is non-zero if SPEC is valid. */
+ int (*valid_p) (Lisp_Object spec);
+
+ /* Next in list of all supported image types. */
+ struct xwidget_type *next;
+};
+
+
+struct xwidget *xwidget_from_id (int id);
+
+void xwidget_start_redisplay (void);
+void xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix);
+
+void xwidget_touch (struct xwidget_view *xw);
+
+struct xwidget *lookup_xwidget (Lisp_Object spec);
+#define XG_XWIDGET "emacs_xwidget"
+#define XG_XWIDGET_VIEW "emacs_xwidget_view"
+void xwidget_view_delete_all_in_window (struct window *w);
+
+void kill_buffer_xwidgets (Lisp_Object buffer);
+#endif /* XWIDGET_H_INCLUDED */