| @@ -236,8 +236,6 @@ static · 235 unmodified lines |
| 236 | void | 236 | void |
| 237 | drawflush(Draw *d) | 237 | drawflush(Draw *d) |
| 238 | { | 238 | { |
| 239 | // Rectangle r = d->flushrect; | | |
| 240 | // print("XXX drawflush: %d %d %d %d \n", r.min.x, r.min.y, r.max.x, r.max.y); | | |
| 241 | if(d->flushrect.min.x < d->flushrect.max.x) | 239 | if(d->flushrect.min.x < d->flushrect.max.x) |
| 242 | xflushmemscreen(d->window, d->flushrect); | 240 | xflushmemscreen(d->window, d->flushrect); |
| 243 | d->flushrect = Rect(10000, 10000, -10000, -10000); | 241 | d->flushrect = Rect(10000, 10000, -10000, -10000); |
| @@ -258,13 +256,11 @@ drawlookupname(int n, char *str) · 14 unmodified lines |
| 258 | { | 256 | { |
| 259 | DName *name, *ename; | 257 | DName *name, *ename; |
| 260 | | 258 | |
| 261 | // print("XXX drawlookupname %d %s\n", n, str); | | |
| 262 | name = dname; | 259 | name = dname; |
| 263 | ename = &name[ndname]; | 260 | ename = &name[ndname]; |
| 264 | for(; name<ename; name++) | 261 | for(; name<ename; name++) |
| 265 | if(drawcmp(name->name, str, n) == 0) | 262 | if(drawcmp(name->name, str, n) == 0) |
| 266 | return name; | 263 | return name; |
| 267 | // print("XXX drawlookupname: %s not found\n", str); | | |
| 268 | return 0; | 264 | return 0; |
| 269 | } | 265 | } |
| 270 | | 266 | |
| @@ -293,7 +289,6 @@ drawlookup(Client *client, int id, int checkname) · 22 unmodified lines |
| 293 | { | 289 | { |
| 294 | DImage *d; | 290 | DImage *d; |
| 295 | | 291 | |
| 296 | // print("XXX drawlookup %d in client %p\n", id, client); | | |
| 297 | d = client->dimage[id&HASHMASK]; | 292 | d = client->dimage[id&HASHMASK]; |
| 298 | while(d){ | 293 | while(d){ |
| 299 | if(d->id == id){ | 294 | if(d->id == id){ |
| @@ -365,7 +360,6 @@ drawinstall(Client *client, int id, Memimage *i, DScreen *dscreen) · 65 unmodified lines |
| 365 | { | 360 | { |
| 366 | DImage *d; | 361 | DImage *d; |
| 367 | | 362 | |
| 368 | // print("XXX drawinstall %d (%p) in window %d\n", id, i, client->draw->window->id); | | |
| 369 | d = allocdimage(i); | 363 | d = allocdimage(i); |
| 370 | if(d == 0) | 364 | if(d == 0) |
| 371 | return 0; | 365 | return 0; |
| @@ -383,7 +377,6 @@ drawinstallscreen(Client *client, DScreen *d, int id, DImage *dimage, DImage *df · 11 unmodified lines |
| 383 | Memscreen *s; | 377 | Memscreen *s; |
| 384 | CScreen *c; | 378 | CScreen *c; |
| 385 | | 379 | |
| 386 | // print("XXX drawinstallscreen %d in window %d\n", id, client->draw->window->id); | | |
| 387 | c = malloc(sizeof(CScreen)); | 380 | c = malloc(sizeof(CScreen)); |
| 388 | if(dimage && dimage->image && dimage->image->chan == 0) | 381 | if(dimage && dimage->image && dimage->image->chan == 0) |
| 389 | fatal("bad image %p in drawinstallscreen", dimage->image); | 382 | fatal("bad image %p in drawinstallscreen", dimage->image); |
| @@ -435,7 +428,6 @@ drawdelname(DName *name) · 45 unmodified lines |
| 435 | { | 428 | { |
| 436 | int i; | 429 | int i; |
| 437 | | 430 | |
| 438 | // print("XXX drawdelname %s\n", dname->name); | | |
| 439 | i = name-dname; | 431 | i = name-dname; |
| 440 | memmove(name, name+1, (ndname-(i+1))*sizeof(DName)); | 432 | memmove(name, name+1, (ndname-(i+1))*sizeof(DName)); |
| 441 | ndname--; | 433 | ndname--; |
| @@ -448,7 +440,6 @@ drawfreedscreen(Draw *d, DScreen *this) · 6 unmodified lines |
| 448 | DScreen *ds, *next; | 440 | DScreen *ds, *next; |
| 449 | | 441 | |
| 450 | this->ref--; | 442 | this->ref--; |
| 451 | // print("XXX drawfreedscreen %d from window %d (ref %d)\n", this->id, d->window->id, this->ref); | | |
| 452 | if(this->ref < 0) | 443 | if(this->ref < 0) |
| 453 | fprint(2, "negative ref in drawfreedscreen\n"); | 444 | fprint(2, "negative ref in drawfreedscreen\n"); |
| 454 | if(this->ref > 0) | 445 | if(this->ref > 0) |
| @@ -468,7 +459,7 @@ drawfreedscreen(Draw *d, DScreen *this) · 13 unmodified lines |
| 468 | /* BUG: error(Enodrawimage); */ | 459 | /* BUG: error(Enodrawimage); */ |
| 469 | return; | 460 | return; |
| 470 | | 461 | |
| 471 | Found: | 462 | Found: |
| 472 | if(this->dimage) | 463 | if(this->dimage) |
| 473 | drawfreedimage(d, this->dimage); | 464 | drawfreedimage(d, this->dimage); |
| 474 | if(this->dfill) | 465 | if(this->dfill) |
| @@ -486,7 +477,6 @@ drawfreedimage(Draw *d, DImage *dimage) · 11 unmodified lines |
| 486 | DScreen *ds; | 477 | DScreen *ds; |
| 487 | | 478 | |
| 488 | dimage->ref--; | 479 | dimage->ref--; |
| 489 | // print("XXX drawfreedimage %d (%p) from window %d (ref %d) with image (%p)\n", dimage->id, dimage, d->window->id, dimage->ref, dimage->image); | | |
| 490 | if(dimage->ref < 0) | 480 | if(dimage->ref < 0) |
| 491 | fprint(2, "negative ref in drawfreedimage\n"); | 481 | fprint(2, "negative ref in drawfreedimage\n"); |
| 492 | if(dimage->ref > 0) | 482 | if(dimage->ref > 0) |
| @@ -537,7 +527,6 @@ drawuninstallscreen(Client *client, CScreen *this) · 44 unmodified lines |
| 537 | { | 527 | { |
| 538 | CScreen *cs, *next; | 528 | CScreen *cs, *next; |
| 539 | | 529 | |
| 540 | // print("XXX drawuninstallscreen %d from window %d\n", this->dscreen->id, client->draw->window->id); | | |
| 541 | cs = client->cscreen; | 530 | cs = client->cscreen; |
| 542 | if(cs == this){ | 531 | if(cs == this){ |
| 543 | client->cscreen = this->next; | 532 | client->cscreen = this->next; |
| @@ -567,7 +556,6 @@ drawuninstall(Client *client, int id) · 23 unmodified lines |
| 567 | return -1; /* BUG: error(Enodrawimage); */ | 556 | return -1; /* BUG: error(Enodrawimage); */ |
| 568 | if(d->id == id){ | 557 | if(d->id == id){ |
| 569 | client->dimage[id&HASHMASK] = d->next; | 558 | client->dimage[id&HASHMASK] = d->next; |
| 570 | // print("XXX drawuninstall %d from client %d\n", id, client->draw->window->id); | | |
| 571 | drawfreedimage(client->draw, d); | 559 | drawfreedimage(client->draw, d); |
| 572 | return 0; | 560 | return 0; |
| 573 | } | 561 | } |
| @@ -589,7 +577,6 @@ drawaddname(Client *client, DImage *di, int n, char *str, char **err) · 15 unmodified lines |
| 589 | DName *name, *ename, *new, *t; | 577 | DName *name, *ename, *new, *t; |
| 590 | char *ns; | 578 | char *ns; |
| 591 | | 579 | |
| 592 | // print("XXX drawaddname %s\n", str); | | |
| 593 | name = dname; | 580 | name = dname; |
| 594 | ename = &name[ndname]; | 581 | ename = &name[ndname]; |
| 595 | for(; name<ename; name++) | 582 | for(; name<ename; name++) |
| @@ -671,7 +658,6 @@ drawimage(Client *client, uchar *a) · 75 unmodified lines |
| 671 | { | 658 | { |
| 672 | DImage *d; | 659 | DImage *d; |
| 673 | | 660 | |
| 674 | // print("XXX drawimage %d\n", BGLONG(a)); | | |
| 675 | d = drawlookup(client, BGLONG(a), 1); | 661 | d = drawlookup(client, BGLONG(a), 1); |
| 676 | if(d == nil) | 662 | if(d == nil) |
| 677 | return nil; /* caller must check! */ | 663 | return nil; /* caller must check! */ |
| @@ -850,7 +836,7 @@ drawread(Client *cl, int type, char *data, int count) · 172 unmodified lines |
| 850 | IOResponse r; | 836 | IOResponse r; |
| 851 | | 837 | |
| 852 | r.data = data; | 838 | r.data = data; |
| 853 | r.count = count; | 839 | r.count = 0; |
| 854 | r.err = nil; | 840 | r.err = nil; |
| 855 | switch(type) { | 841 | switch(type) { |
| 856 | case FsFCtl: | 842 | case FsFCtl: |
| @@ -873,12 +859,14 @@ drawread(Client *cl, int type, char *data, int count) · 16 unmodified lines |
| 873 | if(count == -1) { | 859 | if(count == -1) { |
| 874 | free(cl->readdata); | 860 | free(cl->readdata); |
| 875 | cl->readdata = nil; | 861 | cl->readdata = nil; |
| | 862 | cl->nreaddata = 0; |
| 876 | return r; | 863 | return r; |
| 877 | } | 864 | } |
| 878 | if(count < cl->nreaddata) { | 865 | if(count < cl->nreaddata) { |
| 879 | r.err = Eshortread; | 866 | r.err = Eshortread; |
| 880 | return r; | 867 | return r; |
| 881 | } | 868 | } |
| | 869 | r.data = cl->readdata; |
| 882 | r.count = cl->nreaddata; | 870 | r.count = cl->nreaddata; |
| 883 | break; | 871 | break; |
| 884 | case FsFColormap: | 872 | case FsFColormap: |
| @@ -1145,6 +1133,9 @@ drawmesg(Client *client, void *av, int n) · 260 unmodified lines |
| 1145 | dst = drawimage(client, a+1); | 1133 | dst = drawimage(client, a+1); |
| 1146 | src = drawimage(client, a+5); | 1134 | src = drawimage(client, a+5); |
| 1147 | mask = drawimage(client, a+9); | 1135 | mask = drawimage(client, a+9); |
| | 1136 | /* |
| | 1137 | * TODO: this test fails on rio windows. |
| | 1138 | */ |
| 1148 | if(!dst || !src || !mask) | 1139 | if(!dst || !src || !mask) |
| 1149 | goto Enodrawimage; | 1140 | goto Enodrawimage; |
| 1150 | drawrectangle(&r, a+13); | 1141 | drawrectangle(&r, a+13); |
| @@ -1800,19 +1791,21 @@ drawwrite(Client *cl, int type, char *data, int count) · 649 unmodified lines |
| 1800 | IOResponse r; | 1791 | IOResponse r; |
| 1801 | | 1792 | |
| 1802 | r.data = data; | 1793 | r.data = data; |
| 1803 | r.count = count; | 1794 | r.count = 0; |
| 1804 | r.err = nil; | 1795 | r.err = nil; |
| 1805 | switch(type) { | 1796 | switch(type) { |
| 1806 | case FsFData: | 1797 | case FsFData: |
| 1807 | drawmesg(cl,data, count); | 1798 | drawmesg(cl,data, count); |
| | 1799 | r.count = count; |
| 1808 | // drawwakeall(); | 1800 | // drawwakeall(); |
| 1809 | break; | 1801 | break; |
| 1810 | case FsFCtl: | 1802 | case FsFCtl: |
| 1811 | if(r.count != 4){ | 1803 | if(count != 4){ |
| 1812 | r.err = "unknown draw control request"; | 1804 | r.err = "unknown draw control request"; |
| 1813 | break; | 1805 | break; |
| 1814 | } | 1806 | } |
| 1815 | cl->infoid = BGLONG((uchar*)data); | 1807 | cl->infoid = BGLONG((uchar*)data); |
| | 1808 | r.count = count; |
| 1816 | break; | 1809 | break; |
| 1817 | case FsFColormap: | 1810 | case FsFColormap: |
| 1818 | r.count = 0; | 1811 | r.count = 0; |
| @@ -1931,8 +1924,15 @@ drawdettach(Draw *d) · 112 unmodified lines |
| 1931 | freememimage(d->window->screenimage); | 1924 | freememimage(d->window->screenimage); |
| 1932 | free(d->window->name); | 1925 | free(d->window->name); |
| 1933 | d->window->name = nil; | 1926 | d->window->name = nil; |
| 1934 | drawfreedscreen(d, d->dscreen); | 1927 | if(d->dscreen) |
| 1935 | free(d); | 1928 | drawfreedscreen(d, d->dscreen); |
| | 1929 | /* |
| | 1930 | * TODO: we cannot free d because it is needed |
| | 1931 | * to get the window from a client, and the structures |
| | 1932 | * of the drawing device will be freed after the |
| | 1933 | * window has been deleted. |
| | 1934 | */ |
| | 1935 | // free(d); |
| 1936 | } | 1936 | } |
| 1937 | | 1937 | |
| 1938 | Window* | 1938 | Window* |