kwin Library API Documentation

bridge.cpp

00001 /***************************************************************** 00002 KWin - the KDE window manager 00003 This file is part of the KDE project. 00004 00005 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> 00006 00007 You can Freely distribute this program under the GNU General Public 00008 License. See the file "COPYING" for the exact licensing terms. 00009 ******************************************************************/ 00010 00011 #include "bridge.h" 00012 00013 #include "client.h" 00014 #include "options.h" 00015 00016 namespace KWinInternal 00017 { 00018 00019 Bridge::Bridge( Client* cl ) 00020 : c( cl ) 00021 { 00022 } 00023 00024 #define BRIDGE_HELPER( rettype, prototype, args1, args2, cst ) \ 00025 rettype Bridge::prototype ( args1 ) cst \ 00026 { \ 00027 return c->prototype( args2 ); \ 00028 } 00029 00030 BRIDGE_HELPER( bool, isActive,,, const ) 00031 BRIDGE_HELPER( bool, isCloseable,,, const ) 00032 BRIDGE_HELPER( bool, isMaximizable,,, const ) 00033 BRIDGE_HELPER( Bridge::MaximizeMode, maximizeMode,,, const ) 00034 BRIDGE_HELPER( bool, isMinimizable,,, const ) 00035 BRIDGE_HELPER( bool, providesContextHelp,,, const ) 00036 BRIDGE_HELPER( int, desktop,,, const ) 00037 BRIDGE_HELPER( bool, isModal,,, const ) 00038 BRIDGE_HELPER( bool, isShadeable,,, const ) 00039 BRIDGE_HELPER( bool, isShade,,, const ) 00040 BRIDGE_HELPER( bool, keepAbove,,, const ) 00041 BRIDGE_HELPER( bool, keepBelow,,, const ) 00042 BRIDGE_HELPER( bool, isMovable,,, const ) 00043 BRIDGE_HELPER( bool, isResizable,,, const ) 00044 BRIDGE_HELPER( QString, caption,,, const ) 00045 BRIDGE_HELPER( void, processMousePressEvent, QMouseEvent* e, e, ) 00046 BRIDGE_HELPER( QRect, geometry,,, const ) 00047 BRIDGE_HELPER( void, closeWindow,,, ) 00048 BRIDGE_HELPER( void, maximize, MaximizeMode m, m, ) 00049 BRIDGE_HELPER( void, minimize,,, ) 00050 BRIDGE_HELPER( void, showContextHelp,,, ) 00051 BRIDGE_HELPER( void, setDesktop, int desktop, desktop, ) 00052 BRIDGE_HELPER( void, setKeepAbove, bool set, set, ) 00053 BRIDGE_HELPER( void, setKeepBelow, bool set, set, ) 00054 00055 NET::WindowType Bridge::windowType( unsigned long supported_types ) const 00056 { 00057 return c->windowType( false, supported_types ); 00058 } 00059 00060 QIconSet Bridge::icon() const 00061 { 00062 return QIconSet( c->miniIcon(), c->icon()); 00063 } 00064 00065 bool Bridge::isSetShade() const 00066 { 00067 return c->shadeMode() != Client::ShadeNone; 00068 } 00069 00070 void Bridge::showWindowMenu( QPoint p ) 00071 { 00072 c->workspace()->showWindowMenu( p, c ); 00073 } 00074 00075 void Bridge::performWindowOperation( WindowOperation op ) 00076 { 00077 c->workspace()->performWindowOperation( c, op ); 00078 } 00079 00080 void Bridge::setMask( const QRegion& r, int mode ) 00081 { 00082 c->setMask( r, mode ); 00083 } 00084 00085 bool Bridge::isPreview() const 00086 { 00087 return false; 00088 } 00089 00090 QRect Bridge::iconGeometry() const 00091 { 00092 NETRect r = c->info->iconGeometry(); 00093 return QRect( r.pos.x, r.pos.y, r.size.width, r.size.height ); 00094 } 00095 00096 QWidget* Bridge::workspaceWidget() const 00097 { 00098 return c->workspace()->desktopWidget(); 00099 } 00100 00101 void Bridge::titlebarDblClickOperation() 00102 { 00103 c->workspace()->performWindowOperation( c, options->operationTitlebarDblClick()); 00104 } 00105 00106 void Bridge::setShade( bool set ) 00107 { 00108 c->setShade( set ? Client::ShadeNormal : Client::ShadeNone ); 00109 } 00110 00111 int Bridge::currentDesktop() const 00112 { 00113 return c->workspace()->currentDesktop(); 00114 } 00115 00116 QWidget* Bridge::initialParentWidget() const 00117 { 00118 return NULL; 00119 } 00120 00121 Qt::WFlags Bridge::initialWFlags() const 00122 { 00123 return 0; 00124 } 00125 00126 void Bridge::helperShowHide( bool show ) 00127 { 00128 if( show ) 00129 c->rawShow(); 00130 else 00131 c->rawHide(); 00132 } 00133 00134 QRegion Bridge::unobscuredRegion( const QRegion& r ) const 00135 { 00136 QRegion reg( r ); 00137 const ClientList stacking_order = c->workspace()->stackingOrder(); 00138 ClientList::ConstIterator it = stacking_order.find( c ); 00139 ++it; 00140 for(; 00141 it != stacking_order.end(); 00142 ++it ) 00143 { 00144 if( !(*it)->isShown( true )) 00145 continue; // these don't obscure the window 00146 if( c->isOnAllDesktops()) 00147 { 00148 if( !(*it)->isOnCurrentDesktop()) 00149 continue; 00150 } 00151 else 00152 { 00153 if( !(*it)->isOnDesktop( c->desktop())) 00154 continue; 00155 } 00156 /* the clients all have their mask-regions in local coords 00157 so we have to translate them to a shared coord system 00158 we choose ours */ 00159 int dx = (*it)->x() - c->x(); 00160 int dy = (*it)->y() - c->y(); 00161 QRegion creg = (*it)->mask(); 00162 creg.translate(dx, dy); 00163 reg -= creg; 00164 if (reg.isEmpty()) 00165 { 00166 // early out, we are completely obscured 00167 break; 00168 } 00169 } 00170 return reg; 00171 } 00172 00173 void Bridge::grabXServer( bool grab ) 00174 { 00175 if( grab ) 00176 KWinInternal::grabXServer(); 00177 else 00178 KWinInternal::ungrabXServer(); 00179 } 00180 00181 } // namespace
KDE Logo
This file is part of the documentation for kwin Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Dec 16 19:08:40 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003