Lisp_Object QCxwgir_class;
Lisp_Object Qbutton, Qtoggle, Qslider, Qsocket, Qsocket_osr, Qcairo, Qxwgir,
Qwebkit_osr, QCplist;
+Lisp_Object Qxwidgetp, Qxwidget_view_p;
extern Lisp_Object QCtype;
for (tail = Vxwidget_list; CONSP (tail); tail = XCDR (tail))
{
xw = XCAR (tail);
- if (XXWIDGETP (xw) && EQ (Fxwidget_buffer (xw), buffer))
+ if (XWIDGETP (xw) && EQ (Fxwidget_buffer (xw), buffer))
xw_list = Fcons (xw, xw_list);
}
return xw_list;
for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail))
{
- if (XXWIDGET_VIEW_P (XCAR (tail))) {
+ if (XWIDGET_VIEW_P (XCAR (tail))) {
xv = XXWIDGET_VIEW (XCAR (tail));
if (EQ (xvp->model, xv->model)) {
//block sibling views signal handlers
for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail))
{
- if (XXWIDGET_VIEW_P (XCAR (tail))) {
+ if (XWIDGET_VIEW_P (XCAR (tail))) {
xv = XXWIDGET_VIEW (XCAR (tail));
if (XXWIDGET (xv->model) == xw)
gtk_widget_queue_draw (xv->widget); //redraw all views, the master has changed
doc: /* call xwidget object method.*/)
(Lisp_Object xwidget, Lisp_Object method, Lisp_Object arguments)
{
+ CHECK_XWIDGET (xwidget);
GError *error = NULL;
GIArgument return_value;
GIArgument in_args[20];
struct xwidget* xw;
- if(!XXWIDGETP(xwidget)) {printf("ERROR not an xwidget\n"); return Qnil;};
if (NILP (xwidget)) { printf("ERROR xwidget nil\n"); return Qnil; };
xw = XXWIDGET(xwidget);
if(NULL == xw) printf("ERROR xw is 0\n");
//FUGLY macro that checks WEBKIT_IS_WEB_VIEW(xw->widget_osr) first
#define WEBKIT_FN_INIT() \
struct xwidget* xw; \
-if(!XXWIDGETP(xwidget)) {printf("ERROR not an xwidget\n"); return Qnil;}; \
+ CHECK_XWIDGET (xwidget); \
if(NILP (xwidget)) {printf("ERROR xwidget nil\n"); return Qnil;}; \
xw = XXWIDGET(xwidget); \
if(NULL == xw) printf("ERROR xw is 0\n"); \
/* resize xwidgets*/)
(Lisp_Object xwidget, Lisp_Object new_width, Lisp_Object new_height)
{
+ CHECK_XWIDGET (xwidget);
struct xwidget* xw = XXWIDGET(xwidget);
struct xwidget_view *xv;
int w, h;
for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail)) //TODO MVC refactor lazy linear search
{
- if (XXWIDGET_VIEW_P (XCAR (tail))) {
+ if (XWIDGET_VIEW_P (XCAR (tail))) {
xv = XXWIDGET_VIEW (XCAR (tail));
if(XXWIDGET (xv->model) == xw) {
gtk_layout_set_size (GTK_LAYOUT (xv->widgetwindow), xw->width, xw->height);
/* desired size (TODO crashes if arg not osr widget)*/)
(Lisp_Object xwidget)
{
+ CHECK_XWIDGET (xwidget);
GtkRequisition requisition;
Lisp_Object rv;
gtk_widget_size_request(XXWIDGET(xwidget)->widget_osr, &requisition);
return XWIDGETP (object) ? Qt : Qnil;
}
+DEFUN ("xwidget-view-p", Fxwidget_view_p, Sxwidget_view_p, 1, 1, 0,
+ doc: /* Return t if OBJECT is a xwidget-view. */)
+ (Lisp_Object object)
+{
+ return XWIDGET_VIEW_P (object) ? Qt : Qnil;
+}
+
DEFUN("xwidget-info", Fxwidget_info , Sxwidget_info, 1,1,0, doc: /* get xwidget props */)
(Lisp_Object xwidget)
{
+ CHECK_XWIDGET (xwidget);
Lisp_Object info, n;
struct xwidget* xw = XXWIDGET(xwidget);
return info;
}
-
-DEFUN("xwidget-view-info", Fxwidget_view_info , Sxwidget_view_info, 2,2,0, doc: /* get xwidget view props */)
- (Lisp_Object xwidget, Lisp_Object window)
+DEFUN("xwidget-view-info", Fxwidget_view_info , Sxwidget_view_info, 1, 1, 0, doc: /* get xwidget view props */)
+ (Lisp_Object xwidget_view)
{
- struct xwidget* xw = XXWIDGET(xwidget);
- struct xwidget_view* xv = xwidget_view_lookup(xw, XWINDOW(window));
-
+ CHECK_XWIDGET_VIEW (xwidget_view);
+ struct xwidget_view *xv = XXWIDGET_VIEW (xwidget_view);
Lisp_Object info;
info = Fmake_vector (make_number (6), Qnil);
- XVECTOR (info)->contents[0] = make_number(xv->x);
- XVECTOR (info)->contents[1] = make_number(xv->y);
- XVECTOR (info)->contents[2] = make_number(xv->clip_right);
- XVECTOR (info)->contents[3] = make_number(xv->clip_bottom);
- XVECTOR (info)->contents[4] = make_number(xv->clip_top);
- XVECTOR (info)->contents[5] = make_number(xv->clip_left);
+ ASET (info, 0, make_number(xv->x));
+ ASET (info, 1, make_number(xv->y));
+ ASET (info, 2, make_number(xv->clip_right));
+ ASET (info, 3, make_number(xv->clip_bottom));
+ ASET (info, 4, make_number(xv->clip_top));
+ ASET (info, 5, make_number(xv->clip_left));
return info;
}
struct xwidget_view* xv = NULL;
for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail))
{
- if (XXWIDGET_VIEW_P (XCAR (tail))) {
+ if (XWIDGET_VIEW_P (XCAR (tail))) {
xv = XXWIDGET_VIEW (XCAR (tail));
if(!WINDOW_LIVE_P (xv->w)) {
gtk_widget_destroy(GTK_WIDGET(xv->widgetwindow));
doc: /* Return the plist of XWIDGET. */)
(register Lisp_Object xwidget)
{
- //CHECK_XWIDGET (xwidget); //todo
+ CHECK_XWIDGET (xwidget);
return XXWIDGET (xwidget)->plist;
}
doc: /* Return the buffer of XWIDGET. */)
(register Lisp_Object xwidget)
{
- //CHECK_XWIDGET (xwidget); //todo
+ CHECK_XWIDGET (xwidget);
return XXWIDGET (xwidget)->buffer;
}
doc: /* Replace the plist of XWIDGET with PLIST. Returns PLIST. */)
(register Lisp_Object xwidget, Lisp_Object plist)
{
- //CHECK_XWIDGET (xwidget); //todo
+ CHECK_XWIDGET (xwidget);
CHECK_LIST (plist);
XXWIDGET (xwidget)->plist = plist;
return plist;
}
-
-
void
syms_of_xwidget (void)
{
defsubr (&Smake_xwidget);
defsubr (&Sxwidgetp);
+ DEFSYM (Qxwidgetp, "xwidgetp");
+ defsubr (&Sxwidget_view_p);
+ DEFSYM (Qxwidget_view_p, "xwidget-view-p");
defsubr (&Sxwidget_info);
defsubr (&Sxwidget_view_info);
defsubr (&Sxwidget_resize);
xwidget type. */
int
-valid_xwidget_p (Lisp_Object object)
+valid_xwidget_spec_p (Lisp_Object object)
{
int valid_p = 0;
- if (XWIDGETP (object))
+ if (CONSP (object) && EQ (XCAR (object), Qxwidget))
{
/* Lisp_Object tem; */
{
Lisp_Object tail;
- eassert (valid_xwidget_p (spec));
+ eassert (valid_xwidget_spec_p (spec));
for (tail = XCDR (spec);
CONSP (tail) && CONSP (XCDR (tail)); tail = XCDR (XCDR (tail)))
struct xwidget_view* xv = NULL;
for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail))
{
- if (XXWIDGET_VIEW_P (XCAR (tail))) {
+ if (XWIDGET_VIEW_P (XCAR (tail))) {
xv = XXWIDGET_VIEW (XCAR (tail));
if(XWINDOW (xv->w) == w) {
gtk_widget_destroy(GTK_WIDGET(xv->widgetwindow));
struct xwidget_view* xv = NULL;
for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail))
{
- if (XXWIDGET_VIEW_P (XCAR (tail))) {
+ if (XWIDGET_VIEW_P (XCAR (tail))) {
xv = XXWIDGET_VIEW (XCAR (tail));
if (XXWIDGET (xv->model) == xw && XWINDOW (xv->w) == w)
return xv;
{
for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail))
{
- if (XXWIDGET_VIEW_P (XCAR (tail)))
+ if (XWIDGET_VIEW_P (XCAR (tail)))
XXWIDGET_VIEW (XCAR (tail))->redisplayed = 0;
}
}
for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail))
{
- if (XXWIDGET_VIEW_P (XCAR (tail))) {
+ if (XWIDGET_VIEW_P (XCAR (tail))) {
struct xwidget_view* xv = XXWIDGET_VIEW (XCAR (tail));
//"touched" is only meaningful for the current window, so disregard other views