fix showing program icons with depth=1 in menus
This commit is contained in:
parent
eaabe0321d
commit
9daf464b28
1 changed files with 22 additions and 6 deletions
|
@ -114,14 +114,30 @@ void MenuItem::draw(FbDrawable &draw,
|
||||||
int icon_x = x + theme.bevelWidth();
|
int icon_x = x + theme.bevelWidth();
|
||||||
int icon_y = y + theme.bevelWidth();
|
int icon_y = y + theme.bevelWidth();
|
||||||
// enable clip mask
|
// enable clip mask
|
||||||
XSetClipMask(disp, gc, None); //tmp_mask.drawable());
|
XSetClipMask(disp, gc, tmp_mask.drawable());
|
||||||
XSetClipOrigin(disp, gc, icon_x, icon_y);
|
XSetClipOrigin(disp, gc, icon_x, icon_y);
|
||||||
|
|
||||||
draw.copyArea(tmp_pixmap.drawable(),
|
if (draw.depth() == tmp_pixmap.depth()) {
|
||||||
gc,
|
draw.copyArea(tmp_pixmap.drawable(),
|
||||||
0, 0,
|
gc,
|
||||||
icon_x, icon_y,
|
0, 0,
|
||||||
tmp_pixmap.width(), tmp_pixmap.height());
|
icon_x, icon_y,
|
||||||
|
tmp_pixmap.width(), tmp_pixmap.height());
|
||||||
|
} else { // TODO: wrong in soon-to-be-common circumstances
|
||||||
|
XGCValues backup;
|
||||||
|
XGetGCValues(draw.display(), gc, GCForeground|GCBackground,
|
||||||
|
&backup);
|
||||||
|
XSetForeground(draw.display(), gc,
|
||||||
|
Color("black", theme.screenNum()).pixel());
|
||||||
|
XSetBackground(draw.display(), gc,
|
||||||
|
Color("white", theme.screenNum()).pixel());
|
||||||
|
XCopyPlane(draw.display(), tmp_pixmap.drawable(),
|
||||||
|
draw.drawable(), gc,
|
||||||
|
0, 0, tmp_pixmap.width(), tmp_pixmap.height(),
|
||||||
|
icon_x, icon_y, 1);
|
||||||
|
XSetForeground(draw.display(), gc, backup.foreground);
|
||||||
|
XSetBackground(draw.display(), gc, backup.background);
|
||||||
|
}
|
||||||
|
|
||||||
// restore clip mask
|
// restore clip mask
|
||||||
XSetClipMask(disp, gc, None);
|
XSetClipMask(disp, gc, None);
|
||||||
|
|
Loading…
Reference in a new issue