It's really interesting that KWin has had support for an arbitrary root

window, but I don't think it really works these days, and it's probably
also not useful at all.


svn path=/trunk/KDE/kdebase/workspace/; revision=689949
This commit is contained in:
Luboš Luňák 2007-07-19 16:24:51 +00:00
parent 824f005f58
commit ab1582de27
9 changed files with 25 additions and 64 deletions

View file

@ -235,7 +235,7 @@ void Client::releaseWindow( bool on_shutdown )
XDeleteProperty( display(), client, atoms->kde_net_wm_user_creation_time); XDeleteProperty( display(), client, atoms->kde_net_wm_user_creation_time);
XDeleteProperty( display(), client, atoms->net_frame_extents ); XDeleteProperty( display(), client, atoms->net_frame_extents );
XDeleteProperty( display(), client, atoms->kde_net_wm_frame_strut ); XDeleteProperty( display(), client, atoms->kde_net_wm_frame_strut );
XReparentWindow( display(), client, workspace()->rootWin(), x(), y()); XReparentWindow( display(), client, rootWindow(), x(), y());
XRemoveFromSaveSet( display(), client ); XRemoveFromSaveSet( display(), client );
XSelectInput( display(), client, NoEventMask ); XSelectInput( display(), client, NoEventMask );
if( on_shutdown ) if( on_shutdown )

View file

@ -555,14 +555,14 @@ inline Client* Client::transientFor()
inline bool Client::groupTransient() const inline bool Client::groupTransient() const
{ {
return transient_for_id == workspace()->rootWin(); return transient_for_id == rootWindow();
} }
// needed because verifyTransientFor() may set transient_for_id to root window, // needed because verifyTransientFor() may set transient_for_id to root window,
// if the original value has a problem (window doesn't exist, etc.) // if the original value has a problem (window doesn't exist, etc.)
inline bool Client::wasOriginallyGroupTransient() const inline bool Client::wasOriginallyGroupTransient() const
{ {
return original_transient_for_id == workspace()->rootWin(); return original_transient_for_id == rootWindow();
} }
inline bool Client::isTransient() const inline bool Client::isTransient() const

View file

