aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xwidget.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index dbcb7a42f6e..0acacbde951 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -192,19 +192,22 @@ void xwidget_plug_added(GtkSocket *socket,
192} 192}
193 193
194 194
195 195int xwidget_view_index=0;
196 196
197/* initializes and does initial placement of an xwidget view on screen */ 197/* initializes and does initial placement of an xwidget view on screen */
198void 198struct xwidget_view*
199xwidget_init_view (struct xwidget *xww, 199xwidget_init_view (
200 struct xwidget *xww,
200 struct glyph_string *s, 201 struct glyph_string *s,
201 int x, int y) 202 int x, int y)
202{ 203{
203 struct xwidget_view *xv;//TODO create 204 struct xwidget_view *xv = &xwidget_views[xwidget_view_index++];
204 GdkColor color; 205 GdkColor color;
206
205 xv->initialized = 1; 207 xv->initialized = 1;
206 xv->w = s->w; 208 xv->w = s->w;
207 209 xv->model = xww;
210
208 //widget creation 211 //widget creation
209 switch (xww->type) 212 switch (xww->type)
210 { 213 {
@@ -282,6 +285,7 @@ xwidget_init_view (struct xwidget *xww,
282 //gtk_widget_realize(xw->widget); 285 //gtk_widget_realize(xw->widget);
283 break; 286 break;
284 } 287 }
288 return xv;
285} 289}
286 290
287 291
@@ -318,6 +322,10 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
318 322
319 struct xwidget *xww = &xwidgets[s->xwidget_id]; 323 struct xwidget *xww = &xwidgets[s->xwidget_id];
320 struct xwidget_view *xv = xwidget_view_lookup(xww, (s->w)); 324 struct xwidget_view *xv = xwidget_view_lookup(xww, (s->w));
325
326
327
328
321 int clipx; int clipy; 329 int clipx; int clipy;
322 330
323 /*printf("x_draw_xwidget_glyph_string: id:%d %d %d (%d,%d,%d,%d) selected win:%d\n", 331 /*printf("x_draw_xwidget_glyph_string: id:%d %d %d (%d,%d,%d,%d) selected win:%d\n",
@@ -329,8 +337,9 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
329 int y = s->y + (s->height / 2) - (xww->height / 2); 337 int y = s->y + (s->height / 2) - (xww->height / 2);
330 int doingsocket = 0; 338 int doingsocket = 0;
331 int moved=0; 339 int moved=0;
332 if (!xv->initialized){ 340
333 xwidget_init_view (xww, s, x, y); //once for each view TODO split 341 if (xv == NULL){
342 xv = xwidget_init_view (xww, s, x, y); //once for each view
334 } 343 }
335 344
336 //calculate clip widht and height, which is used both for the xwidget 345 //calculate clip widht and height, which is used both for the xwidget
@@ -712,10 +721,12 @@ xwidget_from_id (int id)
712} 721}
713 722
714struct xwidget_view* xwidget_view_lookup(struct xwidget* xw, struct window *w){ 723struct xwidget_view* xwidget_view_lookup(struct xwidget* xw, struct window *w){
724 struct xwidget_view* xv = NULL;
715 for (int i = 0; i < MAX_XWIDGETS; i++) 725 for (int i = 0; i < MAX_XWIDGETS; i++)
716 if ((xwidget_views[i].model == xw) && (xwidget_views[i].w == w)) 726 if ((xwidget_views[i].model == xw) && (xwidget_views[i].w == w))
717 return &xwidget_views[i]; 727 xv = &xwidget_views[i];
718 return NULL; 728
729 return xv;
719} 730}
720 731
721int 732int