http://developer.gnome.org/libevview/3.2/libevview-ev-view.html
would be useful for reading PDF:s and other document types.
it would work the same way webkit embedding works.
+
+** TODO support gobject introspection
+https://live.gnome.org/GObjectIntrospection/
+supporting gobject introspection would mean that more gtk widgets
+could be tried out with less effort, and also that the build process
+and runtime support would be easier. The drawbacks are small: somewhat
+slower execution, and difficulty in providing elisp bindings for
+introspection.
+
+https://live.gnome.org/GObjectIntrospection/HowToWriteALanguageBinding
+
+http://developer.gnome.org/gi/unstable/gi-girepository.html
+http://developer.gnome.org/gi/unstable/gi-overview.html
HAVE_WEBKIT=no
HAVE_GOOCANVAS=no
HAVE_CLUTTER=no
+HAVE_GIR=no
+
if test "${with_xwidgets}" != "no"; then
echo "xwidgets enabled, checking webkit, and others"
HAVE_XWIDGETS=yes
AC_DEFINE(HAVE_GOOCANVAS, 1, [Define to 1 if you have goocanvas 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
+
+
fi
echo " Does Emacs support Xwidgets? ${HAVE_XWIDGETS}"
echo " Does xwidgets support webkit(requires gtk3)? ${HAVE_WEBKIT}"
+echo " Does xwidgets support gobject introspection? ${HAVE_GIR}"
echo " Does xwidgets support clutter(demo code)? ${HAVE_CLUTTER}"
echo " Does xwidgets support goocanvas(demo code)? ${HAVE_GOOCANVAS}"
echo
WEBKIT_LIBS= @WEBKIT_LIBS@
WEBKIT_CFLAGS= @WEBKIT_CFLAGS@
+GIR_LIBS= @GIR_LIBS@
+GIR_CFLAGS= @GIR_CFLAGS@
+
IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@
IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@
$(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
$(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
$(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
- $(WEBKIT_CFLAGS) $(CLUTTER_CFLAGS) \
+ $(WEBKIT_CFLAGS) $(CLUTTER_CFLAGS) $(GIR_CFLAGS) \
$(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
$(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \
$(LIBGNUTLS_CFLAGS) \
## with GCC, we might need LIB_GCC again after them.
LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
$(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(DBUS_LIBS) \
- $(WEBKIT_LIBS) $(CLUTTER_LIBS) \
+ $(WEBKIT_LIBS) $(CLUTTER_LIBS) $(GIR_LIBS) \
$(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
$(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
$(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
#include <webkit/webkitdownload.h>
#endif
+//for GIR
+#include <girepository.h>
+
#include "xwidget.h"
//TODO should of course not be a hardcoded array but I can't be bothered atm
Lisp_Object Qxwidget_resize;
Lisp_Object Qxwidget_send_keyboard_event;
-Lisp_Object Qbutton, Qtoggle, Qslider, Qsocket, Qsocket_osr, Qcairo,
+Lisp_Object Qbutton, Qtoggle, Qslider, Qsocket, Qsocket_osr, Qcairo, Qxwgir,
Qwebkit_osr, QCplist;
return TRUE; //dont propagate this event furter
}
+
+GtkWidget* xwgir_create(char* class){
+ //create a gtk widget, given its name
+ //find the constructor
+ //call it
+ //also figure out how to pass args
+ /* gboolean g_function_info_invoke (GIFunctionInfo *info, */
+ /* const GIArgument *in_args, */
+ /* int n_in_args, */
+ /* const GIArgument *out_args, */
+ /* int n_out_args, */
+ /* GIArgument *return_value, */
+ /* GError **error); */
+ char* namespace = "Gtk";
+ char* namespace_version = "3.0";
+ GError *error = NULL;
+ GIRepository *repository;
+ GIArgument return_value;
+ /* GtkWidget* rv; */
+ repository = g_irepository_get_default();
+ g_irepository_require(repository, namespace, namespace_version, 0, &error);
+ if (error) {
+ g_error("ERROR: %s\n", error->message);
+ return NULL;
+ }
+
+ GIObjectInfo* obj_info = g_irepository_find_by_name(repository, namespace, class);
+ GIFunctionInfo* f_info = g_object_info_find_method (obj_info, "new");
+ g_function_info_invoke(f_info,
+ 0, NULL,
+ 0, NULL,
+ &return_value,
+ NULL);
+ return return_value.v_pointer;
+
+}
+
+
+
+
int xwidget_view_index=0;
/* initializes and does initial placement of an xwidget view on screen */
} else if (EQ(xww->type, Qtoggle)) {
xv->widget = gtk_toggle_button_new_with_label (XSTRING(xww->title)->data);
//xv->widget = gtk_entry_new ();//temp hack to experiment with key propagation TODO entry widget is useful for testing
+ } else if (EQ(xww->type, Qxwgir)) {
+ //this is just a test for xwgir
+ xv->widget = xwgir_create ("Button");
} else if (EQ(xww->type, Qsocket)) {
xv->widget = gtk_socket_new ();
g_signal_connect_after(xv->widget, "plug-added", G_CALLBACK(xwidget_plug_added), "plug added");
#endif
- } else return NULL;
+ } else {
+ //here we have run out of hard coded symbols, we will now attempt to create
+ //a widget dynamically
+ //TODO
+ // - support OSR
+ // - support constructor args
+ // - support signals
+ // - check that the argument widget type actually exists
+ printf("xwgir symbol %s:\n",SDATA(SYMBOL_NAME(xww->type)));
+ //xv->widget = xwgir_create ("Button");
+ xv->widget = xwgir_create(SDATA(SYMBOL_NAME(xww->type)));
+
+ }
+
+ //else return NULL;
//widget realization
//make container widget 1st, and put the actual widget inside the container
DEFSYM (Qsocket_osr, "socket-osr");
DEFSYM (Qcairo, "cairo");
+ DEFSYM (Qxwgir, "xwgir");
+
DEFSYM (QCplist, ":plist");
DEFVAR_LISP ("xwidget-alist", Vxwidget_alist, doc: /*xwidgets list*/);
}
}
}
+
+
#endif