diff options
| author | Joakim Verona | 2011-07-05 08:18:50 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-07-05 08:18:50 +0200 |
| commit | f53a15f2c3b8eec90e76c95058842d76e60d29cd (patch) | |
| tree | 5c895d917ff03f3f5640e12f3382681ee4dab69e | |
| parent | a218ae21ecda33aea853063f7bdc50fe4290ddf6 (diff) | |
| download | emacs-f53a15f2c3b8eec90e76c95058842d76e60d29cd.tar.gz emacs-f53a15f2c3b8eec90e76c95058842d76e60d29cd.zip | |
work on clipleft. now seemingly ok
| -rw-r--r-- | README.xwidget | 7 | ||||
| -rw-r--r-- | src/xwidget.c | 22 |
2 files changed, 16 insertions, 13 deletions
diff --git a/README.xwidget b/README.xwidget index 94d10fbbedf..b709fcd7d9e 100644 --- a/README.xwidget +++ b/README.xwidget | |||
| @@ -602,6 +602,13 @@ maybe control be used in place of my own copy hacks? | |||
| 602 | you will get weirdo display artefacts. Composition ought to solve this, since that means the live window is | 602 | you will get weirdo display artefacts. Composition ought to solve this, since that means the live window is |
| 603 | always available in an off-screen buffer. My current attempt at composition doesnt work properly however. | 603 | always available in an off-screen buffer. My current attempt at composition doesnt work properly however. |
| 604 | 604 | ||
| 605 | //allocation debugging. the correct values cant be expected to show upp immediately, but eventually they should get to be ok | ||
| 606 | // this is because we dont know when the container gets around to doing layout | ||
| 607 | //GtkAllocation galloc; | ||
| 608 | //gtk_widget_get_allocation(GTK_WIDGET (xv->widgetwindow), &galloc); | ||
| 609 | //printf("allocation %d %d , %d %d\n", galloc.x,galloc.y,galloc.width,galloc.height); | ||
| 610 | |||
| 611 | |||
| 605 | *** old notes about the old live/phantom scheme | 612 | *** old notes about the old live/phantom scheme |
| 606 | 613 | ||
| 607 | //TODO: | 614 | //TODO: |
diff --git a/src/xwidget.c b/src/xwidget.c index 3b3b96399e9..6b4cc2d459f 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -620,6 +620,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 620 | { | 620 | { |
| 621 | /* | 621 | /* |
| 622 | this method is called by the redisplay engine and places the xwidget on screen. | 622 | this method is called by the redisplay engine and places the xwidget on screen. |
| 623 | moving and clpping | ||
| 623 | 624 | ||
| 624 | */ | 625 | */ |
| 625 | int box_line_hwidth = eabs (s->face->box_line_width); | 626 | int box_line_hwidth = eabs (s->face->box_line_width); |
| @@ -631,7 +632,6 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 631 | 632 | ||
| 632 | int x = s->x; | 633 | int x = s->x; |
| 633 | int y = s->y + (s->height / 2) - (xww->height / 2); | 634 | int y = s->y + (s->height / 2) - (xww->height / 2); |
| 634 | int doingsocket = 0; | ||
| 635 | int moved=0; | 635 | int moved=0; |
| 636 | 636 | ||
| 637 | if (xv == NULL){ | 637 | if (xv == NULL){ |
| @@ -643,16 +643,19 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 643 | xv = xwidget_init_view (xww, s, x, y); | 643 | xv = xwidget_init_view (xww, s, x, y); |
| 644 | } | 644 | } |
| 645 | 645 | ||
| 646 | //calculate clip width and height, which is used for all manner of onscreen xwidget views | 646 | //calculate clipping, which is used for all manner of onscreen xwidget views |
| 647 | //each widget border can get clipped by other emacs objects so there are four clipping variables | ||
| 647 | clip_right = min (xww->width, WINDOW_RIGHT_EDGE_X (s->w) - x - WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH(s->w) - WINDOW_RIGHT_FRINGE_WIDTH(s->w)); | 648 | clip_right = min (xww->width, WINDOW_RIGHT_EDGE_X (s->w) - x - WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH(s->w) - WINDOW_RIGHT_FRINGE_WIDTH(s->w)); |
| 648 | clip_left = max (0, WINDOW_LEFT_EDGE_X (s->w) - x - WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH(s->w) - WINDOW_LEFT_FRINGE_WIDTH(s->w)); | 649 | clip_left = max (0, WINDOW_LEFT_EDGE_X (s->w) - x + WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH(s->w) + WINDOW_LEFT_FRINGE_WIDTH(s->w)); |
| 649 | 650 | ||
| 650 | clip_bottom = min (xww->height, WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y); | 651 | clip_bottom = min (xww->height, WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y); |
| 651 | clip_top = max(0, WINDOW_TOP_EDGE_Y(s->w) -y ); //how much to cut from the topside of an xwidget | 652 | clip_top = max(0, WINDOW_TOP_EDGE_Y(s->w) -y ); |
| 652 | 653 | ||
| 654 | //we are conserned with movement of the onscreen area. the area might sit still when the widget actually moves | ||
| 655 | //this happens when an emacs window border moves across a widget winow | ||
| 653 | moved = (xv->x + xv->clip_left != x+clip_left) | 656 | moved = (xv->x + xv->clip_left != x+clip_left) |
| 654 | || ((xv->y + xv->clip_top)!= (y+clip_top)); | 657 | || ((xv->y + xv->clip_top)!= (y+clip_top)); |
| 655 | if(moved) printf ("live xwidget moved: id:%d (%d,%d)->(%d,%d) y+clip_top:%d\n", xww->id, xv->x, xv->y, x, y, y + clip_top); | 658 | //if(moved) printf ("live xwidget moved: id:%d (%d,%d)->(%d,%d) y+clip_top:%d\n", xww->id, xv->x, xv->y, x, y, y + clip_top); |
| 656 | xv->x = x; | 659 | xv->x = x; |
| 657 | xv->y = y; | 660 | xv->y = y; |
| 658 | if (moved) //has it moved? | 661 | if (moved) //has it moved? |
| @@ -676,16 +679,9 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) | |||
| 676 | gtk_fixed_put(GTK_FIXED(xv->widgetwindow), xv->widget, -clip_left, -clip_top); | 679 | gtk_fixed_put(GTK_FIXED(xv->widgetwindow), xv->widget, -clip_left, -clip_top); |
| 677 | printf("reclip %d %d -> %d %d clip_top:%d clip_left:%d\n",xv->clip_right, xv->clip_bottom, clip_right, clip_bottom, clip_top , clip_left); | 680 | printf("reclip %d %d -> %d %d clip_top:%d clip_left:%d\n",xv->clip_right, xv->clip_bottom, clip_right, clip_bottom, clip_top , clip_left); |
| 678 | 681 | ||
| 679 | //allocation debugging. the correct values cant be expected to show upp immediately, but eventually they should get to be ok | ||
| 680 | // this is because we dont know when the container gets around to doing layout | ||
| 681 | //GtkAllocation galloc; | ||
| 682 | //gtk_widget_get_allocation(GTK_WIDGET (xv->widgetwindow), &galloc); | ||
| 683 | //printf("allocation %d %d , %d %d\n", galloc.x,galloc.y,galloc.width,galloc.height); | ||
| 684 | 682 | ||
| 685 | xv->clip_right = clip_right; xv->clip_bottom = clip_bottom; xv->clip_top = clip_top;xv->clip_left = clip_left; | 683 | xv->clip_right = clip_right; xv->clip_bottom = clip_bottom; xv->clip_top = clip_top;xv->clip_left = clip_left; |
| 686 | } | 684 | } |
| 687 | //a live xwidget paints itself. when using composition, that | ||
| 688 | //happens through the expose handler for the xwidget | ||
| 689 | //if emacs wants to repaint the area where the widget lives, queue a redraw | 685 | //if emacs wants to repaint the area where the widget lives, queue a redraw |
| 690 | if (!xwidget_hidden(xv)){ | 686 | if (!xwidget_hidden(xv)){ |
| 691 | gtk_widget_queue_draw (xv->widgetwindow); | 687 | gtk_widget_queue_draw (xv->widgetwindow); |