@ -309,7 +309,7 @@ bool Workspace::workspaceEvent( XEvent * e )
switch (e->type) switch (e->type)
{ {
case CreateNotify: case CreateNotify:
if ( e->xcreatewindow.parent == root && if ( e->xcreatewindow.parent == rootWindow() &&
!QWidget::find( e->xcreatewindow.window) && !QWidget::find( e->xcreatewindow.window) &&
!e->xcreatewindow.override_redirect ) !e->xcreatewindow.override_redirect )
{ {
@ -351,13 +351,8 @@ bool Workspace::workspaceEvent( XEvent * e )
// children of WindowWrapper (=clients), the check is AFAIK useless anyway // children of WindowWrapper (=clients), the check is AFAIK useless anyway
// Note: Now the save-set support in Client::mapRequestEvent() actually requires that // Note: Now the save-set support in Client::mapRequestEvent() actually requires that
// this code doesn't check the parent to be root. // this code doesn't check the parent to be root.
// if ( e->xmaprequest.parent == root ) { //###TODO store previously destroyed client ids // if ( e->xmaprequest.parent == root ) {
c = createClient( e->xmaprequest.window, false ); c = createClient( e->xmaprequest.window, false );
if ( c != NULL && root != rootWindow() )
{ // TODO what is this?
// TODO may use QWidget::create
XReparentWindow( display(), c->frameId(), root, 0, 0 );
}
if( c == NULL ) // refused to manage, simply map it (most probably override redirect) if( c == NULL ) // refused to manage, simply map it (most probably override redirect)
XMapRaised( display(), e->xmaprequest.window ); XMapRaised( display(), e->xmaprequest.window );
return true; return true;
@ -407,7 +402,7 @@ bool Workspace::workspaceEvent( XEvent * e )
} }
case ConfigureRequest: case ConfigureRequest:
{ {
if ( e->xconfigurerequest.parent == root ) if ( e->xconfigurerequest.parent == rootWindow())
{ {
XWindowChanges wc; XWindowChanges wc;
wc.border_width = e->xconfigurerequest.border_width; wc.border_width = e->xconfigurerequest.border_width;
@ -433,7 +428,7 @@ bool Workspace::workspaceEvent( XEvent * e )
return false; return false;
break; break;
case FocusIn: case FocusIn:
if( e->xfocus.window == rootWin() if( e->xfocus.window == rootWindow()
&& ( e->xfocus.detail == NotifyDetailNone || e->xfocus.detail == NotifyPointerRoot )) && ( e->xfocus.detail == NotifyDetailNone || e->xfocus.detail == NotifyPointerRoot ))
{ {
updateXTime(); // focusToNull() uses xTime(), which is old now (FocusIn has no timestamp) updateXTime(); // focusToNull() uses xTime(), which is old now (FocusIn has no timestamp)
@ -761,7 +756,7 @@ void Client::unmapNotifyEvent( XUnmapEvent* e )
if( e->event != wrapperId()) if( e->event != wrapperId())
{ // most probably event from root window when initially reparenting { // most probably event from root window when initially reparenting
bool ignore = true; bool ignore = true;
if( e->event == workspace()->rootWin() && e->send_event ) if( e->event == rootWindow() && e->send_event )
ignore = false; // XWithdrawWindow() ignore = false; // XWithdrawWindow()
if( ignore ) if( ignore )
return; return;

View file

@ -2287,7 +2287,7 @@ bool Client::startMoveResize()
// (http://lists.kde.org/?t=107302193400001&r=1&w=2) // (http://lists.kde.org/?t=107302193400001&r=1&w=2)
XSetWindowAttributes attrs; XSetWindowAttributes attrs;
QRect r = workspace()->clientArea( FullArea, this ); QRect r = workspace()->clientArea( FullArea, this );
move_resize_grab_window = XCreateWindow( display(), workspace()->rootWin(), r.x(), r.y(), move_resize_grab_window = XCreateWindow( display(), rootWindow(), r.x(), r.y(),
r.width(), r.height(), 0, CopyFromParent, InputOnly, CopyFromParent, 0, &attrs ); r.width(), r.height(), 0, CopyFromParent, InputOnly, CopyFromParent, 0, &attrs );
XMapRaised( display(), move_resize_grab_window ); XMapRaised( display(), move_resize_grab_window );
if( XGrabPointer( display(), move_resize_grab_window, False, if( XGrabPointer( display(), move_resize_grab_window, False,

View file

@ -211,7 +211,7 @@ Group::Group( Window leader_P, Workspace* workspace_P )
{ {
leader_client = workspace_P->findClient( WindowMatchPredicate( leader_P )); leader_client = workspace_P->findClient( WindowMatchPredicate( leader_P ));
unsigned long properties[ 2 ] = { 0, NET::WM2StartupId }; unsigned long properties[ 2 ] = { 0, NET::WM2StartupId };
leader_info = new NETWinInfo( display(), leader_P, workspace()->rootWin(), leader_info = new NETWinInfo( display(), leader_P, rootWindow(),
properties, 2 ); properties, 2 );
} }
effect_group = new EffectWindowGroupImpl( this ); effect_group = new EffectWindowGroupImpl( this );
@ -773,23 +773,23 @@ Window Client::verifyTransientFor( Window new_transient_for, bool defined )
// make sure splashscreens are shown above all their app's windows, even though // make sure splashscreens are shown above all their app's windows, even though
// they're in Normal layer // they're in Normal layer
if( isSplash() && new_transient_for == None ) if( isSplash() && new_transient_for == None )
new_transient_for = workspace()->rootWin(); new_transient_for = rootWindow();
if( new_transient_for == None ) if( new_transient_for == None )
if( defined ) // sometimes WM_TRANSIENT_FOR is set to None, instead of root window if( defined ) // sometimes WM_TRANSIENT_FOR is set to None, instead of root window
new_property_value = new_transient_for = workspace()->rootWin(); new_property_value = new_transient_for = rootWindow();
else else
return None; return None;
if( new_transient_for == window()) // pointing to self if( new_transient_for == window()) // pointing to self
{ // also fix the property itself { // also fix the property itself
kWarning( 1216 ) << "Client " << this << " has WM_TRANSIENT_FOR poiting to itself." << endl; kWarning( 1216 ) << "Client " << this << " has WM_TRANSIENT_FOR poiting to itself." << endl;
new_property_value = new_transient_for = workspace()->rootWin(); new_property_value = new_transient_for = rootWindow();
} }
// The transient_for window may be embedded in another application, // The transient_for window may be embedded in another application,
// so kwin cannot see it. Try to find the managed client for the // so kwin cannot see it. Try to find the managed client for the
// window and fix the transient_for property if possible. // window and fix the transient_for property if possible.
WId before_search = new_transient_for; WId before_search = new_transient_for;
while( new_transient_for != None while( new_transient_for != None
&& new_transient_for != workspace()->rootWin() && new_transient_for != rootWindow()
&& !workspace()->findClient( WindowMatchPredicate( new_transient_for ))) && !workspace()->findClient( WindowMatchPredicate( new_transient_for )))
{ {
Window root_return, parent_return; Window root_return, parent_return;
@ -818,7 +818,7 @@ Window Client::verifyTransientFor( Window new_transient_for, bool defined )
// windows in the group // windows in the group
int count = 20; int count = 20;
Window loop_pos = new_transient_for; Window loop_pos = new_transient_for;
while( loop_pos != None && loop_pos != workspace()->rootWin()) while( loop_pos != None && loop_pos != rootWindow())
{ {
Client* pos = workspace()->findClient( WindowMatchPredicate( loop_pos )); Client* pos = workspace()->findClient( WindowMatchPredicate( loop_pos ));
if( pos == NULL ) if( pos == NULL )
@ -827,13 +827,13 @@ Window Client::verifyTransientFor( Window new_transient_for, bool defined )
if( --count == 0 ) if( --count == 0 )
{ {
kWarning( 1216 ) << "Client " << this << " caused WM_TRANSIENT_FOR loop." << endl; kWarning( 1216 ) << "Client " << this << " caused WM_TRANSIENT_FOR loop." << endl;
new_transient_for = workspace()->rootWin(); new_transient_for = rootWindow();
} }
} }
if( new_transient_for != workspace()->rootWin() if( new_transient_for != rootWindow()
&& workspace()->findClient( WindowMatchPredicate( new_transient_for )) == NULL ) && workspace()->findClient( WindowMatchPredicate( new_transient_for )) == NULL )
{ // it's transient for a specific window, but that window is not mapped { // it's transient for a specific window, but that window is not mapped
new_transient_for = workspace()->rootWin(); new_transient_for = rootWindow();
} }
if( new_property_value != original_transient_for_id ) if( new_property_value != original_transient_for_id )
XSetTransientForHint( display(), window(), new_property_value ); XSetTransientForHint( display(), window(), new_property_value );
@ -869,7 +869,7 @@ void Client::removeTransient( Client* cl )
{ {
cl->transient_for_id = None; cl->transient_for_id = None;
cl->transient_for = NULL; // SELI cl->transient_for = NULL; // SELI
// SELI cl->setTransient( workspace()->rootWin()); // SELI cl->setTransient( rootWindow());
cl->setTransient( None ); cl->setTransient( None );
} }
} }

View file

@ -177,7 +177,7 @@ class Rules
bool wmclasscomplete; bool wmclasscomplete;
QByteArray windowrole; QByteArray windowrole;
StringMatch windowrolematch; StringMatch windowrolematch;
QString title; // TODO "caption" ? QString title;
StringMatch titlematch; StringMatch titlematch;
QByteArray extrarole; QByteArray extrarole;
StringMatch extrarolematch; StringMatch extrarolematch;

View file

@ -833,8 +833,6 @@ static bool areModKeysDepressed( const KShortcut& cut )
void Workspace::slotWalkThroughWindows() void Workspace::slotWalkThroughWindows()
{ {
if ( root != rootWindow() )
return;
if ( tab_grab || control_grab ) if ( tab_grab || control_grab )
return; return;
if ( options->altTabStyle == Options::CDE || !options->focusPolicyIsReasonable()) if ( options->altTabStyle == Options::CDE || !options->focusPolicyIsReasonable())
@ -859,8 +857,6 @@ void Workspace::slotWalkThroughWindows()
void Workspace::slotWalkBackThroughWindows() void Workspace::slotWalkBackThroughWindows()
{ {
if ( root != rootWindow() )
return;
if( tab_grab || control_grab ) if( tab_grab || control_grab )
return; return;
if ( options->altTabStyle == Options::CDE || !options->focusPolicyIsReasonable()) if ( options->altTabStyle == Options::CDE || !options->focusPolicyIsReasonable())
@ -884,8 +880,6 @@ void Workspace::slotWalkBackThroughWindows()
void Workspace::slotWalkThroughDesktops() void Workspace::slotWalkThroughDesktops()
{ {
if ( root != rootWindow() )
return;
if( tab_grab || control_grab ) if( tab_grab || control_grab )
return; return;
if ( areModKeysDepressed( cutWalkThroughDesktops ) ) if ( areModKeysDepressed( cutWalkThroughDesktops ) )
@ -901,8 +895,6 @@ void Workspace::slotWalkThroughDesktops()
void Workspace::slotWalkBackThroughDesktops() void Workspace::slotWalkBackThroughDesktops()
{ {
if ( root != rootWindow() )
return;
if( tab_grab || control_grab ) if( tab_grab || control_grab )
return; return;
if ( areModKeysDepressed( cutWalkThroughDesktopsReverse ) ) if ( areModKeysDepressed( cutWalkThroughDesktopsReverse ) )
@ -918,8 +910,6 @@ void Workspace::slotWalkBackThroughDesktops()
void Workspace::slotWalkThroughDesktopList() void Workspace::slotWalkThroughDesktopList()
{ {
if ( root != rootWindow() )
return;
if( tab_grab || control_grab ) if( tab_grab || control_grab )
return; return;
if ( areModKeysDepressed( cutWalkThroughDesktopList ) ) if ( areModKeysDepressed( cutWalkThroughDesktopList ) )
@ -935,8 +925,6 @@ void Workspace::slotWalkThroughDesktopList()
void Workspace::slotWalkBackThroughDesktopList() void Workspace::slotWalkBackThroughDesktopList()
{ {
if ( root != rootWindow() )
return;
if( tab_grab || control_grab ) if( tab_grab || control_grab )
return; return;
if ( areModKeysDepressed( cutWalkThroughDesktopListReverse ) ) if ( areModKeysDepressed( cutWalkThroughDesktopListReverse ) )

View file

@ -110,7 +110,6 @@ Workspace::Workspace( bool restore )
disable_shortcuts_keys ( NULL ), disable_shortcuts_keys ( NULL ),
global_shortcuts_disabled( false ), global_shortcuts_disabled( false ),
global_shortcuts_disabled_for_client( false ), global_shortcuts_disabled_for_client( false ),
root (0),
workspaceInit (true), workspaceInit (true),
startup(0), startup(0),
layoutOrientation(Qt::Vertical), layoutOrientation(Qt::Vertical),
@ -138,8 +137,7 @@ Workspace::Workspace( bool restore )
dbus.connect(QString(), "/KWin", "org.kde.KWin", "reloadConfig", this, SLOT(slotReloadConfig())); dbus.connect(QString(), "/KWin", "org.kde.KWin", "reloadConfig", this, SLOT(slotReloadConfig()));
_self = this; _self = this;
mgr = new PluginMgr; mgr = new PluginMgr;
root = rootWindow(); QX11Info info;
QX11Info info;
default_colormap = DefaultColormap(display(), info.screen() ); default_colormap = DefaultColormap(display(), info.screen() );
installed_colormap = default_colormap; installed_colormap = default_colormap;
@ -175,7 +173,7 @@ Workspace::Workspace( bool restore )
KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this ); KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this );
// select windowmanager privileges // select windowmanager privileges
XSelectInput(display(), root, XSelectInput(display(), rootWindow(),
KeyPressMask | KeyPressMask |
PropertyChangeMask | PropertyChangeMask |
ColormapChangeMask | ColormapChangeMask |
@ -370,7 +368,7 @@ void Workspace::init()
unsigned int i, nwins; unsigned int i, nwins;
Window root_return, parent_return, *wins; Window root_return, parent_return, *wins;
XQueryTree(display(), root, &root_return, &parent_return, &wins, &nwins); XQueryTree(display(), rootWindow(), &root_return, &parent_return, &wins, &nwins);
for (i = 0; i < nwins; i++) for (i = 0; i < nwins; i++)
{ {
XWindowAttributes attr; XWindowAttributes attr;
@ -383,15 +381,7 @@ void Workspace::init()
if( topmenu_space && topmenu_space->winId() == wins[ i ] ) if( topmenu_space && topmenu_space->winId() == wins[ i ] )
continue; continue;
if (attr.map_state != IsUnmapped) if (attr.map_state != IsUnmapped)
{ createClient( wins[i], true );
Client* c = createClient( wins[i], true );
if ( c != NULL && root != rootWindow() )
{ // TODO what is this?
// TODO may use QWidget:.create
XReparentWindow( display(), c->frameId(), root, 0, 0 );
c->move(0,0);
}
}
} }
if ( wins ) if ( wins )
XFree((void *) wins); XFree((void *) wins);
@ -462,8 +452,7 @@ Workspace::~Workspace()
delete tab_box; delete tab_box;
delete popupinfo; delete popupinfo;
delete popup; delete popup;
if ( root == rootWindow() ) XDeleteProperty(display(), rootWindow(), atoms->kwin_running);
XDeleteProperty(display(), rootWindow(), atoms->kwin_running);
writeWindowRules(); writeWindowRules();
KGlobal::config()->sync(); KGlobal::config()->sync();
@ -1948,8 +1937,6 @@ unsigned int Workspace::sendFakedMouseEvent( QPoint pos, WId w, MouseEmulation t
*/ */
bool Workspace::keyPressMouseEmulation( XKeyEvent& ev ) bool Workspace::keyPressMouseEmulation( XKeyEvent& ev )
{ {
if ( root != rootWindow() )
return false;
int kc = XKeycodeToKeysym(display(), ev.keycode, 0); int kc = XKeycodeToKeysym(display(), ev.keycode, 0);
int km = ev.state & (ControlMask | Mod1Mask | ShiftMask); int km = ev.state & (ControlMask | Mod1Mask | ShiftMask);

View file

@ -82,8 +82,6 @@ class Workspace : public QObject, public KDecorationDefines
void killWindow() { slotKillWindow(); } void killWindow() { slotKillWindow(); }
WId rootWin() const;
bool initializing() const; bool initializing() const;
/** /**
@ -650,8 +648,6 @@ class Workspace : public QObject, public KDecorationDefines
bool global_shortcuts_disabled; bool global_shortcuts_disabled;
bool global_shortcuts_disabled_for_client; bool global_shortcuts_disabled_for_client;
WId root;
PluginMgr *mgr; PluginMgr *mgr;
RootInfo *rootInfo; RootInfo *rootInfo;
@ -757,11 +753,6 @@ class RootInfo : public NETRootInfo
}; };
inline WId Workspace::rootWin() const
{
return root;
}
inline bool Workspace::initializing() const inline bool Workspace::initializing() const
{ {
return workspaceInit; return workspaceInit;