Some convenience functions for QX11Info stuff.

svn path=/branches/work/kwin_composite/; revision=558154
icc-effect-5.14.5
Luboš Luňák 2006-07-04 19:36:19 +00:00
parent e12b8f755a
commit e0dcc3ba46
16 changed files with 319 additions and 287 deletions

View File

@ -624,7 +624,7 @@ void Workspace::unfakeActivity( Client* c )
void Client::updateUserTime( Time time )
{ // copied in Group::updateUserTime
if( time == CurrentTime )
time = QX11Info::appTime();
time = xTime();
if( time != -1U
&& ( user_time == CurrentTime
|| timestampCompare( time, user_time ) > 0 )) // time > user_time
@ -641,7 +641,7 @@ Time Client::readUserCreationTime() const
unsigned long extra = 0;
unsigned char *data = 0;
KXErrorHandler handler; // ignore errors?
status = XGetWindowProperty( QX11Info::display(), window(),
status = XGetWindowProperty( display(), window(),
atoms->kde_net_wm_user_creation_time, 0, 10000, false, XA_CARDINAL,
&type, &format, &nitems, &extra, &data );
if (status == Success )
@ -910,7 +910,7 @@ void Group::startupIdChanged()
void Group::updateUserTime( Time time )
{ // copy of Client::updateUserTime
if( time == CurrentTime )
time = QX11Info::appTime();
time = xTime();
if( time != -1U
&& ( user_time == CurrentTime
|| timestampCompare( time, user_time ) > 0 )) // time > user_time

View File

@ -12,8 +12,8 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QApplication>
#include "atoms.h"
#include "utils.h"
#include <assert.h>
#include <QX11Info>
namespace KWinInternal
{
@ -108,7 +108,7 @@ Atoms::Atoms()
assert( n <= max );
XInternAtoms( QX11Info::display(), names, n, false, atoms_return );
XInternAtoms( display(), names, n, false, atoms_return );
for (int i = 0; i < n; i++ )
*atoms[i] = atoms_return[i];
}

View File

@ -192,7 +192,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 +204,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 +249,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,7 +272,7 @@ 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 ?
@ -458,13 +458,13 @@ void Client::updateShape()
setShapable(true);
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);
}
// workaround for #19644 - shaped windows shouldn't have decoration
@ -479,10 +479,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
{
@ -497,7 +497,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;
}
@ -513,7 +513,7 @@ QRegion Client::mask() const
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);
XChangeProperty(display(), frameId(), atoms->net_wm_window_shapable, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &tmp, 1L);
}
void Client::hideClient( bool hide )
@ -667,7 +667,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 )
{
@ -676,8 +676,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;
@ -765,16 +765,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 );
@ -784,7 +784,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 );
@ -801,7 +801,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
{
@ -814,7 +814,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
@ -827,9 +827,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 );
}
@ -928,7 +928,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 );
@ -936,7 +936,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
@ -951,11 +951,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 );
}
}
@ -972,11 +972,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 );
@ -993,14 +993,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);
}
/*
@ -1052,7 +1052,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();
}
@ -1071,7 +1071,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 );
}
@ -1238,15 +1238,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
@ -1255,17 +1255,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);
@ -1398,7 +1398,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;
@ -1487,7 +1487,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)
@ -1546,7 +1546,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);
@ -1763,7 +1763,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
@ -1818,21 +1818,21 @@ 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());
// qWarning("setting opacity for %d",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
XDeleteProperty (display(), frameId(), atoms->net_wm_window_opacity);
XDeleteProperty (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);
XChangeProperty(display(), frameId(), atoms->net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
XChangeProperty(display(), window(), atoms->net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
}
}
@ -1841,7 +1841,7 @@ 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);
XChangeProperty(display(), frameId(), atoms->net_wm_window_shadow, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
}
void Client::updateOpacity()
@ -2025,7 +2025,7 @@ bool Client::getWindowOpacity() //query translucency settings from X, returns tr
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);
result = XGetWindowProperty(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 );
@ -2072,12 +2072,12 @@ void Client::setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHei
(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);
XChangeProperty(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);
XDeleteProperty( display(), frameId(), atoms->net_wm_window_decohash);
}
#ifndef NDEBUG

View File

@ -196,7 +196,7 @@ bool Workspace::workspaceEvent( XEvent * e )
if ( mouse_emulation && (e->type == ButtonPress || e->type == ButtonRelease ) )
{
mouse_emulation = false;
XUngrabKeyboard( QX11Info::display(), QX11Info::appTime() );
XUngrabKeyboard( display(), xTime() );
}
if ( e->type == PropertyNotify || e->type == ClientMessage )
@ -287,8 +287,8 @@ bool Workspace::workspaceEvent( XEvent * e )
!e->xcreatewindow.override_redirect )
{
// see comments for allowClientActivation()
Time t = QX11Info::appTime();
XChangeProperty(QX11Info::display(), e->xcreatewindow.window,
Time t = xTime();
XChangeProperty(display(), e->xcreatewindow.window,
atoms->kde_net_wm_user_creation_time, XA_CARDINAL,
32, PropModeReplace, (unsigned char *)&t, 1);
}
@ -308,12 +308,12 @@ bool Workspace::workspaceEvent( XEvent * e )
// window.
XEvent ev;
WId w = e->xunmap.window;
if ( XCheckTypedWindowEvent (QX11Info::display(), w,
if ( XCheckTypedWindowEvent (display(), w,
ReparentNotify, &ev) )
{
if ( ev.xreparent.parent != root )
{
XReparentWindow( QX11Info::display(), w, root, 0, 0 );
XReparentWindow( display(), w, root, 0, 0 );
addSystemTrayWin( w );
}
}
@ -358,13 +358,13 @@ bool Workspace::workspaceEvent( XEvent * e )
if ( addSystemTrayWin( e->xmaprequest.window ) )
return true;
c = createClient( e->xmaprequest.window, false );
if ( c != NULL && root != QX11Info::appRootWindow() )
if ( c != NULL && root != rootWindow() )
{ // TODO what is this?
// TODO may use QWidget::create
XReparentWindow( QX11Info::display(), c->frameId(), root, 0, 0 );
XReparentWindow( display(), c->frameId(), root, 0, 0 );
}
if( c == NULL ) // refused to manage, simply map it (most probably override redirect)
XMapRaised( QX11Info::display(), e->xmaprequest.window );
XMapRaised( display(), e->xmaprequest.window );
return true;
}
if( c )
@ -411,7 +411,7 @@ bool Workspace::workspaceEvent( XEvent * e )
wc.stack_mode = Above;
unsigned int value_mask = e->xconfigurerequest.value_mask
& ( CWX | CWY | CWWidth | CWHeight | CWBorderWidth );
XConfigureWindow( QX11Info::display(), e->xconfigurerequest.window, value_mask, &wc );
XConfigureWindow( display(), e->xconfigurerequest.window, value_mask, &wc );
return true;
}
break;
@ -428,10 +428,10 @@ bool Workspace::workspaceEvent( XEvent * e )
if( e->xfocus.window == rootWin()
&& ( e->xfocus.detail == NotifyDetailNone || e->xfocus.detail == NotifyPointerRoot ))
{
updateXTime(); // focusToNull() uses QX11Info::appTime(), which is old now (FocusIn has no timestamp)
updateXTime(); // focusToNull() uses xTime(), which is old now (FocusIn has no timestamp)
Window focus;
int revert;
XGetInputFocus( QX11Info::display(), &focus, &revert );
XGetInputFocus( display(), &focus, &revert );
if( focus == None || focus == PointerRoot )
{
//kWarning( 1212 ) << "X focus set to None/PointerRoot, reseting focus" << endl;
@ -723,7 +723,7 @@ void Client::unmapNotifyEvent( XUnmapEvent* e )
case NormalState:
// maybe we will be destroyed soon. Check this first.
XEvent ev;
if( XCheckTypedWindowEvent (QX11Info::display(), window(),
if( XCheckTypedWindowEvent (display(), window(),
DestroyNotify, &ev) ) // TODO I don't like this much
{
destroyClient(); // deletes this
@ -819,7 +819,7 @@ void Client::configureRequestEvent( XConfigureRequestEvent* e )
wc.border_width = 0;
value_mask = CWBorderWidth;
XConfigureWindow( QX11Info::display(), window(), value_mask, & wc );
XConfigureWindow( display(), window(), value_mask, & wc );
}
if( e->value_mask & ( CWX | CWY | CWHeight | CWWidth ))
@ -946,7 +946,7 @@ void Client::leaveNotifyEvent( XCrossingEvent* e )
int d1, d2, d3, d4;
unsigned int d5;
Window w, child;
if( XQueryPointer( QX11Info::display(), frameId(), &w, &child, &d1, &d2, &d3, &d4, &d5 ) == False
if( XQueryPointer( display(), frameId(), &w, &child, &d1, &d2, &d3, &d4, &d5 ) == False
|| child == None )
lostMouse = true; // really lost the mouse
}
@ -979,7 +979,7 @@ void Client::grabButton( int modifier )
for( int i = 0;
i < 8;
++i )
XGrabButton( QX11Info::display(), AnyButton,
XGrabButton( display(), AnyButton,
modifier | mods[ i ],
wrapperId(), false, ButtonPressMask,
GrabModeSync, GrabModeAsync, None, None );
@ -996,7 +996,7 @@ void Client::ungrabButton( int modifier )
for( int i = 0;
i < 8;
++i )
XUngrabButton( QX11Info::display(), AnyButton,
XUngrabButton( display(), AnyButton,
modifier | mods[ i ], wrapperId());
}
#undef XCapL
@ -1013,7 +1013,7 @@ void Client::updateMouseGrab()
{
if( workspace()->globalShortcutsDisabled())
{
XUngrabButton( QX11Info::display(), AnyButton, AnyModifier, wrapperId());
XUngrabButton( display(), AnyButton, AnyModifier, wrapperId());
// keep grab for the simple click without modifiers if needed
if( !( !options->clickRaise || not_obscured ))
grabButton( None );
@ -1033,9 +1033,9 @@ void Client::updateMouseGrab()
}
else
{
XUngrabButton( QX11Info::display(), AnyButton, AnyModifier, wrapperId());
XUngrabButton( display(), AnyButton, AnyModifier, wrapperId());
// simply grab all modifier combinations
XGrabButton(QX11Info::display(), AnyButton, AnyModifier, wrapperId(), false,
XGrabButton(display(), AnyButton, AnyModifier, wrapperId(), false,
ButtonPressMask,
GrabModeSync, GrabModeAsync,
None, None );
@ -1126,7 +1126,7 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in
if (buttonDown)
{
if( w == wrapperId())
XAllowEvents(QX11Info::display(), SyncPointer, CurrentTime ); //QX11Info::appTime());
XAllowEvents(display(), SyncPointer, CurrentTime ); //xTime());
return true;
}
@ -1144,7 +1144,7 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in
{ // hide splashwindow if the user clicks on it
hideClient( true );
if( w == wrapperId())
XAllowEvents(QX11Info::display(), SyncPointer, CurrentTime ); //QX11Info::appTime());
XAllowEvents(display(), SyncPointer, CurrentTime ); //xTime());
return true;
}
@ -1209,14 +1209,14 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in
replay = true;
if( w == wrapperId()) // these can come only from a grab
XAllowEvents(QX11Info::display(), replay? ReplayPointer : SyncPointer, CurrentTime ); //QX11Info::appTime());
XAllowEvents(display(), replay? ReplayPointer : SyncPointer, CurrentTime ); //xTime());
return true;
}
}
if( w == wrapperId()) // these can come only from a grab
{
XAllowEvents(QX11Info::display(), ReplayPointer, CurrentTime ); //QX11Info::appTime());
XAllowEvents(display(), ReplayPointer, CurrentTime ); //xTime());
return true;
}
if( w == decorationId())
@ -1289,7 +1289,7 @@ bool Client::buttonReleaseEvent( Window w, int /*button*/, int state, int x, int
return false;
if( w == wrapperId())
{
XAllowEvents(QX11Info::display(), SyncPointer, CurrentTime ); //QX11Info::appTime());
XAllowEvents(display(), SyncPointer, CurrentTime ); //xTime());
return true;
}
if( w != frameId() && w != decorationId() && w != moveResizeGrabWindow())
@ -1336,12 +1336,12 @@ static bool waitingMotionEvent()
// of processes events reaches the timestamp of the last suitable
// MotionNotify event in the queue.
if( next_motion_time != CurrentTime
&& timestampCompare( QX11Info::appTime(), next_motion_time ) < 0 )
&& timestampCompare( xTime(), next_motion_time ) < 0 )
return true;
was_motion = false;
XSync( QX11Info::display(), False ); // this helps to discard more MotionNotify events
XSync( display(), False ); // this helps to discard more MotionNotify events
XEvent dummy;
XCheckIfEvent( QX11Info::display(), &dummy, motion_predicate, NULL );
XCheckIfEvent( display(), &dummy, motion_predicate, NULL );
return was_motion;
}
@ -1434,7 +1434,7 @@ static bool check_follows_focusin( Client* c )
// XCheckIfEvent() is used to make the search non-blocking, the predicate
// always returns False, so nothing is removed from the events queue.
// XPeekIfEvent() would block.
XCheckIfEvent( QX11Info::display(), &dummy, predicate_follows_focusin, (XPointer)c );
XCheckIfEvent( display(), &dummy, predicate_follows_focusin, (XPointer)c );
return follows_focusin;
}

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());
}
if( shape())
updateShape();
@ -1722,14 +1722,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());
}
if( shape())
updateShape();
@ -1753,7 +1753,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();
@ -2222,18 +2222,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;
}
@ -2296,9 +2296,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 )
@ -2544,7 +2544,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

