diff options
| author | Joakim Verona | 2011-06-22 02:32:40 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-06-22 02:32:40 +0200 |
| commit | c20c683273e27d1682982c609bf3fce7eeca7f7d (patch) | |
| tree | b12003da31270c25a88144a2d9909009e41fb88a | |
| parent | 479d2bf9a9887d6b3d59ba077cb0ad564b180e07 (diff) | |
| download | emacs-c20c683273e27d1682982c609bf3fce7eeca7f7d.tar.gz emacs-c20c683273e27d1682982c609bf3fce7eeca7f7d.zip | |
already xwidget-demo-minimal works with 1 button and 1 emacs window
| -rw-r--r-- | src/xwidget.c | 29 |
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 | 195 | int 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 */ |
| 198 | void | 198 | struct xwidget_view* |
| 199 | xwidget_init_view (struct xwidget *xww, | 199 | xwidget_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 | ||
| 714 | struct xwidget_view* xwidget_view_lookup(struct xwidget* xw, struct window *w){ | 723 | struct 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 | ||
| 721 | int | 732 | int |