* mothra fixes
@ 2020-04-26 8:53 qwx
2020-04-26 15:34 ` [9front] " Stanley Lieber
0 siblings, 1 reply; 3+ messages in thread
From: qwx @ 2020-04-26 8:53 UTC (permalink / raw)
To: 9front
Hello,
A few bugs seem to have slipped in with the last mothra patch.
The inlined patch below fixes them.
Does this look ok to merge?
Thanks,
qwx
- nil check pl_blue allocation, and don't do it every time pl_rtdraw is called
- fix re-adding previously removed flushimage calls
- correct format for pointer
diff -r b012b1555646 sys/src/cmd/mothra/libpanel/draw.c
--- a/sys/src/cmd/mothra/libpanel/draw.c Sat Apr 25 20:46:45 2020 -0700
+++ b/sys/src/cmd/mothra/libpanel/draw.c Sun Apr 26 10:46:21 2020 +0200
@@ -15,6 +15,7 @@
#define CKBORDER 2 /* space around X inside frame */
static int plldepth;
static Image *pl_white, *pl_light, *pl_dark, *pl_black, *pl_hilit;
+Image *pl_blue;
int pl_drawinit(int ldepth){
plldepth=ldepth;
/* mono */
@@ -23,7 +24,8 @@
pl_dark=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x555555FF);
pl_black=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x000000FF);
pl_hilit=allocimage(display, Rect(0,0,1,1), CHAN1(CAlpha,8), 1, 0x80);
- if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0) return 0;
+ pl_blue=allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x0000FFFF);
+ if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0 || pl_blue==0) return 0;
return 1;
}
void pl_relief(Image *b, Image *ul, Image *lr, Rectangle r, int wid){
diff -r b012b1555646 sys/src/cmd/mothra/libpanel/event.c
--- a/sys/src/cmd/mothra/libpanel/event.c Sat Apr 25 20:46:45 2020 -0700
+++ b/sys/src/cmd/mothra/libpanel/event.c Sun Apr 26 10:46:21 2020 +0200
@@ -9,10 +9,8 @@
plkbfocus=g;
}
void plkeyboard(Rune c){
- if(plkbfocus){
+ if(plkbfocus)
plkbfocus->type(plkbfocus, c);
- flushimage(display, 1);
- }
}
/*
@@ -47,5 +45,4 @@
g->flags&=~REMOUSE;
g->lastmouse=hit;
}
- flushimage(display, 1);
}
diff -r b012b1555646 sys/src/cmd/mothra/libpanel/panel.h
--- a/sys/src/cmd/mothra/libpanel/panel.h Sat Apr 25 20:46:45 2020 -0700
+++ b/sys/src/cmd/mothra/libpanel/panel.h Sun Apr 26 10:46:21 2020 +0200
@@ -109,6 +109,8 @@
Panel *plkbfocus; /* the panel in keyboard focus */
+extern Image *pl_blue;
+
int plinit(int); /* initialization */
void plpack(Panel *, Rectangle); /* figure out where to put the Panel & children */
void plmove(Panel *, Point); /* move an already-packed panel to a new location */
diff -r b012b1555646 sys/src/cmd/mothra/libpanel/popup.c
--- a/sys/src/cmd/mothra/libpanel/popup.c Sat Apr 25 20:46:45 2020 -0700
+++ b/sys/src/cmd/mothra/libpanel/popup.c Sun Apr 26 10:46:21 2020 +0200
@@ -65,7 +65,6 @@
if(g->state!=DOWN){
if(pp->save!=0){
draw(g->b, p->r, pp->save, 0, p->r.min);
- flushimage(display, 1);
freeimage(pp->save);
pp->save=0;
}
diff -r b012b1555646 sys/src/cmd/mothra/libpanel/rtext.c
--- a/sys/src/cmd/mothra/libpanel/rtext.c Sat Apr 25 20:46:45 2020 -0700
+++ b/sys/src/cmd/mothra/libpanel/rtext.c Sun Apr 26 10:46:21 2020 +0200
@@ -175,9 +175,7 @@
Point lp, sp;
Rectangle dr;
Image *bb;
- Image *pl_blue;
- pl_blue=allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x0000FFFF);
bb = b;
if(backup==0 || backup->chan!=b->chan || rectinrect(r, backup->r)==0){
freeimage(backup);
diff -r b012b1555646 sys/src/cmd/mothra/libpanel/textwin.c
--- a/sys/src/cmd/mothra/libpanel/textwin.c Sat Apr 25 20:46:45 2020 -0700
+++ b/sys/src/cmd/mothra/libpanel/textwin.c Sun Apr 26 10:46:21 2020 +0200
@@ -136,7 +136,7 @@
er=t->text+last;
for(r=t->text+first,lp=t->loc+(first-t->top);r!=er;r++,lp++){
if(lp->y+t->hgt>t->r.max.y){
- fprint(2, "chr %C, index %lld of %d, loc %d %d, off bottom\n",
+ fprint(2, "chr %C, index %zd of %d, loc %d %d, off bottom\n",
*r, lp-t->loc, t->bot-t->top, lp->x, lp->y);
return;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9front] mothra fixes
2020-04-26 8:53 mothra fixes qwx
@ 2020-04-26 15:34 ` Stanley Lieber
2020-04-26 17:44 ` qwx
0 siblings, 1 reply; 3+ messages in thread
From: Stanley Lieber @ 2020-04-26 15:34 UTC (permalink / raw)
To: 9front
On April 26, 2020 4:53:14 AM EDT, qwx <qwx@sciops.net> wrote:
>Hello,
>
>A few bugs seem to have slipped in with the last mothra patch.
>
>The inlined patch below fixes them.
>Does this look ok to merge?
>
>Thanks,
>
>qwx
>
>
>- nil check pl_blue allocation, and don't do it every time pl_rtdraw is called
>- fix re-adding previously removed flushimage calls
>- correct format for pointer
>
>diff -r b012b1555646 sys/src/cmd/mothra/libpanel/draw.c
>--- a/sys/src/cmd/mothra/libpanel/draw.c Sat Apr 25 20:46:45 2020 -0700
>+++ b/sys/src/cmd/mothra/libpanel/draw.c Sun Apr 26 10:46:21 2020 +0200
>@@ -15,6 +15,7 @@
> #define CKBORDER 2 /* space around X inside frame */
> static int plldepth;
> static Image *pl_white, *pl_light, *pl_dark, *pl_black, *pl_hilit;
>+Image *pl_blue;
> int pl_drawinit(int ldepth){
> plldepth=ldepth;
> /* mono */
>@@ -23,7 +24,8 @@
> pl_dark=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x555555FF);
> pl_black=allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x000000FF);
> pl_hilit=allocimage(display, Rect(0,0,1,1), CHAN1(CAlpha,8), 1, 0x80);
>- if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0) return 0;
>+ pl_blue=allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x0000FFFF);
>+ if(pl_white==0 || pl_light==0 || pl_black==0 || pl_dark==0 || pl_blue==0) return 0;
> return 1;
> }
> void pl_relief(Image *b, Image *ul, Image *lr, Rectangle r, int wid){
>diff -r b012b1555646 sys/src/cmd/mothra/libpanel/event.c
>--- a/sys/src/cmd/mothra/libpanel/event.c Sat Apr 25 20:46:45 2020 -0700
>+++ b/sys/src/cmd/mothra/libpanel/event.c Sun Apr 26 10:46:21 2020 +0200
>@@ -9,10 +9,8 @@
> plkbfocus=g;
> }
> void plkeyboard(Rune c){
>- if(plkbfocus){
>+ if(plkbfocus)
> plkbfocus->type(plkbfocus, c);
>- flushimage(display, 1);
>- }
> }
>
> /*
>@@ -47,5 +45,4 @@
> g->flags&=~REMOUSE;
> g->lastmouse=hit;
> }
>- flushimage(display, 1);
> }
>diff -r b012b1555646 sys/src/cmd/mothra/libpanel/panel.h
>--- a/sys/src/cmd/mothra/libpanel/panel.h Sat Apr 25 20:46:45 2020 -0700
>+++ b/sys/src/cmd/mothra/libpanel/panel.h Sun Apr 26 10:46:21 2020 +0200
>@@ -109,6 +109,8 @@
>
> Panel *plkbfocus; /* the panel in keyboard focus */
>
>+extern Image *pl_blue;
>+
> int plinit(int); /* initialization */
> void plpack(Panel *, Rectangle); /* figure out where to put the Panel & children */
> void plmove(Panel *, Point); /* move an already-packed panel to a new location */
>diff -r b012b1555646 sys/src/cmd/mothra/libpanel/popup.c
>--- a/sys/src/cmd/mothra/libpanel/popup.c Sat Apr 25 20:46:45 2020 -0700
>+++ b/sys/src/cmd/mothra/libpanel/popup.c Sun Apr 26 10:46:21 2020 +0200
>@@ -65,7 +65,6 @@
> if(g->state!=DOWN){
> if(pp->save!=0){
> draw(g->b, p->r, pp->save, 0, p->r.min);
>- flushimage(display, 1);
> freeimage(pp->save);
> pp->save=0;
> }
>diff -r b012b1555646 sys/src/cmd/mothra/libpanel/rtext.c
>--- a/sys/src/cmd/mothra/libpanel/rtext.c Sat Apr 25 20:46:45 2020 -0700
>+++ b/sys/src/cmd/mothra/libpanel/rtext.c Sun Apr 26 10:46:21 2020 +0200
>@@ -175,9 +175,7 @@
> Point lp, sp;
> Rectangle dr;
> Image *bb;
>- Image *pl_blue;
>
>- pl_blue=allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x0000FFFF);
> bb = b;
> if(backup==0 || backup->chan!=b->chan || rectinrect(r, backup->r)==0){
> freeimage(backup);
>diff -r b012b1555646 sys/src/cmd/mothra/libpanel/textwin.c
>--- a/sys/src/cmd/mothra/libpanel/textwin.c Sat Apr 25 20:46:45 2020 -0700
>+++ b/sys/src/cmd/mothra/libpanel/textwin.c Sun Apr 26 10:46:21 2020 +0200
>@@ -136,7 +136,7 @@
> er=t->text+last;
> for(r=t->text+first,lp=t->loc+(first-t->top);r!=er;r++,lp++){
> if(lp->y+t->hgt>t->r.max.y){
>- fprint(2, "chr %C, index %lld of %d, loc %d %d, off bottom\n",
>+ fprint(2, "chr %C, index %zd of %d, loc %d %d, off bottom\n",
> *r, lp-t->loc, t->bot-t->top, lp->x, lp->y);
> return;
> }
this looks fine to me. then again, i made the original mistakes.
sl
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9front] mothra fixes
2020-04-26 15:34 ` [9front] " Stanley Lieber
@ 2020-04-26 17:44 ` qwx
0 siblings, 0 replies; 3+ messages in thread
From: qwx @ 2020-04-26 17:44 UTC (permalink / raw)
To: 9front
> this looks fine to me. then again, i made the original mistakes.
>
> sl
No big deal :)
Pushed a fix after confirming with Ori_B.
Cheers,
qwx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-26 17:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-26 8:53 mothra fixes qwx
2020-04-26 15:34 ` [9front] " Stanley Lieber
2020-04-26 17:44 ` qwx
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).