summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Forsyth <charles.forsyth@gmail.com>2024-04-22 07:09:01 +0100
committerGitHub <noreply@github.com>2024-04-22 07:09:01 +0100
commit73b5cba380d148e77d696880027a416cda50f756 (patch)
treea642616d55c1d79ff9ef22e325c359947dbfbcf0
parent22dd4b9c0961cd615779c72accc1e150357289cf (diff)
parent1bf9388ccb3bd33b5825ee20ec6824b17508f045 (diff)
Merge pull request #16 from pete/multiple-small-fixes
Multiple small fixes
-rw-r--r--appl/charon/mkfile2
-rw-r--r--appl/svc/httpd/httpd.b4
-rw-r--r--appl/svc/httpd/httpd.suff3
-rw-r--r--appl/wm/memory.b6
-rw-r--r--appl/wm/view.b33
-rw-r--r--emu/port/win-x11a.c4
-rw-r--r--lib/units1
-rw-r--r--libdraw/font.c2
-rw-r--r--services/httpd/httpd.suff3
9 files changed, 48 insertions, 10 deletions
diff --git a/appl/charon/mkfile b/appl/charon/mkfile
index 6345f815..05ac5cb6 100644
--- a/appl/charon/mkfile
+++ b/appl/charon/mkfile
@@ -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
diff --git a/appl/svc/httpd/httpd.b b/appl/svc/httpd/httpd.b
index db570a74..20d48f10 100644
--- a/appl/svc/httpd/httpd.b
+++ b/appl/svc/httpd/httpd.b
@@ -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));
diff --git a/appl/svc/httpd/httpd.suff b/appl/svc/httpd/httpd.suff
index dbc599d2..110e4726 100644
--- a/appl/svc/httpd/httpd.suff
+++ b/appl/svc/httpd/httpd.suff
@@ -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 -
@@ -76,6 +77,7 @@
.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 -
@@ -83,6 +85,7 @@
.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
diff --git a/appl/wm/memory.b b/appl/wm/memory.b
index 6bbfa68b..77221a8f 100644
--- a/appl/wm/memory.b
+++ b/appl/wm/memory.b
@@ -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");
@@ -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";
}
diff --git a/appl/wm/view.b b/appl/wm/view.b
index c96ef87d..8e847e55 100644
--- a/appl/wm/view.b
+++ b/appl/wm/view.b
@@ -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",
@@ -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");
diff --git a/emu/port/win-x11a.c b/emu/port/win-x11a.c
index bbc65761..0fc38450 100644
--- a/emu/port/win-x11a.c
+++ b/emu/port/win-x11a.c
@@ -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);
@@ -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++){
diff --git a/lib/units b/lib/units
index 106fc0f9..4195db90 100644
--- a/lib/units
+++ b/lib/units
@@ -595,3 +595,4 @@ weymass 252 lb
Xunit 1.00202e-13 m
k 1.38047e-16 erg/°K
foal 9223372036854775807
+romanmile 1620 yard
diff --git a/libdraw/font.c b/libdraw/font.c
index f51804d2..849bb289 100644
--- a/libdraw/font.c
+++ b/libdraw/font.c
@@ -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){
diff --git a/services/httpd/httpd.suff b/services/httpd/httpd.suff
index dbc599d2..110e4726 100644
--- a/services/httpd/httpd.suff
+++ b/services/httpd/httpd.suff
@@ -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 -
@@ -76,6 +77,7 @@
.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 -
@@ -83,6 +85,7 @@
.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