diff options
| author | Joakim Verona | 2015-02-08 10:51:15 +0100 |
|---|---|---|
| committer | Joakim Verona | 2015-02-08 10:51:15 +0100 |
| commit | 148262ce3db990ed16989341345e232570b3a338 (patch) | |
| tree | 26b8d5b78b4e711360bd86fda0236880d0b04f26 | |
| parent | e70993dd977debaaafa1b2ef9d692f7c25b98c1c (diff) | |
| download | emacs-148262ce3db990ed16989341345e232570b3a338.tar.gz emacs-148262ce3db990ed16989341345e232570b3a338.zip | |
xwgir components now accept constructor args
| -rw-r--r-- | lisp/xwidget.el | 4 | ||||
| -rw-r--r-- | src/xwidget.c | 325 | ||||
| -rw-r--r-- | test/xwidget-test-manual.el | 20 |
3 files changed, 238 insertions, 111 deletions
diff --git a/lisp/xwidget.el b/lisp/xwidget.el index de3235d4701..a4e4a422df9 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | 'native or 'image." | 20 | 'native or 'image." |
| 21 | :group 'xwidgets) | 21 | :group 'xwidgets) |
| 22 | 22 | ||
| 23 | (defun xwidget-insert (pos type title width height) | 23 | (defun xwidget-insert (pos type title width height &optional args) |
| 24 | "Insert an xwidget at POS. | 24 | "Insert an xwidget at POS. |
| 25 | given ID, TYPE, TITLE WIDTH and | 25 | given ID, TYPE, TITLE WIDTH and |
| 26 | HEIGHT in the current buffer. | 26 | HEIGHT in the current buffer. |
| @@ -30,7 +30,7 @@ Return ID | |||
| 30 | see `make-xwidget' for types suitable for TYPE." | 30 | see `make-xwidget' for types suitable for TYPE." |
| 31 | (goto-char pos) | 31 | (goto-char pos) |
| 32 | (let ((id (make-xwidget (point) (point) | 32 | (let ((id (make-xwidget (point) (point) |
| 33 | type title width height nil))) | 33 | type title width height args))) |
| 34 | (put-text-property (point) (+ 1 (point)) | 34 | (put-text-property (point) (+ 1 (point)) |
| 35 | 'display (list 'xwidget ':xwidget id)) | 35 | 'display (list 'xwidget ':xwidget id)) |
| 36 | id)) | 36 | id)) |
diff --git a/src/xwidget.c b/src/xwidget.c index 154d1373287..b68d3cb70ff 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -178,26 +178,35 @@ webkit_osr_navigation_policy_decision_requested_callback (WebKitWebView * | |||
| 178 | * policy_decision, | 178 | * policy_decision, |
| 179 | gpointer user_data); | 179 | gpointer user_data); |
| 180 | 180 | ||
| 181 | static GtkWidget *xwgir_create (char *, char *); | 181 | static GtkWidget *xwgir_create (char *, char *, char *, Lisp_Object); |
| 182 | 182 | ||
| 183 | 183 | ||
| 184 | static void send_xembed_ready_event (struct xwidget *xw, int xembedid); | 184 | static void send_xembed_ready_event (struct xwidget *xw, int xembedid); |
| 185 | DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 8, 0, doc: /* Make an xwidget from BEG to END of TYPE. | 185 | |
| 186 | 186 | DEFUN ("make-xwidget", | |
| 187 | If BUFFER is nil it uses the current buffer. If BUFFER is a string and | 187 | Fmake_xwidget, Smake_xwidget, |
| 188 | no such buffer exists, it is created. | 188 | 7, 8, 0, doc: /* Make an xwidget from BEG to END of TYPE. |
| 189 | 189 | ||
| 190 | TYPE is a symbol which can take one of the following values: | 190 | If BUFFER is nil it uses the current |
| 191 | - Button | 191 | buffer. If BUFFER is a string and no such |
| 192 | - ToggleButton | 192 | buffer exists, it is created. |
| 193 | - slider | 193 | |
| 194 | - socket | 194 | TYPE is a symbol which can take one of the |
| 195 | - socket-osr | 195 | following values: |
| 196 | */ | 196 | |
| 197 | - Button | ||
| 198 | - ToggleButton | ||
| 199 | - slider | ||
| 200 | - socket | ||
| 201 | - socket-osr | ||
| 202 | |||
| 203 | ARGUMENTS are xwgir constructor args | ||
| 204 | */ | ||
| 197 | )(Lisp_Object beg, Lisp_Object end, | 205 | )(Lisp_Object beg, Lisp_Object end, |
| 198 | Lisp_Object type, | 206 | Lisp_Object type, |
| 199 | Lisp_Object title, | 207 | Lisp_Object title, |
| 200 | Lisp_Object width, Lisp_Object height, Lisp_Object data, Lisp_Object buffer) | 208 | Lisp_Object width, Lisp_Object height, |
| 209 | Lisp_Object arguments, Lisp_Object buffer) | ||
| 201 | { | 210 | { |
| 202 | //should work a bit like "make-button"(make-button BEG END &rest PROPERTIES) | 211 | //should work a bit like "make-button"(make-button BEG END &rest PROPERTIES) |
| 203 | // arg "type" and fwd should be keyword args eventually | 212 | // arg "type" and fwd should be keyword args eventually |
| @@ -216,7 +225,8 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 8, 0, doc: /* Make an xw | |||
| 216 | xw->height = XFASTINT (height); | 225 | xw->height = XFASTINT (height); |
| 217 | xw->width = XFASTINT (width); | 226 | xw->width = XFASTINT (width); |
| 218 | xw->kill_without_query = 0; | 227 | xw->kill_without_query = 0; |
| 219 | XSETXWIDGET (val, xw); // set the vectorlike_header of VAL with the correct value | 228 | XSETXWIDGET (val, xw); // set the vectorlike_header of VAL |
| 229 | // with the correct value | ||
| 220 | Vxwidget_list = Fcons (val, Vxwidget_list); | 230 | Vxwidget_list = Fcons (val, Vxwidget_list); |
| 221 | xw->widgetwindow_osr = NULL; | 231 | xw->widgetwindow_osr = NULL; |
| 222 | xw->widget_osr = NULL; | 232 | xw->widget_osr = NULL; |
| @@ -262,8 +272,11 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 8, 0, doc: /* Make an xw | |||
| 262 | xw->widget_osr = gtk_socket_new (); | 272 | xw->widget_osr = gtk_socket_new (); |
| 263 | if (!NILP (Fget (xw->type, QCxwgir_class))) | 273 | if (!NILP (Fget (xw->type, QCxwgir_class))) |
| 264 | xw->widget_osr = | 274 | xw->widget_osr = |
| 265 | xwgir_create (SSDATA (Fcar (Fcdr (Fget (xw->type, QCxwgir_class)))), | 275 | xwgir_create (SSDATA (Fcar (Fcdr (Fget (xw->type, QCxwgir_class)))), //class |
| 266 | SSDATA (Fcar (Fget (xw->type, QCxwgir_class)))); | 276 | SSDATA (Fcar (Fget (xw->type, QCxwgir_class))), //namespace |
| 277 | SSDATA (Fcar (Fcdr (Fcdr (Fget (xw->type, QCxwgir_class))))), //constructor | ||
| 278 | arguments | ||
| 279 | ); | ||
| 267 | 280 | ||
| 268 | gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, | 281 | gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, |
| 269 | xw->height); | 282 | xw->height); |
| @@ -688,24 +701,6 @@ DEFUN ("xwgir-require-namespace", Fxwgir_require_namespace, Sxwgir_require_names | |||
| 688 | return Qt; | 701 | return Qt; |
| 689 | } | 702 | } |
| 690 | 703 | ||
| 691 | GtkWidget * | ||
| 692 | xwgir_create (char *class, char *namespace) | ||
| 693 | { | ||
| 694 | //TODO this is more or less the same as xwgir-call-method, so should be refactored | ||
| 695 | //create a gtk widget, given its name | ||
| 696 | //find the constructor | ||
| 697 | //call it | ||
| 698 | //also figure out how to pass args | ||
| 699 | |||
| 700 | GIArgument return_value; | ||
| 701 | |||
| 702 | GIObjectInfo *obj_info = | ||
| 703 | g_irepository_find_by_name (girepository, namespace, class); | ||
| 704 | GIFunctionInfo *f_info = g_object_info_find_method (obj_info, "new"); | ||
| 705 | g_function_info_invoke (f_info, NULL, 0, NULL, 0, &return_value, NULL); | ||
| 706 | return return_value.v_pointer; | ||
| 707 | |||
| 708 | } | ||
| 709 | 704 | ||
| 710 | static int | 705 | static int |
| 711 | xwgir_convert_lisp_to_gir_arg (GIArgument * giarg, | 706 | xwgir_convert_lisp_to_gir_arg (GIArgument * giarg, |
| @@ -778,11 +773,85 @@ xwgir_convert_lisp_to_gir_arg (GIArgument * giarg, | |||
| 778 | return 0; | 773 | return 0; |
| 779 | } | 774 | } |
| 780 | 775 | ||
| 781 | DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_call_method, 3, 3, 0, doc: /* Call Xwidget object method using GObject Introspection. | 776 | GtkWidget * |
| 782 | XWIDGET is the xwidget instance to act upon. | 777 | xwgir_create (char *class, char *namespace, char *constructor, |
| 783 | METHOD is the Gobject intrsopsection method name. | 778 | Lisp_Object arguments) |
| 784 | ARGUMENTS is a list of arguments for the call. They will be converted to GObject types from Lisp types. | 779 | { |
| 785 | */ ) | 780 | //TODO this is more or less the same as xwgir-call-method, |
| 781 | //so should be refactored | ||
| 782 | //create a gtk widget, given its name | ||
| 783 | //find the constructor | ||
| 784 | //call it | ||
| 785 | //also figure out how to pass args | ||
| 786 | |||
| 787 | GIArgument return_value; | ||
| 788 | |||
| 789 | GIObjectInfo *obj_info = | ||
| 790 | g_irepository_find_by_name (girepository, namespace, class); | ||
| 791 | //some constructors are like "new_with_label etc | ||
| 792 | GIFunctionInfo *f_info = g_object_info_find_method (obj_info, constructor); | ||
| 793 | g_function_info_invoke (f_info, NULL, 0, NULL, 0, &return_value, NULL); | ||
| 794 | |||
| 795 | |||
| 796 | ////////////////////////////////////////////////////////////////////////////// | ||
| 797 | // refactorable | ||
| 798 | |||
| 799 | //loop over args, convert from lisp to primitive type, given arg | ||
| 800 | //introspection data TODO g_callable_info_get_n_args(f_info) should | ||
| 801 | //match | ||
| 802 | GError *error = NULL; | ||
| 803 | GIArgument in_args[20]; | ||
| 804 | |||
| 805 | int argscount = XFASTINT (Flength (arguments)); | ||
| 806 | if (argscount != g_callable_info_get_n_args (f_info)) | ||
| 807 | { | ||
| 808 | printf ("xwgir call method arg count doesn match! \n"); | ||
| 809 | return NULL; | ||
| 810 | } | ||
| 811 | int i; | ||
| 812 | Lisp_Object n; | ||
| 813 | for (i = 0; i < argscount ; ++i) | ||
| 814 | { | ||
| 815 | XSETFASTINT (n, i); | ||
| 816 | xwgir_convert_lisp_to_gir_arg (&in_args[i], | ||
| 817 | g_callable_info_get_arg (f_info, i), | ||
| 818 | Fnth (n, arguments)); | ||
| 819 | } | ||
| 820 | |||
| 821 | //in_args[0].v_pointer = widget; | ||
| 822 | //g_function_info_invoke (f_info, NULL, 0, NULL, 0, &return_value, NULL); | ||
| 823 | if (!g_function_info_invoke (f_info, | ||
| 824 | in_args, argscount, | ||
| 825 | NULL, 0, &return_value, &error)) | ||
| 826 | { | ||
| 827 | //g_error("ERROR: %s\n", error->message); | ||
| 828 | printf ("invokation error\n"); | ||
| 829 | return NULL; | ||
| 830 | } | ||
| 831 | /////////////////////////////////////// | ||
| 832 | |||
| 833 | |||
| 834 | |||
| 835 | return return_value.v_pointer; | ||
| 836 | |||
| 837 | } | ||
| 838 | |||
| 839 | |||
| 840 | DEFUN ("xwgir-xwidget-call-method", | ||
| 841 | Fxwgir_xwidget_call_method, Sxwgir_xwidget_call_method, | ||
| 842 | 3, 3, 0, doc: /* Call Xwidget object method using GObject | ||
| 843 | Introspection. | ||
| 844 | |||
| 845 | XWIDGET is the xwidget instance to act | ||
| 846 | upon. | ||
| 847 | |||
| 848 | METHOD is the Gobject intrsopsection method | ||
| 849 | name. | ||
| 850 | |||
| 851 | ARGUMENTS is a list of arguments for the | ||
| 852 | call. They will be converted to GObject | ||
| 853 | types from Lisp types. | ||
| 854 | */ ) | ||
| 786 | (Lisp_Object xwidget, Lisp_Object method, Lisp_Object arguments) | 855 | (Lisp_Object xwidget, Lisp_Object method, Lisp_Object arguments) |
| 787 | { | 856 | { |
| 788 | CHECK_XWIDGET (xwidget); | 857 | CHECK_XWIDGET (xwidget); |
| @@ -801,35 +870,32 @@ DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_c | |||
| 801 | if (NULL == xw) | 870 | if (NULL == xw) |
| 802 | printf ("ERROR xw is 0\n"); | 871 | printf ("ERROR xw is 0\n"); |
| 803 | char *namespace = SSDATA (Fcar (Fget (xw->type, QCxwgir_class))); | 872 | char *namespace = SSDATA (Fcar (Fget (xw->type, QCxwgir_class))); |
| 804 | //we need the concrete widget, which happens in 2 ways depending on OSR or not TODO | 873 | //we need the concrete widget, which happens in 2 ways depending on |
| 874 | //OSR or not TODO | ||
| 805 | GtkWidget *widget = NULL; | 875 | GtkWidget *widget = NULL; |
| 806 | if (NULL == xw->widget_osr) | 876 | if (NULL == xw->widget_osr) |
| 807 | { | 877 | { |
| 808 | widget = | 878 | widget = xwidget_view_lookup (xw, |
| 809 | xwidget_view_lookup (xw, | 879 | XWINDOW (FRAME_SELECTED_WINDOW |
| 810 | XWINDOW (FRAME_SELECTED_WINDOW | 880 | (SELECTED_FRAME ())))->widget; |
| 811 | (SELECTED_FRAME ())))->widget; | ||
| 812 | } | 881 | } |
| 813 | else | 882 | else |
| 814 | { | 883 | { |
| 815 | widget = xw->widget_osr; | 884 | widget = xw->widget_osr; |
| 816 | } | 885 | } |
| 817 | 886 | ||
| 818 | //char* class = SDATA(SYMBOL_NAME(xw->type)); //this works but is unflexible | ||
| 819 | //figure out the class from the widget instead | ||
| 820 | /* printf("type class: %s %s\n", G_OBJECT_TYPE_NAME(widget), G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(widget))); */ | ||
| 821 | /* char* class = G_OBJECT_TYPE_NAME(widget); //gives "GtkButton"(I want "Button") */ | ||
| 822 | /* class += strlen(namespace); //TODO check for corresponding api method. but this seems to work. */ | ||
| 823 | 887 | ||
| 824 | char *class = SSDATA (Fcar (Fcdr (Fget (xw->type, QCxwgir_class)))); | 888 | char *class = SSDATA (Fcar (Fcdr (Fget (xw->type, QCxwgir_class)))); |
| 825 | 889 | ////////////////////////////////////////////////////////////////////////////// | |
| 890 | // class, namespace, argumentss | ||
| 826 | GIObjectInfo *obj_info = | 891 | GIObjectInfo *obj_info = |
| 827 | g_irepository_find_by_name (girepository, namespace, class); | 892 | g_irepository_find_by_name (girepository, namespace, class); |
| 828 | GIFunctionInfo *f_info = | 893 | GIFunctionInfo *f_info = |
| 829 | g_object_info_find_method (obj_info, SSDATA (method)); | 894 | g_object_info_find_method (obj_info, SSDATA (method)); |
| 830 | 895 | ||
| 831 | //loop over args, convert from lisp to primitive type, given arg introspection data | 896 | //loop over args, convert from lisp to primitive type, given arg |
| 832 | //TODO g_callable_info_get_n_args(f_info) should match | 897 | //introspection data TODO g_callable_info_get_n_args(f_info) should |
| 898 | //match | ||
| 833 | int argscount = XFASTINT (Flength (arguments)); | 899 | int argscount = XFASTINT (Flength (arguments)); |
| 834 | if (argscount != g_callable_info_get_n_args (f_info)) | 900 | if (argscount != g_callable_info_get_n_args (f_info)) |
| 835 | { | 901 | { |
| @@ -847,7 +913,7 @@ DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_c | |||
| 847 | } | 913 | } |
| 848 | 914 | ||
| 849 | in_args[0].v_pointer = widget; | 915 | in_args[0].v_pointer = widget; |
| 850 | if (g_function_info_invoke (f_info, | 916 | if (!g_function_info_invoke (f_info, |
| 851 | in_args, argscount + 1, | 917 | in_args, argscount + 1, |
| 852 | NULL, 0, &return_value, &error)) | 918 | NULL, 0, &return_value, &error)) |
| 853 | { | 919 | { |
| @@ -1031,8 +1097,8 @@ xwidget_init_view (struct xwidget *xww, struct glyph_string *s, int x, int y) | |||
| 1031 | 1097 | ||
| 1032 | ////////////////////////////////////////////////////////////// | 1098 | ////////////////////////////////////////////////////////////// |
| 1033 | // xwgir debug | 1099 | // xwgir debug |
| 1034 | if ( //EQ(xww->type, Qwebkit_osr)|| //TODO should be able to choose compile time which method to use with webkit | 1100 | if ( |
| 1035 | EQ (xww->type, Qsocket_osr) || (!NILP (Fget (xww->type, QCxwgir_class)))) //xwgir widgets are OSR | 1101 | EQ (xww->type, Qsocket_osr) || (!NILP (Fget (xww->type, QCxwgir_class)))) |
| 1036 | { | 1102 | { |
| 1037 | printf ("gdk_offscreen_window_set_embedder %d %d\n", | 1103 | printf ("gdk_offscreen_window_set_embedder %d %d\n", |
| 1038 | GDK_IS_WINDOW (gtk_widget_get_window (xww->widget_osr)), | 1104 | GDK_IS_WINDOW (gtk_widget_get_window (xww->widget_osr)), |
| @@ -1064,8 +1130,9 @@ void | |||
| 1064 | x_draw_xwidget_glyph_string (struct glyph_string *s) | 1130 | x_draw_xwidget_glyph_string (struct glyph_string *s) |
| 1065 | { | 1131 | { |
| 1066 | /* | 1132 | /* |
| 1067 | this method is called by the redisplay engine and places the xwidget on screen. | 1133 | this method is called by the redisplay engine and places the |
| 1068 | moving and clipping is done here. also view init. | 1134 | xwidget on screen. moving and clipping is done here. also view |
| 1135 | init. | ||
| 1069 | 1136 | ||
| 1070 | */ | 1137 | */ |
| 1071 | struct xwidget *xww = s->xwidget; | 1138 | struct xwidget *xww = s->xwidget; |
| @@ -1084,8 +1151,9 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 1084 | */ | 1151 | */ |
| 1085 | xv = xwidget_init_view (xww, s, x, y); | 1152 | xv = xwidget_init_view (xww, s, x, y); |
| 1086 | 1153 | ||
| 1087 | //calculate clipping, which is used for all manner of onscreen xwidget views | 1154 | //calculate clipping, which is used for all manner of onscreen |
| 1088 | //each widget border can get clipped by other emacs objects so there are four clipping variables | 1155 | //xwidget views each widget border can get clipped by other emacs |
| 1156 | //objects so there are four clipping variables | ||
| 1089 | clip_right = | 1157 | clip_right = |
| 1090 | min (xww->width, | 1158 | min (xww->width, |
| 1091 | WINDOW_RIGHT_EDGE_X (s->w) - x - | 1159 | WINDOW_RIGHT_EDGE_X (s->w) - x - |
| @@ -1232,7 +1300,9 @@ xwidget_webkit_dom_dump (WebKitDOMNode * parent) | |||
| 1232 | WebKitDOMNode *attribute; | 1300 | WebKitDOMNode *attribute; |
| 1233 | WebKitDOMNamedNodeMap *attrs; | 1301 | WebKitDOMNamedNodeMap *attrs; |
| 1234 | WebKitDOMNode *child; | 1302 | WebKitDOMNode *child; |
| 1235 | printf ("node:%d type:%d name:%s content:%s\n", parent, webkit_dom_node_get_node_type (parent), //1 element 3 text 8 comment 2 attribute | 1303 | printf ("node:%d type:%d name:%s content:%s\n", parent, |
| 1304 | webkit_dom_node_get_node_type (parent), | ||
| 1305 | //1 element 3 text 8 comment 2 attribute | ||
| 1236 | webkit_dom_node_get_local_name (parent), | 1306 | webkit_dom_node_get_local_name (parent), |
| 1237 | webkit_dom_node_get_text_content (parent)); | 1307 | webkit_dom_node_get_text_content (parent)); |
| 1238 | 1308 | ||
| @@ -1244,7 +1314,9 @@ xwidget_webkit_dom_dump (WebKitDOMNode * parent) | |||
| 1244 | for (int i = 0; i < length; i++) | 1314 | for (int i = 0; i < length; i++) |
| 1245 | { | 1315 | { |
| 1246 | attribute = webkit_dom_named_node_map_item (attrs, i); | 1316 | attribute = webkit_dom_named_node_map_item (attrs, i); |
| 1247 | printf (" attr node:%d type:%d name:%s content:%s\n", attribute, webkit_dom_node_get_node_type (attribute), //1 element 3 text 8 comment | 1317 | printf (" attr node:%d type:%d name:%s content:%s\n", |
| 1318 | attribute, webkit_dom_node_get_node_type (attribute), | ||
| 1319 | //1 element 3 text 8 comment | ||
| 1248 | webkit_dom_node_get_local_name (attribute), | 1320 | webkit_dom_node_get_local_name (attribute), |
| 1249 | webkit_dom_node_get_text_content (attribute)); | 1321 | webkit_dom_node_get_text_content (attribute)); |
| 1250 | } | 1322 | } |
| @@ -1261,7 +1333,10 @@ xwidget_webkit_dom_dump (WebKitDOMNode * parent) | |||
| 1261 | } | 1333 | } |
| 1262 | 1334 | ||
| 1263 | 1335 | ||
| 1264 | DEFUN ("xwidget-webkit-dom-dump", Fxwidget_webkit_dom_dump, Sxwidget_webkit_dom_dump, 1, 1, 0, doc: /*Dump the DOM contained in the webkit instance in XWIDGET. */ | 1336 | DEFUN ("xwidget-webkit-dom-dump", |
| 1337 | Fxwidget_webkit_dom_dump, Sxwidget_webkit_dom_dump, | ||
| 1338 | 1, 1, 0, doc: /*Dump the DOM contained in the webkit | ||
| 1339 | instance in XWIDGET. */ | ||
| 1265 | ) | 1340 | ) |
| 1266 | (Lisp_Object xwidget) | 1341 | (Lisp_Object xwidget) |
| 1267 | { | 1342 | { |
| @@ -1299,10 +1374,12 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 3, 3, 0, doc: | |||
| 1299 | //if theres a osr resize it 1st | 1374 | //if theres a osr resize it 1st |
| 1300 | if (xw->widget_osr) | 1375 | if (xw->widget_osr) |
| 1301 | { | 1376 | { |
| 1302 | gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height); //minimum size | 1377 | gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), |
| 1378 | xw->width, xw->height); //minimum size | ||
| 1303 | gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width, | 1379 | gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width, |
| 1304 | xw->height); | 1380 | xw->height); |
| 1305 | /* gtk_window_resize (GTK_WINDOW (xw->widgetscrolledwindow_osr), xw->width, */ | 1381 | /* gtk_window_resize (GTK_WINDOW (xw->widgetscrolledwindow_osr), |
| 1382 | xw->width, */ | ||
| 1306 | /* xw->height); */ | 1383 | /* xw->height); */ |
| 1307 | gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW | 1384 | gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW |
| 1308 | (xw-> | 1385 | (xw-> |
| @@ -1317,14 +1394,15 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 3, 3, 0, doc: | |||
| 1317 | 1394 | ||
| 1318 | } | 1395 | } |
| 1319 | 1396 | ||
| 1320 | for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail)) //TODO MVC refactor lazy linear search | 1397 | for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail)) |
| 1321 | { | 1398 | { |
| 1322 | if (XWIDGET_VIEW_P (XCAR (tail))) | 1399 | if (XWIDGET_VIEW_P (XCAR (tail))) |
| 1323 | { | 1400 | { |
| 1324 | xv = XXWIDGET_VIEW (XCAR (tail)); | 1401 | xv = XXWIDGET_VIEW (XCAR (tail)); |
| 1325 | if (XXWIDGET (xv->model) == xw) | 1402 | if (XXWIDGET (xv->model) == xw) |
| 1326 | { | 1403 | { |
| 1327 | /* gtk_layout_set_size (GTK_CONTAINER (xv->widgetwindow), xw->width, */ | 1404 | /* gtk_layout_set_size (GTK_CONTAINER |
| 1405 | (xv->widgetwindow), xw->width, */ | ||
| 1328 | /* xw->height); */ | 1406 | /* xw->height); */ |
| 1329 | gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xw->width, | 1407 | gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xw->width, |
| 1330 | xw->height); | 1408 | xw->height); |
| @@ -1337,7 +1415,8 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 3, 3, 0, doc: | |||
| 1337 | 1415 | ||
| 1338 | 1416 | ||
| 1339 | 1417 | ||
| 1340 | DEFUN ("xwidget-set-adjustment", Fxwidget_set_adjustment, Sxwidget_set_adjustment, 4, 4, 0, doc: | 1418 | DEFUN ("xwidget-set-adjustment", |
| 1419 | Fxwidget_set_adjustment, Sxwidget_set_adjustment, 4, 4, 0, doc: | ||
| 1341 | /* set scrolling */ | 1420 | /* set scrolling */ |
| 1342 | ) | 1421 | ) |
| 1343 | (Lisp_Object xwidget, Lisp_Object axis, Lisp_Object relative, | 1422 | (Lisp_Object xwidget, Lisp_Object axis, Lisp_Object relative, |
| @@ -1379,10 +1458,13 @@ DEFUN ("xwidget-set-adjustment", Fxwidget_set_adjustment, Sxwidget_set_adjustmen | |||
| 1379 | } | 1458 | } |
| 1380 | 1459 | ||
| 1381 | 1460 | ||
| 1382 | DEFUN ("xwidget-size-request", Fxwidget_size_request, Sxwidget_size_request, 1, 1, 0, doc: | 1461 | DEFUN ("xwidget-size-request", |
| 1462 | Fxwidget_size_request, Sxwidget_size_request, | ||
| 1463 | 1, 1, 0, doc: | ||
| 1383 | /* Desired size of the XWIDGET. | 1464 | /* Desired size of the XWIDGET. |
| 1384 | 1465 | ||
| 1385 | This can be used to read the xwidget desired size, and resizes the Emacs allocated area accordingly. | 1466 | This can be used to read the xwidget desired size, and |
| 1467 | resizes the Emacs allocated area accordingly. | ||
| 1386 | 1468 | ||
| 1387 | (TODO crashes if arg not osr widget) */ | 1469 | (TODO crashes if arg not osr widget) */ |
| 1388 | ) | 1470 | ) |
| @@ -1399,22 +1481,29 @@ DEFUN ("xwidget-size-request", Fxwidget_size_request, Sxwidget_size_request, 1, | |||
| 1399 | 1481 | ||
| 1400 | } | 1482 | } |
| 1401 | 1483 | ||
| 1402 | DEFUN ("xwidgetp", Fxwidgetp, Sxwidgetp, 1, 1, 0, doc: /* Return t if OBJECT is a xwidget. */ | 1484 | DEFUN ("xwidgetp", |
| 1485 | Fxwidgetp, Sxwidgetp, | ||
| 1486 | 1, 1, 0, doc: /* Return t if OBJECT is a xwidget. */ | ||
| 1403 | ) | 1487 | ) |
| 1404 | (Lisp_Object object) | 1488 | (Lisp_Object object) |
| 1405 | { | 1489 | { |
| 1406 | return XWIDGETP (object) ? Qt : Qnil; | 1490 | return XWIDGETP (object) ? Qt : Qnil; |
| 1407 | } | 1491 | } |
| 1408 | 1492 | ||
| 1409 | DEFUN ("xwidget-view-p", Fxwidget_view_p, Sxwidget_view_p, 1, 1, 0, doc:/* Return t if OBJECT is a xwidget-view. */ | 1493 | DEFUN ("xwidget-view-p", |
| 1494 | Fxwidget_view_p, Sxwidget_view_p, | ||
| 1495 | 1, 1, 0, doc:/* Return t if OBJECT is a xwidget-view. */ | ||
| 1410 | ) | 1496 | ) |
| 1411 | (Lisp_Object object) | 1497 | (Lisp_Object object) |
| 1412 | { | 1498 | { |
| 1413 | return XWIDGET_VIEW_P (object) ? Qt : Qnil; | 1499 | return XWIDGET_VIEW_P (object) ? Qt : Qnil; |
| 1414 | } | 1500 | } |
| 1415 | 1501 | ||
| 1416 | DEFUN ("xwidget-info", Fxwidget_info, Sxwidget_info, 1, 1, 0, doc: /* Get XWIDGET properties. | 1502 | DEFUN ("xwidget-info", |
| 1417 | Currently type, title, width, height. */ ) | 1503 | Fxwidget_info, Sxwidget_info, |
| 1504 | 1, 1, 0, doc: /* Get XWIDGET properties. | ||
| 1505 | Currently | ||
| 1506 | type, title, width, height. */ ) | ||
| 1418 | (Lisp_Object xwidget) | 1507 | (Lisp_Object xwidget) |
| 1419 | { | 1508 | { |
| 1420 | CHECK_XWIDGET (xwidget); | 1509 | CHECK_XWIDGET (xwidget); |
| @@ -1432,9 +1521,11 @@ DEFUN ("xwidget-info", Fxwidget_info, Sxwidget_info, 1, 1, 0, doc: /* Get XWIDGE | |||
| 1432 | return info; | 1521 | return info; |
| 1433 | } | 1522 | } |
| 1434 | 1523 | ||
| 1435 | DEFUN ("xwidget-view-info", Fxwidget_view_info, Sxwidget_view_info, 1, 1, 0, doc: | 1524 | DEFUN ("xwidget-view-info", |
| 1436 | /* Get XWIDGET-VIEW properties. | 1525 | Fxwidget_view_info, Sxwidget_view_info, |
| 1437 | Currently x,y clip right, clip bottom, clip top, clip left */ | 1526 | 1, 1, 0, doc: |
| 1527 | /* Get XWIDGET-VIEW properties. Currently x,y clip right, clip | ||
| 1528 | bottom, clip top, clip left */ | ||
| 1438 | ) | 1529 | ) |
| 1439 | (Lisp_Object xwidget_view) | 1530 | (Lisp_Object xwidget_view) |
| 1440 | { | 1531 | { |
| @@ -1453,7 +1544,9 @@ DEFUN ("xwidget-view-info", Fxwidget_view_info, Sxwidget_view_info, 1, 1, 0, doc | |||
| 1453 | return info; | 1544 | return info; |
| 1454 | } | 1545 | } |
| 1455 | 1546 | ||
| 1456 | DEFUN ("xwidget-view-model", Fxwidget_view_model, Sxwidget_view_model, 1, 1, 0, doc: /* Get XWIDGET-VIEW model. */ | 1547 | DEFUN ("xwidget-view-model", |
| 1548 | Fxwidget_view_model, Sxwidget_view_model, | ||
| 1549 | 1, 1, 0, doc: /* Get XWIDGET-VIEW model. */ | ||
| 1457 | ) | 1550 | ) |
| 1458 | (Lisp_Object xwidget_view) | 1551 | (Lisp_Object xwidget_view) |
| 1459 | { | 1552 | { |
| @@ -1461,7 +1554,9 @@ DEFUN ("xwidget-view-model", Fxwidget_view_model, Sxwidget_view_model, 1, 1, 0, | |||
| 1461 | return XXWIDGET_VIEW (xwidget_view)->model; | 1554 | return XXWIDGET_VIEW (xwidget_view)->model; |
| 1462 | } | 1555 | } |
| 1463 | 1556 | ||
| 1464 | DEFUN ("xwidget-view-window", Fxwidget_view_window, Sxwidget_view_window, 1, 1, 0, doc:/* Get XWIDGET-VIEW window. */ | 1557 | DEFUN ("xwidget-view-window", |
| 1558 | Fxwidget_view_window, Sxwidget_view_window, | ||
| 1559 | 1, 1, 0, doc:/* Get XWIDGET-VIEW window. */ | ||
| 1465 | ) | 1560 | ) |
| 1466 | (Lisp_Object xwidget_view) | 1561 | (Lisp_Object xwidget_view) |
| 1467 | { | 1562 | { |
| @@ -1469,12 +1564,15 @@ DEFUN ("xwidget-view-window", Fxwidget_view_window, Sxwidget_view_window, 1, 1, | |||
| 1469 | return XXWIDGET_VIEW (xwidget_view)->w; | 1564 | return XXWIDGET_VIEW (xwidget_view)->w; |
| 1470 | } | 1565 | } |
| 1471 | 1566 | ||
| 1472 | DEFUN ("xwidget-send-keyboard-event", Fxwidget_send_keyboard_event, Sxwidget_send_keyboard_event, 2, 2, 0, doc:/* Synthesize a kbd event for XWIDGET. TODO crashes atm.. */ | 1567 | DEFUN ("xwidget-send-keyboard-event", |
| 1568 | Fxwidget_send_keyboard_event, Sxwidget_send_keyboard_event, | ||
| 1569 | 2, 2, 0, doc: /* Synthesize a kbd event for XWIDGET. TODO | ||
| 1570 | crashes atm.. */ | ||
| 1473 | )(Lisp_Object xwidget, | 1571 | )(Lisp_Object xwidget, |
| 1474 | Lisp_Object keydescriptor) | 1572 | Lisp_Object keydescriptor) |
| 1475 | { | 1573 | { |
| 1476 | //TODO this code crashes for offscreen widgets and ive tried many different strategies | 1574 | //TODO this code crashes for offscreen widgets and ive tried many |
| 1477 | //int keyval = 0x058; //X | 1575 | //different strategies int keyval = 0x058; //X |
| 1478 | int keyval = XFASTINT (keydescriptor); //X | 1576 | int keyval = XFASTINT (keydescriptor); //X |
| 1479 | GdkKeymapKey *keys; | 1577 | GdkKeymapKey *keys; |
| 1480 | gint n_keys; | 1578 | gint n_keys; |
| @@ -1497,7 +1595,8 @@ DEFUN ("xwidget-send-keyboard-event", Fxwidget_send_keyboard_event, Sxwidget_sen | |||
| 1497 | window = FRAME_SELECTED_WINDOW (SELECTED_FRAME ()); | 1595 | window = FRAME_SELECTED_WINDOW (SELECTED_FRAME ()); |
| 1498 | 1596 | ||
| 1499 | 1597 | ||
| 1500 | //TODO maybe we also need to special case sockets by picking up the plug rather than the socket | 1598 | //TODO maybe we also need to special case sockets by picking up the |
| 1599 | //plug rather than the socket | ||
| 1501 | if (xw->widget_osr) | 1600 | if (xw->widget_osr) |
| 1502 | widget = xw->widget_osr; | 1601 | widget = xw->widget_osr; |
| 1503 | else | 1602 | else |
| @@ -1535,7 +1634,9 @@ DEFUN ("xwidget-send-keyboard-event", Fxwidget_send_keyboard_event, Sxwidget_sen | |||
| 1535 | return Qnil; | 1634 | return Qnil; |
| 1536 | } | 1635 | } |
| 1537 | 1636 | ||
| 1538 | DEFUN ("delete-xwidget-view", Fdelete_xwidget_view, Sdelete_xwidget_view, 1, 1, 0, doc:/* Delete the XWIDGET-VIEW. */ | 1637 | DEFUN ("delete-xwidget-view", |
| 1638 | Fdelete_xwidget_view, Sdelete_xwidget_view, | ||
| 1639 | 1, 1, 0, doc:/* Delete the XWIDGET-VIEW. */ | ||
| 1539 | ) | 1640 | ) |
| 1540 | (Lisp_Object xwidget_view) | 1641 | (Lisp_Object xwidget_view) |
| 1541 | { | 1642 | { |
| @@ -1556,8 +1657,11 @@ DEFUN ("delete-xwidget-view", Fdelete_xwidget_view, Sdelete_xwidget_view, 1, 1, | |||
| 1556 | return Qnil; | 1657 | return Qnil; |
| 1557 | } | 1658 | } |
| 1558 | 1659 | ||
| 1559 | DEFUN ("xwidget-view-lookup", Fxwidget_view_lookup, Sxwidget_view_lookup, 1, 2, 0, doc:/* Return the xwidget-view associated to XWIDGET in | 1660 | DEFUN ("xwidget-view-lookup", |
| 1560 | WINDOW if specified, otherwise it uses the selected window. */ | 1661 | Fxwidget_view_lookup, Sxwidget_view_lookup, |
| 1662 | 1, 2, 0, doc: /* Return the xwidget-view associated to XWIDGET in | ||
| 1663 | WINDOW | ||
| 1664 | if specified, otherwise it uses the selected window. */ | ||
| 1561 | ) | 1665 | ) |
| 1562 | (Lisp_Object xwidget, Lisp_Object window) | 1666 | (Lisp_Object xwidget, Lisp_Object window) |
| 1563 | { | 1667 | { |
| @@ -1579,7 +1683,9 @@ DEFUN ("xwidget-view-lookup", Fxwidget_view_lookup, Sxwidget_view_lookup, 1, 2, | |||
| 1579 | return Qnil; | 1683 | return Qnil; |
| 1580 | } | 1684 | } |
| 1581 | 1685 | ||
| 1582 | DEFUN ("set-frame-visible", Fset_frame_visible, Sset_frame_visible, 2, 2, 0, doc: /* HACKY */ | 1686 | DEFUN ("set-frame-visible", |
| 1687 | Fset_frame_visible, Sset_frame_visible, | ||
| 1688 | 2, 2, 0, doc: /* HACKY */ | ||
| 1583 | ) | 1689 | ) |
| 1584 | (Lisp_Object frame, Lisp_Object flag) | 1690 | (Lisp_Object frame, Lisp_Object flag) |
| 1585 | { | 1691 | { |
| @@ -1589,7 +1695,9 @@ DEFUN ("set-frame-visible", Fset_frame_visible, Sset_frame_visible, 2, 2, 0, doc | |||
| 1589 | return flag; | 1695 | return flag; |
| 1590 | } | 1696 | } |
| 1591 | 1697 | ||
| 1592 | DEFUN ("xwidget-plist", Fxwidget_plist, Sxwidget_plist, 1, 1, 0, doc: /* Return the plist of XWIDGET. */ | 1698 | DEFUN ("xwidget-plist", |
| 1699 | Fxwidget_plist, Sxwidget_plist, | ||
| 1700 | 1, 1, 0, doc: /* Return the plist of XWIDGET. */ | ||
| 1593 | ) | 1701 | ) |
| 1594 | (register Lisp_Object xwidget) | 1702 | (register Lisp_Object xwidget) |
| 1595 | { | 1703 | { |
| @@ -1597,7 +1705,9 @@ DEFUN ("xwidget-plist", Fxwidget_plist, Sxwidget_plist, 1, 1, 0, doc: /* Return | |||
| 1597 | return XXWIDGET (xwidget)->plist; | 1705 | return XXWIDGET (xwidget)->plist; |
| 1598 | } | 1706 | } |
| 1599 | 1707 | ||
| 1600 | DEFUN ("xwidget-buffer", Fxwidget_buffer, Sxwidget_buffer, 1, 1, 0, doc:/* Return the buffer of XWIDGET. */ | 1708 | DEFUN ("xwidget-buffer", |
| 1709 | Fxwidget_buffer, Sxwidget_buffer, | ||
| 1710 | 1, 1, 0, doc:/* Return the buffer of XWIDGET. */ | ||
| 1601 | ) | 1711 | ) |
| 1602 | (register Lisp_Object xwidget) | 1712 | (register Lisp_Object xwidget) |
| 1603 | { | 1713 | { |
| @@ -1605,7 +1715,10 @@ DEFUN ("xwidget-buffer", Fxwidget_buffer, Sxwidget_buffer, 1, 1, 0, doc:/* Retur | |||
| 1605 | return XXWIDGET (xwidget)->buffer; | 1715 | return XXWIDGET (xwidget)->buffer; |
| 1606 | } | 1716 | } |
| 1607 | 1717 | ||
| 1608 | DEFUN ("set-xwidget-plist", Fset_xwidget_plist, Sset_xwidget_plist, 2, 2, 0, doc: /* Replace the plist of XWIDGET with PLIST. Returns PLIST. */ | 1718 | DEFUN ("set-xwidget-plist", |
| 1719 | Fset_xwidget_plist, Sset_xwidget_plist, | ||
| 1720 | 2, 2, 0, doc: /* Replace the plist of XWIDGET with PLIST. | ||
| 1721 | Returns PLIST. */ | ||
| 1609 | ) | 1722 | ) |
| 1610 | (register Lisp_Object xwidget, Lisp_Object plist) | 1723 | (register Lisp_Object xwidget, Lisp_Object plist) |
| 1611 | { | 1724 | { |
| @@ -1616,11 +1729,12 @@ DEFUN ("set-xwidget-plist", Fset_xwidget_plist, Sset_xwidget_plist, 2, 2, 0, doc | |||
| 1616 | return plist; | 1729 | return plist; |
| 1617 | } | 1730 | } |
| 1618 | 1731 | ||
| 1619 | DEFUN ("set-xwidget-query-on-exit-flag", Fset_xwidget_query_on_exit_flag, Sset_xwidget_query_on_exit_flag, 2, 2, 0, doc: | 1732 | DEFUN ("set-xwidget-query-on-exit-flag", |
| 1620 | /* Specify if query is needed for XWIDGET when Emacs is | 1733 | Fset_xwidget_query_on_exit_flag, Sset_xwidget_query_on_exit_flag, |
| 1621 | exited. If the second argument FLAG is non-nil, Emacs will query the | 1734 | 2, 2, 0, doc: /* Specify if query is needed for XWIDGET when |
| 1622 | user before exiting or killing a buffer if XWIDGET is running. This | 1735 | Emacs is exited. If the second argument FLAG is non-nil, Emacs will |
| 1623 | function returns FLAG. */ | 1736 | query the user before exiting or killing a buffer if XWIDGET is |
| 1737 | running. This function returns FLAG. */ | ||
| 1624 | ) | 1738 | ) |
| 1625 | (Lisp_Object xwidget, Lisp_Object flag) | 1739 | (Lisp_Object xwidget, Lisp_Object flag) |
| 1626 | { | 1740 | { |
| @@ -1629,7 +1743,10 @@ DEFUN ("set-xwidget-query-on-exit-flag", Fset_xwidget_query_on_exit_flag, Sset_x | |||
| 1629 | return flag; | 1743 | return flag; |
| 1630 | } | 1744 | } |
| 1631 | 1745 | ||
| 1632 | DEFUN ("xwidget-query-on-exit-flag", Fxwidget_query_on_exit_flag, Sxwidget_query_on_exit_flag, 1, 1, 0, doc: /* Return the current value of query-on-exit flag for XWIDGET. */ | 1746 | DEFUN ("xwidget-query-on-exit-flag", |
| 1747 | Fxwidget_query_on_exit_flag, Sxwidget_query_on_exit_flag, | ||
| 1748 | 1, 1, 0, doc: /* Return the current value of query-on-exit | ||
| 1749 | flag for XWIDGET. */ | ||
| 1633 | ) | 1750 | ) |
| 1634 | (Lisp_Object xwidget) | 1751 | (Lisp_Object xwidget) |
| 1635 | { | 1752 | { |
| @@ -1689,7 +1806,7 @@ syms_of_xwidget (void) | |||
| 1689 | 1806 | ||
| 1690 | /* Do not forget to update the docstring of make-xwidget if you add | 1807 | /* Do not forget to update the docstring of make-xwidget if you add |
| 1691 | new types. */ | 1808 | new types. */ |
| 1692 | DEFSYM (Qbutton, "Button"); //changed to match the gtk class because xwgir(experimental and not really needed) | 1809 | DEFSYM (Qbutton, "Button"); |
| 1693 | DEFSYM (Qtoggle, "ToggleButton"); | 1810 | DEFSYM (Qtoggle, "ToggleButton"); |
| 1694 | DEFSYM (Qslider, "slider"); | 1811 | DEFSYM (Qslider, "slider"); |
| 1695 | DEFSYM (Qsocket, "socket"); | 1812 | DEFSYM (Qsocket, "socket"); |
| @@ -1812,12 +1929,13 @@ xwidget_view_lookup (struct xwidget *xw, struct window *w) | |||
| 1812 | struct xwidget * | 1929 | struct xwidget * |
| 1813 | lookup_xwidget (Lisp_Object spec) | 1930 | lookup_xwidget (Lisp_Object spec) |
| 1814 | { | 1931 | { |
| 1815 | /* When a xwidget lisp spec is found initialize the C struct that is used in the C code. | 1932 | /* When a xwidget lisp spec is found initialize the C struct that is |
| 1816 | This is done by redisplay so values change if the spec changes. | 1933 | used in the C code. This is done by redisplay so values change |
| 1817 | So, take special care of one-shot events | 1934 | if the spec changes. So, take special care of one-shot events |
| 1818 | 1935 | ||
| 1819 | TODO remove xwidget init from display spec. simply store an xwidget reference only and set | 1936 | TODO remove xwidget init from display spec. simply store an |
| 1820 | size etc when creating the xwidget, which should happen before insertion into buffer | 1937 | xwidget reference only and set size etc when creating the |
| 1938 | xwidget, which should happen before insertion into buffer | ||
| 1821 | */ | 1939 | */ |
| 1822 | int found = 0; | 1940 | int found = 0; |
| 1823 | Lisp_Object value; | 1941 | Lisp_Object value; |
| @@ -1906,7 +2024,8 @@ xwidget_end_redisplay (struct window *w, struct glyph_matrix *matrix) | |||
| 1906 | { | 2024 | { |
| 1907 | struct xwidget_view *xv = XXWIDGET_VIEW (XCAR (tail)); | 2025 | struct xwidget_view *xv = XXWIDGET_VIEW (XCAR (tail)); |
| 1908 | 2026 | ||
| 1909 | //"touched" is only meaningful for the current window, so disregard other views | 2027 | //"touched" is only meaningful for the current window, so |
| 2028 | //disregard other views | ||
| 1910 | if (XWINDOW (xv->w) == w) | 2029 | if (XWINDOW (xv->w) == w) |
| 1911 | { | 2030 | { |
| 1912 | if (xwidget_touched (xv)) | 2031 | if (xwidget_touched (xv)) |
diff --git a/test/xwidget-test-manual.el b/test/xwidget-test-manual.el index 3732dca4e93..1c9b181467a 100644 --- a/test/xwidget-test-manual.el +++ b/test/xwidget-test-manual.el | |||
| @@ -85,30 +85,38 @@ | |||
| 85 | 85 | ||
| 86 | (xwidget-demo "a-xwgir-color-button" | 86 | (xwidget-demo "a-xwgir-color-button" |
| 87 | (xwgir-require-namespace "Gtk" "3.0") | 87 | (xwgir-require-namespace "Gtk" "3.0") |
| 88 | (put 'ColorButton :xwgir-class '("Gtk" "ColorSelection")) | 88 | (put 'ColorButton :xwgir-class '("Gtk" "ColorSelection" "new")) |
| 89 | (xwidget-insert (point-min) 'ColorButton "xwgir-color-button" 1000 1000) | 89 | (xwidget-insert (point-min) 'ColorButton "xwgir-color-button" 1000 1000) |
| 90 | (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) | 90 | (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) |
| 91 | 91 | ||
| 92 | (xwidget-demo "a-xwgir-button" | 92 | (xwidget-demo "a-xwgir-button" |
| 93 | (xwgir-require-namespace "Gtk" "3.0") | 93 | (xwgir-require-namespace "Gtk" "3.0") |
| 94 | (put 'xwgirButton :xwgir-class '("Gtk" "Button")) | 94 | (put 'xwgirButton :xwgir-class '("Gtk" "Button" "new")) |
| 95 | 95 | ||
| 96 | (xwidget-insert (point-min) 'xwgirButton "xwgir label didnt work..." 700 700) | 96 | (xwidget-insert (point-min) 'xwgirButton "xwgir label didnt work..." 700 700) |
| 97 | (xwgir-xwidget-call-method (xwidget-at 1) "set_label" '( "xwgir label worked!")) | 97 | (xwgir-xwidget-call-method (xwidget-at 1) "set_label" '( "xwgir label worked!")) |
| 98 | (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) | 98 | (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) |
| 99 | 99 | ||
| 100 | (xwidget-demo "a-xwgir-button-constructor" | ||
| 101 | (xwgir-require-namespace "Gtk" "3.0") | ||
| 102 | (put 'xwgirButtonLabel :xwgir-class '("Gtk" "Button" "new_with_label")) | ||
| 103 | |||
| 104 | (xwidget-insert (point-min) 'xwgirButtonLabel "xwgir label didnt work..." 700 700 '("constructor label worked!")) | ||
| 105 | (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) | ||
| 106 | |||
| 107 | |||
| 100 | (xwidget-demo "a-xwgir-check-button" | 108 | (xwidget-demo "a-xwgir-check-button" |
| 101 | (xwgir-require-namespace "Gtk" "3.0") | 109 | (xwgir-require-namespace "Gtk" "3.0") |
| 102 | (put 'xwgirCheckButton :xwgir-class '("Gtk" "CheckButton")) | 110 | (put 'xwgirCheckButton :xwgir-class '("Gtk" "CheckButton" "new")) |
| 103 | 111 | ||
| 104 | (xwidget-insert (point-min) 'xwgirCheckButton "xwgir label didnt work..." 700 700) | 112 | (xwidget-insert (point-min) 'xwgirCheckButton "xwgir label didnt work..." 700 700) |
| 105 | (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) | 113 | (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) |
| 106 | 114 | ||
| 107 | (xwidget-demo "a-xwgir-hscale" | 115 | (xwidget-demo "a-xwgir-hscale-broken" |
| 108 | (xwgir-require-namespace "Gtk" "3.0") | 116 | (xwgir-require-namespace "Gtk" "3.0") |
| 109 | (put 'xwgirHScale :xwgir-class '("Gtk" "HScale")) | 117 | (put 'xwgirHScale :xwgir-class '("Gtk" "HScale" "new_with_range" )) |
| 110 | 118 | ||
| 111 | (xwidget-insert (point-min) 'xwgirHScale "xwgir label didnt work..." 700 700) | 119 | (xwidget-insert (point-min) 'xwgirHScale "xwgir label didnt work..." 700 700 '(0.0 100.0 1.0)) |
| 112 | (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) | 120 | (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)) |
| 113 | 121 | ||
| 114 | (xwidget-demo "a-xwgir-webkit" | 122 | (xwidget-demo "a-xwgir-webkit" |