Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple small fixes #16

Merged
merged 9 commits into from Apr 22, 2024
2 changes: 1 addition & 1 deletion appl/charon/mkfile
Expand Up @@ -86,7 +86,7 @@ $ROOT/dis/charon.dis: charon.dis
charon.dis: $MODULES $SYS_MODULES

img.dis: img.b $MODULE $SYS_MODULE
limbo $LIMBOFLAGS -c -gw img.b
limbo $LIMBOFLAGS -gw img.b

nuke:V:
rm -f $ROOT/dis/charon.dis
4 changes: 2 additions & 2 deletions appl/svc/httpd/httpd.b
Expand Up @@ -506,8 +506,8 @@ senddir(g: ref Private_info,vers,uri: string, fd: ref FD, mydir: ref Dir)
g.bout.puts("<table>\n");
for(i := 0; i < n; i++){
(typ, enc) := classify(a[i]);
g.bout.puts(sys->sprint("<tr><td><a href=\"%s%s\">%s</A></td>",
myname, a[i].name, a[i].name));
g.bout.puts(sys->sprint("<tr><td><a href=\"%s\">%s</A></td>",
a[i].name, a[i].name));
if(typ != nil){
if(typ.generic!=nil)
g.bout.puts(sys->sprint("<td>%s", typ.generic));
Expand Down
3 changes: 3 additions & 0 deletions appl/svc/httpd/httpd.suff
Expand Up @@ -15,6 +15,7 @@
.bcpio application x-bcpio - # [Mosaic]
.bib text plain - # BibTex input
.c text plain - # C program
.css text css - # CSS
.c++ text plain - # C++ program
.cc text plain - # [Mosaic]
.cdf application x-netcdf -
Expand Down Expand Up @@ -76,13 +77,15 @@
.rfr text plain - # refer
.rgb image x-rgb - # [Mosaic]
.roff application x-troff - # [Mosaic]
.rss application rss+xml - # RSS feeds
.rtf application rtf - # [Mosaic]
.rtx text richtext - # MIME richtext [Mosaic]
.sh application x-shar -
.shar application x-shar -
.snd audio basic -
.sv4cpio application x-sv4cpio - # [Mosaic]
.sv4crc application x-sv4crc - # [Mosaic]
.svg image svg+xml - # SVG images
.t application x-troff - # [Mosaic]
.tar application x-tar - # [Mosaic]
.taz application x-tar x-compress
Expand Down
6 changes: 3 additions & 3 deletions appl/wm/memory.b
Expand Up @@ -109,9 +109,9 @@ realinit(ctxt: ref Draw->Context)
maxx+x,
a[i].y + 8);
cmd(t, s);
s = sys->sprint(".c itemconfigure %s -text '%s", a[i].tagsz, string a[i].size);
s = sys->sprint(".c itemconfigure %s -text '%s", a[i].tagsz, sizestr(a[i].size));
cmd(t, s);
s = sys->sprint(".c itemconfigure %s -text '%d", a[i].tagiu, a[i].allocs-a[i].frees);
s = sys->sprint(".c itemconfigure %s -text '%s", a[i].tagiu, sizestr(a[i].allocs-a[i].frees));
cmd(t, s);
}
cmd(t, "update");
Expand Down Expand Up @@ -163,7 +163,7 @@ initdraw(n: int): int

sizestr(n: int): string
{
if ((n / 1024) % 1024 == 0)
if ((n / 1024) % 1024 == 0 || n > (100 * 1024 * 1024))
return string (n / (1024 * 1024)) + "M";
return string (n / 1024) + "K";
}
Expand Down
33 changes: 31 additions & 2 deletions appl/wm/view.b
Expand Up @@ -178,13 +178,42 @@ readimages(file: string, errdiff: int) : (array of ref Image, array of ref Image

# if transparency is enabled, errdiff==1 is probably a mistake,
# but there's no easy solution.
(ims[i], err2) = imageremap->remap(ai[i], display, errdiff);
(ims[i], err2) = remap(ai[i], display, errdiff);
if(ims[i] == nil)
return(nil, nil, err2);
}
return (ims, masks, nil);
}

