aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGrégoire Jadi2013-06-11 15:14:43 +0200
committerGrégoire Jadi2013-06-11 15:14:43 +0200
commit7a00481ac3501d071446618c6308ecd7d7f1f18c (patch)
tree500676e87b1aa46368d792dd2e0f79f49175e772 /src
parent8847f1116c0a29899c742805ccabb7604f08a52c (diff)
downloademacs-7a00481ac3501d071446618c6308ecd7d7f1f18c.tar.gz
emacs-7a00481ac3501d071446618c6308ecd7d7f1f18c.zip
* src/xwidget.c (Fmake_xwidget): Add a docstring and add BUFFER as an optional parameter.
The docstring now lists the types accepted. The GCPROtection has also been removed because it wasn't necessary (no call to Feval/eval_sub either directly or indirectly). (syms_of_xwidget): Add a comment to remind us to update the docstring of `Fmake_xwidget' if new types are added.
Diffstat (limited to 'src')
-rw-r--r--src/xwidget.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index 9c9e8169790..d7c219f6cfd 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -188,14 +188,27 @@ xwgir_event_callback (GtkWidget *widget,
188GtkWidget* xwgir_create(char* class, char* namespace); 188GtkWidget* xwgir_create(char* class, char* namespace);
189static void 189static void
190send_xembed_ready_event (struct xwidget* xw, int xembedid); 190send_xembed_ready_event (struct xwidget* xw, int xembedid);
191DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0, 191DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 8, 0,
192 doc: /* xw */ 192 doc: /* Make an xwidget from BEG to END of TYPE.
193
194If BUFFER is nil it uses the current buffer. If BUFFER is a string and
195no such buffer exists, it is created.
196
197TYPE is a symbol which can take one of the following values:
198- Button
199- ToggleButton
200- slider
201- socket
202- socket-osr
203- cairo
204*/
193 ) 205 )
194 (Lisp_Object beg, Lisp_Object end, 206 (Lisp_Object beg, Lisp_Object end,
195 Lisp_Object type, 207 Lisp_Object type,
196 Lisp_Object title, 208 Lisp_Object title,
197 Lisp_Object width, Lisp_Object height, 209 Lisp_Object width, Lisp_Object height,
198 Lisp_Object data) 210 Lisp_Object data,
211 Lisp_Object buffer)
199{ 212{
200 //should work a bit like "make-button"(make-button BEG END &rest PROPERTIES) 213 //should work a bit like "make-button"(make-button BEG END &rest PROPERTIES)
201 // arg "type" and fwd should be keyword args eventually 214 // arg "type" and fwd should be keyword args eventually
@@ -203,12 +216,14 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0,
203 //(xwidget-info (car xwidget-alist)) 216 //(xwidget-info (car xwidget-alist))
204 struct xwidget* xw = allocate_xwidget(); 217 struct xwidget* xw = allocate_xwidget();
205 Lisp_Object val; 218 Lisp_Object val;
206 struct gcpro gcpro1;
207 GCPRO1(xw);
208 XSETSYMBOL(xw->type, type); 219 XSETSYMBOL(xw->type, type);
209 XSETSTRING(xw->title, title); 220 XSETSTRING(xw->title, title);
210 //TODO buffer should be an optional argument not just assumed to be the current buffer 221 if (NILP (buffer))
211 XSETBUFFER(xw->buffer, Fcurrent_buffer()); // conservatively gcpro xw since we call lisp 222 buffer = Fcurrent_buffer(); // no need to gcpro because Fcurrent_buffer doesn't call Feval/eval_sub.
223 else
224 buffer = Fget_buffer_create (buffer);
225 XSETBUFFER(xw->buffer, buffer);
226
212 xw->height = XFASTINT(height); 227 xw->height = XFASTINT(height);
213 xw->width = XFASTINT(width); 228 xw->width = XFASTINT(width);
214 XSETPSEUDOVECTOR (val, xw, PVEC_XWIDGET); // set the vectorlike_header of VAL with the correct value 229 XSETPSEUDOVECTOR (val, xw, PVEC_XWIDGET); // set the vectorlike_header of VAL with the correct value
@@ -295,7 +310,6 @@ DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, 7, 7, 0,
295 } 310 }
296#endif /* HAVE_WEBKIT_OSR */ 311#endif /* HAVE_WEBKIT_OSR */
297 312
298 UNGCPRO;
299 return val; 313 return val;
300} 314}
301 315
@@ -1617,6 +1631,8 @@ syms_of_xwidget (void)
1617 DEFSYM (Qcxwgir_class ,":xwgir-class"); 1631 DEFSYM (Qcxwgir_class ,":xwgir-class");
1618 DEFSYM (Qtitle ,":title"); 1632 DEFSYM (Qtitle ,":title");
1619 1633
1634 /* Do not forget to update the docstring of make-xwidget if you add
1635 new types. */
1620 DEFSYM (Qbutton, "Button"); //changed to match the gtk class because xwgir(experimental and not really needed) 1636 DEFSYM (Qbutton, "Button"); //changed to match the gtk class because xwgir(experimental and not really needed)
1621 DEFSYM (Qtoggle, "ToggleButton"); 1637 DEFSYM (Qtoggle, "ToggleButton");
1622 DEFSYM (Qslider, "slider"); 1638 DEFSYM (Qslider, "slider");