Merging from old trunk:

r571712 | lunakl | 2006-08-10 15:15:16 +0200 (Thu, 10 Aug 2006) | 3 lines

Support for input shape from XShape1.1 (#122425).


svn path=/trunk/KDE/kdebase/workspace/; revision=659272
This commit is contained in:
Luboš Luňák 2007-04-29 21:19:29 +00:00
parent 12d97dbd49
commit 5feb577369
4 changed files with 38 additions and 8 deletions

View file

@ -458,13 +458,36 @@ void Client::setUserNoBorder( bool set )
void Client::updateShape()
{
if ( shape() )
// workaround for #19644 - shaped windows shouldn't have decoration
if( shape() && !noBorder())
{
noborder = true;
updateDecoration( true );
}
if( shape())
{
XShapeCombineShape(display(), frameId(), ShapeBounding,
clientPos().x(), clientPos().y(),
window(), ShapeBounding, ShapeSet);
}
else
{
XShapeCombineMask( display(), frameId(), ShapeBounding, 0, 0,
None, ShapeSet);
}
if( Extensions::shapeMajor() > 1 || Extensions::shapeMinor() >= 1 ) // has input shape support
{ // there appears to be no way to find out if a window has input
// shape set or not, so always set propagate the input shape
// (it's the same like the bounding shape by default)
XShapeCombineMask( display(), frameId(), ShapeInput, 0, 0,
None, ShapeSet );
XShapeCombineShape( display(), frameId(), ShapeInput,
clientPos().x(), clientPos().y(),
window(), ShapeBounding, ShapeSubtract );
XShapeCombineShape( display(), frameId(), ShapeInput,
clientPos().x(), clientPos().y(),
window(), ShapeInput, ShapeUnion );
}
if( compositing())
addDamageFull();
if( scene != NULL )

View file

@ -1758,8 +1758,7 @@ void Client::plainResize( int w, int h, ForceGeometry_t force )
cs.width(), cs.height());
XMoveResizeWindow( display(), window(), 0, 0, cs.width(), cs.height());
}
if( shape())
updateShape();
updateShape();
updateWorkareaDiffs();
sendSyntheticConfigureNotify();
updateWindowRules();

View file

@ -45,7 +45,7 @@ namespace KWin
#ifndef KCMRULES
bool Extensions::has_shape = false;
int Shape::kwin_shape_version = 0;
int Extensions::shape_event_base = 0;
bool Extensions::has_randr = false;
int Extensions::randr_event_base = 0;
@ -58,7 +58,13 @@ bool Extensions::has_fixes = false;
void Extensions::init()
{
int dummy;
has_shape = XShapeQueryExtension( display(), &shape_event_base, &dummy);
shape_version = 0;
if( XShapeQueryExtension( display(), &kwin_shape_event, &dummy ))
{
int major, minor;
if( XShapeQueryVersion( display(), &major, &minor ))
kwin_shape_version = major * 16 + minor;
}
#ifdef HAVE_XRANDR
has_randr = XRRQueryExtension( display(), &randr_event_base, &dummy );
if( has_randr )
@ -106,7 +112,7 @@ bool Extensions::hasShape( Window w )
int xws, yws, xbs, ybs;
unsigned int wws, hws, wbs, hbs;
int boundingShaped = 0, clipShaped = 0;
if( !Extensions::shapeAvailable())
if( !shapeAvailable())
return false;
XShapeQueryExtents(display(), w,
&boundingShaped, &xws, &yws, &wws, &hws,

View file

@ -148,7 +148,9 @@ class Extensions
{
public:
static void init();
static bool shapeAvailable() { return has_shape; }
static bool shapeAvailable() { return shape_version > 0; }
static int shapeMajor() { return shape_version / 16; }
static int shapeMinor() { return shape_version % 16; }
static int shapeNotifyEvent();
static bool randrAvailable() { return has_randr; }
static int randrNotifyEvent();
@ -159,7 +161,7 @@ class Extensions
static bool fixesAvailable() { return has_fixes; }
static bool hasShape( Window w );
private:
static bool has_shape;
static int shape_version; // as 16*major+minor
static int shape_event_base;
static bool has_randr;
static int randr_event_base;