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

twin

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

twin

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

twin

Skip menu "twin"
  • kate
  • libkonq
  • twin
  •   lib
Generated for twin by doxygen 1.9.1
This website is maintained by Timothy Pearson.