Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paging #90

Merged
merged 4 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 31 additions & 25 deletions src/clientwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ clientwin_get_disp_mode(session_t *ps, ClientWin *cw, bool isViewable) {
case CLIDISP_FILLED:
case CLIDISP_NONE:
return *p;
case CLIDISP_DESKTOP:
return *p;
}
}

Expand Down Expand Up @@ -282,6 +284,8 @@ clientwin_update2(ClientWin *cw) {
clientwin_free_res2(ps, cw);

switch (cw->mode) {
case CLIDISP_DESKTOP:
break;
case CLIDISP_NONE:
break;
case CLIDISP_FILLED:
Expand Down Expand Up @@ -347,6 +351,9 @@ clientwin_repaint(ClientWin *cw, const XRectangle *pbound)
}

switch (cw->mode) {
case CLIDISP_DESKTOP:
source = cw->origin;
break;
case CLIDISP_NONE:
break;
case CLIDISP_FILLED:
Expand Down Expand Up @@ -388,6 +395,7 @@ clientwin_repaint(ClientWin *cw, const XRectangle *pbound)
XRenderComposite(ps->dpy, PictOpOver, source, mask,
cw->destination, s_x, s_y, 0, 0, s_x, s_y, s_w, s_h);
}

if (CLIDISP_ZOMBIE_ICON == cw->mode || CLIDISP_THUMBNAIL_ICON == cw->mode) {
assert(cw->icon_pict && cw->icon_pict->pict);
img_composite_params_t params = IMG_COMPOSITE_PARAMS_INIT;
Expand All @@ -401,9 +409,7 @@ clientwin_repaint(ClientWin *cw, const XRectangle *pbound)
}

// Tinting
if (cw->mode >= CLIDISP_ZOMBIE) // tint only thumbnail
{
// here the client window is being tinted
XRenderColor *tint = &cw->mainwin->normalTint;
if (cw->focused)
tint = &cw->mainwin->highlightTint;
Expand Down Expand Up @@ -460,6 +466,29 @@ clientwin_schedule_repair(ClientWin *cw, XRectangle *area)
cw->damaged = true;
}

void clientwin_round_corners(ClientWin *cw) {
session_t* ps = cw->mainwin->ps;
int dia = 2 * ps->o.cornerRadius;
int w = cw->mini.width;
int h = cw->mini.height;
XGCValues xgcv;
Pixmap mask = XCreatePixmap(ps->dpy, cw->mini.window, w, h, 1);
GC shape_gc = XCreateGC(ps->dpy, mask, 0, &xgcv);

XSetForeground(ps->dpy, shape_gc, 0);
XFillRectangle(ps->dpy, mask, shape_gc, 0, 0, w, h);
XSetForeground(ps->dpy, shape_gc, 1);
XFillArc(ps->dpy, mask, shape_gc, 0, 0, dia, dia, 0, 360 * 64);
XFillArc(ps->dpy, mask, shape_gc, w-dia-1, 0, dia, dia, 0, 360 * 64);
XFillArc(ps->dpy, mask, shape_gc, 0, h-dia-1, dia, dia, 0, 360 * 64);
XFillArc(ps->dpy, mask, shape_gc, w-dia-1, h-dia-1, dia, dia, 0, 360 * 64);
XFillRectangle(ps->dpy, mask, shape_gc, ps->o.cornerRadius, 0, w-dia, h);
XFillRectangle(ps->dpy, mask, shape_gc, 0, ps->o.cornerRadius, w, h-dia);
XShapeCombineMask(ps->dpy, cw->mini.window, ShapeBounding, 0, 0, mask, ShapeSet);
XFreePixmap(ps->dpy, mask);
XFreeGC(ps->dpy, shape_gc);
}

void
clientwin_move(ClientWin *cw, float f, int x, int y, float timeslice)
{
Expand Down Expand Up @@ -765,26 +794,3 @@ clientwin_action(ClientWin *cw, enum cliop action) {

return 0;
}

void clientwin_round_corners(ClientWin *cw) {
session_t* ps = cw->mainwin->ps;
int dia = 2 * ps->o.cornerRadius;
int w = cw->mini.width;
int h = cw->mini.height;
XGCValues xgcv;
Pixmap mask = XCreatePixmap(ps->dpy, cw->mini.window, w, h, 1);
GC shape_gc = XCreateGC(ps->dpy, mask, 0, &xgcv);

XSetForeground(ps->dpy, shape_gc, 0);
XFillRectangle(ps->dpy, mask, shape_gc, 0, 0, w, h);
XSetForeground(ps->dpy, shape_gc, 1);
XFillArc(ps->dpy, mask, shape_gc, 0, 0, dia, dia, 0, 360 * 64);
XFillArc(ps->dpy, mask, shape_gc, w-dia-1, 0, dia, dia, 0, 360 * 64);
XFillArc(ps->dpy, mask, shape_gc, 0, h-dia-1, dia, dia, 0, 360 * 64);
XFillArc(ps->dpy, mask, shape_gc, w-dia-1, h-dia-1, dia, dia, 0, 360 * 64);
XFillRectangle(ps->dpy, mask, shape_gc, ps->o.cornerRadius, 0, w-dia, h);
XFillRectangle(ps->dpy, mask, shape_gc, 0, ps->o.cornerRadius, w, h-dia);
XShapeCombineMask(ps->dpy, cw->mini.window, ShapeBounding, 0, 0, mask, ShapeSet);
XFreePixmap(ps->dpy, mask);
XFreeGC(ps->dpy, shape_gc);
}
2 changes: 1 addition & 1 deletion src/mainwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct _mainwin_t {
Picture normalPicture, highlightPicture, shadowPicture;

ClientWin *pressed, *focus;
dlist *clientondesktop, *focuslist;
dlist *clientondesktop, *focuslist, *desktopwins, *dminis;
struct _Tooltip *tooltip;

KeySym *keysyms_Up;
Expand Down
Loading