tool window handling for the default style
visible dialogs for stays-on-top fullscreen windows (helps with Konqueror's dialogs) Fixed lock with Alt-Tab box plus accelerator svn path=/trunk/kdebase/kwin/; revision=65241
This commit is contained in:
parent
e0e632dfdf
commit
6dacbd0112
15 changed files with 176 additions and 84 deletions
41
client.cpp
41
client.cpp
|
@ -423,6 +423,7 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
|
|||
is_sticky = FALSE;
|
||||
stays_on_top = FALSE;
|
||||
may_move = TRUE;
|
||||
is_fullscreen = TRUE;
|
||||
skip_taskbar = FALSE;
|
||||
max_mode = MaximizeRestore;
|
||||
|
||||
|
@ -497,8 +498,10 @@ bool Client::manage( bool isMapped, bool doNotShow, bool isInitial )
|
|||
|
||||
QRect area = workspace()->clientArea();
|
||||
|
||||
if ( geom == workspace()->geometry() )
|
||||
if ( geom == workspace()->geometry() ) {
|
||||
is_fullscreen = TRUE;
|
||||
may_move = FALSE; // don't let fullscreen windows be moved around
|
||||
}
|
||||
|
||||
if ( isMapped || session || isTransient() ) {
|
||||
placementDone = TRUE;
|
||||
|
@ -1144,9 +1147,19 @@ bool Client::isMaximizable() const
|
|||
{
|
||||
if ( isMaximized() )
|
||||
return TRUE;
|
||||
return isResizable() && !isTransient();
|
||||
return isResizable() && !isTransient() && !isTool();
|
||||
}
|
||||
|
||||
/*
|
||||
Returns whether the window is minimizable or not
|
||||
*/
|
||||
bool Client::isMinimizable() const
|
||||
{
|
||||
return wantsTabFocus();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
Reimplemented to provide move/resize
|
||||
|
@ -1516,7 +1529,7 @@ void Client::invalidateWindow()
|
|||
*/
|
||||
void Client::iconify()
|
||||
{
|
||||
if ( windowType() != NET::Normal && windowType() != NET::Toolbar ) // desktop and dock cannot be minimized
|
||||
if ( !isMinimizable() )
|
||||
return;
|
||||
|
||||
if ( isShade() )
|
||||
|
@ -1867,7 +1880,7 @@ void Client::setShade( bool s )
|
|||
|
||||
shaded = s;
|
||||
|
||||
int as = options->animateShade? options->animSteps : 1;
|
||||
int as = options->animateShade? 10 : 1;
|
||||
|
||||
if (shaded ) {
|
||||
int h = height();
|
||||
|
@ -2406,6 +2419,12 @@ bool Client::wantsTabFocus() const
|
|||
return (windowType() == NET::Normal || windowType() == NET::Override ) && ( input || Ptakefocus ) && !skip_taskbar;
|
||||
}
|
||||
|
||||
|
||||
bool Client::wantsInput() const
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns whether the window is moveable or has a fixed
|
||||
position. !isMovable implies !isResizable.
|
||||
|
@ -2433,6 +2452,12 @@ bool Client::isMenu() const
|
|||
}
|
||||
|
||||
|
||||
bool Client::isTool() const
|
||||
{
|
||||
return windowType() == NET::Tool;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
Returns \a area with the client's strut taken into account.
|
||||
|
@ -2465,9 +2490,13 @@ void Client::animateIconifyOrDeiconify( bool iconify)
|
|||
|
||||
float lf,rf,tf,bf,step;
|
||||
|
||||
int options_dot_ResizeAnimation = 1;
|
||||
int speed = options->animateMinimizeSpeed;
|
||||
if ( speed > 10 )
|
||||
speed = 10;
|
||||
if ( speed < 0 )
|
||||
speed = 0;
|
||||
|
||||
step = 40. * (11 - options_dot_ResizeAnimation);
|
||||
step = 40. * (11 - speed );
|
||||
|
||||
NETRect r = info->iconGeometry();
|
||||
QRect icongeom( r.pos.x, r.pos.y, r.size.width, r.size.height );
|
||||
|
|
12
client.h
12
client.h
|
@ -117,6 +117,7 @@ public:
|
|||
bool isMaximizable() const;
|
||||
QRect geometryRestore() const;
|
||||
MaximizeMode maximizeMode() const;
|
||||
bool isMinimizable() const;
|
||||
|
||||
bool isSticky() const;
|
||||
void setSticky( bool );
|
||||
|
@ -126,9 +127,11 @@ public:
|
|||
|
||||
// auxiliary functions, depend on the windowType
|
||||
bool wantsTabFocus() const;
|
||||
bool wantsInput() const;
|
||||
bool isMovable() const;
|
||||
bool isDesktop() const;
|
||||
bool isDock() const;
|
||||
bool isTool() const;
|
||||
bool isMenu() const;
|
||||
|
||||
bool isResizable() const;
|
||||
|
@ -142,6 +145,8 @@ public:
|
|||
virtual void drawbound( const QRect& geom );
|
||||
virtual void clearbound();
|
||||
|
||||
// fullscreen hint, for stacking
|
||||
bool isFullScreen() const;
|
||||
|
||||
// shape extensions
|
||||
bool shape() const;
|
||||
|
@ -264,6 +269,7 @@ private:
|
|||
uint stays_on_top : 1;
|
||||
uint is_shape :1;
|
||||
uint may_move :1;
|
||||
uint is_fullscreen :1;
|
||||
uint skip_taskbar :1;
|
||||
uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol?
|
||||
uint Ptakefocus :1;// does the window understand the TakeFocus protocol?
|
||||
|
@ -386,6 +392,12 @@ inline bool Client::shape() const
|
|||
return is_shape;
|
||||
}
|
||||
|
||||
|
||||
inline bool Client::isFullScreen() const
|
||||
{
|
||||
return is_fullscreen;
|
||||
}
|
||||
|
||||
inline const QRegion& Client::getMask() const
|
||||
{
|
||||
return mask;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
Client *allocate(Workspace *ws, WId w)
|
||||
Client *allocate(Workspace *ws, WId w, int)
|
||||
{
|
||||
return(new B2Client(ws, w));
|
||||
}
|
||||
|
|
|
@ -22,8 +22,10 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|||
|
||||
extern "C"
|
||||
{
|
||||
Client * allocate(Workspace * workSpace, WId winId)
|
||||
Client * allocate(Workspace * workSpace, WId winId, int tool )
|
||||
{
|
||||
if ( tool )
|
||||
return new StdToolClient( workSpace, winId );
|
||||
return new StdClient(workSpace, winId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
Client *allocate(Workspace *ws, WId w)
|
||||
Client *allocate(Workspace *ws, WId w, int )
|
||||
{
|
||||
return(new NextClient(ws, w));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
Client *allocate(Workspace *ws, WId w)
|
||||
Client *allocate(Workspace *ws, WId w, int)
|
||||
{
|
||||
return(new LaptopClient(ws, w));
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
Client *allocate(Workspace *ws, WId w)
|
||||
Client *allocate(Workspace *ws, WId w, int)
|
||||
{
|
||||
return(new ModernSys(ws, w));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
Client * allocate(Workspace * workSpace, WId winId)
|
||||
Client * allocate(Workspace * workSpace, WId winId, int)
|
||||
{
|
||||
return new RiscOS::Manager(workSpace, winId);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
Client *allocate(Workspace *ws, WId w)
|
||||
Client *allocate(Workspace *ws, WId w, int)
|
||||
{
|
||||
return(new SystemClient(ws, w));
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
Client *allocate(Workspace *ws, WId w)
|
||||
Client *allocate(Workspace *ws, WId w, int)
|
||||
{
|
||||
return(new KDEClient(ws, w));
|
||||
}
|
||||
|
@ -323,18 +323,22 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent,
|
|||
g->addColSpacing(0, 4);
|
||||
g->addColSpacing(2, 4);
|
||||
|
||||
button[BtnClose] = new KDEDefaultClientButton(27, titleHeight, this, "close", close_bits);
|
||||
button[BtnSticky] = new KDEDefaultClientButton(17, titleHeight, this, "sticky");
|
||||
int th = titleHeight;
|
||||
if ( isTool() )
|
||||
th -= 2;
|
||||
|
||||
button[BtnClose] = new KDEDefaultClientButton(27, th, this, "close", close_bits);
|
||||
button[BtnSticky] = new KDEDefaultClientButton(17, th, this, "sticky");
|
||||
if(isSticky())
|
||||
button[BtnSticky]->setBitmap(unsticky_bits);
|
||||
else
|
||||
button[BtnSticky]->setBitmap(sticky_bits);
|
||||
button[BtnIconify] = new KDEDefaultClientButton(27, titleHeight, this, "iconify",
|
||||
button[BtnIconify] = new KDEDefaultClientButton(27, th, this, "iconify",
|
||||
iconify_bits);
|
||||
button[BtnMax] = new KDEDefaultClientButton(27, titleHeight, this, "maximize",
|
||||
button[BtnMax] = new KDEDefaultClientButton(27, th, this, "maximize",
|
||||
maximize_bits);
|
||||
if(help){
|
||||
button[BtnHelp] = new KDEDefaultClientButton(17, titleHeight, this, "help",
|
||||
button[BtnHelp] = new KDEDefaultClientButton(17, th, this, "help",
|
||||
question_bits);
|
||||
connect(button[BtnHelp], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
|
||||
}
|
||||
|
@ -351,7 +355,7 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent,
|
|||
g->addLayout( hb, 1, 1 );
|
||||
hb->addWidget( button[BtnClose]);
|
||||
hb->addSpacing(1);
|
||||
titlebar = new QSpacerItem(10, titleHeight, QSizePolicy::Expanding,
|
||||
titlebar = new QSpacerItem(10, th, QSizePolicy::Expanding,
|
||||
QSizePolicy::Minimum);
|
||||
hb->addItem(titlebar);
|
||||
hb->addSpacing(1);
|
||||
|
@ -362,11 +366,12 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent,
|
|||
hb->addWidget( button[BtnIconify]);
|
||||
hb->addWidget( button[BtnMax]);
|
||||
|
||||
if ( isTransient() ) {
|
||||
if ( isTransient() || isTool() )
|
||||
button[BtnSticky]->hide();
|
||||
if ( !isMinimizable() )
|
||||
button[BtnIconify]->hide();
|
||||
if ( !isMaximizable() )
|
||||
button[BtnMax]->hide();
|
||||
}
|
||||
|
||||
hiddenItems = false;
|
||||
bufferDirty = true;
|
||||
|
@ -429,9 +434,13 @@ void KDEClient::paintEvent( QPaintEvent* )
|
|||
p.drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom()-1);
|
||||
p.drawLine(r.x()+1, r.bottom()-1, r.right()-1, r.bottom()-1);
|
||||
|
||||
int th = titleHeight;
|
||||
if ( isTool() )
|
||||
th -= 2;
|
||||
|
||||
// inner rect
|
||||
p.drawRect(r.x()+3, r.y()+titleHeight+3, r.width()-6,
|
||||
r.height()-titleHeight-10);
|
||||
p.drawRect(r.x()+3, r.y()+th+3, r.width()-6,
|
||||
r.height()-th-10);
|
||||
// handles
|
||||
if(r.width() > 44){
|
||||
qDrawShadePanel(&p, r.x()+1, r.bottom()-6, 20,
|
||||
|
@ -464,7 +473,7 @@ void KDEClient::paintEvent( QPaintEvent* )
|
|||
p.fillRect(r.x(), r.y(), r.width(), r.height()-1,
|
||||
options->color(Options::TitleBar, false));
|
||||
|
||||
p.setFont(options->font(false));
|
||||
p.setFont(options->font(false, isTool() ));
|
||||
QFontMetrics fm(options->font(false));
|
||||
g = options->colorGroup(Options::TitleBar, false);
|
||||
if(iUpperGradient)
|
||||
|
@ -582,7 +591,12 @@ void KDEClient::calcHiddenButtons()
|
|||
if(button[i]){
|
||||
if(button[i]->sizeHint().width() + totalSize <= width()){
|
||||
totalSize+=button[i]->sizeHint().width();
|
||||
if(button[i]->isHidden() && ( !isTransient() || ( i != BtnIconify && i != BtnSticky && i != BtnMax ) ) ){
|
||||
if(button[i]->isHidden() &&
|
||||
( !isTransient() || !isTransient() || i != BtnSticky ) &&
|
||||
( isMinimizable() || i != BtnIconify ) &&
|
||||
( isMaximizable() || ( i != BtnIconify && i != BtnSticky && i != BtnMax ) )
|
||||
|
||||
) {
|
||||
button[i]->resize(button[i]->sizeHint());
|
||||
button[i]->show();
|
||||
}
|
||||
|
@ -621,7 +635,7 @@ void KDEClient::updateActiveBuffer( )
|
|||
if(titlePix)
|
||||
p.drawTiledPixmap(r, *titlePix);
|
||||
|
||||
p.setFont(options->font(true));
|
||||
p.setFont(options->font(true, isTool() ));
|
||||
QFontMetrics fm(options->font(true));
|
||||
QColorGroup g = options->colorGroup(Options::TitleBar, true);
|
||||
if(aUpperGradient)
|
||||
|
|
|
@ -169,8 +169,8 @@ void Options::reload()
|
|||
|
||||
animateShade = config->readBoolEntry("AnimateShade", TRUE );
|
||||
|
||||
animSteps = config->readNumEntry("AnimSteps", 10);
|
||||
|
||||
animateMinimize = config->readBoolEntry("AnimateMinimize", TRUE );
|
||||
animateMinimizeSpeed = config->readNumEntry("AnimateMinimizeSpeed", 1 );
|
||||
|
||||
autoRaise = config->readBoolEntry("AutoRaise", FALSE );
|
||||
autoRaiseInterval = config->readNumEntry("AutoRaiseInterval", 0 );
|
||||
|
|
15
options.h
15
options.h
|
@ -145,11 +145,6 @@ public:
|
|||
*/
|
||||
bool animateShade;
|
||||
|
||||
/**
|
||||
* the number of animation steps (would this be general?)
|
||||
*/
|
||||
int animSteps;
|
||||
|
||||
/**
|
||||
* the size of the zone that triggers snapping on desktop borders
|
||||
*/
|
||||
|
@ -161,6 +156,16 @@ public:
|
|||
int windowSnapZone;
|
||||
|
||||
|
||||
/**
|
||||
* whether we animate the minimization of windows or not
|
||||
*/
|
||||
bool animateMinimize;
|
||||
|
||||
/**
|
||||
* Animation speed (0 .. 10 )
|
||||
*/
|
||||
int animateMinimizeSpeed;
|
||||
|
||||
|
||||
// mouse bindings
|
||||
|
||||
|
|
|
@ -120,10 +120,10 @@ PluginMgr::~PluginMgr()
|
|||
lt_dlclose(handle);
|
||||
}
|
||||
|
||||
Client* PluginMgr::allocateClient(Workspace *ws, WId w)
|
||||
Client* PluginMgr::allocateClient(Workspace *ws, WId w, bool tool)
|
||||
{
|
||||
if(alloc_ptr)
|
||||
return(alloc_ptr(ws, w));
|
||||
return(alloc_ptr(ws, w, tool));
|
||||
else
|
||||
return(new KDEClient(ws, w));
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ void PluginMgr::loadPlugin(QString nameStr)
|
|||
else{
|
||||
lt_ptr_t alloc_func = lt_dlsym(handle, "allocate");
|
||||
if(alloc_func)
|
||||
alloc_ptr = (Client* (*)(Workspace *ws, WId w))alloc_func;
|
||||
alloc_ptr = (Client* (*)(Workspace *ws, WId w, int tool))alloc_func;
|
||||
else{
|
||||
qWarning("KWin: %s is not a KWin plugin.", nameStr.latin1());
|
||||
lt_dlclose(handle);
|
||||
|
|
|
@ -22,13 +22,13 @@ class PluginMgr : public QObject
|
|||
public:
|
||||
PluginMgr();
|
||||
~PluginMgr();
|
||||
Client *allocateClient(Workspace *ws, WId w);
|
||||
Client *allocateClient(Workspace *ws, WId w, bool tool);
|
||||
void loadPlugin(QString name);
|
||||
QString currentPlugin() { return pluginStr; }
|
||||
signals:
|
||||
void resetAllClients();
|
||||
protected:
|
||||
Client* (*alloc_ptr)(Workspace *ws, WId w);
|
||||
Client* (*alloc_ptr)(Workspace *ws, WId w, int tool);
|
||||
lt_dlhandle handle;
|
||||
QString pluginStr;
|
||||
};
|
||||
|
|
|
@ -162,8 +162,8 @@ Client* Workspace::clientFactory( WId w )
|
|||
return c;
|
||||
}
|
||||
|
||||
case NET::Toolbar:
|
||||
return (mgr.allocateClient(this,w) ); // TODO use mgr.allocateClient in toolbar mode
|
||||
case NET::Tool:
|
||||
return ( mgr.allocateClient( this, w, true ) );
|
||||
|
||||
case NET::Menu:
|
||||
case NET::Dock:
|
||||
|
@ -183,7 +183,7 @@ Client* Workspace::clientFactory( WId w )
|
|||
if ( Shape::hasShape( w ) ){
|
||||
return new NoBorderClient( this, w );
|
||||
}
|
||||
return(mgr.allocateClient(this, w));
|
||||
return ( mgr.allocateClient( this, w, false ) );
|
||||
}
|
||||
|
||||
// Rikkus: This class is too complex. It needs splitting further.
|
||||
|
@ -703,6 +703,7 @@ bool Workspace::keyPress(XKeyEvent key)
|
|||
tab_box->reset();
|
||||
}
|
||||
tab_box->nextPrev( (km & ShiftMask) == 0 );
|
||||
keys->setEnabled( FALSE );
|
||||
tab_box->delayedShow();
|
||||
}
|
||||
}
|
||||
|
@ -730,6 +731,7 @@ bool Workspace::keyPress(XKeyEvent key)
|
|||
tab_box->reset();
|
||||
}
|
||||
tab_box->nextPrev( (km & ShiftMask) == 0 );
|
||||
keys->setEnabled( FALSE );
|
||||
tab_box->delayedShow();
|
||||
}
|
||||
}
|
||||
|
@ -739,6 +741,7 @@ bool Workspace::keyPress(XKeyEvent key)
|
|||
XUngrabKeyboard(qt_xdisplay(), kwin_time);
|
||||
XUngrabPointer( qt_xdisplay(), kwin_time);
|
||||
tab_box->hide();
|
||||
keys->setEnabled( TRUE );
|
||||
tab_grab = FALSE;
|
||||
control_grab = FALSE;
|
||||
return TRUE;
|
||||
|
@ -766,6 +769,7 @@ bool Workspace::keyRelease(XKeyEvent key)
|
|||
XUngrabKeyboard(qt_xdisplay(), kwin_time);
|
||||
XUngrabPointer( qt_xdisplay(), kwin_time);
|
||||
tab_box->hide();
|
||||
keys->setEnabled( TRUE );
|
||||
tab_grab = false;
|
||||
if ( tab_box->currentClient() ){
|
||||
|
||||
|
@ -782,6 +786,7 @@ bool Workspace::keyRelease(XKeyEvent key)
|
|||
XUngrabPointer( qt_xdisplay(), kwin_time);
|
||||
XUngrabKeyboard(qt_xdisplay(), kwin_time);
|
||||
tab_box->hide();
|
||||
keys->setEnabled( TRUE );
|
||||
control_grab = False;
|
||||
if ( tab_box->currentDesktop() != -1 )
|
||||
setCurrentDesktop( tab_box->currentDesktop() );
|
||||
|
@ -1071,6 +1076,7 @@ void Workspace::requestFocus( Client* c, bool force )
|
|||
} else if ( c->isShade() ) {
|
||||
// client cannot accept focus, but at least the window should be active (window menu, et. al. )
|
||||
focusToNull();
|
||||
if ( c->wantsInput() )
|
||||
c->setActive( TRUE );
|
||||
}
|
||||
}
|
||||
|
@ -1653,6 +1659,26 @@ void Workspace::raiseClient( Client* c )
|
|||
raiseTransientsOf(saveset, c );
|
||||
|
||||
ClientList list = constrainedStackingOrder( stacking_order );
|
||||
|
||||
/* workaround to help broken full-screen applications to keep (modal) dialogs visible
|
||||
*/
|
||||
if ( c->isTransient() && c->mainClient() == c ) {
|
||||
bool has_full_screen = false;
|
||||
for ( ClientList::ConstIterator it = list.fromLast(); it != list.end(); --it) {
|
||||
if ( (*it) == c )
|
||||
break;
|
||||
if ( (*it)->isVisible() && (*it)->isFullScreen() ) {
|
||||
has_full_screen = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( has_full_screen ) {
|
||||
list.remove( c );
|
||||
list.append( c );
|
||||
}
|
||||
}
|
||||
/* end workaround */
|
||||
|
||||
Window* new_stack = new Window[ list.count() + 1 ];
|
||||
int i = 0;
|
||||
for ( ClientList::ConstIterator it = list.fromLast(); it != list.end(); --it) {
|
||||
|
@ -2309,6 +2335,10 @@ void Workspace::slotWindowOperations()
|
|||
*/
|
||||
void Workspace::slotWindowClose()
|
||||
{
|
||||
if ( tab_box->isVisible() ) {
|
||||
qDebug("ARGGGLLLLLLLLL");
|
||||
return;
|
||||
}
|
||||
performWindowOperation( popup_client, Options::CloseOp );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue