| @@ -47,14 +47,17 @@ newwlwin(void) · 46 unmodified lines |
| 47 | 47 | void |
| 48 | 48 | wlflush(Wlwin *wl) |
| 49 | 49 | { |
| 50 | | − if(wl->dirty == 1) |
| 51 | | − memcpy(wl->shm_data, gscreen->data->bdata, wl->dx*wl->dy*4); |
| 50 | + Point p; |
| 52 | 51 | |
| 53 | 52 | wl_surface_attach(wl->surface, wl->screenbuffer, 0, 0); |
| 54 | | − if(wl->dirty) |
| 55 | | − wl_surface_damage(wl->surface, wl->r.min.x, wl->r.min.y, Dx(wl->r), Dy(wl->r)); |
| 53 | + if(wl->dirty){ |
| 54 | + p.x = wl->r.min.x; |
| 55 | + for(p.y = wl->r.min.y; p.y < wl->r.max.y; p.y++) |
| 56 | + memcpy(wl->shm_data+(p.y*wl->dx+p.x)*4, byteaddr(gscreen, p), Dx(wl->r)*4); |
| 57 | + wl_surface_damage(wl->surface, p.x, wl->r.min.y, Dx(wl->r), Dy(wl->r)); |
| 58 | + wl->dirty = 0; |
| 59 | + } |
| 56 | 60 | wl_surface_commit(wl->surface); |
| 57 | | − wl->dirty = 0; |
| 58 | 61 | } |
| 59 | 62 | |
| 60 | 63 | void |
| @@ -86,9 +89,8 @@ dispatchproc(void *a) · 25 unmodified lines |
| 86 | 89 | { |
| 87 | 90 | Wlwin *wl; |
| 88 | 91 | wl = a; |
| 89 | | − for(;wl->runing == 1;){ |
| 92 | + while(wl->runing) |
| 90 | 93 | wl_display_dispatch(wl->display); |
| 91 | | − } |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | static Wlwin* |
| @@ -99,7 +101,7 @@ wlattach(char *label) · 4 unmodified lines |
| 99 | 101 | |
| 100 | 102 | wl = newwlwin(); |
| 101 | 103 | gwin = wl; |
| 102 | | − wl->display = wl_display_connect(NULL); |
| 104 | + wl->display = wl_display_connect(nil); |
| 103 | 105 | if(wl->display == nil) |
| 104 | 106 | sysfatal("could not connect to display"); |
| 105 | 107 | |
| @@ -151,19 +153,15 @@ attachscreen(Rectangle *r, ulong *chan, int *depth, int *width, int *softscreen) · 45 unmodified lines |
| 151 | 153 | void |
| 152 | 154 | flushmemscreen(Rectangle r) |
| 153 | 155 | { |
| 154 | | − Wlwin *wl; |
| 155 | | − |
| 156 | | − wl = gwin; |
| 157 | | − wl->dirty = 1; |
| 158 | | − wl->r = r; |
| 159 | | − wlflush(wl); |
| 156 | + gwin->dirty = 1; |
| 157 | + gwin->r = r; |
| 158 | + wlflush(gwin); |
| 160 | 159 | } |
| 161 | 160 | |
| 162 | 161 | void |
| 163 | 162 | screensize(Rectangle r, ulong chan) |
| 164 | 163 | { |
| 165 | | − gwin->dirty = 1; |
| 166 | | − gwin->r = r; |
| 164 | + flushmemscreen(r); |
| 167 | 165 | } |
| 168 | 166 | |
| 169 | 167 | void |