Example #1
0
void textedit_draw_update ( struct widget *self ) {
    g_error e;
    struct cursor * c;
    if (!DATA->update_clean) {
        /* Translate to screen coordinates */
        DATA->update_x1 += self->in->div->r.x;
        DATA->update_x2 += self->in->div->r.x;
        DATA->update_y1 += self->in->div->r.y;
        DATA->update_y2 += self->in->div->r.y;

        grop_render(self->in->div, NULL);  
        VID(update) (self->dt->display,
		     DATA->update_x1,
                     DATA->update_y1,
                     DATA->update_x2 - DATA->update_x1,
                     DATA->update_y2 - DATA->update_y1);
        
        /* Make sure we show cursors affected by update */
        for (c = cursor_get_default(); c; c = c->next) {
            if ((c->sprite) && 
                (point_in_rect(c->sprite->x, c->sprite->y,
                               DATA->update_x1, DATA->update_y1,
                               DATA->update_x2, DATA->update_y2) ||
                 point_in_rect(c->sprite->x + c->sprite->w, 
                               c->sprite->y + c->sprite->h,
                               DATA->update_x1, DATA->update_y1,
                               DATA->update_x2, DATA->update_y2))) {
                VID(sprite_update) (c->sprite);
            } 
        }
        DATA->update_clean= 1;
    }
}
Example #2
0
/* Get the window the cursor is in, falling back on the debug window */
static hwrbitmap magic_cursor_display(void) {
  struct cursor *c = cursor_get_default();
  struct divtree *dt;

  if (!c)
    return VID(window_debug)();
  if (iserror(rdhandle((void**)&dt, PG_TYPE_DIVTREE, -1, c->divtree)))
    return VID(window_debug)();

  return dt->display;
}
Example #3
0
void cursor_getposition(struct cursor *crsr, int *x, int *y, struct divtree **dt) {
  if (!crsr)
    crsr = cursor_get_default();
  if (!crsr) {
    /* Start cursors out near the top-left corner */
    *x = 16;
    *y = 16;
    if (dt)
      *dt = dts->top;
  }
  else {
    *x = crsr->x;
    *y = crsr->y;

    if (dt) {
      if (iserror(rdhandle((void**)dt, PG_TYPE_DIVTREE, -1, crsr->divtree)) || !*dt)
	*dt = dts->top;
    }
  }
}