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