• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KWin

bridge.cpp

Go to the documentation of this file.
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 This program is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 This program is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 *********************************************************************/
00020 
00021 #include "bridge.h"
00022 
00023 #include "client.h"
00024 #include "options.h"
00025 
00026 namespace KWin
00027 {
00028 
00029 Bridge::Bridge( Client* cl )
00030     : c( cl )
00031     {
00032     }
00033 
00034 #define BRIDGE_HELPER( rettype, prototype, args1, args2, cst ) \
00035 rettype Bridge::prototype ( args1 ) cst \
00036     { \
00037     return c->prototype( args2 ); \
00038     }
00039 
00040 BRIDGE_HELPER( bool, isActive,,, const )
00041 BRIDGE_HELPER( bool, isCloseable,,, const )
00042 BRIDGE_HELPER( bool, isMaximizable,,, const )
00043 BRIDGE_HELPER( Bridge::MaximizeMode, maximizeMode,,, const )
00044 BRIDGE_HELPER( bool, isMinimizable,,, const )
00045 BRIDGE_HELPER( bool, providesContextHelp,,, const )
00046 BRIDGE_HELPER( int, desktop,,, const )
00047 BRIDGE_HELPER( bool, isModal,,, const )
00048 BRIDGE_HELPER( bool, isShadeable,,, const )
00049 BRIDGE_HELPER( bool, isShade,,, const )
00050 BRIDGE_HELPER( bool, keepAbove,,, const )
00051 BRIDGE_HELPER( bool, keepBelow,,, const )
00052 BRIDGE_HELPER( bool, isMovable,,, const )
00053 BRIDGE_HELPER( bool, isResizable,,, const )
00054 BRIDGE_HELPER( QString, caption,,, const )
00055 BRIDGE_HELPER( void, processMousePressEvent, QMouseEvent* e, e, )
00056 BRIDGE_HELPER( QRect, geometry,,, const )
00057 BRIDGE_HELPER( void, closeWindow,,, )
00058 BRIDGE_HELPER( void, maximize, MaximizeMode m, m, )
00059 BRIDGE_HELPER( void, minimize,,, )
00060 BRIDGE_HELPER( void, showContextHelp,,, )
00061 BRIDGE_HELPER( void, setDesktop, int desktop, desktop, )
00062 
00063 void Bridge::setKeepAbove( bool set )
00064     {
00065     if( c->keepAbove() != set )
00066         c->workspace()->performWindowOperation( c, KeepAboveOp );
00067     }
00068 
00069 void Bridge::setKeepBelow( bool set )
00070     {
00071     if( c->keepBelow() != set )
00072         c->workspace()->performWindowOperation( c, KeepBelowOp );
00073     }
00074 
00075 NET::WindowType Bridge::windowType( unsigned long supported_types ) const
00076     {
00077     return c->windowType( false, supported_types );
00078     }
00079 
00080 QIcon Bridge::icon() const
00081     {
00082     QIcon ret( c->icon());
00083     ret.addPixmap( c->miniIcon());
00084     return ret;
00085     }
00086 
00087 bool Bridge::isSetShade() const
00088     {
00089     return c->shadeMode() != ShadeNone;
00090     }
00091 
00092 void Bridge::showWindowMenu( const QPoint &p )
00093     {
00094     c->workspace()->showWindowMenu( p, c );
00095     }
00096 
00097 void Bridge::showWindowMenu( const QRect &p )
00098     {
00099     c->workspace()->showWindowMenu( p, c );
00100     }
00101 
00102 void Bridge::performWindowOperation( WindowOperation op )
00103     {
00104     c->workspace()->performWindowOperation( c, op );
00105     }
00106 
00107 void Bridge::setMask( const QRegion& r, int mode )
00108     {
00109     c->setMask( r, mode );
00110     }
00111 
00112 bool Bridge::isPreview() const
00113     {
00114     return false;
00115     }
00116 
00117 QRect Bridge::iconGeometry() const
00118     {
00119     NETRect r = c->info->iconGeometry();
00120     return QRect( r.pos.x, r.pos.y, r.size.width, r.size.height );
00121     }
00122 
00123 WId Bridge::windowId() const
00124     {
00125     return c->window();
00126     }
00127 
00128 void Bridge::titlebarDblClickOperation()
00129     {
00130     c->workspace()->performWindowOperation( c, options->operationTitlebarDblClick());
00131     }
00132 
00133 void Bridge::titlebarMouseWheelOperation( int delta )
00134     {
00135     c->performMouseCommand( options->operationTitlebarMouseWheel( delta ), cursorPos());
00136     }
00137 
00138 void Bridge::setShade( bool set )
00139     {
00140     c->setShade( set ? ShadeNormal : ShadeNone );
00141     }
00142 
00143 int Bridge::currentDesktop() const
00144     {
00145     return c->workspace()->currentDesktop();
00146     }
00147 
00148 QWidget* Bridge::initialParentWidget() const
00149     {
00150     return NULL;
00151     }
00152 
00153 Qt::WFlags Bridge::initialWFlags() const
00154     {
00155     return 0;
00156     }
00157 
00158 QRegion Bridge::unobscuredRegion( const QRegion& r ) const
00159     {
00160     QRegion reg( r );
00161     const ClientList stacking_order = c->workspace()->stackingOrder();
00162     int pos = stacking_order.indexOf( c );
00163     ++pos;
00164     for(; pos < stacking_order.count(); ++pos )
00165         {
00166         if( !stacking_order[pos]->isShown( true ))
00167             continue; // these don't obscure the window
00168         if( c->isOnAllDesktops())
00169             {
00170             if( !stacking_order[ pos ]->isOnCurrentDesktop())
00171                 continue;
00172             }
00173         else
00174             {
00175             if( !stacking_order[ pos ]->isOnDesktop( c->desktop()))
00176                 continue;
00177             }
00178         /* the clients all have their mask-regions in local coords
00179        so we have to translate them to a shared coord system
00180        we choose ours */
00181     int dx = stacking_order[ pos ]->x() - c->x();
00182     int dy = stacking_order[ pos ]->y() - c->y();
00183     QRegion creg = stacking_order[ pos ]->mask();
00184     creg.translate(dx, dy);
00185     reg -= creg;
00186     if (reg.isEmpty())
00187             {
00188         // early out, we are completely obscured
00189         break;
00190         }
00191         }
00192     return reg;
00193     }
00194 
00195 void Bridge::grabXServer( bool grab )
00196     {
00197     if( grab )
00198         KWin::grabXServer();
00199     else
00200         KWin::ungrabXServer();
00201     }
00202 
00203 } // namespace

KWin

Skip menu "KWin"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal