You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
207 lines
5.0 KiB
207 lines
5.0 KiB
15 years ago
|
/*****************************************************************
|
||
|
KWin - the KDE window manager
|
||
|
This file is part of the KDE project.
|
||
|
|
||
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
||
|
|
||
|
You can Freely distribute this program under the GNU General Public
|
||
|
License. See the file "COPYING" for the exact licensing terms.
|
||
|
******************************************************************/
|
||
|
|
||
|
#include "bridge.h"
|
||
|
|
||
|
#include "client.h"
|
||
|
#include "options.h"
|
||
|
|
||
|
namespace KWinInternal
|
||
|
{
|
||
|
|
||
|
Bridge::Bridge( Client* cl )
|
||
|
: c( cl )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
#define BRIDGE_HELPER( rettype, prototype, args1, args2, cst ) \
|
||
|
rettype Bridge::prototype ( args1 ) cst \
|
||
|
{ \
|
||
|
return c->prototype( args2 ); \
|
||
|
}
|
||
|
|
||
|
BRIDGE_HELPER( bool, isActive,,, const )
|
||
|
BRIDGE_HELPER( bool, isCloseable,,, const )
|
||
|
BRIDGE_HELPER( bool, isMaximizable,,, const )
|
||
|
BRIDGE_HELPER( Bridge::MaximizeMode, maximizeMode,,, const )
|
||
|
BRIDGE_HELPER( bool, isMinimizable,,, const )
|
||
|
BRIDGE_HELPER( bool, providesContextHelp,,, const )
|
||
|
BRIDGE_HELPER( int, desktop,,, const )
|
||
|
BRIDGE_HELPER( bool, isModal,,, const )
|
||
|
BRIDGE_HELPER( bool, isShadeable,,, const )
|
||
|
BRIDGE_HELPER( bool, isShade,,, const )
|
||
|
BRIDGE_HELPER( bool, keepAbove,,, const )
|
||
|
BRIDGE_HELPER( bool, keepBelow,,, const )
|
||
|
BRIDGE_HELPER( bool, isMovable,,, const )
|
||
|
BRIDGE_HELPER( bool, isResizable,,, const )
|
||
15 years ago
|
BRIDGE_HELPER( TQString, caption,,, const )
|
||
|
BRIDGE_HELPER( void, processMousePressEvent, TQMouseEvent* e, e, )
|
||
14 years ago
|
BRIDGE_HELPER( TQRect, geometry,,, const )
|
||
15 years ago
|
BRIDGE_HELPER( void, closeWindow,,, )
|
||
|
BRIDGE_HELPER( void, maximize, MaximizeMode m, m, )
|
||
|
BRIDGE_HELPER( void, minimize,,, )
|
||
|
BRIDGE_HELPER( void, showContextHelp,,, )
|
||
|
BRIDGE_HELPER( void, setDesktop, int desktop, desktop, )
|
||
|
|
||
|
void Bridge::setKeepAbove( bool set )
|
||
|
{
|
||
|
if( c->keepAbove() != set )
|
||
|
c->workspace()->performWindowOperation( c, KeepAboveOp );
|
||
|
}
|
||
|
|
||
|
void Bridge::setKeepBelow( bool set )
|
||
|
{
|
||
|
if( c->keepBelow() != set )
|
||
|
c->workspace()->performWindowOperation( c, KeepBelowOp );
|
||
|
}
|
||
|
|
||
|
NET::WindowType Bridge::windowType( unsigned long supported_types ) const
|
||
|
{
|
||
|
return c->windowType( false, supported_types );
|
||
|
}
|
||
|
|
||
15 years ago
|
TQIconSet Bridge::icon() const
|
||
15 years ago
|
{
|
||
15 years ago
|
return TQIconSet( c->miniIcon(), c->icon());
|
||
15 years ago
|
}
|
||
|
|
||
|
bool Bridge::isSetShade() const
|
||
|
{
|
||
|
return c->shadeMode() != ShadeNone;
|
||
|
}
|
||
|
|
||
15 years ago
|
void Bridge::showWindowMenu( TQPoint p )
|
||
15 years ago
|
{
|
||
|
c->workspace()->showWindowMenu( p, c );
|
||
|
}
|
||
|
|
||
15 years ago
|
void Bridge::showWindowMenu( const TQRect &p )
|
||
15 years ago
|
{
|
||
|
c->workspace()->showWindowMenu( p, c );
|
||
|
}
|
||
|
|
||
|
void Bridge::performWindowOperation( WindowOperation op )
|
||
|
{
|
||
|
c->workspace()->performWindowOperation( c, op );
|
||
|
}
|
||
|
|
||
15 years ago
|
void Bridge::setMask( const TQRegion& r, int mode )
|
||
15 years ago
|
{
|
||
|
c->setMask( r, mode );
|
||
|
}
|
||
|
|
||
|
bool Bridge::isPreview() const
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
|
||
15 years ago
|
TQRect Bridge::iconGeometry() const
|
||
15 years ago
|
{
|
||
|
NETRect r = c->info->iconGeometry();
|
||
15 years ago
|
return TQRect( r.pos.x, r.pos.y, r.size.width, r.size.height );
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
TQWidget* Bridge::workspaceWidget() const
|
||
15 years ago
|
{
|
||
|
return c->workspace()->desktopWidget();
|
||
|
}
|
||
|
|
||
|
WId Bridge::windowId() const
|
||
|
{
|
||
|
return c->window();
|
||
|
}
|
||
|
|
||
|
void Bridge::titlebarDblClickOperation()
|
||
|
{
|
||
|
c->workspace()->performWindowOperation( c, options->operationTitlebarDblClick());
|
||
|
}
|
||
|
|
||
|
void Bridge::titlebarMouseWheelOperation( int delta )
|
||
|
{
|
||
15 years ago
|
c->performMouseCommand( options->operationTitlebarMouseWheel( delta ), TQCursor::pos());
|
||
15 years ago
|
}
|
||
|
|
||
|
void Bridge::setShade( bool set )
|
||
|
{
|
||
|
c->setShade( set ? ShadeNormal : ShadeNone );
|
||
|
}
|
||
|
|
||
|
int Bridge::currentDesktop() const
|
||
|
{
|
||
|
return c->workspace()->currentDesktop();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQWidget* Bridge::initialParentWidget() const
|
||
15 years ago
|
{
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
Qt::WFlags Bridge::initialWFlags() const
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
void Bridge::helperShowHide( bool show )
|
||
|
{
|
||
|
if( show )
|
||
|
c->rawShow();
|
||
|
else
|
||
|
c->rawHide();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQRegion Bridge::unobscuredRegion( const TQRegion& r ) const
|
||
15 years ago
|
{
|
||
15 years ago
|
TQRegion reg( r );
|
||
15 years ago
|
const ClientList stacking_order = c->workspace()->stackingOrder();
|
||
13 years ago
|
ClientList::ConstIterator it = stacking_order.find( c );
|
||
15 years ago
|
++it;
|
||
|
for(;
|
||
|
it != stacking_order.end();
|
||
|
++it )
|
||
|
{
|
||
|
if( !(*it)->isShown( true ))
|
||
|
continue; // these don't obscure the window
|
||
|
if( c->isOnAllDesktops())
|
||
|
{
|
||
|
if( !(*it)->isOnCurrentDesktop())
|
||
|
continue;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if( !(*it)->isOnDesktop( c->desktop()))
|
||
|
continue;
|
||
|
}
|
||
14 years ago
|
/* the clients all have their mask-regions in local coords
|
||
15 years ago
|
so we have to translate them to a shared coord system
|
||
|
we choose ours */
|
||
|
int dx = (*it)->x() - c->x();
|
||
|
int dy = (*it)->y() - c->y();
|
||
14 years ago
|
TQRegion creg = (*it)->mask();
|
||
15 years ago
|
creg.translate(dx, dy);
|
||
|
reg -= creg;
|
||
|
if (reg.isEmpty())
|
||
|
{
|
||
|
// early out, we are completely obscured
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return reg;
|
||
|
}
|
||
|
|
||
|
void Bridge::grabXServer( bool grab )
|
||
|
{
|
||
|
if( grab )
|
||
|
KWinInternal::grabXServer();
|
||
|
else
|
||
|
KWinInternal::ungrabXServer();
|
||
|
}
|
||
|
|
||
|
} // namespace
|