FX: Fix clipping with compositing enabled
This commit is contained in:
parent
8170ada68c
commit
726bb9ea13
|
@ -256,17 +256,29 @@ static int ECompMgrDetermineOrder(EObj * const *lst, int num,
|
|||
#define REGION_DESTROY(rgn) \
|
||||
if (rgn != NoXID) { ERegionDestroy(rgn); rgn = NoXID; }
|
||||
|
||||
void
|
||||
ECompMgrWinClipToGC(EObj * eo, GC gc)
|
||||
EX_SrvRegion
|
||||
ECompMgrChildClipRegion(void)
|
||||
{
|
||||
EObj *const *lst, *eoi;
|
||||
int i, num;
|
||||
EX_SrvRegion rgn = Mode_compmgr.rgn_tmp2;
|
||||
|
||||
if (!eo || !eo->cmhook)
|
||||
return;
|
||||
if (!Mode_compmgr.active)
|
||||
return NoXID;
|
||||
|
||||
ERegionCopy(rgn, Mode_compmgr.rgn_screen);
|
||||
ERegionSubtract(rgn, eo->cmhook->clip);
|
||||
XFixesSetGCClipRegion(disp, gc, 0, 0, rgn);
|
||||
|
||||
lst = EobjListStackGet(&num);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
eoi = lst[i];
|
||||
if (eoi->cmhook && eoi->cmhook->shape &&
|
||||
(eoi->type == EOBJ_TYPE_EWIN || eoi->type == EOBJ_TYPE_BUTTON ||
|
||||
eoi->type == EOBJ_TYPE_MISC))
|
||||
ERegionSubtract(rgn, eoi->cmhook->shape);
|
||||
}
|
||||
|
||||
return rgn;
|
||||
}
|
||||
|
||||
#if !USE_BG_WIN_ON_ALL_DESKS
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2004-2014 Kim Woelders
|
||||
* Copyright (C) 2004-2021 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "eobj.h"
|
||||
#include "etypes.h"
|
||||
#include "xtypes.h"
|
||||
|
||||
typedef struct {
|
||||
char enable;
|
||||
|
@ -60,7 +61,6 @@ void ECompMgrWinChangeOpacity(EObj * eo, unsigned int opacity);
|
|||
void ECompMgrWinChangeShadow(EObj * eo, int shadow);
|
||||
EX_Pixmap ECompMgrWinGetPixmap(const EObj * eo);
|
||||
EX_Picture ECompMgrWinGetAlphaPict(const EObj * eo);
|
||||
void ECompMgrWinClipToGC(EObj * eo, GC gc);
|
||||
|
||||
void ECompMgrConfigGet(cfg_composite * cfg);
|
||||
void ECompMgrConfigSet(const cfg_composite * cfg);
|
||||
|
@ -70,6 +70,8 @@ int ECompMgrRender(int dt);
|
|||
|
||||
EX_Window ECompMgrRootWin(void);
|
||||
|
||||
EX_SrvRegion ECompMgrChildClipRegion(void);
|
||||
|
||||
#else
|
||||
|
||||
#define ECompMgrIsActive() 0
|
||||
|
|
6
src/fx.c
6
src/fx.c
|
@ -67,10 +67,10 @@ _FxSetup(FXData * d, unsigned int height)
|
|||
{
|
||||
EObj *bgeo;
|
||||
|
||||
bgeo = DeskGetBackgroundObj(DesksGetCurrent());
|
||||
|
||||
if (!d->above)
|
||||
{
|
||||
bgeo = DeskGetBackgroundObj(DesksGetCurrent());
|
||||
|
||||
d->win = EobjGetWin(bgeo);
|
||||
#if USE_COMPOSITE
|
||||
if (ECompMgrIsActive() && !Mode.wm.window)
|
||||
|
@ -89,7 +89,7 @@ _FxSetup(FXData * d, unsigned int height)
|
|||
|
||||
#if USE_COMPOSITE
|
||||
/* As of composite 0.4 we need to set the clip region */
|
||||
ECompMgrWinClipToGC(bgeo, d->gc1);
|
||||
EGCSetClip(d->gc1, ECompMgrChildClipRegion());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
6
src/x.c
6
src/x.c
|
@ -2171,6 +2171,12 @@ EPictureFillRect(EX_Picture pict, int x, int y, int w, int h,
|
|||
|
||||
#if USE_COMPOSITE
|
||||
|
||||
void
|
||||
EGCSetClip(GC gc, EX_SrvRegion clip)
|
||||
{
|
||||
XFixesSetGCClipRegion(disp, gc, 0, 0, clip);
|
||||
}
|
||||
|
||||
void
|
||||
EPictureSetClip(EX_Picture pict, EX_SrvRegion clip)
|
||||
{
|
||||
|
|
|
@ -352,6 +352,7 @@ int ERegionIsEmpty(EX_SrvRegion rgn);
|
|||
void ERegionShow(const char *txt, EX_SrvRegion rgn,
|
||||
void (*prf)(const char *fmt, ...));
|
||||
|
||||
void EGCSetClip(GC gc, EX_SrvRegion clip);
|
||||
void EPictureSetClip(EX_Picture pict, EX_SrvRegion clip);
|
||||
|
||||
EX_Pixmap EWindowGetPixmap(const Win win);
|
||||
|
|
Loading…
Reference in New Issue