From 6dacbd01128897852579b2748aef9d1267b920f8 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Mon, 25 Sep 2000 15:30:51 +0000 Subject: [PATCH] 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 --- client.cpp | 47 +++++++++++++++++++++++------ client.h | 12 ++++++++ clients/b2/b2client.cpp | 2 +- clients/kde1/kde1client.cpp | 6 ++-- clients/kstep/nextclient.cpp | 8 ++--- clients/laptop/laptopclient.cpp | 4 +-- clients/modernsystem/modernsys.cpp | 6 ++-- clients/riscos/Manager.cpp | 16 +++++----- clients/system/systemclient.cpp | 30 +++++++++---------- default/kdedefault.cpp | 44 +++++++++++++++++---------- options.cpp | 6 ++-- options.h | 17 +++++++---- plugins.cpp | 8 ++--- plugins.h | 6 ++-- workspace.cpp | 48 ++++++++++++++++++++++++------ 15 files changed, 176 insertions(+), 84 deletions(-) diff --git a/client.cpp b/client.cpp index 816d962a91..9fee6edf2a 100644 --- a/client.cpp +++ b/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,15 +498,17 @@ 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; } else { if ( (xSizeHint.flags & PPosition) || (xSizeHint.flags & USPosition) ) { placementDone = TRUE; - if ( windowType() == NET::Normal && !area.contains( geom.topLeft() ) && may_move ) { + if ( windowType() == NET::Normal && !area.contains( geom.topLeft() ) && may_move ) { int tx = geom.x(); int ty = geom.y(); if ( tx >= 0 && tx < area.x() ) @@ -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,9 +1529,9 @@ void Client::invalidateWindow() */ void Client::iconify() { - if ( windowType() != NET::Normal && windowType() != NET::Toolbar ) // desktop and dock cannot be minimized + if ( !isMinimizable() ) return; - + if ( isShade() ) setShade( FALSE ); if ( workspace()->iconifyMeansWithdraw( this ) ) { @@ -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 ); diff --git a/client.h b/client.h index 7c7bc0ba68..81073f6f38 100644 --- a/client.h +++ b/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; diff --git a/clients/b2/b2client.cpp b/clients/b2/b2client.cpp index 3e15767e87..f75bc46123 100644 --- a/clients/b2/b2client.cpp +++ b/clients/b2/b2client.cpp @@ -15,7 +15,7 @@ extern "C" { - Client *allocate(Workspace *ws, WId w) + Client *allocate(Workspace *ws, WId w, int) { return(new B2Client(ws, w)); } diff --git a/clients/kde1/kde1client.cpp b/clients/kde1/kde1client.cpp index b39d4999f4..9acd7c5e3d 100644 --- a/clients/kde1/kde1client.cpp +++ b/clients/kde1/kde1client.cpp @@ -22,9 +22,11 @@ Copyright (C) 1999, 2000 Matthias Ettrich extern "C" { - Client * allocate(Workspace * workSpace, WId winId) + Client * allocate(Workspace * workSpace, WId winId, int tool ) { - return new StdClient(workSpace, winId); + if ( tool ) + return new StdToolClient( workSpace, winId ); + return new StdClient(workSpace, winId); } } diff --git a/clients/kstep/nextclient.cpp b/clients/kstep/nextclient.cpp index b0fae0de51..a7250380f8 100644 --- a/clients/kstep/nextclient.cpp +++ b/clients/kstep/nextclient.cpp @@ -13,7 +13,7 @@ extern "C" { - Client *allocate(Workspace *ws, WId w) + Client *allocate(Workspace *ws, WId w, int ) { return(new NextClient(ws, w)); } @@ -105,7 +105,7 @@ static void create_pixmaps() aBtnDown->resize(18, 18); KPixmap internal; internal.resize(12, 12); - + // inactive buttons QColor c(options->color(Options::ButtonBg, false)); KPixmapEffect::gradient(*iBtn, c.light(120), c.dark(120), @@ -170,7 +170,7 @@ void NextClient::slotReset() delete iBtn; delete aBtnDown; delete iBtnDown; - + pixmaps_created = false; create_pixmaps(); button[0]->reset(); @@ -218,7 +218,7 @@ NextClient::NextClient( Workspace *ws, WId w, QWidget *parent, { create_pixmaps(); connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); - + QVBoxLayout *mainLayout = new QVBoxLayout(this); QHBoxLayout *titleLayout = new QHBoxLayout(); QHBoxLayout *windowLayout = new QHBoxLayout(); diff --git a/clients/laptop/laptopclient.cpp b/clients/laptop/laptopclient.cpp index 8d8502cc42..9066b959b8 100644 --- a/clients/laptop/laptopclient.cpp +++ b/clients/laptop/laptopclient.cpp @@ -17,7 +17,7 @@ extern "C" { - Client *allocate(Workspace *ws, WId w) + Client *allocate(Workspace *ws, WId w, int) { return(new LaptopClient(ws, w)); } @@ -359,7 +359,7 @@ void LaptopClient::resizeEvent( QResizeEvent* e) dx = 16 + QABS( e->oldSize().width() - width() ); if ( e->oldSize().height() != height() ) dy = 16 + QABS( e->oldSize().height() - height() ); - if ( dy ) + if ( dy ) update( 0, height() - dy + 1, width(), dy ); if ( dx ) { update( width() - dx + 1, 0, dx, height() ); diff --git a/clients/modernsystem/modernsys.cpp b/clients/modernsystem/modernsys.cpp index 37cc07f3cc..9998fad075 100644 --- a/clients/modernsystem/modernsys.cpp +++ b/clients/modernsystem/modernsys.cpp @@ -18,7 +18,7 @@ extern "C" { - Client *allocate(Workspace *ws, WId w) + Client *allocate(Workspace *ws, WId w, int) { return(new ModernSys(ws, w)); } @@ -51,7 +51,7 @@ static unsigned char btnhighcolor_mask_bits[] = { 0xe0,0x41,0xf8,0x07,0xfc,0x0f,0xfe,0xdf,0xfe,0x1f,0xff,0x3f,0xff,0xff,0xff, 0x3f,0xff,0x3f,0xff,0xff,0xff,0xff,0xfe,0x9f,0xfe,0x1f,0xfc,0x0f,0xf0,0x03, 0x00,0x40,0x80,0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x20,0x99,0x0f,0x08,0xc4, - 0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x58,0x5f,0x43,0x68,0x61,0x6e,0x67,0x65 }; + 0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x58,0x5f,0x43,0x68,0x61,0x6e,0x67,0x65 }; static KPixmap *aUpperGradient=0; static KPixmap *iUpperGradient=0; @@ -508,7 +508,7 @@ void ModernSys::activeChange(bool) Client::MousePosition ModernSys::mousePosition( const QPoint& p) const { MousePosition m = Client::mousePosition( p ); - + if ( m == Center ) { int border = 10; if ( p.y() >= height()-border ) diff --git a/clients/riscos/Manager.cpp b/clients/riscos/Manager.cpp index 42a130f8a8..dd87e17164 100644 --- a/clients/riscos/Manager.cpp +++ b/clients/riscos/Manager.cpp @@ -1,6 +1,6 @@ /* RISC OS KWin client - + Copyright 2000 Rik Hemsley @@ -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); } @@ -70,7 +70,7 @@ Manager::slotReset() Static::instance()->update(); _updateDisplay(); } - + void Manager::captionChange(const QString &) { @@ -80,7 +80,7 @@ Manager::captionChange(const QString &) void Manager::paletteChange(const QPalette &) { - Static::instance()->update(); + Static::instance()->update(); _updateDisplay(); } @@ -127,12 +127,12 @@ Manager::paintEvent(QPaintEvent * e) if (intersectsLeft) p.drawLine(0, r.top(), 0, r.bottom()); - + if (intersectsRight) p.drawLine(width() - 1, r.top(), width() - 1, r.bottom()); } } - + Client::MousePosition Manager::mousePosition(const QPoint & p) const { @@ -173,7 +173,7 @@ Manager::_updateLayout() titleBar_ -> setGeometry(0, 0, width(), 20); windowWrapper() -> setGeometry(1, 20, width() - 2, height() - 30); resizeBar_ -> setGeometry(0, height() - 10, width(), 10); - + _updateDisplay(); } @@ -193,7 +193,7 @@ Manager::fakeMouseEvent(QMouseEvent * e, QWidget * w) Client::event(&fake); } - void + void Manager::mouseDoubleClickEvent( QMouseEvent * ) { workspace()->performWindowOperation( this, options->operationTitlebarDblClick() ); diff --git a/clients/system/systemclient.cpp b/clients/system/systemclient.cpp index 160cadff91..9b03a8de48 100644 --- a/clients/system/systemclient.cpp +++ b/clients/system/systemclient.cpp @@ -15,7 +15,7 @@ extern "C" { - Client *allocate(Workspace *ws, WId w) + Client *allocate(Workspace *ws, WId w, int) { return(new SystemClient(ws, w)); } @@ -23,13 +23,13 @@ extern "C" static unsigned char iconify_bits[] = { 0x00, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00}; - + static unsigned char maximize_bits[] = { 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00}; - + static unsigned char minmax_bits[] = { 0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f}; - + static unsigned char unsticky_bits[] = { 0x00, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x00}; @@ -38,7 +38,7 @@ static unsigned char sticky_bits[] = { static unsigned char question_bits[] = { 0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18}; - + static KPixmap *aUpperGradient=0; static KPixmap *iUpperGradient=0; @@ -131,7 +131,7 @@ static void create_pixmaps() bitBlt(iBtnPix, 2, 2, &iPix, 0, 0, 10, 10, Qt::CopyROP, true); drawButtonFrame(iBtnPix, options->colorGroup(Options::Frame, false)); - + // pressed buttons hColor = options->color(Options::ButtonBg, false); KPixmapEffect::gradient(iInternal, @@ -171,7 +171,7 @@ static void create_pixmaps() btnForeground = Qt::black; else btnForeground = Qt::white; -} +} SystemButton::SystemButton(Client *parent, const char *name, @@ -233,9 +233,9 @@ void SystemButton::drawButton(QPainter *p) p->setPen(isDown() ? g.light() : g.mid()); p->drawLine(x2-2, 2, x2-2, y2-2); p->drawLine(2, x2-2, y2-2, x2-2); - + } - + if(!deco.isNull()){ p->setPen(btnForeground); p->drawPixmap(isDown() ? 4 : 3, isDown() ? 4 : 3, deco); @@ -359,7 +359,7 @@ void SystemClient::recalcTitleBuffer() p.fillRect(0, 0, width(), 18, options->colorGroup(Options::Frame, true). brush(QColorGroup::Button)); - + QRect t = titlebar->geometry(); t.setTop( 2 ); t.setLeft( t.left() + 4 ); @@ -386,7 +386,7 @@ void SystemClient::recalcTitleBuffer() p.end(); oldTitle = caption(); } - + void SystemClient::captionChange( const QString &) { recalcTitleBuffer(); @@ -415,7 +415,7 @@ void SystemClient::paintEvent( QPaintEvent* ) t.setTop( 2 ); t.setLeft( t.left() + 4 ); t.setRight( t.right() - 2 ); - + if(isActive()) p.drawPixmap(0, 0, titleBuffer); else{ @@ -427,7 +427,7 @@ void SystemClient::paintEvent( QPaintEvent* ) p.setFont(options->font(isActive())); p.drawText(t, AlignCenter, caption() ); } - + p.setPen(options->colorGroup(Options::Frame, isActive()).light()); @@ -446,7 +446,7 @@ void SystemClient::doShape() { // using a bunch of QRect lines seems much more efficent than bitmaps or // point arrays - + QRegion mask; kRoundMaskRegion(mask, 0, 0, width(), height()); setMask(mask); @@ -462,7 +462,7 @@ void SystemClient::showEvent(QShowEvent *ev) void SystemClient::windowWrapperShowEvent( QShowEvent* ) { doShape(); -} +} void SystemClient::mouseDoubleClickEvent( QMouseEvent * e ) { diff --git a/default/kdedefault.cpp b/default/kdedefault.cpp index b09ec642c7..df80e065cf 100644 --- a/default/kdedefault.cpp +++ b/default/kdedefault.cpp @@ -18,7 +18,7 @@ extern "C" { - Client *allocate(Workspace *ws, WId w) + Client *allocate(Workspace *ws, WId w, int) { return(new KDEClient(ws, w)); } @@ -307,7 +307,7 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent, { lastButtonWidth = 0; lastBufferWidth = 0; - + create_pixmaps(); connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); bool help = providesContextHelp(); @@ -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) diff --git a/options.cpp b/options.cpp index 50a6965752..6d202f3a07 100644 --- a/options.cpp +++ b/options.cpp @@ -169,9 +169,9 @@ 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 ); diff --git a/options.h b/options.h index 67ddd82345..fe018c2863 100644 --- a/options.h +++ b/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 */ @@ -159,7 +154,17 @@ public: * the number of animation steps (would this be general?) */ int windowSnapZone; - + + + /** + * whether we animate the minimization of windows or not + */ + bool animateMinimize; + + /** + * Animation speed (0 .. 10 ) + */ + int animateMinimizeSpeed; // mouse bindings diff --git a/plugins.cpp b/plugins.cpp index e44f52eab6..78a3ccf752 100644 --- a/plugins.cpp +++ b/plugins.cpp @@ -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)); } @@ -134,7 +134,7 @@ void PluginMgr::loadPlugin(QString nameStr) static lt_dlhandle oldHandle = 0; pluginStr = nameStr; - + oldHandle = handle; // Rikkus: temporary change in semantics. @@ -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); diff --git a/plugins.h b/plugins.h index 1af88cad43..1ccbc5afa4 100644 --- a/plugins.h +++ b/plugins.h @@ -1,6 +1,6 @@ /***************************************************************** kwin - the KDE window manager - + Copyright (C) 1999, 2000 Daniel M. Duley ******************************************************************/ #ifndef __PLUGINS_H @@ -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; }; diff --git a/workspace.cpp b/workspace.cpp index cfb6b9f14e..ae507a2783 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -162,13 +162,13 @@ 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: { - Client * c = new NoBorderClient( this, w); + Client * c = new NoBorderClient( this, w ); c->setSticky( TRUE ); return c; } @@ -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(); } } @@ -737,8 +739,9 @@ bool Workspace::keyPress(XKeyEvent key) if (control_grab || tab_grab){ if (kc == XK_Escape){ XUngrabKeyboard(qt_xdisplay(), kwin_time); - XUngrabPointer( qt_xdisplay(), kwin_time); + XUngrabPointer( qt_xdisplay(), kwin_time); tab_box->hide(); + keys->setEnabled( TRUE ); tab_grab = FALSE; control_grab = FALSE; return TRUE; @@ -764,8 +767,9 @@ bool Workspace::keyRelease(XKeyEvent key) if (xmk->modifiermap[xmk->max_keypermod * Mod1MapIndex + i] == key.keycode){ XUngrabKeyboard(qt_xdisplay(), kwin_time); - XUngrabPointer( qt_xdisplay(), kwin_time); + XUngrabPointer( qt_xdisplay(), kwin_time); tab_box->hide(); + keys->setEnabled( TRUE ); tab_grab = false; if ( tab_box->currentClient() ){ @@ -779,9 +783,10 @@ bool Workspace::keyRelease(XKeyEvent key) for (i=0; imax_keypermod; i++) if (xmk->modifiermap[xmk->max_keypermod * ControlMapIndex + i] == key.keycode){ - XUngrabPointer( qt_xdisplay(), kwin_time); + 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,7 +1076,8 @@ 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(); - c->setActive( TRUE ); + 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 ); } @@ -2652,7 +2682,7 @@ void Workspace::slotResetAllClients() (*jt) = newClient; jt = focus_chain.find (oldClient); (*jt) = newClient; - newClient->cloneMode(oldClient); + newClient->cloneMode(oldClient); delete oldClient; bool showIt = newClient->manage( TRUE, TRUE, FALSE ); if ( prev ) {