summaryrefslogtreecommitdiff
path: root/sys/src/cmd/mothra
diff options
context:
space:
mode:
authorqwx <devnull@localhost>2020-04-26 19:43:10 +0200
committerqwx <devnull@localhost>2020-04-26 19:43:10 +0200
commit0fc1abc73d813280fbd8e7119391a8c5c3d36b7c (patch)
tree8dcad5544e2c3289a0a57613ead4df9a8dda38e2 /sys/src/cmd/mothra
parentc6f7989176b9da3b977f397ac4f20bc2f86dec1b (diff)
mothra: fix a few errors in previous patch
- 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 - sysfatal in pl_drawinit on error
Diffstat (limited to 'sys/src/cmd/mothra')
-rw-r--r--sys/src/cmd/mothra/libpanel/draw.c4
-rw-r--r--sys/src/cmd/mothra/libpanel/event.c5
-rw-r--r--sys/src/cmd/mothra/libpanel/panel.h2
-rw-r--r--sys/src/cmd/mothra/libpanel/popup.c1
-rw-r--r--sys/src/cmd/mothra/libpanel/rtext.c2
-rw-r--r--sys/src/cmd/mothra/libpanel/textwin.c2
6 files changed, 7 insertions, 9 deletions
diff --git a/sys/src/cmd/mothra/libpanel/draw.c b/sys/src/cmd/mothra/libpanel/draw.c
index 8ea2b7dcf..5f51eb86d 100644
--- a/sys/src/cmd/mothra/libpanel/draw.c
+++ b/sys/src/cmd/mothra/libpanel/draw.c
@@ -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 @@ int pl_drawinit(int ldepth){
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) sysfatal("allocimage: %r");
return 1;
}
void pl_relief(Image *b, Image *ul, Image *lr, Rectangle r, int wid){
diff --git a/sys/src/cmd/mothra/libpanel/event.c b/sys/src/cmd/mothra/libpanel/event.c
index 08dbf6bd1..4a9355d58 100644
--- a/sys/src/cmd/mothra/libpanel/event.c
+++ b/sys/src/cmd/mothra/libpanel/event.c
@@ -9,10 +9,8 @@ void plgrabkb(Panel *g){
plkbfocus=g;
}
void plkeyboard(Rune c){
- if(plkbfocus){
+ if(plkbfocus)
plkbfocus->type(plkbfocus, c);
- flushimage(display, 1);
- }
}
/*
@@ -47,5 +45,4 @@ void plmouse(Panel *g, Mouse *m){
g->flags&=~REMOUSE;
g->lastmouse=hit;
}
- flushimage(display, 1);
}
diff --git a/sys/src/cmd/mothra/libpanel/panel.h b/sys/src/cmd/mothra/libpanel/panel.h
index 3d73a81bd..8a7c487e1 100644
--- a/sys/src/cmd/mothra/libpanel/panel.h
+++ b/sys/src/cmd/mothra/libpanel/panel.h
@@ -109,6 +109,8 @@ struct Panel{
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 --git a/sys/src/cmd/mothra/libpanel/popup.c b/sys/src/cmd/mothra/libpanel/popup.c
index a3007bbb8..ea3bde177 100644
--- a/sys/src/cmd/mothra/libpanel/popup.c
+++ b/sys/src/cmd/mothra/libpanel/popup.c
@@ -65,7 +65,6 @@ int pl_hitpopup(Panel *g, Mouse *m){
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 --git a/sys/src/cmd/mothra/libpanel/rtext.c b/sys/src/cmd/mothra/libpanel/rtext.c
index 658831f8e..192c4354f 100644
--- a/sys/src/cmd/mothra/libpanel/rtext.c
+++ b/sys/src/cmd/mothra/libpanel/rtext.c
@@ -175,9 +175,7 @@ void pl_rtdraw(Image *b, Rectangle r, Rtext *t, Point offs){
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 --git a/sys/src/cmd/mothra/libpanel/textwin.c b/sys/src/cmd/mothra/libpanel/textwin.c
index f999867aa..bb00eff0d 100644
--- a/sys/src/cmd/mothra/libpanel/textwin.c
+++ b/sys/src/cmd/mothra/libpanel/textwin.c
@@ -136,7 +136,7 @@ void tw_draw(Textwin *t, int first, int last){
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;
}