- next to no argument checking. If wrong type args are used with the
xwgir methods, emacs crashes.
+*** TODO xwgir create components with more advanced constructor
+so this opens up an entire new can of beans.
-** TODO investigate gdk_offscreen_window_set_embedder()
+explain by example:
+lets say we want to create agtkhscale on screen. its a slider.
+https://developer.gnome.org/gtk3/stable/GtkHScale.html
+we can already create buttons, so sliders shouldnt be much more
+advanced right? wrong.
+
+the simplest slider constructor looks like:
+GtkWidget * gtk_hscale_new
+(GtkAdjustment *adjustment);
+
+so in order to call it, we must be able to forward arguments to the
+constructor. this is almost already done, but we lack the ability to
+pass object instances, only simple types atm.
+
+we need to be able to create GtkAdjustment
+https://developer.gnome.org/gtk3/stable/GtkAdjustment.html
+
+this we can already almost do, because an xwidget is a gir object
+with some decorations. we also store the decorated gir object in an
+array, retrievable from lisp.
+
+In order for this to be usable in practice, we need some changes:
+- lightweight objects should be stored un-decorated. they have no
+ need for the entire graphical machinery of xwidgets
+- lightweight objects should be garbage collectable, but this is the
+ same for all the xwidget objects, and isnt really resolved atm.
+
+
+** DONE investigate gdk_offscreen_window_set_embedder()
+ CLOSED: [2013-04-06 Sat 10:45]
https://developer.gnome.org/gdk/unstable/gdk-Windows.html
,----
(put 'xwgirButton :xwgir-class '("Gtk" "Button"))
(xwidget-insert (point-min) 'xwgirButton "xwgir label didnt work..." 700 700)
- (xwgir-call-method (xwidget-at 1) "set_label" '( "xwgir label worked!"))
+ (xwgir-xwidget-call-method (xwidget-at 1) "set_label" '( "xwgir label worked!"))
(define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
(xwidget-demo "a-xwgir-check-button"
(xwidget-insert (point-min) 'xwgirCheckButton "xwgir label didnt work..." 700 700)
(define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
-(xwidget-demo "a-xwgir-slider"
+(xwidget-demo "a-xwgir-hscale"
(xwgir-require-namespace "Gtk" "3.0")
- (put 'xwgirSlider :xwgir-class '("Gtk" "Slider"))
+ (put 'xwgirHScale :xwgir-class '("Gtk" "HScale"))
- (xwidget-insert (point-min) 'xwgirSlider "xwgir label didnt work..." 700 700)
+ (xwidget-insert (point-min) 'xwgirHScale "xwgir label didnt work..." 700 700)
(define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
(xwidget-demo "a-xwgir-webkit"
return 0;
}
-DEFUN ("xwgir-call-method", Fxwgir_call_method, Sxwgir_call_method, 3, 3, 0,
+
+void
+refactor_attempt(){
+ //this methhod should be called from xwgir-xwidget-call-method and from xwgir xwidget construction
+ char* class = SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class))));
+
+ GIObjectInfo* obj_info = g_irepository_find_by_name(girepository, namespace, class);
+ GIFunctionInfo* f_info = g_object_info_find_method (obj_info, SDATA(method));
+
+ //loop over args, convert from lisp to primitive type, given arg introspection data
+ //TODO g_callable_info_get_n_args(f_info) should match
+ int argscount = XFASTINT(Flength(arguments));
+ if(argscount != g_callable_info_get_n_args(f_info)){
+ printf("xwgir call method arg count doesn match! \n");
+ return Qnil;
+ }
+ int i;
+ for (i = 1; i < argscount + 1; ++i)
+ {
+ xwgir_convert_lisp_to_gir_arg(&in_args[i], g_callable_info_get_arg(f_info, i - 1), Fnth(i - 1, arguments));
+ }
+
+ in_args[0].v_pointer = widget;
+ if(g_function_info_invoke(f_info,
+ in_args, argscount + 1,
+ NULL, 0,
+ &return_value,
+ &error)) {
+ //g_error("ERROR: %s\n", error->message);
+ printf("invokation error\n");
+ return Qnil;
+ }
+ return Qt;
+}
+
+
+DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_call_method, 3, 3, 0,
doc: /* call xwidget object method.*/)
(Lisp_Object xwidget, Lisp_Object method, Lisp_Object arguments)
{
DEFSYM (Qwebkit_osr ,"webkit-osr");
#endif
- defsubr (&Sxwgir_call_method );
+ defsubr (&Sxwgir_xwidget_call_method );
defsubr (&Sxwgir_require_namespace);
defsubr (&Sxwidget_size_request );
defsubr (&Sxwidget_delete_zombies);