diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.in | 7 | ||||
| -rw-r--r-- | src/xwidget.c | 68 |
2 files changed, 71 insertions, 4 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index b02d49ff5b0..2b0d095ad91 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -238,6 +238,9 @@ CLUTTER_CFLAGS= @CLUTTER_CFLAGS@ | |||
| 238 | WEBKIT_LIBS= @WEBKIT_LIBS@ | 238 | WEBKIT_LIBS= @WEBKIT_LIBS@ |
| 239 | WEBKIT_CFLAGS= @WEBKIT_CFLAGS@ | 239 | WEBKIT_CFLAGS= @WEBKIT_CFLAGS@ |
| 240 | 240 | ||
| 241 | GIR_LIBS= @GIR_LIBS@ | ||
| 242 | GIR_CFLAGS= @GIR_CFLAGS@ | ||
| 243 | |||
| 241 | IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@ | 244 | IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@ |
| 242 | IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@ | 245 | IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@ |
| 243 | 246 | ||
| @@ -316,7 +319,7 @@ ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \ | |||
| 316 | $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ | 319 | $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ |
| 317 | $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ | 320 | $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ |
| 318 | $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ | 321 | $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ |
| 319 | $(WEBKIT_CFLAGS) $(CLUTTER_CFLAGS) \ | 322 | $(WEBKIT_CFLAGS) $(CLUTTER_CFLAGS) $(GIR_CFLAGS) \ |
| 320 | $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ | 323 | $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ |
| 321 | $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \ | 324 | $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \ |
| 322 | $(LIBGNUTLS_CFLAGS) \ | 325 | $(LIBGNUTLS_CFLAGS) \ |
| @@ -394,7 +397,7 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \ | |||
| 394 | ## with GCC, we might need LIB_GCC again after them. | 397 | ## with GCC, we might need LIB_GCC again after them. |
| 395 | LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ | 398 | LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ |
| 396 | $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(DBUS_LIBS) \ | 399 | $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(DBUS_LIBS) \ |
| 397 | $(WEBKIT_LIBS) $(CLUTTER_LIBS) \ | 400 | $(WEBKIT_LIBS) $(CLUTTER_LIBS) $(GIR_LIBS) \ |
| 398 | $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ | 401 | $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ |
| 399 | $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ | 402 | $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ |
| 400 | $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ | 403 | $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ |
diff --git a/src/xwidget.c b/src/xwidget.c index f59f2f32d1e..a9e3477d103 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -102,6 +102,9 @@ | |||
| 102 | #include <webkit/webkitdownload.h> | 102 | #include <webkit/webkitdownload.h> |
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
| 105 | //for GIR | ||
| 106 | #include <girepository.h> | ||
| 107 | |||
| 105 | #include "xwidget.h" | 108 | #include "xwidget.h" |
| 106 | 109 | ||
| 107 | //TODO should of course not be a hardcoded array but I can't be bothered atm | 110 | //TODO should of course not be a hardcoded array but I can't be bothered atm |
| @@ -137,7 +140,7 @@ Lisp_Object Qxwidget_info; | |||
| 137 | Lisp_Object Qxwidget_resize; | 140 | Lisp_Object Qxwidget_resize; |
| 138 | Lisp_Object Qxwidget_send_keyboard_event; | 141 | Lisp_Object Qxwidget_send_keyboard_event; |
| 139 | 142 | ||
| 140 | Lisp_Object Qbutton, Qtoggle, Qslider, Qsocket, Qsocket_osr, Qcairo, | 143 | Lisp_Object Qbutton, Qtoggle, Qslider, Qsocket, Qsocket_osr, Qcairo, Qxwgir, |
| 141 | Qwebkit_osr, QCplist; | 144 | Qwebkit_osr, QCplist; |
| 142 | 145 | ||
| 143 | 146 | ||
| @@ -601,6 +604,46 @@ xwidget_osr_button_callback (GtkWidget *widget, | |||
| 601 | return TRUE; //dont propagate this event furter | 604 | return TRUE; //dont propagate this event furter |
| 602 | } | 605 | } |
| 603 | 606 | ||
| 607 | |||
| 608 | GtkWidget* xwgir_create(char* class){ | ||
| 609 | //create a gtk widget, given its name | ||
| 610 | //find the constructor | ||
| 611 | //call it | ||
| 612 | //also figure out how to pass args | ||
| 613 | /* gboolean g_function_info_invoke (GIFunctionInfo *info, */ | ||
| 614 | /* const GIArgument *in_args, */ | ||
| 615 | /* int n_in_args, */ | ||
| 616 | /* const GIArgument *out_args, */ | ||
| 617 | /* int n_out_args, */ | ||
| 618 | /* GIArgument *return_value, */ | ||
| 619 | /* GError **error); */ | ||
| 620 | char* namespace = "Gtk"; | ||
| 621 | char* namespace_version = "3.0"; | ||
| 622 | GError *error = NULL; | ||
| 623 | GIRepository *repository; | ||
| 624 | GIArgument return_value; | ||
| 625 | /* GtkWidget* rv; */ | ||
| 626 | repository = g_irepository_get_default(); | ||
| 627 | g_irepository_require(repository, namespace, namespace_version, 0, &error); | ||
| 628 | if (error) { | ||
| 629 | g_error("ERROR: %s\n", error->message); | ||
| 630 | return NULL; | ||
| 631 | } | ||
| 632 | |||
| 633 | GIObjectInfo* obj_info = g_irepository_find_by_name(repository, namespace, class); | ||
| 634 | GIFunctionInfo* f_info = g_object_info_find_method (obj_info, "new"); | ||
| 635 | g_function_info_invoke(f_info, | ||
| 636 | 0, NULL, | ||
| 637 | 0, NULL, | ||
| 638 | &return_value, | ||
| 639 | NULL); | ||
| 640 | return return_value.v_pointer; | ||
| 641 | |||
| 642 | } | ||
| 643 | |||
| 644 | |||
| 645 | |||
| 646 | |||
| 604 | int xwidget_view_index=0; | 647 | int xwidget_view_index=0; |
| 605 | 648 | ||
| 606 | /* initializes and does initial placement of an xwidget view on screen */ | 649 | /* initializes and does initial placement of an xwidget view on screen */ |
| @@ -635,6 +678,9 @@ xwidget_init_view (struct xwidget *xww, | |||
| 635 | } else if (EQ(xww->type, Qtoggle)) { | 678 | } else if (EQ(xww->type, Qtoggle)) { |
| 636 | xv->widget = gtk_toggle_button_new_with_label (XSTRING(xww->title)->data); | 679 | xv->widget = gtk_toggle_button_new_with_label (XSTRING(xww->title)->data); |
| 637 | //xv->widget = gtk_entry_new ();//temp hack to experiment with key propagation TODO entry widget is useful for testing | 680 | //xv->widget = gtk_entry_new ();//temp hack to experiment with key propagation TODO entry widget is useful for testing |
| 681 | } else if (EQ(xww->type, Qxwgir)) { | ||
| 682 | //this is just a test for xwgir | ||
| 683 | xv->widget = xwgir_create ("Button"); | ||
| 638 | } else if (EQ(xww->type, Qsocket)) { | 684 | } else if (EQ(xww->type, Qsocket)) { |
| 639 | xv->widget = gtk_socket_new (); | 685 | xv->widget = gtk_socket_new (); |
| 640 | g_signal_connect_after(xv->widget, "plug-added", G_CALLBACK(xwidget_plug_added), "plug added"); | 686 | g_signal_connect_after(xv->widget, "plug-added", G_CALLBACK(xwidget_plug_added), "plug added"); |
| @@ -721,7 +767,21 @@ xwidget_init_view (struct xwidget *xww, | |||
| 721 | #endif | 767 | #endif |
| 722 | 768 | ||
| 723 | 769 | ||
| 724 | } else return NULL; | 770 | } else { |
| 771 | //here we have run out of hard coded symbols, we will now attempt to create | ||
| 772 | //a widget dynamically | ||
| 773 | //TODO | ||
| 774 | // - support OSR | ||
| 775 | // - support constructor args | ||
| 776 | // - support signals | ||
| 777 | // - check that the argument widget type actually exists | ||
| 778 | printf("xwgir symbol %s:\n",SDATA(SYMBOL_NAME(xww->type))); | ||
| 779 | //xv->widget = xwgir_create ("Button"); | ||
| 780 | xv->widget = xwgir_create(SDATA(SYMBOL_NAME(xww->type))); | ||
| 781 | |||
| 782 | } | ||
| 783 | |||
| 784 | //else return NULL; | ||
| 725 | 785 | ||
| 726 | //widget realization | 786 | //widget realization |
| 727 | //make container widget 1st, and put the actual widget inside the container | 787 | //make container widget 1st, and put the actual widget inside the container |
| @@ -1245,6 +1305,8 @@ syms_of_xwidget (void) | |||
| 1245 | DEFSYM (Qsocket_osr, "socket-osr"); | 1305 | DEFSYM (Qsocket_osr, "socket-osr"); |
| 1246 | DEFSYM (Qcairo, "cairo"); | 1306 | DEFSYM (Qcairo, "cairo"); |
| 1247 | 1307 | ||
| 1308 | DEFSYM (Qxwgir, "xwgir"); | ||
| 1309 | |||
| 1248 | DEFSYM (QCplist, ":plist"); | 1310 | DEFSYM (QCplist, ":plist"); |
| 1249 | 1311 | ||
| 1250 | DEFVAR_LISP ("xwidget-alist", Vxwidget_alist, doc: /*xwidgets list*/); | 1312 | DEFVAR_LISP ("xwidget-alist", Vxwidget_alist, doc: /*xwidgets list*/); |
| @@ -1471,4 +1533,6 @@ xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix) | |||
| 1471 | } | 1533 | } |
| 1472 | } | 1534 | } |
| 1473 | } | 1535 | } |
| 1536 | |||
| 1537 | |||
| 1474 | #endif | 1538 | #endif |