@ -28,7 +28,7 @@ GeometryTip::GeometryTip( const XSizeHints* xSizeHints, bool save_under ):
{
XSetWindowAttributes attr;
attr.save_under = True; // use saveunder if possible to avoid weird effects in transparent mode
XChangeWindowAttributes( QX11Info::display(), winId(), CWSaveUnder, &attr );
XChangeWindowAttributes( display(), winId(), CWSaveUnder, &attr );
}
}

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 );
@ -393,7 +393,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 );
@ -596,7 +596,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)
@ -637,7 +637,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

@ -36,16 +36,16 @@ void KillWindow::start()
{
static Cursor kill_cursor = 0;
if (!kill_cursor)
kill_cursor = XCreateFontCursor(QX11Info::display(), XC_pirate);
kill_cursor = XCreateFontCursor(display(), XC_pirate);
if (XGrabPointer(QX11Info::display(), QX11Info::appRootWindow(), False,
if (XGrabPointer(display(), rootWindow(), False,
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask |
EnterWindowMask | LeaveWindowMask,
GrabModeAsync, GrabModeAsync, None,
kill_cursor, CurrentTime) == GrabSuccess)
{
XGrabKeyboard(QX11Info::display(), QX11Info::appRootWindow(), False,
XGrabKeyboard(display(), rootWindow(), False,
GrabModeAsync, GrabModeAsync, CurrentTime);
XEvent ev;
@ -57,12 +57,12 @@ void KillWindow::start()
while (!return_pressed && !escape_pressed && !button_released)
{
XMaskEvent(QX11Info::display(), KeyPressMask | ButtonPressMask |
XMaskEvent(display(), KeyPressMask | ButtonPressMask |
ButtonReleaseMask | PointerMotionMask, &ev);
if (ev.type == KeyPress)
{
int kc = XKeycodeToKeysym(QX11Info::display(), ev.xkey.keycode, 0);
int kc = XKeycodeToKeysym(display(), ev.xkey.keycode, 0);
int mx = 0;
int my = 0;
return_pressed = (kc == XK_Return) || (kc == XK_space);
@ -96,7 +96,7 @@ void KillWindow::start()
Window root, child;
int dummy1, dummy2, dummy3, dummy4;
unsigned int dummy5;
if( XQueryPointer( QX11Info::display(), QX11Info::appRootWindow(), &root, &child,
if( XQueryPointer( display(), rootWindow(), &root, &child,
&dummy1, &dummy2, &dummy3, &dummy4, &dummy5 ) == true
&& child != None )
workspace->killWindowId( child );
@ -104,8 +104,8 @@ void KillWindow::start()
ungrabXServer();
XUngrabKeyboard(QX11Info::display(), CurrentTime);
XUngrabPointer(QX11Info::display(), CurrentTime);
XUngrabKeyboard(display(), CurrentTime);
XUngrabPointer(display(), CurrentTime);
}
}

View File

@ -156,7 +156,7 @@ void Workspace::propagateClients( bool propagate_new_clients )
// TODO isn't it too inefficient to restart always all clients?
// TODO don't restack not visible windows?
assert( new_stack[ 0 ] = supportWindow->winId());
XRestackWindows(QX11Info::display(), new_stack, pos);
XRestackWindows(display(), new_stack, pos);
delete [] new_stack;
if ( propagate_new_clients )

View File

@ -29,6 +29,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "atoms.h"
#include "options.h"
#include "sm.h"
#include "utils.h"
#define INT8 _X11INT8
#define INT32 _X11INT32
@ -93,7 +94,7 @@ Application::Application( )
}
if (screen_number == -1)
screen_number = DefaultScreen(QX11Info::display());
screen_number = DefaultScreen(display());
if( !owner.claim( args->isSet( "replace" ), true ))
{
@ -111,7 +112,7 @@ Application::Application( )
XSetErrorHandler( x11ErrorHandler );
// check whether another windowmanager is running
XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), SubstructureRedirectMask );
XSelectInput(display(), rootWindow(), SubstructureRedirectMask );
syncX(); // trigger error now
options = new Options;
@ -128,19 +129,19 @@ Application::Application( )
ksplash.call( "upAndRunning", QString( "wm started" ));
XEvent e;
e.xclient.type = ClientMessage;
e.xclient.message_type = XInternAtom( QX11Info::display(), "_KDE_SPLASH_PROGRESS", False );
e.xclient.display = QX11Info::display();
e.xclient.window = QX11Info::appRootWindow();
e.xclient.message_type = XInternAtom( display(), "_KDE_SPLASH_PROGRESS", False );
e.xclient.display = display();
e.xclient.window = rootWindow();
e.xclient.format = 8;
strcpy( e.xclient.data.b, "wm started" );
XSendEvent( QX11Info::display(), QX11Info::appRootWindow(), False, SubstructureNotifyMask, &e );
XSendEvent( display(), rootWindow(), False, SubstructureNotifyMask, &e );
}
Application::~Application()
{
delete Workspace::self();
if( owner.ownerWindow() != None ) // if there was no --replace (no new WM)
XSetInputFocus( QX11Info::display(), PointerRoot, RevertToPointerRoot, QX11Info::appTime() );
XSetInputFocus( display(), PointerRoot, RevertToPointerRoot, xTime() );
delete options;
}
@ -148,7 +149,7 @@ void Application::lostSelection()
{
delete Workspace::self();
// remove windowmanager privileges
XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), PropertyChangeMask );
XSelectInput(display(), rootWindow(), PropertyChangeMask );
quit();
}
@ -272,7 +273,7 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
KWinInternal::SessionManaged weAreIndeed;
KWinInternal::SessionSaveDoneHelper helper;
fcntl(ConnectionNumber(QX11Info::display()), F_SETFD, 1);
fcntl(XConnectionNumber(KWinInternal::display()), F_SETFD, 1);
QString appname;
if (KWinInternal::screen_number == 0)

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
@ -316,7 +316,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 );
if ( (is_shape = Shape::hasShape( window())) )
{
updateShape();
@ -435,7 +435,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;
@ -507,9 +507,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();
@ -539,30 +539,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 |
@ -574,8 +574,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

@ -119,7 +119,7 @@ void PopupInfo::hide()
QWidget::hide();
QApplication::syncX();
XEvent otherEvent;
while (XCheckTypedEvent (QX11Info::display(), EnterNotify, &otherEvent ) )
while (XCheckTypedEvent (display(), EnterNotify, &otherEvent ) )
;
m_shown = false;
}

View File

@ -516,7 +516,7 @@ void TabBox::hide()
QWidget::hide();
QApplication::syncX();
XEvent otherEvent;
while (XCheckTypedEvent (QX11Info::display(), EnterNotify, &otherEvent ) )
while (XCheckTypedEvent (display(), EnterNotify, &otherEvent ) )
;
}
@ -566,7 +566,7 @@ void TabBox::delayedShow()
void TabBox::handleMouseEvent( XEvent* e )
{
XAllowEvents( QX11Info::display(), AsyncPointer, QX11Info::appTime() );
XAllowEvents( display(), AsyncPointer, xTime() );
if( e->type != ButtonPress )
return;
QPoint pos( e->xbutton.x_root, e->xbutton.y_root );
@ -631,12 +631,12 @@ bool areKeySymXsDepressed( bool bAll, const uint keySyms[], int nKeySyms )
kDebug(125) << "areKeySymXsDepressed: " << (bAll ? "all of " : "any of ") << nKeySyms << endl;
XQueryKeymap( QX11Info::display(), keymap );
XQueryKeymap( display(), keymap );
for( int iKeySym = 0; iKeySym < nKeySyms; iKeySym++ )
{
uint keySymX = keySyms[ iKeySym ];
uchar keyCodeX = XKeysymToKeycode( QX11Info::display(), keySymX );
uchar keyCodeX = XKeysymToKeycode( display(), keySymX );
int i = keyCodeX / 8;
char mask = 1 << (keyCodeX - (i * 8));
@ -723,7 +723,7 @@ void TabBox::updateKeyMapping()
{
const int size = 6;
uint keysyms[ size ] = { XK_Alt_L, XK_Alt_R, XK_Super_L, XK_Super_R, XK_Meta_L, XK_Meta_R };
XModifierKeymap* map = XGetModifierMapping( QX11Info::display() );
XModifierKeymap* map = XGetModifierMapping( display() );
int altpos = 0;
int winpos = 0;
int winmodpos = -1;
@ -741,7 +741,7 @@ void TabBox::updateKeyMapping()
i < size;
++i )
{
KeyCode keycode = XKeysymToKeycode( QX11Info::display(), keysyms[ i ] );
KeyCode keycode = XKeysymToKeycode( display(), keysyms[ i ] );
for( int j = 0;
j < map->max_keypermod;
++j )
@ -759,13 +759,13 @@ void TabBox::updateKeyMapping()
void Workspace::slotWalkThroughWindows()
{
if ( root != QX11Info::appRootWindow() )
if ( root != rootWindow() )
return;
if ( tab_grab || control_grab )
return;
if ( options->altTabStyle == Options::CDE || !options->focusPolicyIsReasonable())
{
//XUngrabKeyboard(QX11Info::display(), QX11Info::appTime()); // need that because of accelerator raw mode
//XUngrabKeyboard(display(), xTime()); // need that because of accelerator raw mode
// CDE style raise / lower
CDEWalkThroughWindows( true );
}
@ -785,7 +785,7 @@ void Workspace::slotWalkThroughWindows()
void Workspace::slotWalkBackThroughWindows()
{
if ( root != QX11Info::appRootWindow() )
if ( root != rootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -810,7 +810,7 @@ void Workspace::slotWalkBackThroughWindows()
void Workspace::slotWalkThroughDesktops()
{
if ( root != QX11Info::appRootWindow() )
if ( root != rootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -827,7 +827,7 @@ void Workspace::slotWalkThroughDesktops()
void Workspace::slotWalkBackThroughDesktops()
{
if ( root != QX11Info::appRootWindow() )
if ( root != rootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -844,7 +844,7 @@ void Workspace::slotWalkBackThroughDesktops()
void Workspace::slotWalkThroughDesktopList()
{
if ( root != QX11Info::appRootWindow() )
if ( root != rootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -861,7 +861,7 @@ void Workspace::slotWalkThroughDesktopList()
void Workspace::slotWalkBackThroughDesktopList()
{
if ( root != QX11Info::appRootWindow() )
if ( root != rootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -1100,7 +1100,7 @@ void Workspace::tabBoxKeyRelease( const XKeyEvent& ev )
release = true;
else
{
XModifierKeymap* xmk = XGetModifierMapping(QX11Info::display());
XModifierKeymap* xmk = XGetModifierMapping(display());
for (int i=0; i<xmk->max_keypermod; i++)
if (xmk->modifiermap[xmk->max_keypermod * mod_index + i]
== ev.keycode)
@ -1231,8 +1231,8 @@ Client* Workspace::previousStaticClient( Client* c ) const
bool Workspace::establishTabBoxGrab()
{
if( XGrabKeyboard( QX11Info::display(), root, false,
GrabModeAsync, GrabModeAsync, QX11Info::appTime()) != GrabSuccess )
if( XGrabKeyboard( display(), root, false,
GrabModeAsync, GrabModeAsync, xTime()) != GrabSuccess )
return false;
// Don't try to establish a global mouse grab using XGrabPointer, as that would prevent
// using Alt+Tab while DND (#44972). However force passive grabs on all windows
@ -1248,7 +1248,7 @@ bool Workspace::establishTabBoxGrab()
void Workspace::removeTabBoxGrab()
{
XUngrabKeyboard(QX11Info::display(), QX11Info::appTime());
XUngrabKeyboard(display(), xTime());
assert( forced_global_mouse_grab );
forced_global_mouse_grab = false;
if( active_client != NULL )

View File

@ -56,7 +56,7 @@ bool Shape::hasShape( WId w)
int boundingShaped = 0, clipShaped = 0;
if (!kwin_has_shape)
return false;
XShapeQueryExtents(QX11Info::display(), w,
XShapeQueryExtents(display(), w,
&boundingShaped, &xws, &yws, &wws, &hws,
&clipShaped, &xbs, &ybs, &wbs, &hbs);
return boundingShaped != 0;
@ -71,7 +71,7 @@ void Shape::init()
{
int dummy;
kwin_has_shape =
XShapeQueryExtension(QX11Info::display(), &kwin_shape_event, &dummy);
XShapeQueryExtension(display(), &kwin_shape_event, &dummy);
}
void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move,
@ -82,7 +82,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 )
{
@ -135,10 +135,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()
@ -149,7 +149,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 ];
}
}
@ -159,7 +159,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 );
}
@ -168,7 +168,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
@ -188,7 +188,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)
@ -243,8 +243,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
@ -256,20 +256,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;
@ -277,7 +277,7 @@ static int server_grab_count = 0;
void grabXServer()
{
if( ++server_grab_count == 1 )
XGrabServer( QX11Info::display());
XGrabServer( display());
}
void ungrabXServer()
@ -285,8 +285,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();
}
}
@ -327,7 +327,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
{
@ -189,6 +190,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

@ -134,9 +134,9 @@ Workspace::Workspace( bool restore )
_self = this;
mgr = new PluginMgr;
root = QX11Info::appRootWindow();
root = rootWindow();
QX11Info info;
default_colormap = DefaultColormap(QX11Info::display(), info.screen() );
default_colormap = DefaultColormap(display(), info.screen() );
installed_colormap = default_colormap;
connect( &temporaryRulesMessages, SIGNAL( gotMessage( const QString& )),
@ -147,8 +147,8 @@ Workspace::Workspace( bool restore )
delayFocusTimer = 0;
electric_time_first = QX11Info::appTime();
electric_time_last = QX11Info::appTime();
electric_time_first = xTime();
electric_time_last = xTime();
if ( restore )
loadSessionInfo();
@ -166,7 +166,7 @@ Workspace::Workspace( bool restore )
KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this );
// select windowmanager privileges
XSelectInput(QX11Info::display(), root,
XSelectInput(display(), root,
KeyPressMask |
PropertyChangeMask |
ColormapChangeMask |
@ -181,8 +181,8 @@ Workspace::Workspace( bool restore )
long data = 1;
XChangeProperty(
QX11Info::display(),
QX11Info::appRootWindow(),
display(),
rootWindow(),
atoms->kwin_running,
atoms->kwin_running,
32,
@ -219,13 +219,13 @@ void Workspace::init()
// maximizedWindowCounter = 0;
supportWindow = new QWidget;
XLowerWindow( QX11Info::display(), supportWindow->winId()); // see usage in layers.cpp
XLowerWindow( display(), supportWindow->winId()); // see usage in layers.cpp
XSetWindowAttributes attr;
attr.override_redirect = 1;
null_focus_window = XCreateWindow( QX11Info::display(), QX11Info::appRootWindow(), -1,-1, 1, 1, 0, CopyFromParent,
null_focus_window = XCreateWindow( display(), rootWindow(), -1,-1, 1, 1, 0, CopyFromParent,
InputOnly, CopyFromParent, CWOverrideRedirect, &attr );
XMapWindow(QX11Info::display(), null_focus_window);
XMapWindow(display(), null_focus_window);
unsigned long protocols[ 5 ] =
{
@ -307,12 +307,12 @@ void Workspace::init()
};
QX11Info info;
rootInfo = new RootInfo( this, QX11Info::display(), supportWindow->winId(), "KWin",
rootInfo = new RootInfo( this, display(), supportWindow->winId(), "KWin",
protocols, 5, info.screen() );
loadDesktopSettings();
// extra NETRootInfo instance in Client mode is needed to get the values of the properties
NETRootInfo client_info( QX11Info::display(), NET::ActiveWindow | NET::CurrentDesktop );
NETRootInfo client_info( display(), NET::ActiveWindow | NET::CurrentDesktop );
int initial_desktop;
if( !kapp->isSessionRestored())
initial_desktop = client_info.currentDesktop();
@ -347,8 +347,8 @@ void Workspace::init()
++block_focus; // because it will be set below
char nm[ 100 ];
sprintf( nm, "_KDE_TOPMENU_OWNER_S%d", DefaultScreen( QX11Info::display()));
Atom topmenu_atom = XInternAtom( QX11Info::display(), nm, False );
sprintf( nm, "_KDE_TOPMENU_OWNER_S%d", DefaultScreen( display()));
Atom topmenu_atom = XInternAtom( display(), nm, False );
topmenu_selection = new KSelectionOwner( topmenu_atom );
topmenu_watcher = new KSelectionWatcher( topmenu_atom );
// TODO grabXServer(); - where exactly put this? topmenu selection claiming down belong must be before
@ -363,11 +363,11 @@ void Workspace::init()
unsigned int i, nwins;
Window root_return, parent_return, *wins;
XQueryTree(QX11Info::display(), root, &root_return, &parent_return, &wins, &nwins);
XQueryTree(display(), root, &root_return, &parent_return, &wins, &nwins);
for (i = 0; i < nwins; i++)
{
XWindowAttributes attr;
XGetWindowAttributes(QX11Info::display(), wins[i], &attr);
XGetWindowAttributes(display(), wins[i], &attr);
if (attr.override_redirect )
continue;
if( topmenu_space && topmenu_space->winId() == wins[ i ] )
@ -377,10 +377,10 @@ void Workspace::init()
if ( addSystemTrayWin( wins[i] ) )
continue;
Client* c = createClient( wins[i], true );
if ( c != NULL && root != QX11Info::appRootWindow() )
if ( c != NULL && root != rootWindow() )
{ // TODO what is this?
// TODO may use QWidget:.create
XReparentWindow( QX11Info::display(), c->frameId(), root, 0, 0 );
XReparentWindow( display(), c->frameId(), root, 0, 0 );
c->move(0,0);
}
}
@ -449,8 +449,8 @@ Workspace::~Workspace()
delete tab_box;
delete popupinfo;
delete popup;
if ( root == QX11Info::appRootWindow() )
XDeleteProperty(QX11Info::display(), QX11Info::appRootWindow(), atoms->kwin_running);
if ( root == rootWindow() )
XDeleteProperty(display(), rootWindow(), atoms->kwin_running);
writeWindowRules();
KGlobal::config()->sync();
@ -473,7 +473,7 @@ Workspace::~Workspace()
}
foreach ( SessionInfo* s, session )
delete s;
XDestroyWindow( QX11Info::display(), null_focus_window );
XDestroyWindow( display(), null_focus_window );
// TODO ungrabXServer();
_self = 0;
}
@ -874,7 +874,7 @@ void Workspace::updateColormap()
cmap = activeClient()->colormap();
if ( cmap != installed_colormap )
{
XInstallColormap(QX11Info::display(), cmap );
XInstallColormap(display(), cmap );
installed_colormap = cmap;
}
}
@ -1130,14 +1130,14 @@ void ObscuringWindows::create( Client* c )
XSetWindowAttributes a;
a.background_pixmap = None;
a.override_redirect = True;
obs_win = XCreateWindow( QX11Info::display(), QX11Info::appRootWindow(), c->x(), c->y(),
obs_win = XCreateWindow( display(), rootWindow(), c->x(), c->y(),
c->width(), c->height(), 0, CopyFromParent, InputOutput,
CopyFromParent, CWBackPixmap | CWOverrideRedirect, &a );
}
chngs.sibling = c->frameId();
chngs.stack_mode = Below;
XConfigureWindow( QX11Info::display(), obs_win, mask, &chngs );
XMapWindow( QX11Info::display(), obs_win );
XConfigureWindow( display(), obs_win, mask, &chngs );
XMapWindow( display(), obs_win );
obscuring_windows.append( obs_win );
}
@ -1148,11 +1148,11 @@ ObscuringWindows::~ObscuringWindows()
it != obscuring_windows.end();
++it )
{
XUnmapWindow( QX11Info::display(), *it );
XUnmapWindow( display(), *it );
if( cached->count() < ( int )max_cache_size )
cached->prepend( *it );
else
XDestroyWindow( QX11Info::display(), *it );
XDestroyWindow( display(), *it );
}
}
@ -1256,7 +1256,7 @@ bool Workspace::setCurrentDesktop( int new_desktop )
{
Window w_tmp;
int i_tmp;
XGetInputFocus( QX11Info::display(), &w_tmp, &i_tmp );
XGetInputFocus( display(), &w_tmp, &i_tmp );
if( w_tmp == null_focus_window ) // CHECKME?
requestFocus( findDesktop( true, currentDesktop()));
}
@ -1542,15 +1542,15 @@ bool Workspace::addSystemTrayWin( WId w )
if ( systemTrayWins.contains( w ) )
return true;
NETWinInfo ni( QX11Info::display(), w, root, NET::WMKDESystemTrayWinFor );
NETWinInfo ni( display(), w, root, NET::WMKDESystemTrayWinFor );
WId trayWinFor = ni.kdeSystemTrayWinFor();
if ( !trayWinFor )
return false;
systemTrayWins.append( SystemTrayWindow( w, trayWinFor ) );
XSelectInput( QX11Info::display(), w,
XSelectInput( display(), w,
StructureNotifyMask
);
XAddToSaveSet( QX11Info::display(), w );
XAddToSaveSet( display(), w );
propagateSystemTrayWins();
return true;
}
@ -1573,7 +1573,7 @@ bool Workspace::removeSystemTrayWin( WId w, bool check )
// embedding it, allowing KWin to figure out. Kicker just mustn't
// crash before removing it again ... *shrug* .
int num_props;
Atom* props = XListProperties( QX11Info::display(), w, &num_props );
Atom* props = XListProperties( display(), w, &num_props );
if( props != NULL )
{
for( int i = 0;
@ -1625,7 +1625,7 @@ void Workspace::killWindowId( Window window_to_kill )
Window parent, root;
Window* children;
unsigned int children_count;
XQueryTree( QX11Info::display(), window, &root, &parent, &children, &children_count );
XQueryTree( display(), window, &root, &parent, &children, &children_count );
if( children != NULL )
XFree( children );
if( window == root ) // we didn't find the client, probably an override-redirect window
@ -1635,7 +1635,7 @@ void Workspace::killWindowId( Window window_to_kill )
if( client != NULL )
client->killWindow();
else
XKillClient( QX11Info::display(), window_to_kill );
XKillClient( display(), window_to_kill );
}
@ -1665,7 +1665,7 @@ void Workspace::slotGrabWindow()
{
//As the first step, get the mask from XShape.
int count, order;
XRectangle* rects = XShapeGetRectangles( QX11Info::display(), active_client->frameId(),
XRectangle* rects = XShapeGetRectangles( display(), active_client->frameId(),
ShapeBounding, &count, &order);
//The ShapeBounding region is the outermost shape of the window;
//ShapeBounding - ShapeClipping is defined to be the border.
@ -1710,7 +1710,7 @@ void Workspace::slotGrabWindow()
*/
void Workspace::slotGrabDesktop()
{
QPixmap p = QPixmap::grabWindow( QX11Info::appRootWindow() );
QPixmap p = QPixmap::grabWindow( rootWindow() );
QClipboard *cb = QApplication::clipboard();
cb->setPixmap( p );
}
@ -1724,15 +1724,15 @@ void Workspace::slotMouseEmulation()
if ( mouse_emulation )
{
XUngrabKeyboard(QX11Info::display(), QX11Info::appTime());
XUngrabKeyboard(display(), xTime());
mouse_emulation = false;
return;
}
if ( XGrabKeyboard(QX11Info::display(),
if ( XGrabKeyboard(display(),
root, false,
GrabModeAsync, GrabModeAsync,
QX11Info::appTime()) == GrabSuccess )
xTime()) == GrabSuccess )
{
mouse_emulation = true;
mouse_emulation_state = 0;
@ -1749,7 +1749,7 @@ void Workspace::slotMouseEmulation()
WId Workspace::getMouseEmulationWindow()
{
Window root;
Window child = QX11Info::appRootWindow();
Window child = rootWindow();
int root_x, root_y, lx, ly;
uint state;
Window w;
@ -1759,7 +1759,7 @@ WId Workspace::getMouseEmulationWindow()
w = child;
if (!c)
c = findClient( FrameIdMatchPredicate( w ));
XQueryPointer( QX11Info::display(), w, &root, &child,
XQueryPointer( display(), w, &root, &child,
&root_x, &root_y, &lx, &ly, &state );
} while ( child != None && child != w );
@ -1780,38 +1780,38 @@ unsigned int Workspace::sendFakedMouseEvent( QPoint pos, WId w, MouseEmulation t
{
int x, y;
Window xw;
XTranslateCoordinates( QX11Info::display(), QX11Info::appRootWindow(), w, pos.x(), pos.y(), &x, &y, &xw );
XTranslateCoordinates( display(), rootWindow(), w, pos.x(), pos.y(), &x, &y, &xw );
if ( type == EmuMove )
{ // motion notify events
XEvent e;
e.type = MotionNotify;
e.xmotion.window = w;
e.xmotion.root = QX11Info::appRootWindow();
e.xmotion.root = rootWindow();
e.xmotion.subwindow = w;
e.xmotion.time = QX11Info::appTime();
e.xmotion.time = xTime();
e.xmotion.x = x;
e.xmotion.y = y;
e.xmotion.x_root = pos.x();
e.xmotion.y_root = pos.y();
e.xmotion.state = state;
e.xmotion.is_hint = NotifyNormal;
XSendEvent( QX11Info::display(), w, true, ButtonMotionMask, &e );
XSendEvent( display(), w, true, ButtonMotionMask, &e );
}
else
{
XEvent e;
e.type = type == EmuRelease ? ButtonRelease : ButtonPress;
e.xbutton.window = w;
e.xbutton.root = QX11Info::appRootWindow();
e.xbutton.root = rootWindow();
e.xbutton.subwindow = w;
e.xbutton.time = QX11Info::appTime();
e.xbutton.time = xTime();
e.xbutton.x = x;
e.xbutton.y = y;
e.xbutton.x_root = pos.x();
e.xbutton.y_root = pos.y();
e.xbutton.state = state;
e.xbutton.button = button;
XSendEvent( QX11Info::display(), w, true, ButtonPressMask, &e );
XSendEvent( display(), w, true, ButtonPressMask, &e );
if ( type == EmuPress )
{
@ -1853,9 +1853,9 @@ unsigned int Workspace::sendFakedMouseEvent( QPoint pos, WId w, MouseEmulation t
*/
bool Workspace::keyPressMouseEmulation( XKeyEvent& ev )
{
if ( root != QX11Info::appRootWindow() )
if ( root != rootWindow() )
return false;
int kc = XKeycodeToKeysym(QX11Info::display(), ev.keycode, 0);
int kc = XKeycodeToKeysym(display(), ev.keycode, 0);
int km = ev.state & (ControlMask | Mod1Mask | ShiftMask);
bool is_control = km & ControlMask;
@ -1930,7 +1930,7 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev )
}
// fall through
case XK_Escape:
XUngrabKeyboard(QX11Info::display(), QX11Info::appTime());
XUngrabKeyboard(display(), xTime());
mouse_emulation = false;
return true;
default:
@ -2017,58 +2017,58 @@ void Workspace::createBorderWindows()
attributes.event_mask = (EnterWindowMask | LeaveWindowMask |
VisibilityChangeMask);
valuemask= (CWOverrideRedirect | CWEventMask | CWCursor );
attributes.cursor = XCreateFontCursor(QX11Info::display(),
attributes.cursor = XCreateFontCursor(display(),
XC_sb_up_arrow);
electric_top_border = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(),
electric_top_border = XCreateWindow (display(), rootWindow(),
0,0,
r.width(),1,
0,
CopyFromParent, InputOnly,
CopyFromParent,
valuemask, &attributes);
XMapWindow(QX11Info::display(), electric_top_border);
XMapWindow(display(), electric_top_border);
attributes.cursor = XCreateFontCursor(QX11Info::display(),
attributes.cursor = XCreateFontCursor(display(),
XC_sb_down_arrow);
electric_bottom_border = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(),
electric_bottom_border = XCreateWindow (display(), rootWindow(),
0,r.height()-1,
r.width(),1,
0,
CopyFromParent, InputOnly,
CopyFromParent,
valuemask, &attributes);
XMapWindow(QX11Info::display(), electric_bottom_border);
XMapWindow(display(), electric_bottom_border);
attributes.cursor = XCreateFontCursor(QX11Info::display(),
attributes.cursor = XCreateFontCursor(display(),
XC_sb_left_arrow);
electric_left_border = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(),
electric_left_border = XCreateWindow (display(), rootWindow(),
0,0,
1,r.height(),
0,
CopyFromParent, InputOnly,
CopyFromParent,
valuemask, &attributes);
XMapWindow(QX11Info::display(), electric_left_border);
XMapWindow(display(), electric_left_border);
attributes.cursor = XCreateFontCursor(QX11Info::display(),
attributes.cursor = XCreateFontCursor(display(),
XC_sb_right_arrow);
electric_right_border = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(),
electric_right_border = XCreateWindow (display(), rootWindow(),
r.width()-1,0,
1,r.height(),
0,
CopyFromParent, InputOnly,
CopyFromParent,
valuemask, &attributes);
XMapWindow(QX11Info::display(), electric_right_border);
XMapWindow(display(), electric_right_border);
// Set XdndAware on the windows, so that DND enter events are received (#86998)
Atom version = 4; // XDND version
XChangeProperty( QX11Info::display(), electric_top_border, atoms->xdnd_aware, XA_ATOM,
XChangeProperty( display(), electric_top_border, atoms->xdnd_aware, XA_ATOM,
32, PropModeReplace, ( unsigned char* )&version, 1 );
XChangeProperty( QX11Info::display(), electric_bottom_border, atoms->xdnd_aware, XA_ATOM,
XChangeProperty( display(), electric_bottom_border, atoms->xdnd_aware, XA_ATOM,
32, PropModeReplace, ( unsigned char* )&version, 1 );
XChangeProperty( QX11Info::display(), electric_left_border, atoms->xdnd_aware, XA_ATOM,
XChangeProperty( display(), electric_left_border, atoms->xdnd_aware, XA_ATOM,
32, PropModeReplace, ( unsigned char* )&version, 1 );
XChangeProperty( QX11Info::display(), electric_right_border, atoms->xdnd_aware, XA_ATOM,
XChangeProperty( display(), electric_right_border, atoms->xdnd_aware, XA_ATOM,
32, PropModeReplace, ( unsigned char* )&version, 1 );
}
@ -2086,13 +2086,13 @@ void Workspace::destroyBorderWindows()
electric_have_borders = false;
if(electric_top_border)
XDestroyWindow(QX11Info::display(),electric_top_border);
XDestroyWindow(display(),electric_top_border);
if(electric_bottom_border)
XDestroyWindow(QX11Info::display(),electric_bottom_border);
XDestroyWindow(display(),electric_bottom_border);
if(electric_left_border)
XDestroyWindow(QX11Info::display(),electric_left_border);
XDestroyWindow(display(),electric_left_border);
if(electric_right_border)
XDestroyWindow(QX11Info::display(),electric_right_border);
XDestroyWindow(display(),electric_right_border);
electric_top_border = None;
electric_bottom_border = None;
@ -2227,7 +2227,7 @@ bool Workspace::electricBorder(XEvent *e)
|| e->xclient.window == electric_right_border ))
{
updateXTime();
clientMoved( QPoint( e->xclient.data.l[2]>>16, e->xclient.data.l[2]&0xffff), QX11Info::appTime() );
clientMoved( QPoint( e->xclient.data.l[2]>>16, e->xclient.data.l[2]&0xffff), xTime() );
return true;
}
}
@ -2242,10 +2242,10 @@ void Workspace::raiseElectricBorders()
if(electric_have_borders)
{
XRaiseWindow(QX11Info::display(), electric_top_border);
XRaiseWindow(QX11Info::display(), electric_left_border);
XRaiseWindow(QX11Info::display(), electric_bottom_border);
XRaiseWindow(QX11Info::display(), electric_right_border);
XRaiseWindow(display(), electric_top_border);
XRaiseWindow(display(), electric_left_border);
XRaiseWindow(display(), electric_bottom_border);
XRaiseWindow(display(), electric_right_border);
}
}
@ -2324,7 +2324,7 @@ void Workspace::setupTopMenuHandling()
Window stack[ 2 ];
stack[ 0 ] = supportWindow->winId();
stack[ 1 ] = topmenu_space->winId();
XRestackWindows(QX11Info::display(), stack, 2);
XRestackWindows(display(), stack, 2);
updateTopMenuGeometry();
topmenu_space->show();
updateClientArea();
@ -2363,7 +2363,7 @@ bool Workspace::checkStartupNotification( Window w, KStartupInfoId& id, KStartup
*/
void Workspace::focusToNull()
{
XSetInputFocus(QX11Info::display(), null_focus_window, RevertToPointerRoot, QX11Info::appTime() );
XSetInputFocus(display(), null_focus_window, RevertToPointerRoot, xTime() );
}
void Workspace::helperDialog( const QString& message, const Client* c )