remap(raw: ref RImagefile->Rawimage, display: ref Draw->Display, errdiff: int): (ref Draw->Image, string)
{
case raw.chandesc {
RImagefile->CRGB =>
r := chanstopix(raw.chans, raw.r.dx(), raw.r.dy());
im := display.newimage(raw.r, Draw->RGB24, 0, Draw->White);
im.writepixels(im.r, r);
return (im, "");
* =>
return imageremap->remap(raw, display, errdiff);
}
}

chanstopix(chans : array of array of byte, width, height: int): array of byte
{
r := chans[0];
g := chans[1];
b := chans[2];

rgb := array [3*len r] of byte;
bix := 0;
for (i := 0; i < len r ; i++) {
rgb[bix++] = b[i];
rgb[bix++] = g[i];
rgb[bix++] = r[i];
}
return rgb;
}

viewcfg := array[] of {
"panel .p",
"menu .m",
Expand Down Expand Up @@ -212,7 +241,7 @@ timer(dt: int, ticks, pidc: chan of int)
view(ctxt: ref Context, ims, masks: array of ref Image, file: string)
{
file = lastcomponent(file);
(t, titlechan) := tkclient->toplevel(ctxt, "", "view: "+file, Tkclient->Hide);
(t, titlechan) := tkclient->toplevel(ctxt, "", "view: "+file, Tkclient->Appl);

cmd := chan of string;
tk->namechan(t, cmd, "cmd");
Expand Down
4 changes: 2 additions & 2 deletions emu/port/win-x11a.c
Expand Up @@ -969,7 +969,7 @@ xinitscreen(int xsize, int ysize, ulong reqchan, ulong *chan, int *d)
}

clipboard = XInternAtom(xmcon, "CLIPBOARD", False);
utf8string = XInternAtom(xmcon, "UTF8_STRING", False);
utf8string = XInternAtom(xmcon, "UTF8_STRING", True);
targets = XInternAtom(xmcon, "TARGETS", False);
text = XInternAtom(xmcon, "TEXT", False);
compoundtext = XInternAtom(xmcon, "COMPOUND_TEXT", False);
Expand Down Expand Up @@ -1523,7 +1523,7 @@ _xgetsnarf(XDisplay *xd)
*/
prop = 1;
XChangeProperty(xd, xdrawable, prop, XA_STRING, 8, PropModeReplace, (uchar*)"", 0);
XConvertSelection(xd, clipboard, XA_STRING, prop, xdrawable, CurrentTime);
XConvertSelection(xd, clipboard, utf8string, prop, xdrawable, CurrentTime);
XFlush(xd);
lastlen = 0;
for(i=0; i<10 || (lastlen!=0 && i<30); i++){
Expand Down
1 change: 1 addition & 0 deletions lib/units
Expand Up @@ -595,3 +595,4 @@ weymass 252 lb
Xunit 1.00202e-13 m
k 1.38047e-16 erg/°K
foal 9223372036854775807
romanmile 1620 yard
2 changes: 2 additions & 0 deletions libdraw/font.c
Expand Up @@ -355,6 +355,8 @@ fontresize(Font *f, int wid, int ncache, int depth)
d = f->display;
if(depth <= 0)
depth = 1;
if(wid == 0)
wid = 1;

new = allocimage(d, Rect(0, 0, ncache*wid, f->height), CHAN1(CGrey, depth), 0, 0);
if(new == nil){
Expand Down
3 changes: 3 additions & 0 deletions services/httpd/httpd.suff
Expand Up @@ -15,6 +15,7 @@
.bcpio application x-bcpio - # [Mosaic]
.bib text plain - # BibTex input
.c text plain - # C program
.css text css - # CSS
.c++ text plain - # C++ program
.cc text plain - # [Mosaic]
.cdf application x-netcdf -
Expand Down Expand Up @@ -76,13 +77,15 @@
.rfr text plain - # refer
.rgb image x-rgb - # [Mosaic]
.roff application x-troff - # [Mosaic]
.rss application rss+xml - # RSS feeds
.rtf application rtf - # [Mosaic]
.rtx text richtext - # MIME richtext [Mosaic]
.sh application x-shar -
.shar application x-shar -
.snd audio basic -
.sv4cpio application x-sv4cpio - # [Mosaic]
.sv4crc application x-sv4crc - # [Mosaic]
.svg image svg+xml - # SVG images
.t application x-troff - # [Mosaic]
.tar application x-tar - # [Mosaic]
.taz application x-tar x-compress
Expand Down