• 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
5Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
6
7You can Freely distribute this program under the GNU General Public
8License. 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
16namespace KWinInternal
17{
18
19Bridge::Bridge( Client* cl )
20 : c( cl )
21 {
22 }
23
24Bridge::~Bridge()
25 {
26 }
27
28#define BRIDGE_HELPER( rettype, prototype, args1, args2, cst ) \
29rettype Bridge::prototype ( args1 ) cst \
30 { \
31 return c->prototype( args2 ); \
32 }
33
34BRIDGE_HELPER( bool, isActive,,, const )
35BRIDGE_HELPER( bool, isCloseable,,, const )
36BRIDGE_HELPER( bool, isMaximizable,,, const )
37BRIDGE_HELPER( Bridge::MaximizeMode, maximizeMode,,, const )
38BRIDGE_HELPER( bool, isMinimizable,,, const )
39BRIDGE_HELPER( bool, providesContextHelp,,, const )
40BRIDGE_HELPER( int, desktop,,, const )
41BRIDGE_HELPER( bool, isModal,,, const )
42BRIDGE_HELPER( bool, isShadeable,,, const )
43BRIDGE_HELPER( bool, isShade,,, const )
44BRIDGE_HELPER( bool, keepAbove,,, const )
45BRIDGE_HELPER( bool, keepBelow,,, const )
46BRIDGE_HELPER( bool, isMovable,,, const )
47BRIDGE_HELPER( bool, isResizable,,, const )
48BRIDGE_HELPER( TQString, caption,,, const )
49BRIDGE_HELPER( void, processMousePressEvent, TQMouseEvent* e, e, )
50BRIDGE_HELPER( TQRect, geometry,,, const )
51BRIDGE_HELPER( void, closeWindow,,, )
52BRIDGE_HELPER( void, maximize, MaximizeMode m, m, )
53BRIDGE_HELPER( void, minimize,,, )
54BRIDGE_HELPER( void, showContextHelp,,, )
55BRIDGE_HELPER( void, setDesktop, int desktop, desktop, )
56
57void Bridge::setKeepAbove( bool set )
58 {
59 if( c->keepAbove() != set )
60 c->workspace()->performWindowOperation( c, KeepAboveOp );
61 }
62
63void Bridge::setKeepBelow( bool set )
64 {
65 if( c->keepBelow() != set )
66 c->workspace()->performWindowOperation( c, KeepBelowOp );
67 }
68
69NET::WindowType Bridge::windowType( unsigned long supported_types ) const
70 {
71 return c->windowType( false, supported_types );
72 }
73
74TQIconSet Bridge::icon() const
75 {
76 return TQIconSet( c->miniIcon(), c->icon());
77 }
78
79bool Bridge::isSetShade() const
80 {
81 return c->shadeMode() != ShadeNone;
82 }
83
84void Bridge::showWindowMenu( TQPoint p )
85 {
86 c->workspace()->showWindowMenu( p, c );
87 }
88
89void Bridge::showWindowMenu( const TQRect &p )
90 {
91 c->workspace()->showWindowMenu( p, c );
92 }
93
94void Bridge::performWindowOperation( WindowOperation op )
95 {
96 c->workspace()->performWindowOperation( c, op );
97 }
98
99void Bridge::setMask( const TQRegion& r, int mode )
100 {
101 c->setMask( r, mode );
102 }
103
104bool Bridge::isPreview() const
105 {
106 return false;
107 }
108
109TQRect 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
115TQWidget* Bridge::workspaceWidget() const
116 {
117 return c->workspace()->desktopWidget();
118 }
119
120WId Bridge::windowId() const
121 {
122 return c->window();
123 }
124
125void Bridge::titlebarDblClickOperation()
126 {
127 c->workspace()->performWindowOperation( c, options->operationTitlebarDblClick());
128 }
129
130void Bridge::titlebarMouseWheelOperation( int delta )
131 {
132 c->performMouseCommand( options->operationTitlebarMouseWheel( delta ), TQCursor::pos());
133 }
134
135void Bridge::setShade( bool set )
136 {
137 c->setShade( set ? ShadeNormal : ShadeNone );
138 }
139
140int Bridge::currentDesktop() const
141 {
142 return c->workspace()->currentDesktop();
143 }
144
145TQWidget* Bridge::initialParentWidget() const
146 {
147 return NULL;
148 }
149
150TQt::WFlags Bridge::initialWFlags() const
151 {
152 return 0;
153 }
154
155void Bridge::helperShowHide( bool show )
156 {
157 if( show )
158 c->rawShow();
159 else
160 c->rawHide();
161 }
162
163TQRegion 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
202void 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.4
This website is maintained by Timothy Pearson.