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() != ShadeNone; 00068 } 00069 00070 void Bridge::showWindowMenu( QPoint p ) 00071 { 00072 c->workspace()->showWindowMenu( p, c ); 00073 } 00074 00075 void Bridge::showWindowMenu( const QRect &p ) 00076 { 00077 c->workspace()->showWindowMenu( p, c ); 00078 } 00079 00080 void Bridge::performWindowOperation( WindowOperation op ) 00081 { 00082 c->workspace()->performWindowOperation( c, op ); 00083 } 00084 00085 void Bridge::setMask( const QRegion& r, int mode ) 00086 { 00087 c->setMask( r, mode ); 00088 } 00089 00090 bool Bridge::isPreview() const 00091 { 00092 return false; 00093 } 00094 00095 QRect Bridge::iconGeometry() const 00096 { 00097 NETRect r = c->info->iconGeometry(); 00098 return QRect( r.pos.x, r.pos.y, r.size.width, r.size.height ); 00099 } 00100 00101 QWidget* Bridge::workspaceWidget() const 00102 { 00103 return c->workspace()->desktopWidget(); 00104 } 00105 00106 void Bridge::titlebarDblClickOperation() 00107 { 00108 c->workspace()->performWindowOperation( c, options->operationTitlebarDblClick()); 00109 } 00110 00111 void Bridge::setShade( bool set ) 00112 { 00113 c->setShade( set ? ShadeNormal : ShadeNone ); 00114 } 00115 00116 int Bridge::currentDesktop() const 00117 { 00118 return c->workspace()->currentDesktop(); 00119 } 00120 00121 QWidget* Bridge::initialParentWidget() const 00122 { 00123 return NULL; 00124 } 00125 00126 Qt::WFlags Bridge::initialWFlags() const 00127 { 00128 return 0; 00129 } 00130 00131 void Bridge::helperShowHide( bool show ) 00132 { 00133 if( show ) 00134 c->rawShow(); 00135 else 00136 c->rawHide(); 00137 } 00138 00139 QRegion Bridge::unobscuredRegion( const QRegion& r ) const 00140 { 00141 QRegion reg( r ); 00142 const ClientList stacking_order = c->workspace()->stackingOrder(); 00143 ClientList::ConstIterator it = stacking_order.find( c ); 00144 ++it; 00145 for(; 00146 it != stacking_order.end(); 00147 ++it ) 00148 { 00149 if( !(*it)->isShown( true )) 00150 continue; // these don't obscure the window 00151 if( c->isOnAllDesktops()) 00152 { 00153 if( !(*it)->isOnCurrentDesktop()) 00154 continue; 00155 } 00156 else 00157 { 00158 if( !(*it)->isOnDesktop( c->desktop())) 00159 continue; 00160 } 00161 /* the clients all have their mask-regions in local coords 00162 so we have to translate them to a shared coord system 00163 we choose ours */ 00164 int dx = (*it)->x() - c->x(); 00165 int dy = (*it)->y() - c->y(); 00166 QRegion creg = (*it)->mask(); 00167 creg.translate(dx, dy); 00168 reg -= creg; 00169 if (reg.isEmpty()) 00170 { 00171 // early out, we are completely obscured 00172 break; 00173 } 00174 } 00175 return reg; 00176 } 00177 00178 void Bridge::grabXServer( bool grab ) 00179 { 00180 if( grab ) 00181 KWinInternal::grabXServer(); 00182 else 00183 KWinInternal::ungrabXServer(); 00184 } 00185 00186 } // namespace
KDE Logo
This file is part of the documentation for kwin Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 13 21:47:04 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003