Commit 7c1f66a9 authored by Joakim Verona's avatar Joakim Verona

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: default avatarGrégoire Jadi  <daimrod@gmail.com>

Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
parent 663d379b
...@@ -373,6 +373,9 @@ otherwise for the first of 'inotify' or 'gfile' that is usable.]) ...@@ -373,6 +373,9 @@ otherwise for the first of 'inotify' or 'gfile' that is usable.])
], ],
[with_file_notification=$with_features]) [with_file_notification=$with_features])
OPTION_DEFAULT_OFF([xwidgets],
[enable use of some gtk widgets in Emacs buffers])
## For the times when you want to build Emacs but don't have ## For the times when you want to build Emacs but don't have
## a suitable makeinfo, and can live without the manuals. ## a suitable makeinfo, and can live without the manuals.
dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
...@@ -2562,6 +2565,42 @@ if test "${HAVE_GTK}" = "yes"; then ...@@ -2562,6 +2565,42 @@ if test "${HAVE_GTK}" = "yes"; then
term_header=gtkutil.h term_header=gtkutil.h
fi fi
HAVE_XWIDGETS=no
HAVE_WEBKIT=no
HAVE_GIR=no
XWIDGETS_OBJ=
if test "$with_xwidgets" != "no" && test "$USE_GTK_TOOLKIT" = "GTK3" &&
test "$window_system" != "none"
then
HAVE_XWIDGETS=yes
AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.])
dnl xwidgets
dnl - enable only if GTK3 is enabled, and we have a window system
dnl - check for webkit and gobject introspection
dnl webkit version for gtk3.
WEBKIT_REQUIRED=1.4.0
WEBKIT_MODULES="webkitgtk-3.0 >= $WEBKIT_REQUIRED"
if test "${with_gtk3}" = "yes"; then
PKG_CHECK_MODULES(WEBKIT, $WEBKIT_MODULES, HAVE_WEBKIT=yes, HAVE_WEBKIT=no)
if test $HAVE_WEBKIT = yes; then
AC_DEFINE([HAVE_WEBKIT_OSR], 1,
[Define to 1 if you have webkit_osr support.])
fi
fi
GIR_REQUIRED=1.32.1
GIR_MODULES="gobject-introspection-1.0 >= $GIR_REQUIRED"
PKG_CHECK_MODULES(GIR, $GIR_MODULES, HAVE_GIR=yes, HAVE_GIR=no)
if test $HAVE_GIR = yes; then
AC_DEFINE([HAVE_GIR], 1, [Define to 1 if you have GIR support.])
fi
XWIDGETS_OBJ=xwidget.o
fi
AC_SUBST(XWIDGETS_OBJ)
CFLAGS=$OLD_CFLAGS CFLAGS=$OLD_CFLAGS
LIBS=$OLD_LIBS LIBS=$OLD_LIBS
...@@ -4925,6 +4964,9 @@ case "$USE_X_TOOLKIT" in ...@@ -4925,6 +4964,9 @@ case "$USE_X_TOOLKIT" in
LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;; LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;; none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
esac esac
if test "$HAVE_XWIDGETS" = "yes"; then
TOOLKIT_LIBW="$TOOLKIT_LIBW -lXcomposite"
fi
AC_SUBST(TOOLKIT_LIBW) AC_SUBST(TOOLKIT_LIBW)
if test "${opsys}" != "mingw32"; then if test "${opsys}" != "mingw32"; then
...@@ -5264,6 +5306,9 @@ AS_ECHO([" Does Emacs use -lXaw3d? ${HAVE_XAW3D ...@@ -5264,6 +5306,9 @@ AS_ECHO([" Does Emacs use -lXaw3d? ${HAVE_XAW3D
Does Emacs directly use zlib? ${HAVE_ZLIB} Does Emacs directly use zlib? ${HAVE_ZLIB}
Does Emacs have dynamic modules support? ${HAVE_MODULES} Does Emacs have dynamic modules support? ${HAVE_MODULES}
Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS} Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}
Does Emacs support Xwidgets? ${HAVE_XWIDGETS}
Does xwidgets support webkit(requires gtk3)? ${HAVE_WEBKIT}
Does xwidgets support gobject introspection? ${HAVE_GIR}
"]) "])
if test -n "${EMACSDATA}"; then if test -n "${EMACSDATA}"; then
......
...@@ -120,6 +120,21 @@ and can contain escape sequences for command keys, quotes, and the like. ...@@ -120,6 +120,21 @@ and can contain escape sequences for command keys, quotes, and the like.
* Changes in Emacs 25.1 * Changes in Emacs 25.1
+++
** Xwidgets : A new feature for embedding native widgets
inside Emacs buffers. If you have gtk3 and webkit-devel installed, you
can access the embedded webkit browser with m-x
xwidget-webkit-browse-url. This will open a new buffer with the
embedded browser. The buffer will have a new mode, xwidget-webkit
mode which is similar to image mode, which supports the webkit widget.
*** New functions for xwidget-webkit mode `xwidget-webkit-insert-string',
`xwidget-webkit-adjust-size-dispatch', `xwidget-webkit-back',
`xwidget-webkit-browse-url', `xwidget-webkit-reload',
`xwidget-webkit-current-url', `xwidget-webkit-scroll-backward',
`xwidget-webkit-scroll-forward', `xwidget-webkit-scroll-down',
`xwidget-webkit-scroll-up',
+++ +++
** Emacs can now load shared/dynamic libraries (modules). ** Emacs can now load shared/dynamic libraries (modules).
A dynamic Emacs module is a shared library that provides additional A dynamic Emacs module is a shared library that provides additional
......
This diff is collapsed.
...@@ -152,6 +152,9 @@ DBUS_LIBS = @DBUS_LIBS@ ...@@ -152,6 +152,9 @@ DBUS_LIBS = @DBUS_LIBS@
## dbusbind.o if HAVE_DBUS, else empty. ## dbusbind.o if HAVE_DBUS, else empty.
DBUS_OBJ = @DBUS_OBJ@ DBUS_OBJ = @DBUS_OBJ@
## xwidgets.o if HAVE_XWIDGETS, else empty.
XWIDGETS_OBJ = @XWIDGETS_OBJ@
LIB_EXECINFO=@LIB_EXECINFO@ LIB_EXECINFO=@LIB_EXECINFO@
SETTINGS_CFLAGS = @SETTINGS_CFLAGS@ SETTINGS_CFLAGS = @SETTINGS_CFLAGS@
...@@ -219,6 +222,11 @@ CFLAGS_SOUND= @CFLAGS_SOUND@ ...@@ -219,6 +222,11 @@ CFLAGS_SOUND= @CFLAGS_SOUND@
RSVG_LIBS= @RSVG_LIBS@ RSVG_LIBS= @RSVG_LIBS@
RSVG_CFLAGS= @RSVG_CFLAGS@ RSVG_CFLAGS= @RSVG_CFLAGS@
WEBKIT_LIBS= @WEBKIT_LIBS@
WEBKIT_CFLAGS= @WEBKIT_CFLAGS@
GIR_LIBS= @GIR_LIBS@
GIR_CFLAGS= @GIR_CFLAGS@
CAIRO_LIBS= @CAIRO_LIBS@ CAIRO_LIBS= @CAIRO_LIBS@
CAIRO_CFLAGS= @CAIRO_CFLAGS@ CAIRO_CFLAGS= @CAIRO_CFLAGS@
...@@ -358,6 +366,7 @@ ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \ ...@@ -358,6 +366,7 @@ ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \
$(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
$(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ $(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
$(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) $(XFIXES_CFLAGS) \ $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) $(XFIXES_CFLAGS) \
$(WEBKIT_CFLAGS) $(GIR_CFLAGS) \
$(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
$(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \
$(LIBGNUTLS_CFLAGS) $(GFILENOTIFY_CFLAGS) $(CAIRO_CFLAGS) \ $(LIBGNUTLS_CFLAGS) $(GFILENOTIFY_CFLAGS) $(CAIRO_CFLAGS) \
...@@ -387,6 +396,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ ...@@ -387,6 +396,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
process.o gnutls.o callproc.o \ process.o gnutls.o callproc.o \
region-cache.o sound.o atimer.o \ region-cache.o sound.o atimer.o \
doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \ doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \
$(XWIDGETS_OBJ) \
profiler.o decompress.o \ profiler.o decompress.o \
$(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
$(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ)
...@@ -467,6 +477,7 @@ lisp = $(addprefix ${lispsource}/,${shortlisp}) ...@@ -467,6 +477,7 @@ lisp = $(addprefix ${lispsource}/,${shortlisp})
LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
$(LIBX_OTHER) $(LIBSOUND) \ $(LIBX_OTHER) $(LIBSOUND) \
$(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(LIB_CLOCK_GETTIME) \ $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(LIB_CLOCK_GETTIME) \
$(WEBKIT_LIBS) $(GIR_LIBS) \
$(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \ $(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \
$(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \ $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \
$(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) $(CAIRO_LIBS) \ $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) $(CAIRO_LIBS) \
......
...@@ -43,6 +43,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -43,6 +43,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "keymap.h" #include "keymap.h"
#include "frame.h" #include "frame.h"
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#ifdef WINDOWSNT #ifdef WINDOWSNT
#include "w32heap.h" /* for mmap_* */ #include "w32heap.h" /* for mmap_* */
#endif #endif
...@@ -1747,6 +1750,9 @@ cleaning up all windows currently displaying the buffer to be killed. */) ...@@ -1747,6 +1750,9 @@ cleaning up all windows currently displaying the buffer to be killed. */)
kill_buffer_processes (buffer); kill_buffer_processes (buffer);
#ifdef HAVE_XWIDGETS
kill_buffer_xwidgets (buffer);
#endif
/* Killing buffer processes may run sentinels which may have killed /* Killing buffer processes may run sentinels which may have killed
our buffer. */ our buffer. */
if (!BUFFER_LIVE_P (b)) if (!BUFFER_LIVE_P (b))
......
...@@ -348,6 +348,10 @@ enum glyph_type ...@@ -348,6 +348,10 @@ enum glyph_type
/* Glyph is a space of fractional width and/or height. */ /* Glyph is a space of fractional width and/or height. */
STRETCH_GLYPH STRETCH_GLYPH
#ifdef HAVE_XWIDGETS
/* Glyph is an external widget drawn by the GUI toolkit. */
,XWIDGET_GLYPH
#endif
}; };
...@@ -499,6 +503,9 @@ struct glyph ...@@ -499,6 +503,9 @@ struct glyph
/* Image ID for image glyphs (type == IMAGE_GLYPH). */ /* Image ID for image glyphs (type == IMAGE_GLYPH). */
int img_id; int img_id;
#ifdef HAVE_XWIDGETS
struct xwidget *xwidget;
#endif
/* Sub-structure for type == STRETCH_GLYPH. */ /* Sub-structure for type == STRETCH_GLYPH. */
struct struct
{ {
...@@ -1350,6 +1357,9 @@ struct glyph_string ...@@ -1350,6 +1357,9 @@ struct glyph_string
/* Image, if any. */ /* Image, if any. */
struct image *img; struct image *img;
#ifdef HAVE_XWIDGETS
struct xwidget *xwidget;
#endif
/* Slice */ /* Slice */
struct glyph_slice slice; struct glyph_slice slice;
...@@ -2102,6 +2112,10 @@ enum display_element_type ...@@ -2102,6 +2112,10 @@ enum display_element_type
/* Continuation glyphs. See the comment for IT_TRUNCATION. */ /* Continuation glyphs. See the comment for IT_TRUNCATION. */
IT_CONTINUATION IT_CONTINUATION
#ifdef HAVE_XWIDGETS
,IT_XWIDGET
#endif
}; };
...@@ -2165,6 +2179,9 @@ enum it_method { ...@@ -2165,6 +2179,9 @@ enum it_method {
GET_FROM_C_STRING, GET_FROM_C_STRING,
GET_FROM_IMAGE, GET_FROM_IMAGE,
GET_FROM_STRETCH, GET_FROM_STRETCH,
#ifdef HAVE_XWIDGETS
GET_FROM_XWIDGET,
#endif
NUM_IT_METHODS NUM_IT_METHODS
}; };
...@@ -2382,6 +2399,12 @@ struct it ...@@ -2382,6 +2399,12 @@ struct it
struct { struct {
Lisp_Object object; Lisp_Object object;
} stretch; } stretch;
#ifdef HAVE_XWIDGETS
/* method == GET_FROM_XWIDGET */
struct {
Lisp_Object object;
} xwidget;
#endif
} u; } u;
/* Current text and display positions. */ /* Current text and display positions. */
...@@ -2506,6 +2529,11 @@ struct it ...@@ -2506,6 +2529,11 @@ struct it
/* If what == IT_IMAGE, the id of the image to display. */ /* If what == IT_IMAGE, the id of the image to display. */
ptrdiff_t image_id; ptrdiff_t image_id;
#ifdef HAVE_XWIDGETS
/* If what == IT_XWIDGET. */
struct xwidget *xwidget;
#endif
/* Values from `slice' property. */ /* Values from `slice' property. */
struct it_slice slice; struct it_slice slice;
......
...@@ -44,6 +44,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -44,6 +44,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include TERM_HEADER #include TERM_HEADER
#endif /* HAVE_WINDOW_SYSTEM */ #endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#include <errno.h> #include <errno.h>
#include <fpending.h> #include <fpending.h>
...@@ -3545,6 +3549,9 @@ update_window (struct window *w, bool force_p) ...@@ -3545,6 +3549,9 @@ update_window (struct window *w, bool force_p)
add_window_display_history (w, w->current_matrix->method, paused_p); add_window_display_history (w, w->current_matrix->method, paused_p);
#endif #endif
#ifdef HAVE_XWIDGETS
xwidget_end_redisplay (w, w->current_matrix);
#endif
clear_glyph_matrix (desired_matrix); clear_glyph_matrix (desired_matrix);
return paused_p; return paused_p;
...@@ -4118,6 +4125,11 @@ scrolling_window (struct window *w, bool header_line_p) ...@@ -4118,6 +4125,11 @@ scrolling_window (struct window *w, bool header_line_p)
break; break;
} }
#ifdef HAVE_XWIDGETS
/* Currently this seems needed to detect xwidget movement reliably. */
return 0;
#endif
/* Give up if some rows in the desired matrix are not enabled. */ /* Give up if some rows in the desired matrix are not enabled. */
if (! MATRIX_ROW_ENABLED_P (desired_matrix, i)) if (! MATRIX_ROW_ENABLED_P (desired_matrix, i))
return -1; return -1;
......
...@@ -66,6 +66,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -66,6 +66,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "buffer.h" #include "buffer.h"
#include "window.h" #include "window.h"
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#include "atimer.h" #include "atimer.h"
#include "blockinput.h" #include "blockinput.h"
#include "syssignal.h" #include "syssignal.h"
...@@ -1485,6 +1488,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem ...@@ -1485,6 +1488,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
syms_of_xfns (); syms_of_xfns ();
syms_of_xmenu (); syms_of_xmenu ();
syms_of_fontset (); syms_of_fontset ();
#ifdef HAVE_XWIDGETS
syms_of_xwidget ();
#endif
syms_of_xsettings (); syms_of_xsettings ();
#ifdef HAVE_X_SM #ifdef HAVE_X_SM
syms_of_xsmfns (); syms_of_xsmfns ();
......
...@@ -23,6 +23,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -23,6 +23,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "lisp.h" #include "lisp.h"
#include "frame.h" #include "frame.h"
#include "xterm.h" #include "xterm.h"
#ifdef HAVE_XWIDGETS
# include "xwidget.h"
#endif
#include "emacsgtkfixed.h" #include "emacsgtkfixed.h"
/* Silence a bogus diagnostic; see GNOME bug 683906. */ /* Silence a bogus diagnostic; see GNOME bug 683906. */
...@@ -31,27 +34,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -31,27 +34,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# pragma GCC diagnostic ignored "-Wunused-local-typedefs" # pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#endif #endif
#define EMACS_TYPE_FIXED emacs_fixed_get_type ()
#define EMACS_FIXED(obj) \
G_TYPE_CHECK_INSTANCE_CAST (obj, EMACS_TYPE_FIXED, EmacsFixed)
typedef struct _EmacsFixed EmacsFixed; typedef struct _EmacsFixed EmacsFixed;
typedef struct _EmacsFixedPrivate EmacsFixedPrivate; typedef struct _EmacsFixedPrivate EmacsFixedPrivate;
typedef struct _EmacsFixedClass EmacsFixedClass; typedef struct _EmacsFixedClass EmacsFixedClass;
struct _EmacsFixed
{
GtkFixed container;
/*< private >*/
EmacsFixedPrivate *priv;
};
struct _EmacsFixedClass
{
GtkFixedClass parent_class;
};
struct _EmacsFixedPrivate struct _EmacsFixedPrivate
{ {
struct frame *f; struct frame *f;
...@@ -64,9 +50,87 @@ static void emacs_fixed_get_preferred_width (GtkWidget *widget, ...@@ -64,9 +50,87 @@ static void emacs_fixed_get_preferred_width (GtkWidget *widget,
static void emacs_fixed_get_preferred_height (GtkWidget *widget, static void emacs_fixed_get_preferred_height (GtkWidget *widget,
gint *minimum, gint *minimum,
gint *natural); gint *natural);
static GType emacs_fixed_get_type (void);
G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED) G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED)
#ifdef HAVE_XWIDGETS
struct GtkFixedPrivateL
{
GList *children;
};
static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
// For xwidgets.
// This basically re-implements the base class method and adds an
// additional case for an xwidget view.
// It would be nicer if the bse class method could be called first,
// and the the xview modification only would remain here. It wasn't
// possible to solve it that way yet.
EmacsFixedClass *klass;
GtkWidgetClass *parent_class;
struct GtkFixedPrivateL* priv;
klass = EMACS_FIXED_GET_CLASS (widget);
parent_class = g_type_class_peek_parent (klass);
parent_class->size_allocate (widget, allocation);
priv = G_TYPE_INSTANCE_GET_PRIVATE (widget,
GTK_TYPE_FIXED,
struct GtkFixedPrivateL);
gtk_widget_set_allocation (widget, allocation);
if (gtk_widget_get_has_window (widget))
{
if (gtk_widget_get_realized (widget))
gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x,
allocation->y,
allocation->width,
allocation->height);
}
for (GList *children = priv->children; children; children = children->next)
{
GtkFixedChild *child = children->data;
if (!gtk_widget_get_visible (child->widget))
continue;
GtkRequisition child_requisition;
gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
GtkAllocation child_allocation;
child_allocation.x = child->x;
child_allocation.y = child->y;
if (!gtk_widget_get_has_window (widget))
{
child_allocation.x += allocation->x;
child_allocation.y += allocation->y;
}
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
struct xwidget_view *xv
= g_object_get_data (G_OBJECT (child->widget), XG_XWIDGET_VIEW);
if (xv)
{
child_allocation.width = xv->clip_right;
child_allocation.height = xv->clip_bottom - xv->clip_top;
}
gtk_widget_size_allocate (child->widget, &child_allocation);
}
}
#endif /* HAVE_XWIDGETS */
static void static void
emacs_fixed_class_init (EmacsFixedClass *klass) emacs_fixed_class_init (EmacsFixedClass *klass)
{ {
...@@ -74,11 +138,16 @@ emacs_fixed_class_init (EmacsFixedClass *klass) ...@@ -74,11 +138,16 @@ emacs_fixed_class_init (EmacsFixedClass *klass)
widget_class = (GtkWidgetClass*) klass; widget_class = (GtkWidgetClass*) klass;
widget_class->get_preferred_width = emacs_fixed_get_preferred_width; widget_class->get_preferred_width = emacs_fixed_get_preferred_width;
widget_class->get_preferred_height = emacs_fixed_get_preferred_height; widget_class->get_preferred_height = emacs_fixed_get_preferred_height;
#ifdef HAVE_XWIDGETS
widget_class->size_allocate = emacs_fixed_gtk_widget_size_allocate;
#endif
g_type_class_add_private (klass, sizeof (EmacsFixedPrivate)); g_type_class_add_private (klass, sizeof (EmacsFixedPrivate));
} }
static void static void
emacs_fixed_init (EmacsFixed *fixed) emacs_fixed_init (EmacsFixed *fixed)
{ {
......
...@@ -27,7 +27,35 @@ struct frame; ...@@ -27,7 +27,35 @@ struct frame;
G_BEGIN_DECLS G_BEGIN_DECLS
struct frame;
#define EMACS_TYPE_FIXED (emacs_fixed_get_type ())
#define EMACS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMACS_TYPE_FIXED, EmacsFixed))
#define EMACS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMACS_TYPE_FIXED, EmacsFixedClass))
#define EMACS_IS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMACS_TYPE_FIXED))
#define EMACS_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMACS_TYPE_FIXED))
#define EMACS_FIXED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMACS_TYPE_FIXED, EmacsFixedClass))
//typedef struct _EmacsFixed EmacsFixed;
typedef struct _EmacsFixedPrivate EmacsFixedPrivate;
typedef struct _EmacsFixedClass EmacsFixedClass;
struct _EmacsFixed
{
GtkFixed container;
/*< private >*/
EmacsFixedPrivate *priv;
};
struct _EmacsFixedClass
{
GtkFixedClass parent_class;
};
extern GtkWidget *emacs_fixed_new (struct frame *f); extern GtkWidget *emacs_fixed_new (struct frame *f);
extern GType emacs_fixed_get_type (void);
G_END_DECLS G_END_DECLS
......
...@@ -4013,6 +4013,13 @@ kbd_buffer_get_event (KBOARD **kbp, ...@@ -4013,6 +4013,13 @@ kbd_buffer_get_event (KBOARD **kbp,
obj = make_lispy_event (&event->ie); obj = make_lispy_event (&event->ie);
kbd_fetch_ptr = event + 1; kbd_fetch_ptr = event + 1;
} }
#endif
#ifdef HAVE_XWIDGETS
else if (event->kind == XWIDGET_EVENT)
{
obj = make_lispy_event (&event->ie);
kbd_fetch_ptr = event + 1;
}
#endif #endif
else if (event->kind == CONFIG_CHANGED_EVENT) else if (event->kind == CONFIG_CHANGED_EVENT)
{ {
...@@ -5950,6 +5957,14 @@ make_lispy_event (struct input_event *event) ...@@ -5950,6 +5957,14 @@ make_lispy_event (struct input_event *event)
} }
#endif /* HAVE_DBUS */ #endif /* HAVE_DBUS */
#ifdef HAVE_XWIDGETS
case XWIDGET_EVENT:
{
return Fcons (Qxwidget_event,event->arg);
}
#endif
#if defined HAVE_GFILENOTIFY || defined HAVE_INOTIFY #if defined HAVE_GFILENOTIFY || defined HAVE_INOTIFY
case FILE_NOTIFY_EVENT: case FILE_NOTIFY_EVENT:
{ {
...@@ -10956,6 +10971,10 @@ syms_of_keyboard (void) ...@@ -10956,6 +10971,10 @@ syms_of_keyboard (void)
DEFSYM (Qdbus_event, "dbus-event"); DEFSYM (Qdbus_event, "dbus-event");
#endif #endif
#ifdef HAVE_XWIDGETS
DEFSYM (Qxwidget_event,"xwidget-event");
#endif
#ifdef USE_FILE_NOTIFY #ifdef USE_FILE_NOTIFY
DEFSYM (Qfile_notify, "file-notify"); DEFSYM (Qfile_notify, "file-notify");
#endif /* USE_FILE_NOTIFY */ #endif /* USE_FILE_NOTIFY */
......
...@@ -799,6 +799,12 @@ enum pvec_type ...@@ -799,6 +799,12 @@ enum pvec_type
PVEC_WINDOW_CONFIGURATION, PVEC_WINDOW_CONFIGURATION,
PVEC_SUBR, PVEC_SUBR,