added start-on-proper-desktop support, as well as fixing a few buglets in
kwin that this exposed. svn path=/trunk/kdebase/kwin/; revision=52536
This commit is contained in:
parent
254997fae5
commit
9b9570699b
3 changed files with 44 additions and 5 deletions
|
@ -65,6 +65,11 @@ Atoms::Atoms()
|
||||||
atoms[n] = &net_avoid_spec;
|
atoms[n] = &net_avoid_spec;
|
||||||
names[n++] = (char *) "_NET_AVOID_SPEC";
|
names[n++] = (char *) "_NET_AVOID_SPEC";
|
||||||
|
|
||||||
|
// FIXME: standardize? KWIN_ prefix is deliberate so this isn't missed
|
||||||
|
// set by kdelibs/kio/kmapnotify.c
|
||||||
|
atoms[n] = &kwin_initial_desktop;
|
||||||
|
names[n++] = (char *) "KWIN_INITIAL_DESKTOP"; // _NET_INITIAL_DESKTOP?
|
||||||
|
|
||||||
XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_return );
|
XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_return );
|
||||||
for (int i = 0; i < n; i++ )
|
for (int i = 0; i < n; i++ )
|
||||||
*atoms[i] = atoms_return[i];
|
*atoms[i] = atoms_return[i];
|
||||||
|
|
2
atoms.h
2
atoms.h
|
@ -31,6 +31,8 @@ public:
|
||||||
Atom net_kde_docking_windows;
|
Atom net_kde_docking_windows;
|
||||||
Atom net_avoid_spec;
|
Atom net_avoid_spec;
|
||||||
|
|
||||||
|
Atom kwin_initial_desktop;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
42
client.cpp
42
client.cpp
|
@ -328,7 +328,7 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
|
||||||
{
|
{
|
||||||
avoid = false;
|
avoid = false;
|
||||||
anchor = AnchorNorth;
|
anchor = AnchorNorth;
|
||||||
|
|
||||||
wspace = ws;
|
wspace = ws;
|
||||||
win = w;
|
win = w;
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
|
@ -368,6 +368,33 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
|
||||||
setSticky( TRUE );
|
setSticky( TRUE );
|
||||||
|
|
||||||
updateAvoidPolicy();
|
updateAvoidPolicy();
|
||||||
|
|
||||||
|
// should we open this window on a certain desktop?
|
||||||
|
Atom type;
|
||||||
|
int format;
|
||||||
|
unsigned long nitems, bytes;
|
||||||
|
long *data = 0L;
|
||||||
|
|
||||||
|
int status=XGetWindowProperty(qt_xdisplay(), w, atoms->kwin_initial_desktop, 0, 1L,
|
||||||
|
False, atoms->kwin_initial_desktop, &type, &format, &nitems, &bytes,
|
||||||
|
(unsigned char **)&data);
|
||||||
|
|
||||||
|
if (status==Success) {
|
||||||
|
if (nitems>0)
|
||||||
|
desk=data[0]; // window had the initial desktop property!
|
||||||
|
|
||||||
|
XFree((char *)data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if this window is transient, ensure that it is opened on the
|
||||||
|
// same window as its parent. this is necessary when an application
|
||||||
|
// starts up on a different desktop than is currently displayed
|
||||||
|
//
|
||||||
|
// are there any other cases we need to check?
|
||||||
|
//
|
||||||
|
if (transient_for != None)
|
||||||
|
desk=KWM::desktop(transient_for);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -450,10 +477,13 @@ void Client::manage( bool isMapped )
|
||||||
XFree(hints);
|
XFree(hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initial desktop placement
|
// initial desktop placement - note we don't clobber desk if it is
|
||||||
|
// set to some value, in case the initial desktop code in the
|
||||||
|
// constructor has already set a value for us
|
||||||
if ( info ) {
|
if ( info ) {
|
||||||
desk = info->desktop;
|
desk = info->desktop;
|
||||||
} else {
|
} else if (desk<=0) {
|
||||||
|
|
||||||
// assume window wants to be visible on the current desktop
|
// assume window wants to be visible on the current desktop
|
||||||
desk = workspace()->currentDesktop();
|
desk = workspace()->currentDesktop();
|
||||||
|
|
||||||
|
@ -461,9 +491,9 @@ void Client::manage( bool isMapped )
|
||||||
desk = KWM::desktop( win );
|
desk = KWM::desktop( win );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initial desktop code needs this now
|
||||||
KWM::moveToDesktop( win, desk ); // KDE 1.x compatibility
|
KWM::moveToDesktop( win, desk ); // KDE 1.x compatibility
|
||||||
|
|
||||||
|
|
||||||
setMappingState( state );
|
setMappingState( state );
|
||||||
if ( state == NormalState && isOnDesktop( workspace()->currentDesktop() ) ) {
|
if ( state == NormalState && isOnDesktop( workspace()->currentDesktop() ) ) {
|
||||||
Events::raise( isTransient() ? Events::TransNew : Events::New );
|
Events::raise( isTransient() ? Events::TransNew : Events::New );
|
||||||
|
@ -605,7 +635,9 @@ bool Client::mapRequest( XMapRequestEvent& /* e */ )
|
||||||
show();
|
show();
|
||||||
break;
|
break;
|
||||||
case NormalState:
|
case NormalState:
|
||||||
show(); // for safety
|
// only show window if we're on current desktop
|
||||||
|
if (desk == KWM::currentDesktop())
|
||||||
|
show(); // for safety
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue