acme: retina scaling for scroll bars, button
R=rsc http://codereview.appspot.com/6854094
This commit is contained in:
parent
c28224992a
commit
c96d832508
2 changed files with 34 additions and 26 deletions
|
|
@ -545,6 +545,7 @@ mousethread(void *v)
|
||||||
if(getwindow(display, Refnone) < 0)
|
if(getwindow(display, Refnone) < 0)
|
||||||
error("attach to window");
|
error("attach to window");
|
||||||
draw(screen, screen->r, display->white, nil, ZP);
|
draw(screen, screen->r, display->white, nil, ZP);
|
||||||
|
iconinit();
|
||||||
scrlresize();
|
scrlresize();
|
||||||
rowresize(&row, screen->clipr);
|
rowresize(&row, screen->clipr);
|
||||||
break;
|
break;
|
||||||
|
|
@ -959,19 +960,25 @@ iconinit(void)
|
||||||
Rectangle r;
|
Rectangle r;
|
||||||
Image *tmp;
|
Image *tmp;
|
||||||
|
|
||||||
/* Blue */
|
if(tagcols[BACK] == nil) {
|
||||||
tagcols[BACK] = allocimagemix(display, DPalebluegreen, DWhite);
|
/* Blue */
|
||||||
tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPalegreygreen);
|
tagcols[BACK] = allocimagemix(display, DPalebluegreen, DWhite);
|
||||||
tagcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPurpleblue);
|
tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPalegreygreen);
|
||||||
tagcols[TEXT] = display->black;
|
tagcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPurpleblue);
|
||||||
tagcols[HTEXT] = display->black;
|
tagcols[TEXT] = display->black;
|
||||||
|
tagcols[HTEXT] = display->black;
|
||||||
|
|
||||||
/* Yellow */
|
/* Yellow */
|
||||||
textcols[BACK] = allocimagemix(display, DPaleyellow, DWhite);
|
textcols[BACK] = allocimagemix(display, DPaleyellow, DWhite);
|
||||||
textcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DDarkyellow);
|
textcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DDarkyellow);
|
||||||
textcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DYellowgreen);
|
textcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DYellowgreen);
|
||||||
textcols[TEXT] = display->black;
|
textcols[TEXT] = display->black;
|
||||||
textcols[HTEXT] = display->black;
|
textcols[HTEXT] = display->black;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = Rect(0, 0, Scrollwid+ButtonBorder, font->height+1);
|
||||||
|
if(button && eqrect(r, button->r))
|
||||||
|
return;
|
||||||
|
|
||||||
if(button){
|
if(button){
|
||||||
freeimage(button);
|
freeimage(button);
|
||||||
|
|
@ -979,18 +986,17 @@ iconinit(void)
|
||||||
freeimage(colbutton);
|
freeimage(colbutton);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = Rect(0, 0, Scrollwid+2, font->height+1);
|
|
||||||
button = allocimage(display, r, screen->chan, 0, DNofill);
|
button = allocimage(display, r, screen->chan, 0, DNofill);
|
||||||
draw(button, r, tagcols[BACK], nil, r.min);
|
draw(button, r, tagcols[BACK], nil, r.min);
|
||||||
r.max.x -= 2;
|
r.max.x -= ButtonBorder;
|
||||||
border(button, r, 2, tagcols[BORD], ZP);
|
border(button, r, ButtonBorder, tagcols[BORD], ZP);
|
||||||
|
|
||||||
r = button->r;
|
r = button->r;
|
||||||
modbutton = allocimage(display, r, screen->chan, 0, DNofill);
|
modbutton = allocimage(display, r, screen->chan, 0, DNofill);
|
||||||
draw(modbutton, r, tagcols[BACK], nil, r.min);
|
draw(modbutton, r, tagcols[BACK], nil, r.min);
|
||||||
r.max.x -= 2;
|
r.max.x -= ButtonBorder;
|
||||||
border(modbutton, r, 2, tagcols[BORD], ZP);
|
border(modbutton, r, ButtonBorder, tagcols[BORD], ZP);
|
||||||
r = insetrect(r, 2);
|
r = insetrect(r, ButtonBorder);
|
||||||
tmp = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DMedblue);
|
tmp = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DMedblue);
|
||||||
draw(modbutton, r, tmp, nil, ZP);
|
draw(modbutton, r, tmp, nil, ZP);
|
||||||
freeimage(tmp);
|
freeimage(tmp);
|
||||||
|
|
|
||||||
|
|
@ -463,12 +463,14 @@ enum
|
||||||
BUFSIZE = Maxblock+IOHDRSZ, /* size from fbufalloc() */
|
BUFSIZE = Maxblock+IOHDRSZ, /* size from fbufalloc() */
|
||||||
RBUFSIZE = BUFSIZE/sizeof(Rune),
|
RBUFSIZE = BUFSIZE/sizeof(Rune),
|
||||||
EVENTSIZE = 256,
|
EVENTSIZE = 256,
|
||||||
Scrollwid = 12, /* width of scroll bar */
|
|
||||||
Scrollgap = 4, /* gap right of scroll bar */
|
|
||||||
Margin = 4, /* margin around text */
|
|
||||||
Border = 2 /* line between rows, cols, windows */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define Scrollwid scalesize(display, 12)
|
||||||
|
#define Scrollgap scalesize(display, 4)
|
||||||
|
#define Margin scalesize(display, 4)
|
||||||
|
#define Border scalesize(display, 2)
|
||||||
|
#define ButtonBorder scalesize(display, 2)
|
||||||
|
|
||||||
#define QID(w,q) ((w<<8)|(q))
|
#define QID(w,q) ((w<<8)|(q))
|
||||||
#define WIN(q) ((((ulong)(q).path)>>8) & 0xFFFFFF)
|
#define WIN(q) ((((ulong)(q).path)>>8) & 0xFFFFFF)
|
||||||
#define FILE(q) ((q).path & 0xFF)
|
#define FILE(q) ((q).path & 0xFF)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue