It wasn't a very good idea to do even compositing-unrelated

work in the work/kwin_composite branch.
svn merge revs 558154,558180,558236,558243,558258,562201


svn path=/trunk/KDE/kdebase/workspace/; revision=571776
icc-effect-5.14.5
Luboš Luňák 2006-08-10 17:00:14 +00:00
parent 293f093ea1
commit fa8cd7541f
16 changed files with 342 additions and 740 deletions

View File

@ -8,10 +8,6 @@ add_subdirectory( pics )
add_subdirectory( clients )
add_subdirectory( data )
if(X11_kompmgr_FOUND)
add_subdirectory(kompmgr)
endif(X11_kompmgr_FOUND)
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/lib )
@ -70,11 +66,7 @@ kde4_install_icons( ${ICON_INSTALL_DIR} crystalsvg )
#INCLUDES = -I$(srcdir)/lib $(all_includes)
#
#if include_kompmgr
#KOMPMGR=kompmgr
#endif
#
#SUBDIRS = lib . killer kcmkwin pics clients oldheaders data $(KOMPMGR)
#SUBDIRS = lib . killer kcmkwin pics clients oldheaders data
#
#bin_PROGRAMS =
#lib_LTLIBRARIES =

View File

@ -697,7 +697,7 @@ void Client::demandAttentionKNotify()
}
// TODO I probably shouldn't be lazy here and do it without the macro, so that people can read it
KWIN_COMPARE_PREDICATE( SameApplicationActiveHackPredicate, Client, const Client*,
KWIN_COMPARE_PREDICATE( SameApplicationActiveHackPredicate, const Client*,
// ignore already existing splashes, toolbars, utilities, menus and topmenus,
// as the app may show those before the main window
!cl->isSplash() && !cl->isToolbar() && !cl->isTopMenu() && !cl->isUtility() && !cl->isMenu()

View File

@ -145,9 +145,6 @@ Client::Client( Workspace *ws )
frame_geometry = QRect( 0, 0, 100, 100 ); // so that decorations don't start with size being (0,0)
client_size = QSize( 100, 100 );
custom_opacity = false;
rule_opacity_active = 0;; //translucency rules
rule_opacity_inactive = 0; //dito.
// SELI initialize xsizehints??
}
@ -182,7 +179,6 @@ void Client::releaseWindow( bool on_shutdown )
deleting = true;
workspace()->discardUsedWindowRules( this, true ); // remove ForceTemporarily rules
StackingUpdatesBlocker blocker( workspace());
if (!custom_opacity) setOpacity(false);
if (moveResizeMode)
leaveMoveResize();
finishWindowRules();
@ -192,7 +188,7 @@ void Client::releaseWindow( bool on_shutdown )
hidden = true; // so that it's not considered visible anymore (can't use hideClient(), it would set flags)
if( !on_shutdown )
workspace()->clientHidden( this );
XUnmapWindow( QX11Info::display(), frameId()); // destroying decoration would cause ugly visual effect
XUnmapWindow( display(), frameId()); // destroying decoration would cause ugly visual effect
destroyDecoration();
cleanGrouping();
if( !on_shutdown )
@ -204,27 +200,27 @@ void Client::releaseWindow( bool on_shutdown )
desk = 0;
info->setState( 0, info->state()); // reset all state flags
}
XDeleteProperty( QX11Info::display(), client, atoms->kde_net_wm_user_creation_time);
XDeleteProperty( QX11Info::display(), client, atoms->net_frame_extents );
XDeleteProperty( QX11Info::display(), client, atoms->kde_net_wm_frame_strut );
XReparentWindow( QX11Info::display(), client, workspace()->rootWin(), x(), y());
XRemoveFromSaveSet( QX11Info::display(), client );
XSelectInput( QX11Info::display(), client, NoEventMask );
XDeleteProperty( display(), client, atoms->kde_net_wm_user_creation_time);
XDeleteProperty( display(), client, atoms->net_frame_extents );
XDeleteProperty( display(), client, atoms->kde_net_wm_frame_strut );
XReparentWindow( display(), client, workspace()->rootWin(), x(), y());
XRemoveFromSaveSet( display(), client );
XSelectInput( display(), client, NoEventMask );
if( on_shutdown )
{ // map the window, so it can be found after another WM is started
XMapWindow( QX11Info::display(), client );
XMapWindow( display(), client );
// TODO preserve minimized, shaded etc. state?
}
else
{
// Make sure it's not mapped if the app unmapped it (#65279). The app
// may do map+unmap before we initially map the window by calling rawShow() from manage().
XUnmapWindow( QX11Info::display(), client );
XUnmapWindow( display(), client );
}
client = None;
XDestroyWindow( QX11Info::display(), wrapper );
XDestroyWindow( display(), wrapper );
wrapper = None;
XDestroyWindow( QX11Info::display(), frame );
XDestroyWindow( display(), frame );
frame = None;
--postpone_geometry_updates; // don't use GeometryUpdatesBlocker, it would now set the geometry
deleteClient( this, Allowed );
@ -249,9 +245,9 @@ void Client::destroyClient()
cleanGrouping();
workspace()->removeClient( this, Allowed );
client = None; // invalidate
XDestroyWindow( QX11Info::display(), wrapper );
XDestroyWindow( display(), wrapper );
wrapper = None;
XDestroyWindow( QX11Info::display(), frame );
XDestroyWindow( display(), frame );
frame = None;
--postpone_geometry_updates; // don't use GeometryUpdatesBlocker, it would now set the geometry
deleteClient( this, Allowed );
@ -272,12 +268,9 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
// TODO check decoration's minimum size?
decoration->init();
decoration->widget()->installEventFilter( this );
XReparentWindow( QX11Info::display(), decoration->widget()->winId(), frameId(), 0, 0 );
XReparentWindow( display(), decoration->widget()->winId(), frameId(), 0, 0 );
decoration->widget()->lower();
decoration->borders( border_left, border_right, border_top, border_bottom );
options->onlyDecoTranslucent ?
setDecoHashProperty(border_top, border_right, border_bottom, border_left):
unsetDecoHashProperty();
int save_workarea_diff_x = workarea_diff_x;
int save_workarea_diff_y = workarea_diff_y;
move( calculateGravitation( false ));
@ -333,9 +326,6 @@ void Client::checkBorderSizes()
border_right != new_right ||
border_top != new_top ||
border_bottom != new_bottom)
options->onlyDecoTranslucent ?
setDecoHashProperty(new_top, new_right, new_bottom, new_left):
unsetDecoHashProperty();
move( calculateGravitation( false ));
plainResize( sizeForClientSize( clientSize()), ForceGeometrySet );
checkWorkspacePosition();
@ -374,30 +364,6 @@ void Client::detectNoBorder()
noborder = true;
}
void Client::detectShapable()
{
if( Shape::hasShape( window()))
return;
switch( windowType())
{
case NET::Desktop :
case NET::Dock :
case NET::TopMenu :
case NET::Splash :
break;
case NET::Unknown :
case NET::Normal :
case NET::Toolbar :
case NET::Menu :
case NET::Dialog :
case NET::Utility :
setShapable(false);
break;
default:
assert( false );
}
}
void Client::updateFrameExtents()
{
NETStrut strut;
@ -463,25 +429,25 @@ void Client::updateShape()
}
if( shape())
{
XShapeCombineShape(QX11Info::display(), frameId(), ShapeBounding,
XShapeCombineShape(display(), frameId(), ShapeBounding,
clientPos().x(), clientPos().y(),
window(), ShapeBounding, ShapeSet);
}
else
{
XShapeCombineMask( QX11Info::display(), frameId(), ShapeBounding, 0, 0,
XShapeCombineMask( display(), frameId(), ShapeBounding, 0, 0,
None, ShapeSet);
}
if( Shape::major() > 1 || Shape::minor() >= 1 ) // has input shape support
{ // there appears to be no way to find out if a window has input
// shape set or not, so always set propagate the input shape
// (it's the same like the bounding shape by default)
XShapeCombineMask( QX11Info::display(), frameId(), ShapeInput, 0, 0,
XShapeCombineMask( display(), frameId(), ShapeInput, 0, 0,
None, ShapeSet );
XShapeCombineShape( QX11Info::display(), frameId(), ShapeInput,
XShapeCombineShape( display(), frameId(), ShapeInput,
clientPos().x(), clientPos().y(),
window(), ShapeBounding, ShapeSubtract );
XShapeCombineShape( QX11Info::display(), frameId(), ShapeInput,
XShapeCombineShape( display(), frameId(), ShapeInput,
clientPos().x(), clientPos().y(),
window(), ShapeInput, ShapeUnion );
}
@ -491,10 +457,10 @@ void Client::setMask( const QRegion& reg, int mode )
{
_mask = reg;
if( reg.isEmpty())
XShapeCombineMask( QX11Info::display(), frameId(), ShapeBounding, 0, 0,
XShapeCombineMask( display(), frameId(), ShapeBounding, 0, 0,
None, ShapeSet );
else if( mode == X::Unsorted )
XShapeCombineRegion( QX11Info::display(), frameId(), ShapeBounding, 0, 0,
XShapeCombineRegion( display(), frameId(), ShapeBounding, 0, 0,
reg.handle(), ShapeSet );
else
{
@ -509,7 +475,7 @@ void Client::setMask( const QRegion& reg, int mode )
xrects[ i ].width = rects[ i ].width();
xrects[ i ].height = rects[ i ].height();
}
XShapeCombineRectangles( QX11Info::display(), frameId(), ShapeBounding, 0, 0,
XShapeCombineRectangles( display(), frameId(), ShapeBounding, 0, 0,
xrects, rects.count(), ShapeSet, mode );
delete[] xrects;
}
@ -522,12 +488,6 @@ QRegion Client::mask() const
return _mask;
}
void Client::setShapable(bool b)
{
long tmp = b?1:0;
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_shapable, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &tmp, 1L);
}
void Client::hideClient( bool hide )
{
if( hidden == hide )
@ -679,7 +639,7 @@ void Client::animateMinimizeOrUnminimize( bool minimize )
if (area2 != area)
{
pm = animationPixmap( area.width() );
pm2 = QPixmap::grabWindow( QX11Info::appRootWindow(), area.x(), area.y(), area.width(), area.height() );
pm2 = QPixmap::grabWindow( rootWindow(), area.x(), area.y(), area.width(), area.height() );
p.drawPixmap( area.x(), area.y(), pm );
if ( need_to_clear )
{
@ -688,8 +648,8 @@ void Client::animateMinimizeOrUnminimize( bool minimize )
}
area2 = area;
}
XFlush(QX11Info::display());
XSync( QX11Info::display(), false );
XFlush(display());
XSync( display(), false );
diff = t.elapsed();
if (diff > step)
diff = step;
@ -777,16 +737,16 @@ void Client::setShade( ShadeMode mode )
{ // shade_mode == ShadeNormal
// we're about to shade, texx xcompmgr to prepare
long _shade = 1;
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L);
XChangeProperty(display(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L);
// shade
int h = height();
shade_geometry_change = true;
QSize s( sizeForClientSize( QSize( clientSize())));
s.setHeight( border_top + border_bottom );
XSelectInput( QX11Info::display(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
XUnmapWindow( QX11Info::display(), wrapper );
XUnmapWindow( QX11Info::display(), client );
XSelectInput( QX11Info::display(), wrapper, ClientWinMask | SubstructureNotifyMask );
XSelectInput( display(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
XUnmapWindow( display(), wrapper );
XUnmapWindow( display(), client );
XSelectInput( display(), wrapper, ClientWinMask | SubstructureNotifyMask );
//as we hid the unmap event, xcompmgr didn't recognize the client wid has vanished, so we'll extra inform it
//done xcompmgr workaround
// FRAME repaint( false );
@ -796,7 +756,7 @@ void Client::setShade( ShadeMode mode )
do
{
h -= step;
XResizeWindow( QX11Info::display(), frameId(), s.width(), h );
XResizeWindow( display(), frameId(), s.width(), h );
resizeDecoration( QSize( s.width(), h ));
QApplication::syncX();
} while ( h > s.height() + step );
@ -813,7 +773,7 @@ void Client::setShade( ShadeMode mode )
}
// tell xcompmgr shade's done
_shade = 2;
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L);
XChangeProperty(display(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L);
}
else
{
@ -826,7 +786,7 @@ void Client::setShade( ShadeMode mode )
do
{
h += step;
XResizeWindow( QX11Info::display(), frameId(), s.width(), h );
XResizeWindow( display(), frameId(), s.width(), h );
resizeDecoration( QSize( s.width(), h ));
// assume a border
// we do not have time to wait for X to send us paint events
@ -839,9 +799,9 @@ void Client::setShade( ShadeMode mode )
plainResize( s );
if( shade_mode == ShadeHover || shade_mode == ShadeActivated )
setActive( true );
XMapWindow( QX11Info::display(), wrapperId());
XMapWindow( QX11Info::display(), window());
XDeleteProperty (QX11Info::display(), client, atoms->net_wm_window_shade);
XMapWindow( display(), wrapperId());
XMapWindow( display(), window());
XDeleteProperty (display(), client, atoms->net_wm_window_shade);
if ( isActive() )
workspace()->requestFocus( this );
}
@ -940,7 +900,7 @@ void Client::setMappingState(int s)
mapping_state = s;
if( mapping_state == WithdrawnState )
{
XDeleteProperty( QX11Info::display(), window(), atoms->wm_state );
XDeleteProperty( display(), window(), atoms->wm_state );
return;
}
assert( s == NormalState || s == IconicState );
@ -948,7 +908,7 @@ void Client::setMappingState(int s)
unsigned long data[2];
data[0] = (unsigned long) s;
data[1] = (unsigned long) None;
XChangeProperty(QX11Info::display(), window(), atoms->wm_state, atoms->wm_state, 32,
XChangeProperty(display(), window(), atoms->wm_state, atoms->wm_state, 32,
PropModeReplace, (unsigned char *)data, 2);
if( was_unmanaged ) // manage() did postpone_geometry_updates = 1, now it's ok to finally set the geometry
@ -963,11 +923,11 @@ void Client::rawShow()
{
if( decoration != NULL )
decoration->widget()->show(); // not really necessary, but let it know the state
XMapWindow( QX11Info::display(), frame );
XMapWindow( display(), frame );
if( !isShade())
{
XMapWindow( QX11Info::display(), wrapper );
XMapWindow( QX11Info::display(), client );
XMapWindow( display(), wrapper );
XMapWindow( display(), client );
}
}
@ -984,11 +944,11 @@ void Client::rawHide()
// which won't be missed, so this shouldn't be a problem. The chance the real UnmapNotify
// will be missed is also very minimal, so I don't think it's needed to grab the server
// here.
XSelectInput( QX11Info::display(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
XUnmapWindow( QX11Info::display(), frame );
XUnmapWindow( QX11Info::display(), wrapper );
XUnmapWindow( QX11Info::display(), client );
XSelectInput( QX11Info::display(), wrapper, ClientWinMask | SubstructureNotifyMask );
XSelectInput( display(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
XUnmapWindow( display(), frame );
XUnmapWindow( display(), wrapper );
XUnmapWindow( display(), client );
XSelectInput( display(), wrapper, ClientWinMask | SubstructureNotifyMask );
if( decoration != NULL )
decoration->widget()->hide(); // not really necessary, but let it know the state
workspace()->clientHidden( this );
@ -1005,14 +965,14 @@ void Client::sendClientMessage(Window w, Atom a, Atom protocol, long data1, long
ev.xclient.message_type = a;
ev.xclient.format = 32;
ev.xclient.data.l[0] = protocol;
ev.xclient.data.l[1] = QX11Info::appTime();
ev.xclient.data.l[1] = xTime();
ev.xclient.data.l[2] = data1;
ev.xclient.data.l[3] = data2;
ev.xclient.data.l[4] = data3;
mask = 0L;
if (w == QX11Info::appRootWindow())
if (w == rootWindow())
mask = SubstructureRedirectMask; /* magic! */
XSendEvent(QX11Info::display(), w, False, mask, &ev);
XSendEvent(display(), w, False, mask, &ev);
}
/*
@ -1064,7 +1024,7 @@ void Client::killWindow()
Notify::raise( Notify::Delete );
killProcess( false );
// always kill this client at the server
XKillClient(QX11Info::display(), window() );
XKillClient(display(), window() );
destroyClient();
}
@ -1083,7 +1043,7 @@ void Client::pingWindow()
connect( ping_timer, SIGNAL( timeout()), SLOT( pingTimeout()));
ping_timer->setSingleShot( true );
ping_timer->start( options->killPingTimeout );
ping_timestamp = QX11Info::appTime();
ping_timestamp = xTime();
workspace()->sendPingToWindow( window(), ping_timestamp );
}
@ -1250,15 +1210,15 @@ void Client::takeActivity( int flags, bool handled, allowed_t )
#ifndef NDEBUG
static Time previous_activity_timestamp;
static Client* previous_client;
if( previous_activity_timestamp == QX11Info::appTime() && previous_client != this )
if( previous_activity_timestamp == xTime() && previous_client != this )
{
kDebug( 1212 ) << "Repeated use of the same X timestamp for activity" << endl;
kDebug( 1212 ) << kBacktrace() << endl;
}
previous_activity_timestamp = QX11Info::appTime();
previous_activity_timestamp = xTime();
previous_client = this;
#endif
workspace()->sendTakeActivity( this, QX11Info::appTime(), flags );
workspace()->sendTakeActivity( this, xTime(), flags );
}
// performs the actual focusing of the window using XSetInputFocus and WM_TAKE_FOCUS
@ -1267,17 +1227,17 @@ void Client::takeFocus( allowed_t )
#ifndef NDEBUG
static Time previous_focus_timestamp;
static Client* previous_client;
if( previous_focus_timestamp == QX11Info::appTime() && previous_client != this )
if( previous_focus_timestamp == xTime() && previous_client != this )
{
kDebug( 1212 ) << "Repeated use of the same X timestamp for focus" << endl;
kDebug( 1212 ) << kBacktrace() << endl;
}
previous_focus_timestamp = QX11Info::appTime();
previous_focus_timestamp = xTime();
previous_client = this;
#endif
if ( rules()->checkAcceptFocus( input ))
{
XSetInputFocus( QX11Info::display(), window(), RevertToPointerRoot, QX11Info::appTime() );
XSetInputFocus( display(), window(), RevertToPointerRoot, xTime() );
}
if ( Ptakefocus )
sendClientMessage(window(), atoms->wm_protocols, atoms->wm_take_focus);
@ -1410,7 +1370,7 @@ QString Client::caption( bool full ) const
void Client::getWMHints()
{
XWMHints *hints = XGetWMHints(QX11Info::display(), window() );
XWMHints *hints = XGetWMHints(display(), window() );
input = true;
window_group = None;
urgency = false;
@ -1499,7 +1459,7 @@ void Client::getWindowProtocols()
Pcontexthelp = 0;
Pping = 0;
if (XGetWMProtocols(QX11Info::display(), window(), &p, &n))
if (XGetWMProtocols(display(), window(), &p, &n))
{
for (i = 0; i < n; i++)
if (p[i] == atoms->wm_delete_window)
@ -1558,7 +1518,7 @@ Window Client::staticWmClientLeader(WId w)
unsigned char *data = 0;
Window result = w;
XErrorHandler oldHandler = XSetErrorHandler(nullErrorHandler);
status = XGetWindowProperty( QX11Info::display(), w, atoms->wm_client_leader, 0, 10000,
status = XGetWindowProperty( display(), w, atoms->wm_client_leader, 0, 10000,
false, XA_WINDOW, &type, &format,
&nitems, &extra, &data );
XSetErrorHandler(oldHandler);
@ -1775,7 +1735,7 @@ void Client::setCursor( const QCursor& c )
cursor = c;
if( decoration != NULL )
decoration->widget()->setCursor( cursor );
XDefineCursor( QX11Info::display(), frameId(), cursor.handle());
XDefineCursor( display(), frameId(), cursor.handle());
}
Client::Position Client::mousePosition( const QPoint& p ) const
@ -1826,272 +1786,6 @@ void Client::cancelAutoRaise()
autoRaiseTimer = 0;
}
void Client::setOpacity(bool translucent, uint opacity)
{
if (isDesktop())
return; // xcompmgr does not like non solid desktops and the user could set it accidently by mouse scrolling
// qWarning("setting opacity for %d",QX11Info::display());
//rule out activated translulcency with 100% opacity
if (!translucent || opacity == 0xFFFFFFFF)
{
opacity_ = 0xFFFFFFFF;
XDeleteProperty (QX11Info::display(), frameId(), atoms->net_wm_window_opacity);
XDeleteProperty (QX11Info::display(), window(), atoms->net_wm_window_opacity); // ??? frameId() is necessary for visible changes, window() is the winId() that would be set by apps - we set both to be sure the app knows what's currently displayd
}
else{
if(opacity == opacity_)
return;
opacity_ = opacity;
long data = opacity; // 32bit XChangeProperty needs long
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
XChangeProperty(QX11Info::display(), window(), atoms->net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
}
}
void Client::setShadowSize(uint shadowSize)
{
// ignoring all individual settings - if we control a window, we control it's shadow
// TODO somehow handle individual settings for docks (besides custom sizes)
long data = shadowSize;
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_shadow, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
}
void Client::updateOpacity()
// extra syncscreen flag allows to avoid double syncs when active state changes (as it will usually change for two windows)
{
if (!(isNormalWindow() || isDialog() || isUtility() )|| custom_opacity)
return;
if (isActive())
{
if( ruleOpacityActive() )
setOpacity(rule_opacity_active < 0xFFFFFFFF, rule_opacity_active);
else
setOpacity(options->translucentActiveWindows, options->activeWindowOpacity);
if (isBMP())
// beep-media-player, only undecorated windows (gtk2 xmms, xmms doesn't work with compmgr at all - s.e.p. :P )
{
ClientList tmpGroupMembers = group()->members();
ClientList activeGroupMembers;
activeGroupMembers.append(this);
tmpGroupMembers.removeAll(this);
ClientList::Iterator it = tmpGroupMembers.begin();
while (it != tmpGroupMembers.end())
// search for next attached and not activated client and repeat if found
{
if ((*it) != this && (*it)->isBMP())
// potential "to activate" client found
{
// qWarning("client found");
if ((*it)->touches(this)) // first test, if the new client touches the just activated one
{
// qWarning("found client touches me");
if( ruleOpacityActive() )
(*it)->setOpacity(rule_opacity_active < 0xFFFFFFFF, rule_opacity_active);
else
(*it)->setOpacity(options->translucentActiveWindows, options->activeWindowOpacity);
// qWarning("activated, search restarted (1)");
(*it)->setShadowSize(options->activeWindowShadowSize);
activeGroupMembers.append(*it);
tmpGroupMembers.erase(it);
it = tmpGroupMembers.begin(); // restart, search next client
continue;
}
else
{ // pot. client does not touch c, so we have to search if it touches some other activated client
bool found = false;
for( ClientList::ConstIterator it2 = activeGroupMembers.begin(); it2 != activeGroupMembers.end(); it2++ )
{
if ((*it2) != this && (*it2) != (*it) && (*it)->touches(*it2))
{
// qWarning("found client touches other active client");
if( ruleOpacityActive() )
(*it)->setOpacity(rule_opacity_active < 0xFFFFFFFF, rule_opacity_active);
else
(*it)->setOpacity(options->translucentActiveWindows, options->activeWindowOpacity);
(*it)->setShadowSize(options->activeWindowShadowSize);
activeGroupMembers.append(*it);
tmpGroupMembers.erase(it);
it = tmpGroupMembers.begin(); // reset potential client search
found = true;
// qWarning("activated, search restarted (2)");
break; // skip this loop
}
}
if (found) continue;
}
}
it++;
}
}
else if (isNormalWindow())
// activate dependent minor windows as well
{
for( ClientList::ConstIterator it = group()->members().begin(); it != group()->members().end(); it++ )
if ((*it)->isDialog() || (*it)->isUtility())
if( (*it)->ruleOpacityActive() )
(*it)->setOpacity((*it)->ruleOpacityActive() < 0xFFFFFFFF, (*it)->ruleOpacityActive());
else
(*it)->setOpacity(options->translucentActiveWindows, options->activeWindowOpacity);
}
}
else
{
if( ruleOpacityInactive() )
setOpacity(rule_opacity_inactive < 0xFFFFFFFF, rule_opacity_inactive);
else
setOpacity(options->translucentInactiveWindows && !(keepAbove() && options->keepAboveAsActive),
options->inactiveWindowOpacity);
// deactivate dependent minor windows as well
if (isBMP())
// beep-media-player, only undecorated windows (gtk2 xmms, xmms doesn't work with compmgr at all - s.e.p. :P )
{
ClientList tmpGroupMembers = group()->members();
ClientList inactiveGroupMembers;
inactiveGroupMembers.append(this);
tmpGroupMembers.removeAll(this);
ClientList::Iterator it = tmpGroupMembers.begin();
while ( it != tmpGroupMembers.end() )
// search for next attached and not activated client and repeat if found
{
if ((*it) != this && (*it)->isBMP())
// potential "to activate" client found
{
// qWarning("client found");
if ((*it)->touches(this)) // first test, if the new client touches the just activated one
{
// qWarning("found client touches me");
if( (*it)->ruleOpacityInactive() )
(*it)->setOpacity((*it)->ruleOpacityInactive() < 0xFFFFFFFF, (*it)->ruleOpacityInactive());
else
(*it)->setOpacity(options->translucentInactiveWindows && !((*it)->keepAbove() && options->keepAboveAsActive), options->inactiveWindowOpacity);
(*it)->setShadowSize(options->inactiveWindowShadowSize);
// qWarning("deactivated, search restarted (1)");
inactiveGroupMembers.append(*it);
tmpGroupMembers.erase(it);
it = tmpGroupMembers.begin(); // restart, search next client
continue;
}
else // pot. client does not touch c, so we have to search if it touches some other activated client
{
bool found = false;
for( ClientList::ConstIterator it2 = inactiveGroupMembers.begin(); it2 != inactiveGroupMembers.end(); it2++ )
{
if ((*it2) != this && (*it2) != (*it) && (*it)->touches(*it2))
{
// qWarning("found client touches other inactive client");
if( (*it)->ruleOpacityInactive() )
(*it)->setOpacity((*it)->ruleOpacityInactive() < 0xFFFFFFFF, (*it)->ruleOpacityInactive());
else
(*it)->setOpacity(options->translucentInactiveWindows && !((*it)->keepAbove() && options->keepAboveAsActive), options->inactiveWindowOpacity);
(*it)->setShadowSize(options->inactiveWindowShadowSize);
// qWarning("deactivated, search restarted (2)");
inactiveGroupMembers.append(*it);
tmpGroupMembers.erase(it);
it = tmpGroupMembers.begin(); // reset potential client search
found = true;
break; // skip this loop
}
}
if (found) continue;
}
}
it++;
}
}
else if (isNormalWindow())
{
for( ClientList::ConstIterator it = group()->members().begin(); it != group()->members().end(); it++ )
if ((*it)->isUtility()) //don't deactivate dialogs...
if( (*it)->ruleOpacityInactive() )
(*it)->setOpacity((*it)->ruleOpacityInactive() < 0xFFFFFFFF, (*it)->ruleOpacityInactive());
else
(*it)->setOpacity(options->translucentInactiveWindows && !((*it)->keepAbove() && options->keepAboveAsActive), options->inactiveWindowOpacity);
}
}
}
void Client::updateShadowSize()
// extra syncscreen flag allows to avoid double syncs when active state changes (as it will usually change for two windows)
{
if (!(isNormalWindow() || isDialog() || isUtility() ))
return;
if (isActive())
setShadowSize(options->activeWindowShadowSize);
else
setShadowSize(options->inactiveWindowShadowSize);
}
uint Client::ruleOpacityInactive()
{
return rule_opacity_inactive;// != 0 ;
}
uint Client::ruleOpacityActive()
{
return rule_opacity_active;// != 0;
}
bool Client::getWindowOpacity() //query translucency settings from X, returns true if window opacity is set
{
unsigned char *data = 0;
Atom actual;
int format, result;
unsigned long n, left;
result = XGetWindowProperty(QX11Info::display(), window(), atoms->net_wm_window_opacity, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, /*(unsigned char **)*/ &data);
if (result == Success && data != None && format == 32 )
{
opacity_ = *reinterpret_cast< long* >( data );
custom_opacity = true;
// setOpacity(opacity_ < 0xFFFFFFFF, opacity_);
XFree ((char*)data);
return true;
}
return false;
}
void Client::setCustomOpacityFlag(bool custom)
{
custom_opacity = custom;
}
uint Client::opacity()
{
return opacity_;
}
int Client::opacityPercentage()
{
return int(100*((double)opacity_/0xffffffff));
}
bool Client::touches(const Client* c)
// checks if this client borders c, needed to test beep media player window state
{
if (y() == c->y() + c->height()) // this bottom to c
return true;
if (y() + height() == c->y()) // this top to c
return true;
if (x() == c->x() + c->width()) // this right to c
return true;
if (x() + width() == c->x()) // this left to c
return true;
return false;
}
void Client::setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHeight, uint leftWidth)
{
long data = (topHeight < 255 ? topHeight : 255) << 24 |
(rightWidth < 255 ? rightWidth : 255) << 16 |
(bottomHeight < 255 ? bottomHeight : 255) << 8 |
(leftWidth < 255 ? leftWidth : 255);
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_decohash, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
}
void Client::unsetDecoHashProperty()
{
XDeleteProperty( QX11Info::display(), frameId(), atoms->net_wm_window_decohash);
}
#ifndef NDEBUG
kdbgstream& operator<<( kdbgstream& stream, const Client* cl )
{

136
client.h
View File

@ -28,7 +28,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "workspace.h"
#include "kdecoration.h"
#include "rules.h"
#include "toplevel.h"
class QTimer;
class KProcess;
@ -43,8 +42,7 @@ class WinInfo;
class SessionInfo;
class Bridge;
class Client
: public Toplevel
class Client : public QObject, public KDecorationDefines
{
Q_OBJECT
public:
@ -54,6 +52,7 @@ class Client
Window wrapperId() const;
Window decorationId() const;
Workspace* workspace() const;
const Client* transientFor() const;
Client* transientFor();
bool isTransient() const;
@ -67,20 +66,23 @@ class Client
const Group* group() const;
Group* group();
void checkGroup( Group* gr = NULL, bool force = false );
// prefer isXXX() instead
NET::WindowType windowType( bool direct = false, int supported_types = SUPPORTED_WINDOW_TYPES_MASK ) const;
const WindowRules* rules() const;
void removeRule( Rules* r );
void setupWindowRules( bool ignore_temporary );
void applyWindowRules();
virtual NET::WindowType windowType( bool direct = false, int supported_types = SUPPORTED_WINDOW_TYPES_MASK ) const;
// returns true for "special" windows and false for windows which are "normal"
// (normal=window which has a border, can be moved by the user, can be closed, etc.)
// true for Desktop, Dock, Splash, Override and TopMenu (and Toolbar??? - for now)
// false for Normal, Dialog, Utility and Menu (and Toolbar??? - not yet) TODO
bool isSpecialWindow() const;
bool hasNETSupport() const;
QRect geometry() const;
QSize size() const;
QSize minSize() const;
QSize maxSize() const;
QPoint pos() const;
QRect rect() const;
int x() const;
int y() const;
int width() const;
int height() const;
QPoint clientPos() const; // inside of geometry()
QSize clientSize() const;
@ -163,9 +165,24 @@ class Client
// auxiliary functions, depend on the windowType
bool wantsTabFocus() const;
bool wantsInput() const;
bool hasNETSupport() const;
bool isMovable() const;
bool isDesktop() const;
bool isDock() const;
bool isToolbar() const;
bool isTopMenu() const;
bool isMenu() const;
bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
bool isDialog() const;
bool isSplash() const;
bool isUtility() const;
// returns true for "special" windows and false for windows which are "normal"
// (normal=window which has a border, can be moved by the user, can be closed, etc.)
// true for Desktop, Dock, Splash, Override and TopMenu (and Toolbar??? - for now)
// false for Normal, Dialog, Utility and Menu (and Toolbar??? - not yet) TODO
bool isSpecialWindow() const;
bool isResizable() const;
bool isMovable() const;
bool isCloseable() const; // may be closed by the user (may have a close button)
void takeActivity( int flags, bool handled, allowed_t ); // takes ActivityFlags as arg (in utils.h)
@ -181,9 +198,6 @@ class Client
// shape extensions
bool shape() const;
void updateShape();
virtual double opacity() const;
void setOpacity( double opacity );
void setGeometry( int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet );
void setGeometry( const QRect& r, ForceGeometry_t force = NormalGeometrySet );
@ -273,15 +287,6 @@ class Client
void checkActiveModal();
bool hasStrut() const;
bool isMove() const
{
return moveResizeMode && mode == PositionCenter;
}
bool isResize() const
{
return moveResizeMode && mode != PositionCenter;
}
private slots:
void autoRaise();
void shadeHover();
@ -325,9 +330,6 @@ class Client
void processDecorationButtonPress( int button, int state, int x, int y, int x_root, int y_root );
protected:
virtual void debug( kdbgstream& stream ) const;
private slots:
void pingTimeout();
void processKillerExited();
@ -398,11 +400,12 @@ class Client
Time readUserCreationTime() const;
static bool sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool active_hack );
void startupIdChanged();
static bool hasShape( Window w );
Window client;
Window wrapper;
Window frame;
KDecoration* decoration;
Workspace* wspace;
Bridge* bridge;
int desk;
bool buttonDown;
@ -410,6 +413,14 @@ class Client
bool move_faked_activity;
Window move_resize_grab_window;
bool unrestrictedMoveResize;
bool isMove() const
{
return moveResizeMode && mode == PositionCenter;
}
bool isResize() const
{
return moveResizeMode && mode != PositionCenter;
}
Position mode;
QPoint moveOffset;
@ -493,6 +504,7 @@ class Client
Time ping_timestamp;
Time user_time;
unsigned long allowed_actions;
QRect frame_geometry;
QSize client_size;
int postpone_geometry_updates; // >0 - new geometry is remembered, but not actually set
bool pending_geometry_update;
@ -545,7 +557,7 @@ inline Window Client::window() const
inline Window Client::frameId() const
{
return handle();
return frame;
}
inline Window Client::wrapperId() const
@ -558,6 +570,11 @@ inline Window Client::decorationId() const
return decoration != NULL ? decoration->widget()->winId() : None;
}
inline Workspace* Client::workspace() const
{
return wspace;
}
inline const Client* Client::transientFor() const
{
return transient_for;
@ -774,6 +791,46 @@ inline QByteArray Client::windowRole() const
return window_role;
}
inline QRect Client::geometry() const
{
return frame_geometry;
}
inline QSize Client::size() const
{
return frame_geometry.size();
}
inline QPoint Client::pos() const
{
return frame_geometry.topLeft();
}
inline int Client::x() const
{
return frame_geometry.x();
}
inline int Client::y() const
{
return frame_geometry.y();
}
inline int Client::width() const
{
return frame_geometry.width();
}
inline int Client::height() const
{
return frame_geometry.height();
}
inline QRect Client::rect() const
{
return QRect( 0, 0, width(), height());
}
inline QPoint Client::clientPos() const
{
return QPoint( border_left, border_top );
@ -819,7 +876,7 @@ inline const WindowRules* Client::rules() const
return &client_rules;
}
KWIN_PROCEDURE( CheckIgnoreFocusStealingProcedure, Client, cl->ignore_focus_stealing = options->checkIgnoreFocusStealing( cl ));
KWIN_PROCEDURE( CheckIgnoreFocusStealingProcedure, cl->ignore_focus_stealing = options->checkIgnoreFocusStealing( cl ));
inline Window Client::moveResizeGrabWindow() const
{
@ -836,9 +893,22 @@ inline void Client::removeRule( Rules* rule )
client_rules.remove( rule );
}
KWIN_COMPARE_PREDICATE( WindowMatchPredicate, Client, Window, cl->window() == value );
KWIN_COMPARE_PREDICATE( FrameIdMatchPredicate, Client, Window, cl->frameId() == value );
KWIN_COMPARE_PREDICATE( WrapperIdMatchPredicate, Client, Window, cl->wrapperId() == value );
#ifdef NDEBUG
inline
kndbgstream& operator<<( kndbgstream& stream, const Client* ) { return stream; }
inline
kndbgstream& operator<<( kndbgstream& stream, const ClientList& ) { return stream; }
inline
kndbgstream& operator<<( kndbgstream& stream, const ConstClientList& ) { return stream; }
#else
kdbgstream& operator<<( kdbgstream& stream, const Client* );
kdbgstream& operator<<( kdbgstream& stream, const ClientList& );
kdbgstream& operator<<( kdbgstream& stream, const ConstClientList& );
#endif
KWIN_COMPARE_PREDICATE( WindowMatchPredicate, Window, cl->window() == value );
KWIN_COMPARE_PREDICATE( FrameIdMatchPredicate, Window, cl->frameId() == value );
KWIN_COMPARE_PREDICATE( WrapperIdMatchPredicate, Window, cl->wrapperId() == value );
} // namespace

View File

@ -21,8 +21,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "tabbox.h"
#include "group.h"
#include "rules.h"
#include "unmanaged.h"
#include "scene.h"
#include <QWhatsThis>
#include <QApplication>
@ -264,11 +262,6 @@ bool Workspace::workspaceEvent( XEvent * e )
if( c->windowEvent( e ))
return true;
}
else if( Unmanaged* c = findUnmanaged( HandleMatchPredicate( e->xany.window )))
{
if( c->windowEvent( e ))
return true;
}
else
{
Window special = findSpecialEventWindow( e );
@ -326,8 +319,13 @@ bool Workspace::workspaceEvent( XEvent * e )
}
return true;
}
return ( e->xunmap.event != e->xunmap.window ); // hide wm typical event from Qt
}
case MapNotify:
return ( e->xmap.event != e->xmap.window ); // hide wm typical event from Qt
case ReparentNotify:
{
//do not confuse Qt with these events. After all, _we_ are the
@ -377,22 +375,6 @@ bool Workspace::workspaceEvent( XEvent * e )
}
break;
}
case MapNotify:
{
if( e->xmap.override_redirect )
{
Unmanaged* c = findUnmanaged( HandleMatchPredicate( e->xmap.window ));
if( c == NULL )
c = createUnmanaged( e->xmap.window );
if( c )
{
c->windowEvent( e );
return true;
}
}
return ( e->xmap.event != e->xmap.window ); // hide wm typical event from Qt
}
case EnterNotify:
{
if ( QWhatsThis::inWhatsThisMode() )
@ -473,10 +455,6 @@ bool Workspace::workspaceEvent( XEvent * e )
XRefreshKeyboardMapping( &e->xmapping );
tab_box->updateKeyMapping();
break;
case Expose:
if( e->xexpose.window == rootWindow() && compositing()) // root window needs repainting
addDamage( e->xexpose.x, e->xexpose.y, e->xexpose.width, e->xexpose.height );
break;
default:
break;
}
@ -573,19 +551,6 @@ bool Client::windowEvent( XEvent* e )
if( demandAttentionKNotifyTimer != NULL )
demandAttentionKNotify();
}
if( dirty[ WinInfo::PROTOCOLS2 ] & NET::WM2Opacity )
{
if( compositing())
{
addDamage( rect());
scene->windowOpacityChanged( this );
}
else
{ // forward to the frame if there's possibly another compositing manager running
NETWinInfo i( display(), frameId(), rootWindow(), 0 );
i.setOpacity( info->opacity());
}
}
}
// TODO move all focus handling stuff to separate file?
@ -671,18 +636,13 @@ bool Client::windowEvent( XEvent* e )
break;
default:
if( e->xany.window == window())
{
if( e->type == Shape::shapeEvent() )
{
if( e->type == Extensions::shapeNotifyEvent() )
{
is_shape = hasShape( window()); // workaround for #19644
updateShape();
}
}
if( e->xany.window == frameId())
{
if( e->type == Extensions::damageNotifyEvent())
damageNotifyEvent( reinterpret_cast< XDamageNotifyEvent* >( e ));
is_shape = Shape::hasShape( window()); // workaround for #19644
updateShape();
}
}
break;
}
return true; // eat all events
@ -1602,57 +1562,6 @@ void Client::keyPressEvent( uint key_code )
QCursor::setPos( pos );
}
// ****************************************
// Unmanaged
// ****************************************
bool Unmanaged::windowEvent( XEvent* e )
{
unsigned long dirty[ 2 ];
info->event( e, dirty, 2 ); // pass through the NET stuff
if( dirty[ NETWinInfo::PROTOCOLS2 ] & NET::WM2Opacity )
{
scene->windowOpacityChanged( this );
addDamage( rect());
}
switch (e->type)
{
case UnmapNotify:
unmapNotifyEvent( &e->xunmap );
break;
case MapNotify:
mapNotifyEvent( &e->xmap );
break;
case ConfigureNotify:
configureNotifyEvent( &e->xconfigure );
break;
default:
if( e->type == Extensions::damageNotifyEvent())
damageNotifyEvent( reinterpret_cast< XDamageNotifyEvent* >( e ));
break;
}
return true; // eat all events
}
void Unmanaged::mapNotifyEvent( XMapEvent* )
{
}
void Unmanaged::unmapNotifyEvent( XUnmapEvent* )
{
release();
}
void Unmanaged::configureNotifyEvent( XConfigureEvent* e )
{
resetWindowPixmap();
// add old and new geometry to damage
// TODO add damage only if the window is not obscured
workspace()->addDamage( this, geometry());
geom = QRect( e->x, e->y, e->width, e->height );
workspace()->addDamage( this, geometry());
}
// ****************************************
// Group
// ****************************************

View File

@ -633,18 +633,18 @@ void Workspace::updateTopMenuGeometry( Client* c )
if( c != NULL )
{
XEvent ev;
ev.xclient.display = QX11Info::display();
ev.xclient.display = display();
ev.xclient.type = ClientMessage;
ev.xclient.window = c->window();
static Atom msg_type_atom = XInternAtom( QX11Info::display(), "_KDE_TOPMENU_MINSIZE", False );
static Atom msg_type_atom = XInternAtom( display(), "_KDE_TOPMENU_MINSIZE", False );
ev.xclient.message_type = msg_type_atom;
ev.xclient.format = 32;
ev.xclient.data.l[0] = QX11Info::appTime();
ev.xclient.data.l[0] = xTime();
ev.xclient.data.l[1] = topmenu_space->width();
ev.xclient.data.l[2] = topmenu_space->height();
ev.xclient.data.l[3] = 0;
ev.xclient.data.l[4] = 0;
XSendEvent( QX11Info::display(), c->window(), False, NoEventMask, &ev );
XSendEvent( display(), c->window(), False, NoEventMask, &ev );
KWin::setStrut( c->window(), 0, 0, topmenu_height, 0 ); // so that kicker etc. know
c->checkWorkspacePosition();
return;
@ -780,25 +780,25 @@ NETExtendedStrut Client::strut() const
{
ext.left_width = str.left;
ext.left_start = 0;
ext.left_end = XDisplayHeight( QX11Info::display(), DefaultScreen( QX11Info::display()));
ext.left_end = displayHeight();
}
if( str.right != 0 )
{
ext.right_width = str.right;
ext.right_start = 0;
ext.right_end = XDisplayHeight( QX11Info::display(), DefaultScreen( QX11Info::display()));
ext.right_end = displayHeight();
}
if( str.top != 0 )
{
ext.top_width = str.top;
ext.top_start = 0;
ext.top_end = XDisplayWidth( QX11Info::display(), DefaultScreen( QX11Info::display()));
ext.top_end = displayWidth();
}
if( str.bottom != 0 )
{
ext.bottom_width = str.bottom;
ext.bottom_start = 0;
ext.bottom_end = XDisplayWidth( QX11Info::display(), DefaultScreen( QX11Info::display()));
ext.bottom_end = displayWidth();
}
}
return ext;
@ -1196,7 +1196,7 @@ QSize Client::sizeForClientSize( const QSize& wsize, Sizemode mode, bool noframe
void Client::getWmNormalHints()
{
long msize;
if (XGetWMNormalHints(QX11Info::display(), window(), &xSizeHint, &msize) == 0 )
if (XGetWMNormalHints(display(), window(), &xSizeHint, &msize) == 0 )
xSizeHint.flags = 0;
// set defined values for the fields, even if they're not in flags
@ -1298,7 +1298,7 @@ void Client::sendSyntheticConfigureNotify()
c.border_width = 0;
c.above = None;
c.override_redirect = 0;
XSendEvent( QX11Info::display(), c.event, true, StructureNotifyMask, (XEvent*)&c );
XSendEvent( display(), c.event, true, StructureNotifyMask, (XEvent*)&c );
}
const QPoint Client::calculateGravitation( bool invert, int gravity ) const
@ -1667,14 +1667,14 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
return;
}
resizeDecoration( QSize( w, h ));
XMoveResizeWindow( QX11Info::display(), frameId(), x, y, w, h );
XMoveResizeWindow( display(), frameId(), x, y, w, h );
// resizeDecoration( QSize( w, h ));
if( !isShade())
{
QSize cs = clientSize();
XMoveResizeWindow( QX11Info::display(), wrapperId(), clientPos().x(), clientPos().y(),
XMoveResizeWindow( display(), wrapperId(), clientPos().x(), clientPos().y(),
cs.width(), cs.height());
XMoveResizeWindow( QX11Info::display(), window(), 0, 0, cs.width(), cs.height());
XMoveResizeWindow( display(), window(), 0, 0, cs.width(), cs.height());
}
updateShape();
// SELI TODO won't this be too expensive?
@ -1721,14 +1721,14 @@ void Client::plainResize( int w, int h, ForceGeometry_t force )
return;
}
resizeDecoration( QSize( w, h ));
XResizeWindow( QX11Info::display(), frameId(), w, h );
XResizeWindow( display(), frameId(), w, h );
// resizeDecoration( QSize( w, h ));
if( !isShade())
{
QSize cs = clientSize();
XMoveResizeWindow( QX11Info::display(), wrapperId(), clientPos().x(), clientPos().y(),
XMoveResizeWindow( display(), wrapperId(), clientPos().x(), clientPos().y(),
cs.width(), cs.height());
XMoveResizeWindow( QX11Info::display(), window(), 0, 0, cs.width(), cs.height());
XMoveResizeWindow( display(), window(), 0, 0, cs.width(), cs.height());
}
updateShape();
updateWorkareaDiffs();
@ -1751,7 +1751,7 @@ void Client::move( int x, int y, ForceGeometry_t force )
pending_geometry_update = true;
return;
}
XMoveWindow( QX11Info::display(), frameId(), x, y );
XMoveWindow( display(), frameId(), x, y );
sendSyntheticConfigureNotify();
updateWindowRules();
checkMaximizeGeometry();
@ -2220,18 +2220,18 @@ bool Client::startMoveResize()
// (http://lists.kde.org/?t=107302193400001&r=1&w=2)
XSetWindowAttributes attrs;
QRect r = workspace()->clientArea( FullArea, this );
move_resize_grab_window = XCreateWindow( QX11Info::display(), workspace()->rootWin(), r.x(), r.y(),
move_resize_grab_window = XCreateWindow( display(), workspace()->rootWin(), r.x(), r.y(),
r.width(), r.height(), 0, CopyFromParent, InputOnly, CopyFromParent, 0, &attrs );
XMapRaised( QX11Info::display(), move_resize_grab_window );
if( XGrabPointer( QX11Info::display(), move_resize_grab_window, False,
XMapRaised( display(), move_resize_grab_window );
if( XGrabPointer( display(), move_resize_grab_window, False,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask,
GrabModeAsync, GrabModeAsync, None, cursor.handle(), QX11Info::appTime() ) == Success )
GrabModeAsync, GrabModeAsync, None, cursor.handle(), xTime() ) == Success )
has_grab = true;
if( XGrabKeyboard( QX11Info::display(), frameId(), False, GrabModeAsync, GrabModeAsync, QX11Info::appTime() ) == Success )
if( XGrabKeyboard( display(), frameId(), False, GrabModeAsync, GrabModeAsync, xTime() ) == Success )
has_grab = true;
if( !has_grab ) // at least one grab is necessary in order to be able to finish move/resize
{
XDestroyWindow( QX11Info::display(), move_resize_grab_window );
XDestroyWindow( display(), move_resize_grab_window );
move_resize_grab_window = None;
return false;
}
@ -2241,13 +2241,6 @@ bool Client::startMoveResize()
workspace()->setClientIsMoving(this);
initialMoveResizeGeom = moveResizeGeom = geometry();
checkUnrestrictedMoveResize();
// rule out non opaque windows from useless translucency settings, maybe resizes?
if ((isResize() && options->removeShadowsOnResize) || (isMove() && options->removeShadowsOnMove))
setShadowSize(0);
if (rules()->checkMoveResizeMode( options->moveMode ) == Options::Opaque){
savedOpacity_ = opacity_;
setOpacity(options->translucentMovingWindows, options->movingWindowOpacity);
}
if ( ( isMove() && rules()->checkMoveResizeMode( options->moveMode ) != Options::Opaque )
|| ( isResize() && rules()->checkMoveResizeMode( options->resizeMode ) != Options::Opaque ) )
{
@ -2279,11 +2272,6 @@ void Client::finishMoveResize( bool cancel )
void Client::leaveMoveResize()
{
// rule out non opaque windows from useless translucency settings, maybe resizes?
if (rules()->checkMoveResizeMode( options->moveMode ) == Options::Opaque)
setOpacity(true, savedOpacity_);
if ((isResize() && options->removeShadowsOnResize) || (isMove() && options->removeShadowsOnMove))
updateShadowSize();
clearbound();
if (geometryTip)
{
@ -2294,9 +2282,9 @@ void Client::leaveMoveResize()
if ( ( isMove() && rules()->checkMoveResizeMode( options->moveMode ) != Options::Opaque )
|| ( isResize() && rules()->checkMoveResizeMode( options->resizeMode ) != Options::Opaque ) )
ungrabXServer();
XUngrabKeyboard( QX11Info::display(), QX11Info::appTime() );
XUngrabPointer( QX11Info::display(), QX11Info::appTime() );
XDestroyWindow( QX11Info::display(), move_resize_grab_window );
XUngrabKeyboard( display(), xTime() );
XUngrabPointer( display(), xTime() );
XDestroyWindow( display(), move_resize_grab_window );
move_resize_grab_window = None;
workspace()->setClientIsMoving(0);
if( move_faked_activity )
@ -2542,7 +2530,7 @@ void Client::handleMoveResize( int x, int y, int x_root, int y_root )
} // so the geometry tip will be painted above the outline
}
if ( isMove() )
workspace()->clientMoved(globalPos, QX11Info::appTime());
workspace()->clientMoved(globalPos, xTime());
}

View File

@ -51,7 +51,7 @@ Group::Group( Window leader_P, Workspace* workspace_P )
{
leader_client = workspace_P->findClient( WindowMatchPredicate( leader_P ));
unsigned long properties[ 2 ] = { 0, NET::WM2StartupId };
leader_info = new NETWinInfo( QX11Info::display(), leader_P, workspace()->rootWin(),
leader_info = new NETWinInfo( display(), leader_P, workspace()->rootWin(),
properties, 2 );
}
workspace()->addGroup( this, Allowed );
@ -398,7 +398,7 @@ bool Client::sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool ac
void Client::readTransient()
{
Window new_transient_for_id;
if( XGetTransientForHint( QX11Info::display(), window(), &new_transient_for_id ))
if( XGetTransientForHint( display(), window(), &new_transient_for_id ))
{
original_transient_for_id = new_transient_for_id;
new_transient_for_id = verifyTransientFor( new_transient_for_id, true );
@ -601,7 +601,7 @@ Window Client::verifyTransientFor( Window new_transient_for, bool defined )
Window root_return, parent_return;
Window* wins = NULL;
unsigned int nwins;
int r = XQueryTree(QX11Info::display(), new_transient_for, &root_return, &parent_return, &wins, &nwins);
int r = XQueryTree(display(), new_transient_for, &root_return, &parent_return, &wins, &nwins);
if ( wins )
XFree((void *) wins);
if ( r == 0)
@ -642,7 +642,7 @@ Window Client::verifyTransientFor( Window new_transient_for, bool defined )
new_transient_for = workspace()->rootWin();
}
if( new_property_value != original_transient_for_id )
XSetTransientForHint( QX11Info::display(), window(), new_property_value );
XSetTransientForHint( display(), window(), new_property_value );
return new_transient_for;
}

View File

@ -1,30 +0,0 @@
########### next target ###############
set(kompmgr_SRCS kompmgr.c )
kde4_automoc(${kompmgr_SRCS})
kde4_add_executable(kompmgr ${kompmgr_SRCS})
target_link_libraries(kompmgr ${KDE4_KDECORE_LIBS} ${X11_Xcomposite_LIB} ${X11_Xdamage_LIB} ${X11_Xfixes_LIB} ${X11_Xext_LIB} m )
install(TARGETS kompmgr DESTINATION ${BIN_INSTALL_DIR})
########### install files ###############
#original Makefile.am contents follow:
#bin_PROGRAMS = kompmgr
#
#kompmgr_SOURCES = kompmgr.c
#kompmgr_LDADD = $(X_LDFLAGS) $(X_RPATH) -lXcomposite -lXdamage -lXfixes $(LIB_XRENDER) $(LIB_X11) -lXext -lm
#
#INCLUDES = $(all_includes)

View File

@ -30,7 +30,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "options.h"
#include "sm.h"
#include "utils.h"
#include "effects.h"
#define INT8 _X11INT8
#define INT32 _X11INT32
@ -118,8 +117,6 @@ Application::Application( )
options = new Options;
atoms = new Atoms;
initting = false; // TODO
// create workspace.
(void) new Workspace( isSessionRestored() );
@ -146,8 +143,6 @@ Application::~Application()
if( owner.ownerWindow() != None ) // if there was no --replace (no new WM)
XSetInputFocus( display(), PointerRoot, RevertToPointerRoot, xTime() );
delete options;
delete effects;
delete atoms;
}
void Application::lostSelection()
@ -282,9 +277,9 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
QString appname;
if (KWinInternal::screen_number == 0)
appname = "kwin";
appname = "org.kde.kwin";
else
appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);
appname.sprintf("org.kde.kwin-screen-%d", KWinInternal::screen_number);
QDBus::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService );

View File

@ -39,7 +39,7 @@ bool Client::manage( Window w, bool isMapped )
StackingUpdatesBlocker stacking_blocker( workspace());
XWindowAttributes attr;
if( !XGetWindowAttributes(QX11Info::display(), w, &attr))
if( !XGetWindowAttributes(display(), w, &attr))
return false;
grabXServer();
@ -53,7 +53,7 @@ bool Client::manage( Window w, bool isMapped )
// SELI order all these things in some sane manner
bool init_minimize = false;
XWMHints * hints = XGetWMHints(QX11Info::display(), w );
XWMHints * hints = XGetWMHints(display(), w );
if (hints && (hints->flags & StateHint) && hints->initial_state == IconicState)
init_minimize = true;
if (hints)
@ -79,12 +79,12 @@ bool Client::manage( Window w, bool isMapped )
NET::WM2ExtendedStrut |
0;
info = new WinInfo( this, QX11Info::display(), client, QX11Info::appRootWindow(), properties, 2 );
info = new WinInfo( this, display(), client, rootWindow(), properties, 2 );
cmap = attr.colormap;
XClassHint classHint;
if ( XGetClassHint( QX11Info::display(), client, &classHint ) )
if ( XGetClassHint( display(), client, &classHint ) )
{
// Qt3.2 and older had this all lowercase, Qt3.3 capitalized resource class
// force lowercase, so that workarounds listing resource classes still work
@ -106,7 +106,6 @@ bool Client::manage( Window w, bool isMapped )
setCaption( cap_normal, true );
detectNoBorder();
detectShapable();
fetchIconicName();
getWMHints(); // needs to be done before readTransient() because of reading the group
modal = ( info->state() & NET::Modal ) != 0; // needs to be valid before handling groups
@ -143,8 +142,6 @@ bool Client::manage( Window w, bool isMapped )
if( rules()->checkNoBorder( false, !isMapped ))
setUserNoBorder( true );
checkAndSetInitialRuledOpacity();
// initial desktop placement
if ( session )
{
@ -316,7 +313,7 @@ bool Client::manage( Window w, bool isMapped )
if(( !isSpecialWindow() || isToolbar()) && isMovable())
keepInArea( area, partial_keep_in_area );
XShapeSelectInput( QX11Info::display(), window(), ShapeNotifyMask );
XShapeSelectInput( display(), window(), ShapeNotifyMask );
is_shape = Shape::hasShape( window());
updateShape();
@ -431,7 +428,7 @@ bool Client::manage( Window w, bool isMapped )
// this should avoid flicker, because real restacking is done
// only after manage() finishes because of blocking, but the window is shown sooner
XLowerWindow( QX11Info::display(), frameId());
XLowerWindow( display(), frameId());
if( session && session->stackingOrder != -1 )
{
sm_stacking_order = session->stackingOrder;
@ -503,9 +500,9 @@ bool Client::manage( Window w, bool isMapped )
if( user_time == CurrentTime || user_time == -1U ) // no known user time, set something old
{
user_time = QX11Info::appTime() - 1000000;
user_time = xTime() - 1000000;
if( user_time == CurrentTime || user_time == -1U ) // let's be paranoid
user_time = QX11Info::appTime() - 1000000 + 10;
user_time = xTime() - 1000000 + 10;
}
updateWorkareaDiffs();
@ -535,30 +532,30 @@ void Client::embedClient( Window w, const XWindowAttributes &attr )
assert( wrapper == None );
client = w;
// we don't want the window to be destroyed when we are destroyed
XAddToSaveSet( QX11Info::display(), client );
XSelectInput( QX11Info::display(), client, NoEventMask );
XUnmapWindow( QX11Info::display(), client );
XAddToSaveSet( display(), client );
XSelectInput( display(), client, NoEventMask );
XUnmapWindow( display(), client );
XWindowChanges wc; // set the border width to 0
wc.border_width = 0; // TODO possibly save this, and also use it for initial configuring of the window
XConfigureWindow( QX11Info::display(), client, CWBorderWidth, &wc );
XConfigureWindow( display(), client, CWBorderWidth, &wc );
XSetWindowAttributes swa;
swa.colormap = attr.colormap;
swa.background_pixmap = None;
swa.border_pixel = 0;
frame = XCreateWindow( QX11Info::display(), QX11Info::appRootWindow(), 0, 0, 1, 1, 0,
frame = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
attr.depth, InputOutput, attr.visual,
CWColormap | CWBackPixmap | CWBorderPixel, &swa );
wrapper = XCreateWindow( QX11Info::display(), frame, 0, 0, 1, 1, 0,
wrapper = XCreateWindow( display(), frame, 0, 0, 1, 1, 0,
attr.depth, InputOutput, attr.visual,
CWColormap | CWBackPixmap | CWBorderPixel, &swa );
XDefineCursor( QX11Info::display(), frame, QCursor( Qt::ArrowCursor ).handle());
XDefineCursor( display(), frame, QCursor( Qt::ArrowCursor ).handle());
// some apps are stupid and don't define their own cursor - set the arrow one for them
XDefineCursor( QX11Info::display(), wrapper, QCursor( Qt::ArrowCursor ).handle());
XReparentWindow( QX11Info::display(), client, wrapper, 0, 0 );
XSelectInput( QX11Info::display(), frame,
XDefineCursor( display(), wrapper, QCursor( Qt::ArrowCursor ).handle());
XReparentWindow( display(), client, wrapper, 0, 0 );
XSelectInput( display(), frame,
KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
KeymapStateMask |
@ -570,8 +567,8 @@ void Client::embedClient( Window w, const XWindowAttributes &attr )
PropertyChangeMask |
StructureNotifyMask | SubstructureRedirectMask |
VisibilityChangeMask );
XSelectInput( QX11Info::display(), wrapper, ClientWinMask | SubstructureNotifyMask );
XSelectInput( QX11Info::display(), client,
XSelectInput( display(), wrapper, ClientWinMask | SubstructureNotifyMask );
XSelectInput( display(), client,
FocusChangeMask |
PropertyChangeMask |
ColormapChangeMask |

View File

@ -174,8 +174,9 @@ unsigned long Options::updateSettings()
CmdAllWheel = mouseWheelCommand(config->readEntry("CommandAllWheel","Nothing"));
//translucency settings - TODO
config->setGroup( "Notification Messages" );
useTranslucency = config->readEntry("UseTranslucency", QVariant(false)).toBool();
config->setGroup( "Translucency");
useTranslucency = config->readEntry("UseTranslucency", QVariant(true)).toBool();
translucentActiveWindows = config->readEntry("TranslucentActiveWindows", QVariant(false)).toBool();
activeWindowOpacity = uint((config->readEntry("ActiveWindowOpacity", 100)/100.0)*0xFFFFFFFF);
translucentInactiveWindows = config->readEntry("TranslucentInactiveWindows", QVariant(false)).toBool();

View File

@ -164,18 +164,10 @@ QMenu* Workspace::clientPopup()
return popup;
}
//sets the transparency of the client to given value(given by slider)
void Workspace::setPopupClientOpacity(int value)
{
if( active_popup_client == NULL )
return;
active_popup_client->setOpacity( value / 100.0 );
}
void Workspace::resetClientOpacity()
{
if( active_popup_client == NULL )
return;
active_popup_client->setOpacity( 1.0 );
// TODO
}
void Workspace::setTransButtonText(int value)
@ -191,6 +183,11 @@ void Workspace::setTransButtonText(int value)
transButton->setText('0'+QString::number(value)+" %");
}
void Workspace::resetClientOpacity()
{
// TODO
}
/*!
The client popup menu will become visible soon.
@ -644,10 +641,10 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
workspace()->windowToNextDesktop( this );
break;
case Options::MouseOpacityMore:
setOpacity( qMin( opacity() + 0.1, 1.0 ));
// TODO
break;
case Options::MouseOpacityLess:
setOpacity( qMax( opacity() - 0.1, 0.0 ));
// TODO
break;
case Options::MouseNothing:
replay = true;

View File

@ -56,7 +56,7 @@ bool Shape::hasShape( WId w)
int boundingShaped = 0, clipShaped = 0;
if (!available())
return false;
XShapeQueryExtents(QX11Info::display(), w,
XShapeQueryExtents(display(), w,
&boundingShaped, &xws, &yws, &wws, &hws,
&clipShaped, &xbs, &ybs, &wbs, &hbs);
return boundingShaped != 0;
@ -71,10 +71,10 @@ void Shape::init()
{
kwin_shape_version = 0;
int dummy;
if( !XShapeQueryExtension( QX11Info::display(), &kwin_shape_event, &dummy ))
if( !XShapeQueryExtension( display(), &kwin_shape_event, &dummy ))
return;
int major, minor;
if( !XShapeQueryVersion( QX11Info::display(), &major, &minor ))
if( !XShapeQueryVersion( display(), &major, &minor ))
return;
kwin_shape_version = major * 16 + minor;
}
@ -87,7 +87,7 @@ void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move,
unsigned long length, after;
unsigned char* data;
MwmHints* hints = 0;
if ( XGetWindowProperty( QX11Info::display(), w, atoms->motif_wm_hints, 0, 5,
if ( XGetWindowProperty( display(), w, atoms->motif_wm_hints, 0, 5,
false, atoms->motif_wm_hints, &type, &format,
&length, &after, &data ) == Success )
{
@ -140,10 +140,10 @@ KWinSelectionOwner::KWinSelectionOwner( int screen_P )
Atom KWinSelectionOwner::make_selection_atom( int screen_P )
{
if( screen_P < 0 )
screen_P = DefaultScreen( QX11Info::display());
screen_P = DefaultScreen( display());
char tmp[ 30 ];
sprintf( tmp, "WM_S%d", screen_P );
return XInternAtom( QX11Info::display(), tmp, False );
return XInternAtom( display(), tmp, False );
}
void KWinSelectionOwner::getAtoms()
@ -154,7 +154,7 @@ void KWinSelectionOwner::getAtoms()
Atom atoms[ 1 ];
const char* const names[] =
{ "VERSION" };
XInternAtoms( QX11Info::display(), const_cast< char** >( names ), 1, False, atoms );
XInternAtoms( display(), const_cast< char** >( names ), 1, False, atoms );
xa_version = atoms[ 0 ];
}
}
@ -164,7 +164,7 @@ void KWinSelectionOwner::replyTargets( Atom property_P, Window requestor_P )
KSelectionOwner::replyTargets( property_P, requestor_P );
Atom atoms[ 1 ] = { xa_version };
// PropModeAppend !
XChangeProperty( QX11Info::display(), requestor_P, property_P, XA_ATOM, 32, PropModeAppend,
XChangeProperty( display(), requestor_P, property_P, XA_ATOM, 32, PropModeAppend,
reinterpret_cast< unsigned char* >( atoms ), 1 );
}
@ -173,7 +173,7 @@ bool KWinSelectionOwner::genericReply( Atom target_P, Atom property_P, Window re
if( target_P == xa_version )
{
long version[] = { 2, 0 };
XChangeProperty( QX11Info::display(), requestor_P, property_P, XA_INTEGER, 32,
XChangeProperty( display(), requestor_P, property_P, XA_INTEGER, 32,
PropModeReplace, reinterpret_cast< unsigned char* >( &version ), 2 );
}
else
@ -193,7 +193,7 @@ QByteArray getStringProperty(WId w, Atom prop, char separator)
unsigned char *data = 0;
QByteArray result = "";
KXErrorHandler handler; // ignore errors
status = XGetWindowProperty( QX11Info::display(), w, prop, 0, 10000,
status = XGetWindowProperty( display(), w, prop, 0, 10000,
false, XA_STRING, &type, &format,
&nitems, &extra, &data );
if ( status == Success)
@ -248,8 +248,8 @@ static Bool update_x_time_predicate( Display*, XEvent* event, XPointer )
}
/*
Updates QX11Info::appTime(). This used to simply fetch current timestamp from the server,
but that can cause QX11Info::appTime() to be newer than timestamp of events that are
Updates xTime(). This used to simply fetch current timestamp from the server,
but that can cause xTime() to be newer than timestamp of events that are
still in our events queue, thus e.g. making XSetInputFocus() caused by such
event to be ignored. Therefore events queue is searched for first
event with timestamp, and extra PropertyNotify is generated in order to make
@ -261,20 +261,20 @@ void updateXTime()
if ( !w )
w = new QWidget;
long data = 1;
XChangeProperty(QX11Info::display(), w->winId(), atoms->kwin_running, atoms->kwin_running, 32,
XChangeProperty(display(), w->winId(), atoms->kwin_running, atoms->kwin_running, 32,
PropModeAppend, (unsigned char*) &data, 1);
next_x_time = CurrentTime;
XEvent dummy;
XCheckIfEvent( QX11Info::display(), &dummy, update_x_time_predicate, NULL );
XCheckIfEvent( display(), &dummy, update_x_time_predicate, NULL );
if( next_x_time == CurrentTime )
{
XSync( QX11Info::display(), False );
XCheckIfEvent( QX11Info::display(), &dummy, update_x_time_predicate, NULL );
XSync( display(), False );
XCheckIfEvent( display(), &dummy, update_x_time_predicate, NULL );
}
assert( next_x_time != CurrentTime );
QX11Info::setAppTime( next_x_time );
XEvent ev; // remove the PropertyNotify event from the events queue
XWindowEvent( QX11Info::display(), w->winId(), PropertyChangeMask, &ev );
XWindowEvent( display(), w->winId(), PropertyChangeMask, &ev );
}
static int server_grab_count = 0;
@ -282,7 +282,7 @@ static int server_grab_count = 0;
void grabXServer()
{
if( ++server_grab_count == 1 )
XGrabServer( QX11Info::display());
XGrabServer( display());
}
void ungrabXServer()
@ -290,8 +290,8 @@ void ungrabXServer()
assert( server_grab_count > 0 );
if( --server_grab_count == 0 )
{
XUngrabServer( QX11Info::display());
XFlush( QX11Info::display());
XUngrabServer( display());
XFlush( display());
Notify::sendPendingEvents();
}
}
@ -332,7 +332,7 @@ ShortcutDialog::ShortcutDialog( const KShortcut& cut )
// make it a popup, so that it has the grab
XSetWindowAttributes attrs;
attrs.override_redirect = True;
XChangeWindowAttributes( QX11Info::display(), winId(), CWOverrideRedirect, &attrs );
XChangeWindowAttributes( display(), winId(), CWOverrideRedirect, &attrs );
setWindowFlags( Qt::Popup );
}

31
utils.h
View File

@ -17,6 +17,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <netwm_def.h>
#include <kshortcutdialog.h>
#include <limits.h>
#include <QX11Info>
namespace KWinInternal
{
@ -191,6 +192,36 @@ void grabXServer();
void ungrabXServer();
bool grabbedXServer();
inline
Display* display()
{
return QX11Info::display();
}
inline
Window rootWindow()
{
return QX11Info::appRootWindow();
}
inline
Window xTime()
{
return QX11Info::appTime();
}
inline
int displayWidth()
{
return XDisplayWidth( display(), DefaultScreen( display()));
}
inline
int displayHeight()
{
return XDisplayHeight( display(), DefaultScreen( display()));
}
// the docs say it's UrgencyHint, but it's often #defined as XUrgencyHint
#ifndef UrgencyHint
#define UrgencyHint XUrgencyHint

View File

@ -43,7 +43,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "group.h"
#include "rules.h"
#include "kwinadaptor.h"
#include "unmanaged.h"
#include <X11/extensions/shape.h>
#include <X11/keysym.h>
@ -123,8 +122,7 @@ Workspace::Workspace( bool restore )
topmenu_space( NULL ),
set_active_client_recursion( 0 ),
block_stacking_updates( 0 ),
forced_global_mouse_grab( false ),
damage_region( None )
forced_global_mouse_grab( false )
{
new KWinAdaptor( "org.kde.kwin", "/KWin", QDBus::sessionBus(), this );
@ -168,12 +166,10 @@ Workspace::Workspace( bool restore )
ColormapChangeMask |
SubstructureRedirectMask |
SubstructureNotifyMask |
FocusChangeMask | // for NotifyDetailNone
ExposureMask
FocusChangeMask // for NotifyDetailNone
);
Extensions::init();
setupCompositing();
Shape::init();
// compatibility
long data = 1;
@ -322,7 +318,6 @@ void Workspace::init()
connect(&reconfigureTimer, SIGNAL(timeout()), this,
SLOT(slotReconfigure()));
connect( &updateToolWindowsTimer, SIGNAL( timeout()), this, SLOT( slotUpdateToolWindows()));
connect( &compositeTimer, SIGNAL( timeout()), SLOT( compositeTimeout()));
connect(kapp, SIGNAL(appearanceChanged()), this,
SLOT(slotReconfigure()));
@ -359,11 +354,7 @@ void Workspace::init()
XWindowAttributes attr;
XGetWindowAttributes(display(), wins[i], &attr);
if (attr.override_redirect )
{
if( attr.map_state != IsUnmapped && attr.c_class != InputOnly && compositing())
createUnmanaged( wins[ i ] );
continue;
}
if( topmenu_space && topmenu_space->winId() == wins[ i ] )
continue;
if (attr.map_state != IsUnmapped)
@ -426,7 +417,6 @@ void Workspace::init()
Workspace::~Workspace()
{
finishCompositing();
blockStackingUpdates( true );
// TODO grabXServer();
// use stacking_order, so that kwin --replace keeps stacking order
@ -438,10 +428,6 @@ Workspace::~Workspace()
(*it)->releaseWindow( true );
// no removeClient() is called !
}
for( UnmanagedList::ConstIterator it = unmanaged.begin();
it != unmanaged.end();
++it )
(*it)->release();
delete desktop_widget;
delete tab_box;
delete popupinfo;
@ -488,18 +474,6 @@ Client* Workspace::createClient( Window w, bool is_mapped )
return c;
}
Unmanaged* Workspace::createUnmanaged( Window w )
{
Unmanaged* c = new Unmanaged( this );
if( !c->track( w ))
{
Unmanaged::deleteUnmanaged( c, Allowed );
return NULL;
}
addUnmanaged( c, Allowed );
return c;
}
void Workspace::addClient( Client* c, allowed_t )
{
Group* grp = findGroup( c->window());
@ -539,11 +513,6 @@ void Workspace::addClient( Client* c, allowed_t )
updateToolWindows( true );
}
void Workspace::addUnmanaged( Unmanaged* c, allowed_t )
{
unmanaged.append( c );
}
/*
Destroys the client \a c
*/
@ -598,12 +567,6 @@ void Workspace::removeClient( Client* c, allowed_t )
updateClientArea();
}
void Workspace::removeUnmanaged( Unmanaged* c, allowed_t )
{
assert( unmanaged.contains( c ));
unmanaged.removeAll( c );
}
void Workspace::updateFocusChains( Client* c, FocusChainChange change )
{
if( !c->wantsTabFocus()) // doesn't want tab focus, remove
@ -900,7 +863,7 @@ void Workspace::slotSettingsChanged(int category)
/*!
Reread settings
*/
KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() );
KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() );
void Workspace::slotReconfigure()
{
@ -957,11 +920,6 @@ void Workspace::slotReconfigure()
updateTopMenuGeometry();
updateCurrentTopMenu();
}
if( options->useTranslucency )
setupCompositing();
else
finishCompositing();
loadWindowRules();
for( ClientList::Iterator it = clients.begin();
@ -1663,7 +1621,7 @@ void Workspace::slotGrabWindow()
QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() );
//No XShape - no work.
if( Extensions::shapeAvailable())
if( Shape::available())
{
//As the first step, get the mask from XShape.
int count, order;

View File

@ -77,7 +77,7 @@ class Workspace : public QObject, public KDecorationDefines
virtual ~Workspace();
static Workspace * self() { return _self; }
bool workspaceEvent( XEvent * );
KDecoration* createDecoration( KDecorationBridge* bridge );
@ -87,9 +87,6 @@ class Workspace : public QObject, public KDecorationDefines
template< typename T > Client* findClient( T predicate );
template< typename T1, typename T2 > void forEachClient( T1 procedure, T2 predicate );
template< typename T > void forEachClient( T procedure );
template< typename T > Unmanaged* findUnmanaged( T predicate );
template< typename T1, typename T2 > void forEachUnmanaged( T1 procedure, T2 predicate );
template< typename T > void forEachUnmanaged( T procedure );
QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
QRect clientArea( clientAreaOption, const Client* c ) const;
@ -245,9 +242,6 @@ class Workspace : public QObject, public KDecorationDefines
void removeGroup( Group* group, allowed_t );
Group* findClientLeaderGroup( const Client* c ) const;
// only called from Unmanaged::release()
void removeUnmanaged( Unmanaged*, allowed_t );
bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
void focusToNull(); // SELI public?
@ -282,13 +276,6 @@ class Workspace : public QObject, public KDecorationDefines
void requestDelayFocus( Client* );
void toggleTopDockShadows(bool on);
void addDamage( const QRect& r );
void addDamage( int x, int y, int w, int h );
void addDamage( XserverRegion r, bool destroy );
void addDamage( Toplevel* c, const QRect& r );
void addDamage( Toplevel* c, int x, int y, int w, int h );
void addDamage( Toplevel* c, XserverRegion r, bool destroy );
public slots:
void refresh();
@ -301,8 +288,48 @@ class Workspace : public QObject, public KDecorationDefines
void slotSwitchDesktopDown();
void slotSwitchToDesktop( int );
void slotSwitchToDesktop1() { return slotSwitchToDesktop( 1 ); }
void slotSwitchToDesktop2() { return slotSwitchToDesktop( 2 ); }
void slotSwitchToDesktop3() { return slotSwitchToDesktop( 3 ); }
void slotSwitchToDesktop4() { return slotSwitchToDesktop( 4 ); }
void slotSwitchToDesktop5() { return slotSwitchToDesktop( 5 ); }
void slotSwitchToDesktop6() { return slotSwitchToDesktop( 6 ); }
void slotSwitchToDesktop7() { return slotSwitchToDesktop( 7 ); }
void slotSwitchToDesktop8() { return slotSwitchToDesktop( 8 ); }
void slotSwitchToDesktop9() { return slotSwitchToDesktop( 9 ); }
void slotSwitchToDesktop10() { return slotSwitchToDesktop( 10 ); }
void slotSwitchToDesktop11() { return slotSwitchToDesktop( 11 ); }
void slotSwitchToDesktop12() { return slotSwitchToDesktop( 12 ); }
void slotSwitchToDesktop13() { return slotSwitchToDesktop( 13 ); }
void slotSwitchToDesktop14() { return slotSwitchToDesktop( 14 ); }
void slotSwitchToDesktop15() { return slotSwitchToDesktop( 15 ); }
void slotSwitchToDesktop16() { return slotSwitchToDesktop( 16 ); }
void slotSwitchToDesktop17() { return slotSwitchToDesktop( 17 ); }
void slotSwitchToDesktop18() { return slotSwitchToDesktop( 18 ); }
void slotSwitchToDesktop19() { return slotSwitchToDesktop( 19 ); }
void slotSwitchToDesktop20() { return slotSwitchToDesktop( 20 ); }
//void slotSwitchToWindow( int );
void slotWindowToDesktop( int );
void slotWindowToDesktop1() { return slotWindowToDesktop( 1 ); }
void slotWindowToDesktop2() { return slotWindowToDesktop( 2 ); }
void slotWindowToDesktop3() { return slotWindowToDesktop( 3 ); }
void slotWindowToDesktop4() { return slotWindowToDesktop( 4 ); }
void slotWindowToDesktop5() { return slotWindowToDesktop( 5 ); }
void slotWindowToDesktop6() { return slotWindowToDesktop( 6 ); }
void slotWindowToDesktop7() { return slotWindowToDesktop( 7 ); }
void slotWindowToDesktop8() { return slotWindowToDesktop( 8 ); }
void slotWindowToDesktop9() { return slotWindowToDesktop( 9 ); }
void slotWindowToDesktop10() { return slotWindowToDesktop( 10 ); }
void slotWindowToDesktop11() { return slotWindowToDesktop( 11 ); }
void slotWindowToDesktop12() { return slotWindowToDesktop( 12 ); }
void slotWindowToDesktop13() { return slotWindowToDesktop( 13 ); }
void slotWindowToDesktop14() { return slotWindowToDesktop( 14 ); }
void slotWindowToDesktop15() { return slotWindowToDesktop( 15 ); }
void slotWindowToDesktop16() { return slotWindowToDesktop( 16 ); }
void slotWindowToDesktop17() { return slotWindowToDesktop( 17 ); }
void slotWindowToDesktop18() { return slotWindowToDesktop( 18 ); }
void slotWindowToDesktop19() { return slotWindowToDesktop( 19 ); }
void slotWindowToDesktop20() { return slotWindowToDesktop( 20 ); }
//void slotWindowToListPosition( int );
void slotWindowMaximize();
@ -379,10 +406,11 @@ class Workspace : public QObject, public KDecorationDefines
void cleanupTemporaryRules();
void writeWindowRules();
void kipcMessage( int id, int data );
// kompmgr
void setPopupClientOpacity(int v);
void resetClientOpacity();
void setTransButtonText(int value);
void compositeTimeout();
// end
protected:
bool keyPressMouseEmulation( XKeyEvent& ev );
@ -430,8 +458,6 @@ class Workspace : public QObject, public KDecorationDefines
// this is the right way to create a new client
Client* createClient( Window w, bool is_mapped );
void addClient( Client* c, allowed_t );
Unmanaged* createUnmanaged( Window w );
void addUnmanaged( Unmanaged* c, allowed_t );
Window findSpecialEventWindow( XEvent* e );
@ -473,9 +499,6 @@ class Workspace : public QObject, public KDecorationDefines
void closeActivePopup();
void updateClientArea( bool force );
void setupCompositing();
void finishCompositing();
SystemTrayWindowList systemTrayWins;
@ -512,7 +535,6 @@ class Workspace : public QObject, public KDecorationDefines
ClientList clients;
ClientList desktops;
UnmanagedList unmanaged;
ClientList unconstrained_stacking_order;
ClientList stacking_order;
@ -632,10 +654,8 @@ class Workspace : public QObject, public KDecorationDefines
Window null_focus_window;
bool forced_global_mouse_grab;
friend class StackingUpdatesBlocker;
QTimer compositeTimer;
XserverRegion damage_region;
//kompmgr
QSlider *transSlider;
QPushButton *transButton;
};
@ -807,27 +827,7 @@ inline void Workspace::forEachClient( T procedure )
return forEachClient( procedure, TruePredicate());
}
template< typename T >
inline Unmanaged* Workspace::findUnmanaged( T predicate )
{
return findUnmanagedInList( unmanaged, predicate );
}
template< typename T1, typename T2 >
inline void Workspace::forEachUnmanaged( T1 procedure, T2 predicate )
{
for ( UnmanagedList::ConstIterator it = unmanaged.begin(); it != unmanaged.end(); ++it)
if ( predicate( const_cast< const Unmanaged* >( *it)))
procedure( *it );
}
template< typename T >
inline void Workspace::forEachUnmanaged( T procedure )
{
return forEachUnmanaged( procedure, TruePredicate());
}
KWIN_COMPARE_PREDICATE( ClientMatchPredicate, Client, const Client*, cl == value );
KWIN_COMPARE_PREDICATE( ClientMatchPredicate, const Client*, cl == value );
inline bool Workspace::hasClient( const Client* c )
{
return findClient( ClientMatchPredicate( c ));