• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kwin
 

kwin

  • kwin
bridge.cpp
1 /*****************************************************************
2  KWin - the KDE window manager
3  This file is part of the KDE project.
4 
5 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
6 
7 You can Freely distribute this program under the GNU General Public
8 License. See the file "COPYING" for the exact licensing terms.
9 ******************************************************************/
10 
11 #include "bridge.h"
12 
13 #include "client.h"
14 #include "options.h"
15 
16 namespace KWinInternal
17 {
18 
19 Bridge::Bridge( Client* cl )
20  : c( cl )
21  {
22  }
23 
24 #define BRIDGE_HELPER( rettype, prototype, args1, args2, cst ) \
25 rettype Bridge::prototype ( args1 ) cst \
26  { \
27  return c->prototype( args2 ); \
28  }
29 
30 BRIDGE_HELPER( bool, isActive,,, const )
31 BRIDGE_HELPER( bool, isCloseable,,, const )
32 BRIDGE_HELPER( bool, isMaximizable,,, const )
33 BRIDGE_HELPER( Bridge::MaximizeMode, maximizeMode,,, const )
34 BRIDGE_HELPER( bool, isMinimizable,,, const )
35 BRIDGE_HELPER( bool, providesContextHelp,,, const )
36 BRIDGE_HELPER( int, desktop,,, const )
37 BRIDGE_HELPER( bool, isModal,,, const )
38 BRIDGE_HELPER( bool, isShadeable,,, const )
39 BRIDGE_HELPER( bool, isShade,,, const )
40 BRIDGE_HELPER( bool, keepAbove,,, const )
41 BRIDGE_HELPER( bool, keepBelow,,, const )
42 BRIDGE_HELPER( bool, isMovable,,, const )
43 BRIDGE_HELPER( bool, isResizable,,, const )
44 BRIDGE_HELPER( TQString, caption,,, const )
45 BRIDGE_HELPER( void, processMousePressEvent, TQMouseEvent* e, e, )
46 BRIDGE_HELPER( TQRect, geometry,,, const )
47 BRIDGE_HELPER( void, closeWindow,,, )
48 BRIDGE_HELPER( void, maximize, MaximizeMode m, m, )
49 BRIDGE_HELPER( void, minimize,,, )
50 BRIDGE_HELPER( void, showContextHelp,,, )
51 BRIDGE_HELPER( void, setDesktop, int desktop, desktop, )
52 
53 void Bridge::setKeepAbove( bool set )
54  {
55  if( c->keepAbove() != set )
56  c->workspace()->performWindowOperation( c, KeepAboveOp );
57  }
58 
59 void Bridge::setKeepBelow( bool set )
60  {
61  if( c->keepBelow() != set )
62  c->workspace()->performWindowOperation( c, KeepBelowOp );
63  }
64 
65 NET::WindowType Bridge::windowType( unsigned long supported_types ) const
66  {
67  return c->windowType( false, supported_types );
68  }
69 
70 TQIconSet Bridge::icon() const
71  {
72  return TQIconSet( c->miniIcon(), c->icon());
73  }
74 
75 bool Bridge::isSetShade() const
76  {
77  return c->shadeMode() != ShadeNone;
78  }
79 
80 void Bridge::showWindowMenu( TQPoint p )
81  {
82  c->workspace()->showWindowMenu( p, c );
83  }
84 
85 void Bridge::showWindowMenu( const TQRect &p )
86  {
87  c->workspace()->showWindowMenu( p, c );
88  }
89 
90 void Bridge::performWindowOperation( WindowOperation op )
91  {
92  c->workspace()->performWindowOperation( c, op );
93  }
94 
95 void Bridge::setMask( const TQRegion& r, int mode )
96  {
97  c->setMask( r, mode );
98  }
99 
100 bool Bridge::isPreview() const
101  {
102  return false;
103  }
104 
105 TQRect Bridge::iconGeometry() const
106  {
107  NETRect r = c->info->iconGeometry();
108  return TQRect( r.pos.x, r.pos.y, r.size.width, r.size.height );
109  }
110 
111 TQWidget* Bridge::workspaceWidget() const
112  {
113  return c->workspace()->desktopWidget();
114  }
115 
116 WId Bridge::windowId() const
117  {
118  return c->window();
119  }
120 
121 void Bridge::titlebarDblClickOperation()
122  {
123  c->workspace()->performWindowOperation( c, options->operationTitlebarDblClick());
124  }
125 
126 void Bridge::titlebarMouseWheelOperation( int delta )
127  {
128  c->performMouseCommand( options->operationTitlebarMouseWheel( delta ), TQCursor::pos());
129  }
130 
131 void Bridge::setShade( bool set )
132  {
133  c->setShade( set ? ShadeNormal : ShadeNone );
134  }
135 
136 int Bridge::currentDesktop() const
137  {
138  return c->workspace()->currentDesktop();
139  }
140 
141 TQWidget* Bridge::initialParentWidget() const
142  {
143  return NULL;
144  }
145 
146 Qt::WFlags Bridge::initialWFlags() const
147  {
148  return 0;
149  }
150 
151 void Bridge::helperShowHide( bool show )
152  {
153  if( show )
154  c->rawShow();
155  else
156  c->rawHide();
157  }
158 
159 TQRegion Bridge::unobscuredRegion( const TQRegion& r ) const
160  {
161  TQRegion reg( r );
162  const ClientList stacking_order = c->workspace()->stackingOrder();
163  ClientList::ConstIterator it = stacking_order.find( c );
164  ++it;
165  for(;
166  it != stacking_order.end();
167  ++it )
168  {
169  if( !(*it)->isShown( true ))
170  continue; // these don't obscure the window
171  if( c->isOnAllDesktops())
172  {
173  if( !(*it)->isOnCurrentDesktop())
174  continue;
175  }
176  else
177  {
178  if( !(*it)->isOnDesktop( c->desktop()))
179  continue;
180  }
181  /* the clients all have their mask-regions in local coords
182  so we have to translate them to a shared coord system
183  we choose ours */
184  int dx = (*it)->x() - c->x();
185  int dy = (*it)->y() - c->y();
186  TQRegion creg = (*it)->mask();
187  creg.translate(dx, dy);
188  reg -= creg;
189  if (reg.isEmpty())
190  {
191  // early out, we are completely obscured
192  break;
193  }
194  }
195  return reg;
196  }
197 
198 void Bridge::grabXServer( bool grab )
199  {
200  if( grab )
201  KWinInternal::grabXServer();
202  else
203  KWinInternal::ungrabXServer();
204  }
205 
206 } // namespace

kwin

Skip menu "kwin"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

kwin

Skip menu "kwin"
  • kate
  • kwin
  •   lib
  • libkonq
Generated for kwin by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |