Commit 4fd08556 authored by Martin Flöser's avatar Martin Flöser

KWin uses kdelibs coding style.

parent 63d5c0c7
This diff is collapsed.
...@@ -27,7 +27,7 @@ namespace KWin ...@@ -27,7 +27,7 @@ namespace KWin
{ {
Atoms::Atoms() Atoms::Atoms()
{ {
const int max = 50; const int max = 50;
Atom* atoms[max]; Atom* atoms[max];
...@@ -84,41 +84,41 @@ Atoms::Atoms() ...@@ -84,41 +84,41 @@ Atoms::Atoms()
atoms[n] = &kde_system_tray_embedding; atoms[n] = &kde_system_tray_embedding;
names[n++] = (char*) "_KDE_SYSTEM_TRAY_EMBEDDING"; names[n++] = (char*) "_KDE_SYSTEM_TRAY_EMBEDDING";
atoms[n] = &net_wm_take_activity; atoms[n] = &net_wm_take_activity;
names[n++] = (char*) "_NET_WM_TAKE_ACTIVITY"; names[n++] = (char*) "_NET_WM_TAKE_ACTIVITY";
atoms[n] = &net_wm_window_opacity; atoms[n] = &net_wm_window_opacity;
names[n++] = (char*) "_NET_WM_WINDOW_OPACITY"; names[n++] = (char*) "_NET_WM_WINDOW_OPACITY";
Atom fake; Atom fake;
atoms[n] = &fake; atoms[n] = &fake;
names[n++] = (char *) "_DT_SM_WINDOW_INFO"; names[n++] = (char *) "_DT_SM_WINDOW_INFO";
atoms[n] = &fake; atoms[n] = &fake;
names[n++] = (char *) "_MOTIF_WM_INFO"; // #172028 names[n++] = (char *) "_MOTIF_WM_INFO"; // #172028
atoms[n] = &xdnd_aware; atoms[n] = &xdnd_aware;
names[n++] = (char*) "XdndAware"; names[n++] = (char*) "XdndAware";
atoms[n] = &xdnd_position; atoms[n] = &xdnd_position;
names[n++] = (char*) "XdndPosition"; names[n++] = (char*) "XdndPosition";
atoms[n] = &net_frame_extents; atoms[n] = &net_frame_extents;
names[n++] = (char*) "_NET_FRAME_EXTENTS"; names[n++] = (char*) "_NET_FRAME_EXTENTS";
atoms[n] = &kde_net_wm_frame_strut; atoms[n] = &kde_net_wm_frame_strut;
names[n++] = (char*) "_KDE_NET_WM_FRAME_STRUT"; names[n++] = (char*) "_KDE_NET_WM_FRAME_STRUT";
atoms[n] = &net_wm_sync_request_counter; atoms[n] = &net_wm_sync_request_counter;
names[n++] = (char*) "_NET_WM_SYNC_REQUEST_COUNTER"; names[n++] = (char*) "_NET_WM_SYNC_REQUEST_COUNTER";
atoms[n] = &net_wm_sync_request; atoms[n] = &net_wm_sync_request;
names[n++] = (char*) "_NET_WM_SYNC_REQUEST"; names[n++] = (char*) "_NET_WM_SYNC_REQUEST";
assert( n <= max ); assert(n <= max);
XInternAtoms( display(), names, n, false, atoms_return ); XInternAtoms(display(), names, n, false, atoms_return);
for (int i = 0; i < n; i++ ) for (int i = 0; i < n; i++)
*atoms[i] = atoms_return[i]; *atoms[i] = atoms_return[i];
} }
} // namespace } // namespace
...@@ -29,38 +29,38 @@ namespace KWin ...@@ -29,38 +29,38 @@ namespace KWin
{ {
class Atoms class Atoms
{ {
public: public:
Atoms(); Atoms();
Atom kwin_running; Atom kwin_running;
Atom activities; Atom activities;
Atom wm_protocols; Atom wm_protocols;
Atom wm_delete_window; Atom wm_delete_window;
Atom wm_take_focus; Atom wm_take_focus;
Atom wm_change_state; Atom wm_change_state;
Atom wm_client_leader; Atom wm_client_leader;
Atom wm_window_role; Atom wm_window_role;
Atom wm_state; Atom wm_state;
Atom sm_client_id; Atom sm_client_id;
Atom motif_wm_hints; Atom motif_wm_hints;
Atom net_wm_context_help; Atom net_wm_context_help;
Atom net_wm_ping; Atom net_wm_ping;
Atom kde_wm_change_state; Atom kde_wm_change_state;
Atom net_wm_user_time; Atom net_wm_user_time;
Atom kde_net_wm_user_creation_time; Atom kde_net_wm_user_creation_time;
Atom kde_system_tray_embedding; Atom kde_system_tray_embedding;
Atom net_wm_take_activity; Atom net_wm_take_activity;
Atom net_wm_window_opacity; Atom net_wm_window_opacity;
Atom xdnd_aware; Atom xdnd_aware;
Atom xdnd_position; Atom xdnd_position;
Atom net_frame_extents; Atom net_frame_extents;
Atom kde_net_wm_frame_strut; Atom kde_net_wm_frame_strut;
Atom net_wm_sync_request_counter; Atom net_wm_sync_request_counter;
Atom net_wm_sync_request; Atom net_wm_sync_request;
}; };
extern Atoms* atoms; extern Atoms* atoms;
......
...@@ -29,155 +29,151 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -29,155 +29,151 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin namespace KWin
{ {
Bridge::Bridge( Client* cl ) Bridge::Bridge(Client* cl)
: c( cl ) : c(cl)
{ {
} }
#define BRIDGE_HELPER( rettype, prototype, args1, args2, cst ) \ #define BRIDGE_HELPER( rettype, prototype, args1, args2, cst ) \
rettype Bridge::prototype ( args1 ) cst \ rettype Bridge::prototype ( args1 ) cst \
{ \ { \
return c->prototype( args2 ); \ return c->prototype( args2 ); \
} }
BRIDGE_HELPER( bool, isActive,,, const ) BRIDGE_HELPER(bool, isActive, , , const)
BRIDGE_HELPER( bool, isCloseable,,, const ) BRIDGE_HELPER(bool, isCloseable, , , const)
BRIDGE_HELPER( bool, isMaximizable,,, const ) BRIDGE_HELPER(bool, isMaximizable, , , const)
BRIDGE_HELPER( Bridge::MaximizeMode, maximizeMode,,, const ) BRIDGE_HELPER(Bridge::MaximizeMode, maximizeMode, , , const)
BRIDGE_HELPER( bool, isMinimizable,,, const ) BRIDGE_HELPER(bool, isMinimizable, , , const)
BRIDGE_HELPER( bool, providesContextHelp,,, const ) BRIDGE_HELPER(bool, providesContextHelp, , , const)
BRIDGE_HELPER( int, desktop,,, const ) BRIDGE_HELPER(int, desktop, , , const)
BRIDGE_HELPER( bool, isModal,,, const ) BRIDGE_HELPER(bool, isModal, , , const)
BRIDGE_HELPER( bool, isShadeable,,, const ) BRIDGE_HELPER(bool, isShadeable, , , const)
BRIDGE_HELPER( bool, isShade,,, const ) BRIDGE_HELPER(bool, isShade, , , const)
BRIDGE_HELPER( bool, keepAbove,,, const ) BRIDGE_HELPER(bool, keepAbove, , , const)
BRIDGE_HELPER( bool, keepBelow,,, const ) BRIDGE_HELPER(bool, keepBelow, , , const)
BRIDGE_HELPER( bool, isMovable,,, const ) BRIDGE_HELPER(bool, isMovable, , , const)
BRIDGE_HELPER( bool, isResizable,,, const ) BRIDGE_HELPER(bool, isResizable, , , const)
BRIDGE_HELPER( QString, caption,,, const ) BRIDGE_HELPER(QString, caption, , , const)
BRIDGE_HELPER( void, processMousePressEvent, QMouseEvent* e, e, ) BRIDGE_HELPER(void, processMousePressEvent, QMouseEvent* e, e,)
BRIDGE_HELPER( QRect, geometry,,, const ) BRIDGE_HELPER(QRect, geometry, , , const)
BRIDGE_HELPER( void, closeWindow,,, ) BRIDGE_HELPER(void, closeWindow, , ,)
BRIDGE_HELPER( void, maximize, MaximizeMode m, m, ) BRIDGE_HELPER(void, maximize, MaximizeMode m, m,)
BRIDGE_HELPER( void, minimize,,, ) BRIDGE_HELPER(void, minimize, , ,)
BRIDGE_HELPER( void, showContextHelp,,, ) BRIDGE_HELPER(void, showContextHelp, , ,)
BRIDGE_HELPER( void, setDesktop, int desktop, desktop, ) BRIDGE_HELPER(void, setDesktop, int desktop, desktop,)
void Bridge::setKeepAbove( bool set ) void Bridge::setKeepAbove(bool set)
{ {
if( c->keepAbove() != set ) if (c->keepAbove() != set)
c->workspace()->performWindowOperation( c, KeepAboveOp ); c->workspace()->performWindowOperation(c, KeepAboveOp);
} }
void Bridge::setKeepBelow( bool set ) void Bridge::setKeepBelow(bool set)
{ {
if( c->keepBelow() != set ) if (c->keepBelow() != set)
c->workspace()->performWindowOperation( c, KeepBelowOp ); c->workspace()->performWindowOperation(c, KeepBelowOp);
} }
NET::WindowType Bridge::windowType( unsigned long supported_types ) const NET::WindowType Bridge::windowType(unsigned long supported_types) const
{ {
return c->windowType( false, supported_types ); return c->windowType(false, supported_types);
} }
QIcon Bridge::icon() const QIcon Bridge::icon() const
{ {
QIcon ret( c->icon()); QIcon ret(c->icon());
ret.addPixmap( c->miniIcon()); ret.addPixmap(c->miniIcon());
return ret; return ret;
} }
bool Bridge::isSetShade() const bool Bridge::isSetShade() const
{ {
return c->shadeMode() != ShadeNone; return c->shadeMode() != ShadeNone;
} }
void Bridge::showWindowMenu( const QPoint &p ) void Bridge::showWindowMenu(const QPoint &p)
{ {
c->workspace()->showWindowMenu( p, c ); c->workspace()->showWindowMenu(p, c);
} }
void Bridge::showWindowMenu( const QRect &p ) void Bridge::showWindowMenu(const QRect &p)
{ {
c->workspace()->showWindowMenu( p, c ); c->workspace()->showWindowMenu(p, c);
} }
void Bridge::performWindowOperation( WindowOperation op ) void Bridge::performWindowOperation(WindowOperation op)
{ {
c->workspace()->performWindowOperation( c, op ); c->workspace()->performWindowOperation(c, op);
} }
void Bridge::setMask( const QRegion& r, int mode ) void Bridge::setMask(const QRegion& r, int mode)
{ {
c->setMask( r, mode ); c->setMask(r, mode);
} }
bool Bridge::isPreview() const bool Bridge::isPreview() const
{ {
return false; return false;
} }
QRect Bridge::iconGeometry() const QRect Bridge::iconGeometry() const
{ {
NETRect r = c->info->iconGeometry(); NETRect r = c->info->iconGeometry();
return QRect( r.pos.x, r.pos.y, r.size.width, r.size.height ); return QRect(r.pos.x, r.pos.y, r.size.width, r.size.height);
} }
WId Bridge::windowId() const WId Bridge::windowId() const
{ {
return c->window(); return c->window();
} }
void Bridge::titlebarDblClickOperation() void Bridge::titlebarDblClickOperation()
{ {
c->workspace()->performWindowOperation( c, options->operationTitlebarDblClick()); c->workspace()->performWindowOperation(c, options->operationTitlebarDblClick());
} }
void Bridge::titlebarMouseWheelOperation( int delta ) void Bridge::titlebarMouseWheelOperation(int delta)
{ {
c->performMouseCommand( options->operationTitlebarMouseWheel( delta ), cursorPos()); c->performMouseCommand(options->operationTitlebarMouseWheel(delta), cursorPos());
} }
void Bridge::setShade( bool set ) void Bridge::setShade(bool set)
{ {
c->setShade( set ? ShadeNormal : ShadeNone ); c->setShade(set ? ShadeNormal : ShadeNone);
} }
int Bridge::currentDesktop() const int Bridge::currentDesktop() const
{ {
return c->workspace()->currentDesktop(); return c->workspace()->currentDesktop();
} }
QWidget* Bridge::initialParentWidget() const QWidget* Bridge::initialParentWidget() const
{ {
return NULL; return NULL;
} }
Qt::WFlags Bridge::initialWFlags() const Qt::WFlags Bridge::initialWFlags() const
{ {
return 0; return 0;
} }
QRegion Bridge::unobscuredRegion( const QRegion& r ) const QRegion Bridge::unobscuredRegion(const QRegion& r) const
{ {
QRegion reg( r ); QRegion reg(r);
const ClientList stacking_order = c->workspace()->stackingOrder(); const ClientList stacking_order = c->workspace()->stackingOrder();
int pos = stacking_order.indexOf( c ); int pos = stacking_order.indexOf(c);
++pos; ++pos;
for(; pos < stacking_order.count(); ++pos ) for (; pos < stacking_order.count(); ++pos) {
{ if (!stacking_order[pos]->isShown(true))
if( !stacking_order[pos]->isShown( true ))
continue; // these don't obscure the window continue; // these don't obscure the window
if( c->isOnAllDesktops()) if (c->isOnAllDesktops()) {
{ if (!stacking_order[ pos ]->isOnCurrentDesktop())
if( !stacking_order[ pos ]->isOnCurrentDesktop())
continue; continue;
} } else {
else if (!stacking_order[ pos ]->isOnDesktop(c->desktop()))
{
if( !stacking_order[ pos ]->isOnDesktop( c->desktop()))
continue; continue;
} }
/* the clients all have their mask-regions in local coords /* the clients all have their mask-regions in local coords
so we have to translate them to a shared coord system so we have to translate them to a shared coord system
we choose ours */ we choose ours */
...@@ -186,121 +182,119 @@ QRegion Bridge::unobscuredRegion( const QRegion& r ) const ...@@ -186,121 +182,119 @@ QRegion Bridge::unobscuredRegion( const QRegion& r ) const
QRegion creg = stacking_order[ pos ]->mask(); QRegion creg = stacking_order[ pos ]->mask();
creg.translate(dx, dy); creg.translate(dx, dy);
reg -= creg; reg -= creg;
if (reg.isEmpty()) if (reg.isEmpty()) {
{
// early out, we are completely obscured // early out, we are completely obscured
break; break;
}
} }
return reg;
} }
return reg;
}
void Bridge::grabXServer( bool grab ) void Bridge::grabXServer(bool grab)
{ {
if( grab ) if (grab)
KWin::grabXServer(); KWin::grabXServer();