summaryrefslogtreecommitdiffstats
path: root/src/kooldock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kooldock.cpp')
-rw-r--r--src/kooldock.cpp4350
1 files changed, 2227 insertions, 2123 deletions
diff --git a/src/kooldock.cpp b/src/kooldock.cpp
index 5f0a9fc..00a0ec3 100644
--- a/src/kooldock.cpp
+++ b/src/kooldock.cpp
@@ -1,19 +1,19 @@
/**************************************************************************
- kooldock.cpp - description
- -------------------
- begin : Tue Jun 10 22:18:34 BST 2003
- copyright : (C) 2003 by KoolDock team
- email :
+ kooldock.cpp - description
+ -------------------
+ begin : Tue Jun 10 22:18:34 BST 2003
+ copyright : (C) 2003 by KoolDock team
+ email :
***************************************************************************/
/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
-***************************************************************************/
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
#include <stdlib.h>
#include <math.h>
@@ -56,7 +56,7 @@
#include "kooldock.h"
-#include <tdeconfig.h>
+#include <tdeconfig.h>
#include <kdebug.h>
#include "setupdialogprg.h"
@@ -65,37 +65,34 @@
#define min(a, b) (a < b) ? (a) : (b)
#define max(a, b) (a > b) ? (a) : (b)
-// compiler issues
-#if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
-# define _GCC295
-#endif
#include <dcopclient.h>
#include <iostream>
#include <ntqdatastream.h>
-KoolDock::KoolDock(TQWidget *parent, const char *name) : TQWidget(parent, name, WStyle_Customize | WStyle_NoBorder | WNoAutoErase | WDestructiveClose | WStyle_StaysOnTop )//| WX11BypassWM)
+KoolDock::KoolDock(TQWidget* parent, const char* name) :
+ TQWidget(parent, name, WStyle_Customize | WStyle_NoBorder | WNoAutoErase | WDestructiveClose | WStyle_StaysOnTop)
{
// Default configuration paths
progPath = locateLocal("data", "kooldock");
menuPath = progPath + TQString("/menu/");
confFile = locateLocal("config", "kooldockrc");
- noSet=false;
- firstInit=true;
- setupdlg = new SetupDialogPrg(); // create the setup dialog object.
-
- connect (setupdlg, SIGNAL(apply()), SLOT(chkRestart()));
+ noSet = false;
+ firstInit = true;
+ setupdlg = new SetupDialogPrg(); // create the setup dialog object.
+
+ connect(setupdlg, SIGNAL(apply()), SLOT(chkRestart()));
perf = new TQTime();
- reloadIcons=TRUE;
-
- //Menu definitions
- deskpopup=new TDEPopupMenu();
- appMenu=new TDEPopupMenu();
- godesk=new TDEPopupMenu;
- tasklist=new TDEPopupMenu;
- popup=new TDEPopupMenu;
- advMenu=new TDEPopupMenu;
+ reloadIcons = true;
+
+ // Menu definitions
+ deskpopup = new TDEPopupMenu();
+ appMenu = new TDEPopupMenu();
+ godesk = new TDEPopupMenu;
+ tasklist = new TDEPopupMenu;
+ popup = new TDEPopupMenu;
+ advMenu = new TDEPopupMenu;
connect(popup, SIGNAL(aboutToShow()), SLOT(aboutToShow()));
connect(popup, SIGNAL(aboutToHide()), SLOT(aboutToHide()));
@@ -106,27 +103,26 @@ KoolDock::KoolDock(TQWidget *parent, const char *name) : TQWidget(parent, name,
connect(godesk, SIGNAL(activated(int)), this, SLOT(goToDesktop(int)));
connect(tasklist, SIGNAL(activated(int)), this, SLOT(goToWindow(int)));
connect(deskpopup, SIGNAL(activated(int)), this, SLOT(sendToDesktop(int)));
- menuCount=0;
-
+ menuCount = 0;
+
init1();
- TQString welcomeMsg;
if (fFirstRun)
{
- // Show welcome dialog.
- welcomeMsg = TQString("<center><B>Welcome</B></center>It appears to be the first time you run KoolDock.<br>"
- "By default the dock is hidden at the botton of the screen, move your mouse"
- " to the bottom edge of the screen and the dock will appear.<br>"
- "Right click on the dock for a menu that allows you to configure it<br>"
- "or run with <I>-o</I> parameter to have preferences window at start.<br>"
- "We hope this software is usefull for you<br>-- The KoolDock Team");
+ // Show welcome dialog.
+ TQString welcomeMsg("<center><B>Welcome</B></center>It appears to be the first time you run KoolDock.<br>"
+ "By default the dock is hidden at the botton of the screen, move your mouse"
+ " to the bottom edge of the screen and the dock will appear.<br>"
+ "Right click on the dock for a menu that allows you to configure it<br>"
+ "or run with <I>-o</I> parameter to have preferences window at start.<br>"
+ "We hope this software is usefull for you<br>-- The KoolDock Team");
KMessageBox::information(0L, i18n(welcomeMsg));
- saveConf(); // create initial configuration.
+ saveConf(); // create initial configuration.
}
-
init2();
- firstInit=false;
+ firstInit = false;
}
+
KoolDock::~KoolDock()
{
if (xosdw) delete(xosdw);
@@ -145,133 +141,134 @@ KoolDock::~KoolDock()
void KoolDock::mTimerEnd()
{
- if (menuCount>0) return;
- TQPoint pointer;
- pointer = TQCursor::pos();
- lastXPos=pointer.x()-rx;
- lastYPos=pointer.y()-ry;
- int px,py,pw,ph,pt;
- int mpx, mpy;
- mpx=pointer.x();
- mpy=pointer.y();
-
- if (fExpanded && !mksmallTimer->isActive()) {px=x1;} else {px=x0;}
- if ((fOrientation & 2)==2) py=0; else py=dh-h;
- pw=w;
- ph=h;
- if ((fOrientation & 1)==1)
- {
- pt=px;px=py;py=pt;
- pt=pw;pw=ph;ph=pt;
- pt=mpx;mpx=mpy;mpy=pt;
+ if (menuCount > 0) {
+ return;
}
- if (xinerama==1) px+=XinPreviousWidth;
+ TQPoint pointer = TQCursor::pos();
+ lastXPos = pointer.x() - rx;
+ lastYPos = pointer.y() - ry;
+ int px, py, pw, ph;
+ int mpx = pointer.x();
+ int mpy = pointer.y();
- if (fHidden==1)
- {
- if (pointer.y() >= py && pointer.y() <= (py + ph) && pointer.x() >= px && pointer.x() <= (px + pw))
- {
- mMoveEvent(pointer.x()-rx,pointer.y()-ry);
+ if (fExpanded && !mksmallTimer->isActive()) {
+ px = x1;
+ }
+ else {
+ px = x0;
+ }
+ if ((fOrientation & 2) == 2) {
+ py = 0;
+ }
+ else {
+ py = dh - h;
+ }
+ pw = w;
+ ph = h;
+ if ((fOrientation & 1) == 1) {
+ std::swap(px, py);
+ std::swap(pw, ph);
+ std::swap(mpx, mpy);
+ }
+ if (xinerama == 1) {
+ px += XinPreviousWidth;
+ }
+
+ if (fHidden == 1) {
+ if ((pointer.y() >= py) && (pointer.y() <= (py + ph)) && (pointer.x() >= px) && (pointer.x() <= (px + pw))) {
+ mMoveEvent(pointer.x() - rx, pointer.y() - ry);
}
- else
- {
- debug(TQString("mTimer1Leave: %1 %2 %3 %4 %5 %6").arg(pointer.x()).arg(pointer.y()).arg(dh-h).arg(ry).arg(rx).arg(x+w));
+ else {
+ debug(TQString("mTimer1Leave: %1 %2 %3 %4 %5 %6").arg(pointer.x()).arg(pointer.y()).arg(dh - h).arg(ry).arg(rx).arg(x + w));
onleaveEvent(NULL);
}
}
- else
- {
- if (pointer.y() >= py && pointer.y() <= (py + ph) && pointer.x() >= px && pointer.x() <= (px + pw))
- {
- if (fExpanded && !mksmallTimer->isActive())
- {
- mMoveEvent(pointer.x()-rx,pointer.y()-ry);
- }
- else
- {
- debug(TQString("mTimer2EnterEv: %1 %2").arg(pointer.x()-rx).arg(pointer.y()-ry));
- if (mpx>=firstX && mpx<=firstX+tmpw)
- {
+ else {
+ if (pointer.y() >= py && pointer.y() <= (py + ph) && pointer.x() >= px && pointer.x() <= (px + pw)) {
+ if (fExpanded && !mksmallTimer->isActive()) {
+ mMoveEvent(pointer.x() - rx, pointer.y() - ry);
+ }
+ else {
+ debug(TQString("mTimer2EnterEv: %1 %2").arg(pointer.x() - rx).arg(pointer.y() - ry));
+ if ((mpx >= firstX) && (mpx <= firstX+tmpw)) {
enterEvent(NULL);
}
}
}
- else
- {
- if (fExpanded)
- {
+ else {
+ if (fExpanded) {
debug(TQString("mTimer2Leave"));
onleaveEvent(NULL);
}
}
}
- if (fSteppy==1) if (!mkbigTimer->isActive() || !mksmallTimer->isActive()) mMoveEvent(pointer.x()-rx, pointer.y()-ry);
+ if (fSteppy == 1) {
+ if (!mkbigTimer->isActive() || !mksmallTimer->isActive()) {
+ mMoveEvent(pointer.x() - rx, pointer.y() - ry);
+ }
+ }
}
-
void KoolDock::trackTimerEnd()
{
-
+
TQPoint pointer;
pointer = TQCursor::pos();
- int px, py;
- if ((fOrientation & 1) == 1)
- {
- px = pointer.y();
- py = pointer.x();
+ int px = pointer.x();
+ int py = pointer.y();
+ if ((fOrientation & 1) == 1) {
+ std::swap(px, py);
}
- else
- {
- py = pointer.y();
- px = pointer.x();
+ if ((fOrientation & 2) == 2) {
+ py = dh - py;
}
- if ((fOrientation & 2) == 2) py = dh-py;
- if (py+2 >= dh && px > x0 && px < x0+w0)
- {
- if(track2active==FALSE) TQTimer::singleShot( hideTimer, this, SLOT(trackTimer2End()) );
- track2active=true;
+ if ((py + 2 >= dh) && (px > x0) && (px < x0 + w0)){
+ if (track2active == false) {
+ TQTimer::singleShot(hideTimer, this, SLOT(trackTimer2End()));
+ }
+ track2active = true;
}
}
void KoolDock::trackTimer2End()
{
- TQPoint pointer;
- pointer = TQCursor::pos();
- int px, py;
- if ((fOrientation & 1) == 1)
- {
- px = pointer.y();
- py = pointer.x();
+ TQPoint pointer = TQCursor::pos();
+ int px = pointer.x();
+ int py = pointer.y();
+ if ((fOrientation & 1) == 1) {
+ std::swap(px, py);
}
- else
- {
- py = pointer.y();
- px = pointer.x();
+ if ((fOrientation & 2) == 2) {
+ py = dh - py;
}
- if ((fOrientation & 2) == 2) py = dh-py;
- if (py+2 >= dh && px > x0 && px < x0+w0)
- {
- if(mksmallTimer->isActive()==TRUE) mksmallTimerstop();
- move( 0, rdh);
+ if (((py + 2) >= dh) && (px > x0) && (px < x0 + w0)) {
+ if (mksmallTimer->isActive() == true) {
+ mksmallTimerstop();
+ }
+ move(0, rdh);
raise();
trackTimer->stop();
getBottomBG();
- if(h1 > h0) getTopBG();
+ if (h1 > h0) {
+ getTopBG();
+ }
debug(TQString("tracktimer: grabWindow(%1, %2, %3, %4)").arg(x1).arg(dh - h1).arg(w1).arg(h1));
- move2( x, dh - h);
+ move2(x, dh - h);
resize2(w, h);
Ybase = iwBig2;
enterEvent(NULL);
}
- track2active=FALSE;
+ track2active = false;
}
void KoolDock::paintEvent(TQPaintEvent *)
{
// Draw backgound, icons, and all that stuff over the widget.
+ if (initialization && (ptPart == 5)) {
+ return;
+ }
TQPainter p;
- if (initialization && ptPart==5) return;
- p.begin (&offscr,this);
+ p.begin(&offscr, this);
int i;
int ii;
@@ -279,414 +276,521 @@ void KoolDock::paintEvent(TQPaintEvent *)
debug(TQString("painting"));
// draw background (new engine)
- int bgY;
TQImage TempBG;
TQPixmap TempScaledLeft;
- //TQPixmap TempScaledCenter;
TQPixmap TempScaledRight;
- int p1,p2,p3,p4=0,p5=0,p6,p7,p8,p9,p10,pt;
- if (w<dw) Offset=0;
- if (fExpanded==FALSE)
- {
- bgY = 0;
+ int p3,p4=0,p5=0,p6,p7,p8,p9,p10;
+ if (w < dw) {
+ Offset = 0;
}
- else
- {
+ int bgY = 0;
+ if (fExpanded == true) {
bgY = h1 - h0 + Ybase;
}
- lastX = cur_cx[items.count()-1] - iSize[items.count()-1]/2 + adjust;
- lastX += iSize[items.count()-1];
- if (ii_first == 0)
- {
- firstX = cur_cx[0] - iSize[0]/2 - iSpace/2 + adjust+soffset-eoffset+x;
+ lastX = cur_cx[items.count() - 1] - iSize[items.count() - 1] / 2 + adjust;
+ lastX += iSize[items.count() - 1];
+ if (ii_first == 0) {
+ firstX = cur_cx[0] - iSize[0] / 2 - iSpace / 2 + adjust + soffset - eoffset + x;
}
- else
- {
- firstX = cur_cx[0] - iSize[0]/2 - iSpace/2 + SPACE_W+x;
+ else {
+ firstX = cur_cx[0] - iSize[0] / 2 - iSpace / 2 + SPACE_W + x;
}
- lastX +=soffset;
- tmpw=lastX+x-firstX+iSpace/2;
- if (ii_last < (int)items.count()-1)
- {
- tmpw+=eoffset;
+ lastX += soffset;
+ tmpw = lastX + x - firstX + iSpace / 2;
+ if (ii_last < (int) items.count() - 1) {
+ tmpw += eoffset;
}
- if (ii_first==ii_last && ii_first>0) tmpw-=adjust;
-
- p1=0;
- p2=0;
- KPixmapIO pixio;
- if (!fLeftImg.isEmpty())
- {
- TempBG = pixio.convertToImage(LeftImg);
- if ((fOrientation & 1)==1) {p1=LeftImg.height();} else {p1=LeftImg.width();}
- p2=h0;
- if ((fOrientation & 1)==1) {pt=p1; p1=p2; p2=pt;}
- if (scaleMax)
- {TempScaledLeft = TQPixmap(TempBG.scale(p1, p2, TQImage::ScaleMin));}
- else
- {TempScaledLeft = TQPixmap(TempBG.scale(p1, p2));}
- p2=0;
- if ((fOrientation & 1)==1) {p1=TempScaledLeft.height();} else {p1=TempScaledLeft.width();}
- }
- if (!fRightImg.isEmpty())
- {
- TempBG = pixio.convertToImage(RightImg);
- if ((fOrientation & 1)==1) {p2=RightImg.height();} else {p2=RightImg.width();}
- p3=h0;
- if ((fOrientation & 1)==1) {pt=p2; p2=p3; p3=pt;}
- if (scaleMax)
- {TempScaledRight = TQPixmap(TempBG.scale(p2, p3, TQImage::ScaleMin));}
- else
- {TempScaledRight = TQPixmap(TempBG.scale(p2, p3));}
- if ((fOrientation & 1)==1) {p2=TempScaledRight.height();} else {p2=TempScaledRight.width();}
- }
- if (oldtmpw<tmpw)
- {
- p10=oldfirstX-Offset-p1;
- p8=oldtmpw+p1+p2;
+ if ((ii_first == ii_last) && (ii_first > 0)) {
+ tmpw -= adjust;
}
- else
- {
- p10=firstX-Offset-p1;
- p8=tmpw+p1+p2;
- }
-
- oldfirstX=firstX;
- oldtmpw=tmpw;
-
- if (p10<0) p10=0;
- if (p8+p10>dw) p8=dw-p10;
+ int p1 = 0;
+ int p2 = 0;
+ KPixmapIO pixio;
- p1=p10;
- p2=0;
- p3=p8;
- p4=h1 - h0;
- p5=p10;
- p6=h1 - h0;
- p7=p8;
- p8=h0;
- p9=p10;
- p10=0;
- if ((fOrientation & 2)==2)
- {
- p6=0;
- p2=h0;
+ if (!fLeftImg.isEmpty()) {
+ TempBG = pixio.convertToImage(LeftImg);
+ if ((fOrientation & 1) == 1) {
+ p1 = LeftImg.height();
+ }
+ else {
+ p1 = LeftImg.width();
+ }
+ p2 = h0;
+ if ((fOrientation & 1) == 1) {
+ std::swap(p1, p2);
+ }
+ if (scaleMax) {
+ TempScaledLeft = TQPixmap(TempBG.scale(p1, p2, TQImage::ScaleMin));
+ }
+ else {
+ TempScaledLeft = TQPixmap(TempBG.scale(p1, p2));
+ }
+ p2 = 0;
+ if ((fOrientation & 1) == 1) {
+ p1 = TempScaledLeft.height();
+ }
+ else {
+ p1 = TempScaledLeft.width();
+ }
}
- if ((fOrientation & 1)==1)
- {
- pt=p1; p1=p2; p2=pt;
- pt=p3; p3=p4; p4=pt;
- pt=p5; p5=p6; p6=pt;
- pt=p7; p7=p8; p8=pt;
- pt=p9; p9=p10; p10=pt;
- }
- if((h1 - h0)>0) bitBlt(&offscr, p1, p2, &topBg, p9, p10, p3, p4); // put the top background
- bitBlt(&offscr, p5, p6, &bottomBg, p5, p6, p7, p8); //put the rest of the background
- if (dockOpacity>0)
- {
- p1=firstX-Offset;
- if ((fOrientation & 2)==2) {p2=0;} else {p2=h1 - h0+Ybase;}
- p3=tmpw;
- p4=h0-Ybase;
- if (p4>0)
- {
- if ((fOrientation & 1)==1)
- {
- pt=p1; p1=p2; p2=pt;
- pt=p3; p3=p4; p4=pt;
+ if (!fRightImg.isEmpty()) {
+ TempBG = pixio.convertToImage(RightImg);
+ if ((fOrientation & 1) == 1) {
+ p2 = RightImg.height();
+ }
+ else {
+ p2 = RightImg.width();
+ }
+ p3 = h0;
+ if ((fOrientation & 1) == 1) {
+ std::swap(p2, p3);
+ }
+ if (scaleMax) {
+ TempScaledRight = TQPixmap(TempBG.scale(p2, p3, TQImage::ScaleMin));
+ }
+ else {
+ TempScaledRight = TQPixmap(TempBG.scale(p2, p3));
+ }
+ if ((fOrientation & 1) == 1) {
+ p2 = TempScaledRight.height();
+ }
+ else {
+ p2 = TempScaledRight.width();
+ }
+ }
+ if (oldtmpw < tmpw) {
+ p10 = oldfirstX - Offset - p1;
+ p8 = oldtmpw + p1 + p2;
+ }
+ else {
+ p10 = firstX - Offset - p1;
+ p8 = tmpw + p1 + p2;
+ }
+
+ oldfirstX = firstX;
+ oldtmpw = tmpw;
+
+ if (p10 < 0) {
+ p10 = 0;
+ }
+ if ((p8 + p10) > dw) {
+ p8 = dw - p10;
+ }
+ p1 = p10;
+ p2 = 0;
+ p3 = p8;
+ p4 = h1 - h0;
+ p5 = p10;
+ p6 = h1 - h0;
+ p7 = p8;
+ p8 = h0;
+ p9 = p10;
+ p10 = 0;
+ if ((fOrientation & 2) == 2) {
+ p6 = 0;
+ p2 = h0;
+ }
+ if ((fOrientation & 1) == 1) {
+ std::swap(p1, p2);
+ std::swap(p3, p4);
+ std::swap(p5, p6);
+ std::swap(p7, p8);
+ std::swap(p9, p10);
+ }
+ if ((h1 - h0) > 0) {
+ bitBlt(&offscr, p1, p2, &topBg, p9, p10, p3, p4); // Put the top background
+ }
+ bitBlt(&offscr, p5, p6, &bottomBg, p5, p6, p7, p8); // Put the rest of the background
+ if (dockOpacity > 0) {
+ p1 = firstX - Offset;
+ if ((fOrientation & 2) == 2) {
+ p2 = 0;
+ }
+ else {
+ p2 = h1 - h0 + Ybase;
+ }
+ p3 = tmpw;
+ p4 = h0 - Ybase;
+ if (p4 > 0) {
+ if ((fOrientation & 1) == 1) {
+ std::swap(p1, p2);
+ std::swap(p3, p4);
}
bitBlt(&offscr, p1, p2, &bottomBgf, p1, p2, p3, p4);
}
}
- // end drawing background
+ // End drawing background
-// Left side image
- p1=0;
- p5=0;
- p6=0;
- if (!fLeftImg.isEmpty())
- {
- if ((fOrientation & 1)==1) {p1=TempScaledLeft.height();} else {p1=TempScaledLeft.width();}
-
- p4=firstX-Offset-p1;
- if (fNWideBg) if (p4<0) p4=0;
- p5=p4+p1;
- if ((fOrientation & 2)==2)
- {if (fExpanded==1) {
- p2=-Ybase;
- } else {p2=0;}}
- else
- if (fExpanded==1) {p2=bgY;} else {p2=h1-h0;}
- if ((fOrientation & 1)==1) {pt=p4; p4=p2; p2=pt;}
+ // Left side image
+ p1 = 0;
+ p5 = 0;
+ p6 = 0;
+ if (!fLeftImg.isEmpty()) {
+ if ((fOrientation & 1) == 1) {
+ p1 = TempScaledLeft.height();
+ }
+ else {
+ p1 = TempScaledLeft.width();
+ }
+
+ p4 = firstX - Offset - p1;
+ if (fNWideBg && (p4 < 0)) {
+ p4 = 0;
+ }
+ p5 = p4 + p1;
+ if ((fOrientation & 2) == 2) {
+ if (fExpanded == 1) {
+ p2 = -Ybase;
+ }
+ else {
+ p2 = 0;
+ }
+ }
+ else {
+ if (fExpanded == 1) {
+ p2 = bgY;
+ }
+ else {
+ p2 = h1 - h0;
+ }
+ }
+ if ((fOrientation & 1) == 1) {
+ std::swap(p2, p4);
+ }
bitBlt(&offscr, p4, p2, &TempScaledLeft);
}
-// Right side image
- if (!fRightImg.isEmpty())
- {
- if ((fOrientation & 1)==1) {p1=TempScaledRight.height();} else {p1=TempScaledRight.width();}
-
- p2=firstX - Offset+tmpw;
- if (fNWideBg) if (p2>dw-p1) p2=dw-p1;
- p6=p2;
- if ((fOrientation & 2)==2)
- {
- if (fExpanded==1) {p3=-Ybase;} else {p3=0;}
- }
- else
- if (fExpanded==1) {p3=bgY;} else {p3=h1-h0;}
- if ((fOrientation & 1)==1) {pt=p2; p2=p3; p3=pt;}
+ // Right side image
+ if (!fRightImg.isEmpty()) {
+ if ((fOrientation & 1) == 1) {
+ p1 = TempScaledRight.height();
+ }
+ else {
+ p1 = TempScaledRight.width();
+ }
+
+ p2 = firstX - Offset + tmpw;
+ if (fNWideBg && (p2>dw-p1)) {
+ p2 = dw - p1;
+ }
+ p6 = p2;
+ if ((fOrientation & 2) == 2) {
+ if (fExpanded == 1) {
+ p3 = -Ybase;
+ }
+ else {
+ p3 = 0;
+ }
+ }
+ else {
+ if (fExpanded == 1) {
+ p3 = bgY;
+ }
+ else {
+ p3 = h1 - h0;
+ }
+ }
+ if ((fOrientation & 1) == 1) {
+ std::swap(p2, p3);
+ }
bitBlt(&offscr, p2, p3, &TempScaledRight);
}
-
- //Center image
- if (!fCenterImg.isEmpty())
- {
+
+ // Center image
+ if (!fCenterImg.isEmpty()) {
TempBG = pixio.convertToImage(CenterImg);
- // hack!! to optimize drawing speed, now it scales the background image only when it's
- // necessary, I'd prefeer to use a bit more of memory instead of loosing speed.
- // -- Matias
- if ((fOrientation & 1)==1) {p1=TempScaledCenter.height();} else {p1=TempScaledCenter.width();}
- if (p1 != (p6-p5))
- {
- p2=p6-p5;
- p3=h0;
- if ((fOrientation & 1)==1) {pt=p2; p2=p3; p3=pt;}
- TempScaledCenter = TQPixmap(TempBG.scale( p2, p3));
- }
- p1=p5;
- if ((fOrientation & 2)==2)
- {if (fExpanded) {p2=-Ybase;} else {p2=0;}}
- else
- {if (fExpanded==1) {p2=bgY;} else {p2=h1-h0;}}
- if ((fOrientation & 1)==1) {pt=p1; p1=p2; p2=pt;}
+ // hack!! to optimize drawing speed, scale the background image only when it's
+ // necessary, I prefer to use a bit more memory than loosing speed.
+ // -- Matias
+ if ((fOrientation & 1) == 1) {
+ p1 = TempScaledCenter.height();
+ }
+ else {
+ p1 = TempScaledCenter.width();
+ }
+ if (p1 != (p6 - p5)) {
+ p2 = p6 - p5;
+ p3 = h0;
+ if ((fOrientation & 1) == 1) {
+ std::swap(p2, p3);
+ }
+ TempScaledCenter = TQPixmap(TempBG.scale(p2, p3));
+ }
+ p1 = p5;
+ if ((fOrientation & 2) == 2) {
+ if (fExpanded) {
+ p2 = -Ybase;
+ }
+ else {
+ p2 = 0;
+ }
+ }
+ else {
+ if (fExpanded == 1) {
+ p2 = bgY;
+ }
+ else {
+ p2 = h1 - h0;
+ }
+ }
+ if ((fOrientation & 1) == 1) {
+ std::swap(p1, p2);
+ }
bitBlt(&offscr, p1, p2, &TempScaledCenter);
}
-
-// End drawing the backgound
-
-
- // draw borders
- if (fShowBorders)
- {
- p1=firstX-Offset;
- p3=SPACE_W;
- p4=h0;
- p5=tmpw;
- p6=SPACE_W;
- p7=tmpw - SPACE_W+firstX-Offset;
- p2=h1 - h0+Ybase;
- p8=p2;
- p9=p1;
- p10=p2;
- if ((fOrientation & 2)==2)
- {
- p2=-Ybase;
- p8=-Ybase;
- p10=p4-Ybase-1;
- }
- if ((fOrientation & 1)==1)
- {
- pt=p1; p1=p2; p2=pt;
- pt=p3; p3=p4; p4=pt;
- pt=p5; p5=p6; p6=pt;
- pt=p7; p7=p8; p8=pt;
- pt=p9; p9=p10; p10=pt;
- }
- p.fillRect (TQRect(p1, p2, p3, p4), TQBrush(borderColor));
- p.fillRect (TQRect(p9, p10, p5, p6), TQBrush(borderColor));
- p.fillRect (TQRect(p7, p8, p3, p4), TQBrush(borderColor));
- }
- // end drawing borders
+ // End drawing the backgound
+
+ // Draw borders
+ if (fShowBorders) {
+ p1 = firstX - Offset;
+ p3 = SPACE_W;
+ p4 = h0;
+ p5 = tmpw;
+ p6 = SPACE_W;
+ p7 = tmpw - SPACE_W + firstX - Offset;
+ p2 = h1 - h0 + Ybase;
+ p8 = p2;
+ p9 = p1;
+ p10 = p2;
+ if ((fOrientation & 2) == 2) {
+ p2 = -Ybase;
+ p8 = -Ybase;
+ p10 = p4 - Ybase - 1;
+ }
+ if ((fOrientation & 1) == 1) {
+ std::swap(p1, p2);
+ std::swap(p3, p4);
+ std::swap(p5, p6);
+ std::swap(p7, p8);
+ std::swap(p9, p10);
+ }
+ p.fillRect(TQRect(p1, p2, p3, p4), TQBrush(borderColor));
+ p.fillRect(TQRect(p9, p10, p5, p6), TQBrush(borderColor));
+ p.fillRect(TQRect(p7, p8, p3, p4), TQBrush(borderColor));
+ }
+ // End drawing borders
Item *item;
- // new icon drawing engine
- int Ypos; // Y position
- int Xpos; // X position
- KPixmap *currentIcon; // current icon pixmap
- i=0;
- for (i = 0; i < (int)items.count(); i++)
- {
+ // New icon drawing engine
+ int Ypos; // Y position
+ int Xpos; // X position
+ KPixmap *currentIcon; // current icon pixmap
+
+ for (i = 0; i < (int) items.count(); i++) {
item = items.at(i);
- // start setting the icon position
- if(i < ii_first)
- {
- // left side icons
- Xpos = cur_cx[i] - iwSmall/2 + SPACE_W-Offset;
- }
- else if(i >= ii_first && i <= ii_last)
- {
- // zoomed icons (center)
- Xpos = cur_cx[i] - iSize[i]/2 + adjust - Offset+soffset-eoffset;
- if (i==ii_first && i==(int)items.count()-1 && i>0) Xpos=cur_cx[i-1] + iwSmall/2 + SPACE_W-Offset + iSpace;
- }
- else if(i > ii_last)
- {
- // right side icons
- Xpos = cur_cx[i] - iwSmall/2 + adjust + SPACE_W - 2 - Offset;
- } // end getting icon positions
- if ((fOrientation & 2)==2)
- {Ypos = iy-Ybase;}
- else
- {Ypos = h1 - iy - iSize[i]+Ybase;}
-
- // now, get the icon image
- if (Xpos<dw && Xpos+iwBig2>0)
- {
+ // Start setting the icon position
+ if (i < ii_first) {
+ // left side icons
+ Xpos = cur_cx[i] - iwSmall / 2 + SPACE_W - Offset;
+ }
+ else if ((i >= ii_first) && (i <= ii_last)) {
+ // Zoomed icons (center)
+ Xpos = cur_cx[i] - iSize[i] / 2 + adjust - Offset + soffset - eoffset;
+ if ((i == ii_first) && (i == (int) items.count() - 1) && (i > 0)) {
+ Xpos = cur_cx[i - 1] + iwSmall / 2 + SPACE_W - Offset + iSpace;
+ }
+ }
+ else if (i > ii_last) {
+ // Right side icons
+ Xpos = cur_cx[i] - iwSmall / 2 + adjust + SPACE_W - 2 - Offset;
+ } // End getting icon positions
+ if ((fOrientation & 2) == 2) {
+ Ypos = iy - Ybase;
+ }
+ else {
+ Ypos = h1 - iy - iSize[i] + Ybase;
+ }
+
+ // Now, get the icon image
+ if ((Xpos < dw) && ((Xpos + iwBig2) > 0)) {
currentIcon = new KPixmap(*item->getIcon(iSize[i]));
- if (items.at(i)->wIcon==TRUE)
- {
- for (ii=0;ii<(int)witems.count();ii++)
- {
- if (items.at(i)->getId()==witems.at(ii)->getId())
- {
+ if (items.at (i)->wIcon == true) {
+ for (ii = 0; ii < (int) witems.count(); ii++) {
+ if (items.at(i)->getId() == witems.at(ii)->getId()) {
currentIcon = new KPixmap(*witems.at(ii)->getIcon(iSize[i]));
}
}
}
-
- // misc icon effects and animations
- if (iOnClick == i)
- {
- // highlight the clicked icon
- KPixmapEffect::fade(*currentIcon, ((float)50)*0.01, TQColor("#FFFFFF"));
- TQTimer::singleShot( 10*60, this, SLOT( unhighlight() ) ); // unhighlight the icon in 1 second
+
+ // Misc icon effects and animations
+ if (iOnClick == i) {
+ // Highlight the clicked icon
+ KPixmapEffect::fade(*currentIcon, ((float) 50) * 0.01, TQColor("#FFFFFF"));
+ TQTimer::singleShot(10 * 60, this, SLOT(unhighlight())); // Unhighlight the icon in 1 second
}
-
- // notify animation
- if (fShowNotification && item->isAnimed())
- {
- KPixmapEffect::fade(*currentIcon, ((float) animValue )*0.01, TQColor("#FFFFFF"));
+
+ // Notify animation
+ if (fShowNotification && item->isAnimed()) {
+ KPixmapEffect::fade(*currentIcon, ((float) animValue) * 0.01, TQColor("#FFFFFF"));
}
- //Lets apply an effect to the active window in TaskBar
- if(item->getId()==wm->activeWindow() && item->getId()!=0)
- {
- KPixmapEffect::fade(*currentIcon, ((float)60)*0.01, TQColor("#FFFFFF"));
+ // Let's apply an effect to the active window in TaskBar
+ if ((item->getId() == wm->activeWindow()) && (item->getId() != 0)) {
+ KPixmapEffect::fade(*currentIcon, ((float) 60) * 0.01, TQColor("#FFFFFF"));
}
-
// End drawing icon effects
- Xpos+=x;
- if ((fOrientation & 1)==1) {ii=Xpos;Xpos=Ypos;Ypos=ii;}
+
+ Xpos += x;
+ if ((fOrientation & 1) == 1) {
+ std::swap(Xpos, Ypos);
+ }
// Draw the icon on the widget in its respective position
bitBlt(&offscr, Xpos, Ypos, currentIcon);
// Destroy the unused currentIcon pixmap.
delete currentIcon;
}
} // End drawing icons
-
+
// Draw the seperator between launcher and taskbar
- if(fShowTaskbar && ((numLaunchers>0 && (int)items.count()>numLaunchers) || (fShowKMenu==1 && items.count()>1)))
- {
- i=numLaunchers-1;
- if (i>=0 && i<(int)items.count()-1)
- {
- Xpos=xFromIndex(i)+xFromIndex(i+1)+iSize[i];
- p1=Xpos/2 - Offset+x;
- p3=SPACE_W;
- p4=h0;
- if (fExpanded==0)
- {
- p2=h1-h0;
- if ((fOrientation & 2)==2) p2=0;
- }
- else if ( (signed)items.count() > numLaunchers)
- {
- p2=h1 - h0 + Ybase;
- if ((fOrientation & 2)==2) p2=-Ybase;
- }
- if ((fOrientation & 1)==1)
- {p.fillRect (TQRect(p2, p1, p4, p3), TQBrush(sepColor));}
- else
- {p.fillRect (TQRect(p1, p2, p3, p4), TQBrush(sepColor));}
- }
- }
- if((fSystray==1) && (numSystray>0))
- {
- i=items.count()-numSystray-1;
- if (i>=0 && i<(int)items.count()-1)
- {
- Xpos=xFromIndex(i)+xFromIndex(i+1)+iSize[i];
- p1=Xpos/2 - Offset+x;
- p3=SPACE_W;
- p4=h0;
- if(h == h0)
- {
- p2=h;
- if ((fOrientation & 2)==2) p2=0;
- }
- else
- {
- p2=h1 - h0 + Ybase;
- if ((fOrientation & 2)==2) p2=-Ybase;
- }
- if ((fOrientation &1)==1)
- {p.fillRect (TQRect(p2, p1, p4, p3), TQBrush(sepColor));}
- else
- {p.fillRect (TQRect(p1, p2, p3, p4), TQBrush(sepColor));}
+ if (fShowTaskbar && ((numLaunchers > 0 && ((int) items.count() > numLaunchers)) || ((fShowKMenu == 1) && (items.count() > 1)))) {
+ i = numLaunchers - 1;
+ if ((i >= 0) && (i < (int) items.count() - 1)) {
+ Xpos = xFromIndex(i) + xFromIndex(i + 1) + iSize[i];
+ p1= Xpos / 2 - Offset + x;
+ p3 = SPACE_W;
+ p4 = h0;
+ if (fExpanded == 0) {
+ p2 = h1 - h0;
+ if ((fOrientation & 2) == 2) {
+ p2 = 0;
+ }
+ }
+ else if ((signed) items.count() > numLaunchers) {
+ p2 = h1 - h0 + Ybase;
+ if ((fOrientation & 2) == 2) {
+ p2 = -Ybase;
+ }
+ }
+ if ((fOrientation & 1) == 1) {
+ p.fillRect(TQRect(p2, p1, p4, p3), TQBrush(sepColor));
+ }
+ else {
+ p.fillRect(TQRect(p1, p2, p3, p4), TQBrush(sepColor));
+ }
+ }
+ }
+ if ((fSystray == 1) && (numSystray > 0)) {
+ i = items.count() - numSystray - 1;
+ if ((i >= 0) && (i < (int) items.count() - 1)) {
+ Xpos = xFromIndex(i) + xFromIndex(i + 1) + iSize[i];
+ p1 = Xpos / 2 - Offset + x;
+ p3 = SPACE_W;
+ p4 = h0;
+ if (h == h0) {
+ p2 = h;
+ if ((fOrientation & 2) == 2) {
+ p2 = 0;
+ }
+ }
+ else {
+ p2 = h1 - h0 + Ybase;
+ if ((fOrientation & 2) == 2) {
+ p2 = -Ybase;
+ }
+ }
+ if ((fOrientation &1) == 1) {
+ p.fillRect(TQRect(p2, p1, p4, p3), TQBrush(sepColor));
+ }
+ else {
+ p.fillRect(TQRect(p1, p2, p3, p4), TQBrush(sepColor));
+ }
}
}
p.end();
// Finally update the widget
- if ((fOrientation & 1)==1)
- {bitBlt(this, 0, 0, &offscr, 0, 0, h1, dh, TQt::CopyROP);}
- else
- {bitBlt(this, 0, 0, &offscr, 0, 0, dw, h1, TQt::CopyROP);}
-
- //return;
+ if ((fOrientation & 1) == 1) {
+ bitBlt(this, 0, 0, &offscr, 0, 0, h1, dh, TQt::CopyROP);
+ }
+ else {
+ bitBlt(this, 0, 0, &offscr, 0, 0, dw, h1, TQt::CopyROP);
+ }
+
//Preparing mask
- TQBitmap bm(size(),true);
+ TQBitmap bm(size(), true);
TQPainter mp;
-
+
mp.begin(&bm, this);
- mp.setPen( TQt::black );
+ mp.setPen(TQt::black);
mp.fillRect(rect(), TQt::black);
mp.fillRect(TQRect(0, 0, 1, 1), TQt::white);
- p1=0;
- p2=0;
- if (!fLeftImg.isEmpty())
- if ((fOrientation & 1)==1) {p1=TempScaledLeft.height();} else {p1=TempScaledLeft.width();}
- if (!fRightImg.isEmpty())
- if ((fOrientation & 1)==1) {p2=TempScaledRight.height();} else {p2=TempScaledRight.width();}
- p3=firstX-Offset-p1;
- if ((fOrientation & 2)==2) {p4=0;} else {if (fExpanded) p4=0; else p4 = h1-h0;}
- p5=tmpw+p1+p2;
- if (fExpanded) p6=h1; else p6=h0;
- if (p3<0) p3=0;
- if (p5+p3>dw) p5=dw-p3;
- if ((fOrientation & 1)==1)
- {p6++;mp.fillRect(TQRect(p4, p3, p6, p5), TQt::white);}
- else
- {mp.fillRect(TQRect(p3, p4, p5, p6), TQt::white);}
- if ((fOrientation & 2)==2)
- {mp.fillRect(TQRect(rw-1, rh-1, 1, 1), TQt::black);}
- else
- {
- if ((fOrientation & 1)==1)
- {mp.fillRect(TQRect(0, rh-1, 1, 1), TQt::black);}
- else
- {mp.fillRect(TQRect(rw-1, 0, 1, 1), TQt::black);}
+ p1 = 0;
+ p2 = 0;
+ if (!fLeftImg.isEmpty()) {
+ if ((fOrientation & 1) == 1) {
+ p1 = TempScaledLeft.height();
+ }
+ else {
+ p1 = TempScaledLeft.width();
+ }
}
- if (initialization)
- {
+ if (!fRightImg.isEmpty()) {
+ if ((fOrientation & 1) == 1) {
+ p2 = TempScaledRight.height();
+ }
+ else {
+ p2 = TempScaledRight.width();
+ }
+ }
+ p3 = firstX - Offset - p1;
+ if ((fOrientation & 2) == 2) {
+ p4 = 0;
+ }
+ else {
+ if (fExpanded) {
+ p4 = 0;
+ }
+ else {
+ p4 = h1 - h0;
+ }
+ }
+ p5 = tmpw + p1 + p2;
+ if (fExpanded) {
+ p6 = h1;
+ }
+ else {
+ p6 = h0;
+ }
+ if (p3 < 0) {
+ p3 = 0;
+ }
+ if (p5 + p3 > dw) {
+ p5 = dw - p3;
+ }
+ if ((fOrientation & 1) == 1) {
+ p6++;
+ mp.fillRect(TQRect(p4, p3, p6, p5), TQt::white);
+ }
+ else {
+ mp.fillRect(TQRect(p3, p4, p5, p6), TQt::white);
+ }
+ if ((fOrientation & 2) == 2) {
+ mp.fillRect(TQRect(rw - 1, rh - 1, 1, 1), TQt::black);
+ }
+ else {
+ if ((fOrientation & 1) == 1) {
+ mp.fillRect(TQRect(0, rh - 1, 1, 1), TQt::black);
+ }
+ else {
+ mp.fillRect(TQRect(rw - 1, 0, 1, 1), TQt::black);
+ }
+ }
+ if (initialization) {
mp.fillRect(rect(), TQt::black);
mp.fillRect(TQRect(0, 0, 1, 1), TQt::white);
}
mp.end();
setMask(bm);
-
}
-
void KoolDock::unhighlight()
{
iOnClick = -1;
paintEvent(NULL);;
}
-void KoolDock::mousePressEvent( TQMouseEvent *e)
+void KoolDock::mousePressEvent(TQMouseEvent *e)
{
- mPress (e->x(), e->y(), e->button());
+ mPress(e->x(), e->y(), e->button());
}
void KoolDock::mPress(int mx, int my, ButtonState srcButton)
@@ -694,158 +798,140 @@ void KoolDock::mPress(int mx, int my, ButtonState srcButton)
int i, j;
int iClicked;
Item *item;
-
- if ((fOrientation & 1)==1)
- {
- i=mx;
- mx=my;
- my=i;
+
+ if ((fOrientation & 1) == 1) {
+ std::swap(mx, my);
}
- if ((fOrientation & 2)==2)
- {my=h1-my;}
- mx=mx-x1;
+ if ((fOrientation & 2) == 2) {
+ my = h1 - my;
+ }
+ mx = mx - x1;
- mx = mx+Offset;
- iClicked=itemFromPoint(mx);
-
- if (srcButton == TQt::LeftButton)
- {
- i=iClicked;
-
- if ((my >= h1 - iy - iSize[i]) && (my <= h1 - iy))
- {
- if ((i >= 0) && (i < (int)items.count()))
- {
- items.at(i)->anim(FALSE);
+ mx = mx + Offset;
+ iClicked = itemFromPoint(mx);
+
+ if (srcButton == TQt::LeftButton) {
+ i = iClicked;
+ if ((my >= h1 - iy - iSize[i]) && (my <= h1 - iy)) {
+ if ((i >= 0) && (i < (int) items.count())) {
+ items.at(i)->anim(false);
WId id = items.at(i)->getId();
- if (id == 0)
- {
- // if user clicked on a quick launcher, launch the app
- // acknowledge on click
+ if (id == 0) {
+ // If user clicked on a quick launcher, launch the app
+ // Acknowledge on click
iOnClick = i;
paintEvent(NULL);
- // run the app
+ // Run the app
debug(TQString("clicked: %1").arg(items.at(i)->getName()));
- if (items.at(i)->getName() == "KMenu")
- {
- // show K Menu
+ if (items.at(i)->getName() == "KMenu") {
+ // Show K Menu
run(items.at(i)->getCommand());
}
- else
- {
- // run the application with KDE feedback (loading icon)
- // we need to run the .desktop file, since the command
- // may be a url or another TDEIO stuff like 'system:/'
- if (items.at(i)->getFilename()!="")
- {
+ else {
+ // Run the application with TDE feedback (loading icon)
+ // We need to run the .desktop file, since the command
+ // may be a url or another TDEIO stuff like 'system:/'
+ if (items.at(i)->getFilename() != "") {
run(items.at(i)->getFilename());
}
- else
- {
+ else {
run(items.at(i)->getCommand());
}
}
}
- else
- {
+ else {
KWin::WindowInfo info;
KWin::WindowInfo winfo;
- info = KWin::windowInfo(id,0,NET::WM2WindowClass);
+ info = KWin::windowInfo(id, 0, NET::WM2WindowClass);
TQString name = info.visibleName();
TQCString cls = info.windowClassClass();
-
- if(i>=((int)items.count()-numSystray))
- {
- //KWin::forceActiveWindow(id);
-
+
+ if (i >= ((int) items.count() - numSystray)) {
KWin::deIconifyWindow(id);
kdDebug(0) << "Systray: " << id << " Name: " << name << " Estado: " << info.state() << endl;
- //TQMouseEvent me(e->type(), mapTo( topLevelWidget(), e->pos() ), e->globalPos(), e->button(), e->state() );
-
- //TQApplication::sendEvent(, &me);
}
- else
- {
- // if user clicked on a running task's icon, activate it
+ else {
+ // If user clicked on a running task's icon, activate it
cId = id;
-
- if (fGrouping) //switches between windows when clicking on window group icon
+ if (fGrouping) // Switch between windows when clicking on window group icon
{
- //find currently focused window in witems list
- int jl=-1,il;
- bool getNext=false;
- for (j=0, item = witems.at(0); item; j++, item = witems.next())
- if (item->getId()==CurrentFocus) {jl=j;break;}
-
- if (jl>=0)
- {if(witems.at(jl)->getClass()==cls) getNext=true;}
- else
- {getNext=true;}
-
- jl=-1;
- if (getNext)
- {
- il=witems.count();
- for (j=0, item = witems.at(0); item; j++, item = witems.next())
- {
- if (item->getIndex()<il)
- {
- if (item->getClass()==cls)
- {
+ // Find currently focused window in witems list
+ int jl = -1, il;
+ bool getNext = false;
+ for (j = 0, item = witems.at(0); item; j++, item = witems.next()) {
+ if (item->getId() == CurrentFocus) {
+ jl = j;
+ break;
+ }
+ }
+ if (jl >= 0) {
+ if (witems.at(jl)->getClass() == cls) {
+ getNext = true;
+ }
+ }
+ else {
+ getNext = true;
+ }
+
+ jl = -1;
+ if (getNext) {
+ il = witems.count();
+ for (j = 0, item = witems.at(0); item; j++, item = witems.next()) {
+ if (item->getIndex() < il) {
+ if (item->getClass() == cls) {
winfo = item->info;
- if ((fMinimizedOnly==0 || winfo.isMinimized()) && (fCurrent==0 || winfo.isOnDesktop(KWin::currentDesktop())))
- {jl=j;il=item->getIndex();}
+ if ((fMinimizedOnly == 0 || winfo.isMinimized()) && (fCurrent == 0 || winfo.isOnDesktop(KWin::currentDesktop()))) {
+ jl = j;
+ il = item->getIndex();
+ }
}
}
}
}
- else
- {
- il=-1;
- for (j=0, item = witems.at(0); item; j++, item = witems.next())
- {
- if (item->getIndex()>il)
- {
- if (item->getClass()==cls)
- {
+ else {
+ il = -1;
+ for (j = 0, item = witems.at(0); item; j++, item = witems.next()) {
+ if (item->getIndex() > il) {
+ if (item->getClass() == cls) {
winfo = item->info;
- if ((fMinimizedOnly==0 || winfo.isMinimized()) && (fCurrent==0 || winfo.isOnDesktop(KWin::currentDesktop())))
- {jl=j;il=item->getIndex();}
+ if ((fMinimizedOnly == 0 || winfo.isMinimized()) && (fCurrent == 0 || winfo.isOnDesktop(KWin::currentDesktop()))) {
+ jl = j;
+ il = item->getIndex();
+ }
}
}
}
}
- if (jl>=0) cId=witems.at(jl)->getId();
+ if (jl >= 0) {
+ cId = witems.at(jl)->getId();
+ }
}
- if (cId!=CurrentFocus)
- {
- //KWin::activateWindow(id);
+ if (cId != CurrentFocus) {
activateApp();
}
- else
- {
+ else {
minApp();
- //KWin::iconifyWindow(id, true);
CurrentFocus = winId();
}
}
}
}
- if(fHidden == 1 && fHideOnClick == 1) onleaveEvent(NULL); // it's configurable
+ if ((fHidden == 1) && (fHideOnClick == 1)) {
+ onleaveEvent(NULL); // it's configurable
+ }
}
}
- else if(srcButton == TQt::RightButton)
- {
- // Right button.
+ else if (srcButton == TQt::RightButton) {
+ // Right button.
i = iClicked;
advMenu->clear();
- advMenu->insertItem(SmallIconSet("go-up"), i18n("Keep &Above Others"), this, SLOT(toggleAlwaysOnTop()),0,1);
- advMenu->insertItem(SmallIconSet("go-down"), i18n("Keep &Below Others"), this, SLOT(toggleKeptBelowOthers()),0,2);
- advMenu->insertItem(SmallIconSet("view-fullscreen"), i18n("&Fullscreen"), this, SLOT(toggleFullScreen()),0,3);
-
- // Main KoolDock popup menu
+ advMenu->insertItem(SmallIconSet("go-up"), i18n("Keep &Above Others"), this, SLOT(toggleAlwaysOnTop()), 0, 1);
+ advMenu->insertItem(SmallIconSet("go-down"), i18n("Keep &Below Others"), this, SLOT(toggleKeptBelowOthers()), 0, 2);
+ advMenu->insertItem(SmallIconSet("view-fullscreen"), i18n("&Fullscreen"), this, SLOT(toggleFullScreen()), 0, 3);
+
+ // Main KoolDock popup menu
popup->clear();
popup->insertTitle(i18n("Main Menu"));
popup->insertItem(SmallIcon("configure"), i18n("Edit Quick Launch &Menu"), this, SLOT(edit()));
@@ -855,50 +941,44 @@ void KoolDock::mPress(int mx, int my, ButtonState srcButton)
popup->insertItem(SmallIcon("about_kde"), i18n("&About"), this, SLOT(about()));
popup->insertSeparator();
popup->insertItem(SmallIcon("system-log-out"), i18n("E&xit"), this, SLOT(endProg()));
- // End Main KoolDock Menu
+ // End Main KoolDock Menu
- if(fShowNav==1)
- {
- //Menu to be appended to MainMenu
+ if (fShowNav == 1) {
+ // Menu to be appended to MainMenu
godesk->clear();
- for(int index=0; index<KWin::numberOfDesktops(); index++)
- {
- TQString tmp=i18n("Desktop &%1").arg(index+1);
- int menustate=godesk->insertItem(SmallIcon("forward"), tmp, index+1);
- if(KWin::currentDesktop()==(index+1)) godesk->setItemEnabled(menustate, false);
- }
- //End godesk Menu
-
- //Append Navigation Menu (godesk+Time)
- TQDateTime timeEntry=TQDateTime::currentDateTime();
- TQString tmp=i18n("Navigation: Desktop %1").arg(KWin::currentDesktop());
+ for (int index = 0; index < KWin::numberOfDesktops(); index++) {
+ TQString tmp = i18n("Desktop &%1").arg(index + 1);
+ int menustate = godesk->insertItem(SmallIcon("forward"), tmp, index + 1);
+ if (KWin::currentDesktop() == (index + 1)) {
+ godesk->setItemEnabled(menustate, false);
+ }
+ }
+ // End godesk Menu
+
+ // Append Navigation Menu (godesk+Time)
+ TQDateTime timeEntry = TQDateTime::currentDateTime();
+ TQString tmp = i18n("Navigation: Desktop %1").arg(KWin::currentDesktop());
popup->insertTitle(tmp);
popup->insertItem(SmallIcon("forward"), i18n("&Go to Desktop"), godesk);
popup->insertItem(SmallIcon("forward"), i18n("&Task List"), tasklist);
popup->insertSeparator();
popup->insertItem(SmallIcon("clock"), timeEntry.toString());
- //End append Navigation Menu
- }
-
- if ((my >= h1 - iy - iSize[i]) && (my <= h1 - iy))
- {
- if ((i >= 0) && (i < (int)items.count()))
- {
- WId id = items.at(i)->getId();
- if (id == 0)
- {
- // if user right clicked on a quick launch icon.
- if (items.at(i)->getCommand() != "")
- {
- // Edit the .desktop file
- if (i==0 && fShowKMenu)
- {
- // if user right clicked on the K menu, show the configuration menu.
+ // End append Navigation Menu
+ }
+
+ if ((my >= h1 - iy - iSize[i]) && (my <= h1 - iy)) {
+ if ((i >= 0) && (i < (int) items.count())) {
+ WId id = items.at (i)->getId();
+ if (id == 0) {
+ // If user right clicked on a quick launch icon.
+ if (items.at (i)->getCommand() != "") {
+ // Edit the .desktop file
+ if ((i == 0) && fShowKMenu) {
+ // If user right clicked on the K menu, show the configuration menu.
popup->exec(TQCursor::pos());
}
- else
- {
- iGroup=false;
+ else {
+ iGroup = false;
appMenu->clear();
appMenu->insertTitle(i18n("Item menu"));
iFilename = items.at(i)->getFilename();
@@ -910,67 +990,54 @@ void KoolDock::mPress(int mx, int my, ButtonState srcButton)
}
}
}
- else
- {
- // If user clicked on a running task icon, show the app menu.
- // Pop-up menu for right-clicking on a taskbar icon.
+ else {
+ // If user clicked on a running task icon, show the app menu.
+ // Pop-up menu for right-clicking on a taskbar icon.
cId = id;
- KWin::WindowInfo winfo;
- winfo = KWin::windowInfo(cId,0, NET::WM2WindowClass | NET::WM2AllowedActions);
- int menustate;
- //winfo.desktop() = -1 1 2 3 ...
-
- //Begin Move to Desktop Menu
- deskpopup->clear();
- TQString tmp=i18n("All desktops");
- menustate=deskpopup->insertItem(SmallIcon("forward"), tmp, 0);
- tmp=i18n("Current Desktop &%1").arg(KWin::currentDesktop());
- menustate=deskpopup->insertItem(SmallIcon("forward"), tmp, KWin::currentDesktop());
+ KWin::WindowInfo winfo = KWin::windowInfo(cId, 0, NET::WM2WindowClass | NET::WM2AllowedActions);
+ // Begin Move to Desktop Menu
+ deskpopup->clear();
+ deskpopup->insertItem(SmallIcon("forward"), i18n("All desktops"), 0);
+ TQString tmp = i18n("Current Desktop &%1").arg(KWin::currentDesktop());
+ deskpopup->insertItem (SmallIcon ("forward"), tmp, KWin::currentDesktop());
deskpopup->insertSeparator();
- for(int i=0; i<KWin::numberOfDesktops(); i++)
- {
- if(winfo.isOnDesktop(KWin::currentDesktop()) && (i+1)==KWin::currentDesktop())
- {
+ for (int i = 0; i < KWin::numberOfDesktops(); i++) {
+ if (winfo.isOnDesktop(KWin::currentDesktop()) && (i + 1) == KWin::currentDesktop()) {
continue;
}
- else
- {
- if((i+1)!=KWin::currentDesktop())
- {
- TQString tmpd=i18n("Desktop &%1").arg(i+1);
- menustate=deskpopup->insertItem(SmallIcon("forward"), tmpd, i+1);
+ else {
+ if ((i + 1) != KWin::currentDesktop()) {
+ TQString tmpd = i18n("Desktop &%1").arg(i + 1);
+ deskpopup->insertItem(SmallIcon("forward"), tmpd, i + 1);
}
}
}
- dIndex=winfo.desktop();
- if(dIndex==-1) dIndex=0;
+ dIndex = winfo.desktop();
+ if (dIndex == -1) {
+ dIndex = 0;
+ }
deskpopup->setItemChecked(dIndex, true);
+ // End Move to Desktop Menu
+
+ advMenu->setItemChecked(1, winfo.state() & NET::KeepAbove);
+ advMenu->setItemChecked(2, winfo.state() & NET::KeepBelow);
+ advMenu->setItemChecked(3, winfo.state() & NET::FullScreen);
+ advMenu->setItemEnabled(3, winfo.actionSupported(NET::ActionFullScreen));
- //End Move to Desktop Menu
-
- advMenu->setItemChecked(1,winfo.state() & NET::KeepAbove);
- advMenu->setItemChecked(2,winfo.state() & NET::KeepBelow);
- advMenu->setItemChecked(3,winfo.state() & NET::FullScreen);
- advMenu->setItemEnabled(3,winfo.actionSupported(NET::ActionFullScreen));
-
appMenu->clear();
- if (fGrouping && items.at(iClicked)->getCount()>0)
- {
- iGroup=true;
+ if (fGrouping && (items.at(iClicked)->getCount() > 0)) {
+ iGroup = true;
TQCString cls = winfo.windowClassClass();
popups.clear();
- for (j=0, item = witems.at(0); item; j++, item = witems.next())
- {
- if (item->getClass()==cls)
- {
+ for (j = 0, item = witems.at(0); item; j++, item = witems.next()) {
+ if (item->getClass() == cls) {
winfo = item->info;
- if ((fMinimizedOnly==0 || winfo.isMinimized()) && (fCurrent==0 || winfo.isOnDesktop(KWin::currentDesktop())))
- {
+ if ((fMinimizedOnly == 0 || winfo.isMinimized()) && (fCurrent == 0 || winfo.isOnDesktop(KWin::currentDesktop()))) {
TDEPopupMenu *tmpMenu = new TDEPopupMenu;
createMenu(tmpMenu, &winfo);
connect(tmpMenu, SIGNAL(aboutToShow()), SLOT(menuShow()));
- popups.append (tmpMenu);
+ popups.append(tmpMenu);
appMenu->setItemParameter(appMenu->insertItem(*item->getIcon(iwBig2), item->getName(), tmpMenu), item->getId());
}
}
@@ -982,663 +1049,645 @@ void KoolDock::mPress(int mx, int my, ButtonState srcButton)
appMenu->insertItem(i18n("&Restore all"), this, SLOT(restAllApps()));
appMenu->insertItem(SmallIcon("window-close"), i18n("&Close all"), this, SLOT(closeAllApps()));
}
- else
- {
- iGroup=false;
+ else {
+ iGroup = false;
createMenu(appMenu, &winfo);
}
appMenu->insertSeparator();
appMenu->insertItem(SmallIcon("forward"), "KoolDock", popup);
appMenu->exec(TQCursor::pos());
- iGroup=false;
+ iGroup = false;
}
}
}
- else
- {
- // Show the configuration popup menu if the user clicked on another place.
+ else {
+ // Show the configuration popup menu if the user clicked on another place.
popup->exec(TQCursor::pos());
}
deskpopup->clear();
godesk->clear();
- //tasklist->clear();
popup->clear();
popups.clear();
appMenu->clear();
}
-
}
-void KoolDock::mMoveEvent( int ex, int ey)
+void KoolDock::mMoveEvent(int ex, int ey)
{
- if (!fExpanded) return;
+ if (!fExpanded) {
+ return;
+ }
unsigned int i;
- int mx, my, dmx;
+ int mx, dmx;
int dx;
unsigned int k;
int cur_cx_desk;
- int p1=0,p2=0;
-
- if ((fOrientation & 1)==1)
- {
- mx=ex;
- ex=ey;
- ey=mx;
+ int p1 = 0, p2 = 0;
+
+ if ((fOrientation & 1) == 1) {
+ mx = ex;
+ ex = ey;
+ ey = mx;
}
- if ((fOrientation & 2)==2)
- {ey=h1-ey;}
-
- if (w0>dw)
- {
- mx=w0*ex/dw;
+ if ((fOrientation & 2) == 2) {
+ ey = h1-ey;
}
- else
- {
- mx = ex-x0;
+ if (w0 > dw) {
+ mx = w0 * ex / dw;
+ }
+ else {
+ mx = ex - x0;
}
- dmx=abs(mx - last_mx);
+ dmx = abs(mx - last_mx);
last_mx = mx;
- if (w1>dw)
- {
- Offset=(w1-dw)*mx/w0;
- ex=ex+Offset;
+ if (w1 > dw) {
+ Offset = (w1 - dw) * mx / w0;
+ ex = ex + Offset;
}
- else
- {
- Offset=0;
+ else {
+ Offset = 0;
}
- if (fSteppy==1) last_ncx=mx=(int)(last_ncx*0.7+cx[(ex - x0 - iSpace)/iDist]*0.3);
-
- if (!mkbigTimer->isActive() && !mksmallTimer->isActive())
- {
- Ybase=0;
+ if (fSteppy == 1) {
+ last_ncx = mx = (int) (last_ncx * 0.7 + cx[(ex - x0 - iSpace) / iDist] * 0.3);
}
- if (dmx >= UPDATE_DIST && fExpanded || mkbigTimer->isActive() || mksmallTimer->isActive())
- {
+ if (!mkbigTimer->isActive() && !mksmallTimer->isActive()) {
+ Ybase = 0;
+ }
+ if ((dmx >= UPDATE_DIST && fExpanded) || mkbigTimer->isActive() || mksmallTimer->isActive()) {
ii_first = 0;
ii_last = items.count() - 1;
- for (i = 0; i < items.count(); i++)
- {
+ for (i = 0; i < items.count(); i++) {
dx = abs(cx[i] - mx);
- if (dx < funcW)
- {
+ if (dx < funcW) {
iSize[i] = func(dx);
}
- else
- {
+ else {
iSize[i] = iwSmall;
- if (cx[i] < mx)
- {
- ii_first = min(i + 1, items.count() - 1);
+ if (cx[i] < mx) {
+ ii_first = min (i + 1, items.count() - 1);
}
- else if (ii_last == (int)items.count() - 1)
- {
- ii_last = max(i - 1, 0);
+ else if (ii_last == (int) items.count() - 1) {
+ ii_last = max (i - 1, 0);
}
}
}
-
- cur_cx[0] = iSpace + iSize[0]/2;
-
- for(i=1; i < items.count() + 1; i++)
- {
- cur_cx[i] = cur_cx[i-1] + (iSize[i] + iSize[i-1])/2 + iSpace;
- }
- for(k=0; (k < items.count()-1) && (mx > cx[k]); k++);
- cur_cx_desk = ((int)((iwBig2 - iwSmall)*0.6*fAmount) + iSpace*2)/2 + cx[k] + (int)((cx[k] - mx)*(func(0) + func(iDist) - 2*iwSmall)/(2*iDist));
+ cur_cx[0] = iSpace + iSize[0] / 2;
+
+ for (i = 1; i < items.count() + 1; i++) {
+ cur_cx[i] = cur_cx[i - 1] + (iSize[i] + iSize[i - 1]) / 2 + iSpace;
+ }
+ for (k = 0; (k < items.count() - 1) && (mx > cx[k]); k++);
+ cur_cx_desk = ((int) ((iwBig2 - iwSmall) * 0.6 * fAmount) + iSpace * 2) / 2 +
+ cx[k] +
+ (int) ((cx[k] - mx) * (func(0) + func(iDist) - 2 * iwSmall) / (2 * iDist));
adjust = cur_cx_desk - cur_cx[k];
-
- if (w1<dw && (!mkbigTimer->isActive() || (zoomTicksB>1 && mkbigTimer->isActive())))
- {
- if (!initialization && menuCount==0)
- {
- if (mx < 0) onleaveEvent(NULL);
- if (lastX>0) if (mx > tmpw+firstX-x1-(w1-w0)/2) onleaveEvent(NULL);
+
+ if ((w1 < dw) && (!mkbigTimer->isActive() || (zoomTicksB > 1 && mkbigTimer->isActive()))) {
+ if (!initialization && (menuCount == 0)) {
+ if (mx < 0) {
+ onleaveEvent(NULL);
+ }
+ if ((lastX > 0) && (mx > tmpw + firstX - x1 - (w1 - w0) / 2)) {
+ onleaveEvent(NULL);
+ }
}
}
- if (ii_last < (int)items.count() - 1)
- {
- cur_cx[items.count() - 1] = w1*zoomVal/fzoomSpeed + (eoffset-soffset+(w1+w0)/2)*(fzoomSpeed-zoomVal)/(fzoomSpeed) - iwSmall/2 - iSpace - adjust;
- for (i = items.count() - 2; (int)i >= ii_last + 1; i--)
- {
- cur_cx[i] = cur_cx[i+1] - iDist;
+ if (ii_last < (int) items.count() - 1) {
+ cur_cx[items.count() - 1] = w1 * zoomVal / fzoomSpeed + (eoffset - soffset + (w1 + w0) / 2) * (fzoomSpeed - zoomVal) / (fzoomSpeed) - iwSmall / 2 - iSpace - adjust;
+ for (i = items.count() - 2; (int) i >= ii_last + 1; i--) {
+ cur_cx[i] = cur_cx[i + 1] - iDist;
+ }
+ if (ii_last == 0) {
+ cur_cx[0] = cur_cx[1] - iDist - (iSize[0] - iSize[1]) / 2;
}
- if (ii_last == 0) cur_cx[0] = cur_cx[1] - iDist - (iSize[0] - iSize[1])/2;
}
-
- for (i = 0; (int)i < ii_first; i++)
- {
- cur_cx[i]+=(int)((soffset-eoffset+(w1-w0)/2)*(fzoomSpeed-zoomVal)/fzoomSpeed);
+
+ for (i = 0; (int) i < ii_first; i++) {
+ cur_cx[i] += (int) ((soffset - eoffset + (w1 - w0) / 2) * (fzoomSpeed - zoomVal) / fzoomSpeed);
}
paintEvent(NULL);
}
- /*if (mx<0)
- {
- ii_first = 0;
- ii_last = items.count() - 1;
-}*/
- my = ey;
mx = ex-x1;
- i=itemFromPoint(mx);
- if ((int)i < numLaunchers)
- {
- mouseOnLauncher=true;
- }
- else
- {
- mouseOnLauncher=false;
- }
-
- if(showNames == 1 && iwBig == iwBig2 && dmx<10 )
- {
- // get the name of the item at the mouse position
- if (!mksmallTimer->isActive() && !mkbigTimer->isActive())
- {
- TQPoint pointer;
- pointer = TQCursor::pos();
- if (i < MAX_ICONS+1)
- {
- if (((int)i >= 0) && (i < items.count()))
- {
+ i = itemFromPoint(mx);
+ mouseOnLauncher = ((int) i < numLaunchers);
+
+ if ((showNames == 1) && (iwBig == iwBig2) && (dmx < 10)) {
+ // Get the name of the item at the mouse position
+ if (!mksmallTimer->isActive() && !mkbigTimer->isActive()) {
+ if (i < MAX_ICONS + 1) {
+ if (((int) i >= 0) && (i < items.count())) {
nom = items.at(i)->getName();
}
- else
- {nom = "";}
+ else {
+ nom = "";
+ }
}
- if(nom!=aux)
- {
- xosd_st=0;
+ if (nom != aux) {
+ xosd_st = 0;
}
- if(xosd_st==0)
- {
+ if (xosd_st == 0) {
xosdw->setText(nom);
- xosd_st=1;
+ xosd_st = 1;
}
aux = nom;
- mx=mx-Offset;
- if (fOrientation==0)
- {
- p1=mx+x1 - (xosdw->w/2);
- p2=dh - h - xosdw->h;
+ mx = mx-Offset;
+ if (fOrientation == 0) {
+ p1 = mx + x1 - (xosdw->w / 2);
+ p2 = dh - h - xosdw->h;
+ }
+ if (fOrientation == 1) {
+ p1 = dh - h1 - xosdw->w;
+ p2 = mx- xosdw->h / 2 + x1;
}
- if (fOrientation==1)
- {
- p1=dh-h1-xosdw->w;
- p2=mx- xosdw->h/2+x1;
+ if (fOrientation == 2) {
+ p1 = mx + x1 - (xosdw->w / 2);
+ p2 = h1;
}
- if (fOrientation==2)
- {
- p1=mx+x1 - (xosdw->w/2);
- p2=h1;
+ if (fOrientation == 3) {
+ p1 = h1;
+ p2 = mx- xosdw->h / 2 + x1;
}
- if (fOrientation==3)
- {
- p1=h1;
- p2=mx- xosdw->h/2+x1;
+ if ((fOrientation & 1) == 0) {
+ if (p1 < 0) {
+ p1 = 0;
+ }
+ if (p1 + xosdw->w > dw) {
+ p1 = dw - xosdw->w;
+ }
}
- if ((fOrientation & 1)==0)
- {
- if (p1<0) p1=0;
- if (p1+xosdw->w>dw) p1=dw-xosdw->w;
+ if (xinerama == 1) {
+ p1 += XinPreviousWidth;
+ }
+ if (!initialization && ((xosdw->pos().x() != p1) || (xosdw->pos().y() != p2))) {
+ xosdw->move2(p1, p2);
}
- if (xinerama==1) p1+=XinPreviousWidth;
- if (!initialization && (xosdw->pos().x()!=p1 || xosdw->pos().y()!=p2)) xosdw->move2(p1, p2);
}
}
- if (dmx>=10)
- {
- xosdw->move2(0,rdh);
+ if (dmx >= 10) {
+ xosdw->move2(0, rdh);
}
-
}
-//Mouse Wheel now switches desktops (away from user desktop+1, towards user desktop-1)
-//-Francisco
-void KoolDock::wheelEvent(TQWheelEvent *e)
+// Mouse Wheel now switches desktops (away from user desktop+1, towards user desktop-1)
+// -Francisco
+void KoolDock::wheelEvent(TQWheelEvent* e)
{
- if(e->delta()==120 && (KWin::currentDesktop()<KWin::numberOfDesktops()))
- {
- KWin::setCurrentDesktop(KWin::currentDesktop()+1);
+ if ((e->delta() == 120) && (KWin::currentDesktop() < KWin::numberOfDesktops())) {
+ KWin::setCurrentDesktop(KWin::currentDesktop() + 1);
}
- if((e->delta()==-120) && (KWin::currentDesktop()>0))
- {
- KWin::setCurrentDesktop(KWin::currentDesktop()-1);
+ if ((e->delta() == -120) && (KWin::currentDesktop() > 0)) {
+ KWin::setCurrentDesktop(KWin::currentDesktop() - 1);
}
}
-
void KoolDock::mkbigTimerDo()
{
- int timing;
-
zoomTicksB++;
- iwBig = iwBig2*zoomVal/fzoomSpeed+iwSmall*(fzoomSpeed-zoomVal)/fzoomSpeed; // frames to grow up the dockbar
- if (iwBig<iwSmall) iwBig=iwSmall;
- zoomVal=zoomVal+zoomStepB;
-
- if (fzoomSpeed<=zoomVal)
- {
- zoomVal=fzoomSpeed;
+ iwBig = iwBig2 * zoomVal / fzoomSpeed + iwSmall * (fzoomSpeed - zoomVal) / fzoomSpeed; // frames to grow up the dockbar
+ if (iwBig < iwSmall) {
+ iwBig = iwSmall;
+ }
+ zoomVal = zoomVal + zoomStepB;
+
+ if (fzoomSpeed <= zoomVal) {
+ zoomVal = fzoomSpeed;
iwBig = iwBig2;
mkbigTimer->stop();
- last_mx=-1;
+ last_mx = -1;
debug(TQString("Stopped mkbigTimer"));
- if (zoomTicksB>=neededTicksB && fSpeed)
- {
- //performace check
- timing =perf->elapsed();
- zoomStepB=zoomStepB*timing/fzoomSpeed;
- if (zoomStepB<=0) zoomStepB=1;
- if (zoomStepB>200) zoomStepB=200;
- neededTicksB=(int)((fzoomSpeed/zoomStep)-1)*zoomStep/zoomStepB;
- }
- zoomTicksB=0;
- zoomTicksS=0;
- if (initialization)
- {
+ if ((zoomTicksB >= neededTicksB) && fSpeed) {
+ // Performace check
+ int timing = perf->elapsed();
+ zoomStepB = zoomStepB * timing / fzoomSpeed;
+ if (zoomStepB <= 0) {
+ zoomStepB = 1;
+ }
+ if (zoomStepB > 200) {
+ zoomStepB = 200;
+ }
+ neededTicksB = (int) ((fzoomSpeed / zoomStep) - 1) * zoomStep / zoomStepB;
+ }
+ zoomTicksB = 0;
+ zoomTicksS = 0;
+ if (initialization) {
pTest();
}
- else
- {
- if (fHidden==1)
- {mTimer->start(fMouseTimer, FALSE);}
- else
- {mTimer->changeInterval(fMouseTimer);}
+ else {
+ if (fHidden == 1) {
+ mTimer->start(fMouseTimer, false);
+ }
+ else {
+ mTimer->changeInterval(fMouseTimer);
+ }
}
}
iy = (iDist - iwSmall) / 2;
funcH = iwBig - iwSmall;
- if (fHidden == 1) Ybase = iwBig2*(fzoomSpeed-zoomVal)/fzoomSpeed;
- mMoveEvent(TQWidget::mapFromGlobal ( TQCursor::pos() ).x(), TQWidget::mapFromGlobal ( TQCursor::pos() ).y());
+ if (fHidden == 1) {
+ Ybase = iwBig2 * (fzoomSpeed - zoomVal) / fzoomSpeed;
+ }
+ mMoveEvent(TQWidget::mapFromGlobal(TQCursor::pos()).x(), TQWidget::mapFromGlobal(TQCursor::pos()).y());
paintEvent(NULL);
}
void KoolDock::mksmallTimerDo()
{
zoomTicksS++;
- iwBig = iwBig2*zoomVal/fzoomSpeed+iwSmall*(fzoomSpeed-zoomVal)/fzoomSpeed;
- if (iwBig<iwSmall) iwBig=iwSmall;
- if (0>zoomVal)
- {
- zoomVal=0;
+ iwBig = iwBig2 * zoomVal / fzoomSpeed + iwSmall * (fzoomSpeed - zoomVal) / fzoomSpeed;
+ if (iwBig < iwSmall) {
+ iwBig = iwSmall;
+ }
+ if (zoomVal < 0) {
+ zoomVal = 0;
mksmallTimerstop();
}
- else
- {
- if (fHidden == 1) Ybase = iwBig2*(fzoomSpeed-zoomVal)/fzoomSpeed;
+ else {
+ if (fHidden == 1) {
+ Ybase = iwBig2 * (fzoomSpeed - zoomVal) / fzoomSpeed;
+ }
funcH = iwBig - iwSmall;
iy = (iDist - iwSmall) / 2;
- mMoveEvent(lastXPos,lastYPos);
+ mMoveEvent(lastXPos, lastYPos);
paintEvent(NULL);
}
- zoomVal=zoomVal-zoomStepS;
+ zoomVal = zoomVal - zoomStepS;
}
void KoolDock::mksmallTimerstop()
{
- zoomVal=0;
- if (fStayBelow==1 && fHidden==0) setDockBelow();
+ zoomVal = 0;
+ if ((fStayBelow == 1) && (fHidden == 0)) {
+ setDockBelow();
+ }
int i;
mksmallTimer->stop();
- xosdw->move2(0,rdh);
- fExpanded=FALSE;
+ xosdw->move2(0, rdh);
+ fExpanded = false;
debug(TQString("Stopped mksmallTimer"));
- if (!initialization)
- {if (fHidden==0) {mTimer->changeInterval(250);} else {mTimer->stop();}}
+ if (!initialization) {
+ if (fHidden == 0) {
+ mTimer->changeInterval(250);
+ }
+ else {
+ mTimer->stop();
+ }
+ }
w = w0;
x = x0;
h = h0;
- // normalize the dock
- for (i = 0; i < (int)items.count() + 1; i++)
- {
+ // Normalize the dock
+ for (i = 0; i < (int) items.count() + 1; i++) {
iSize[i] = iwSmall;
cur_cx[i] = cx[i];
}
-
ii_first = 0;
ii_last = items.count() - 1;
ii_first = 0;
ii_last = items.count() - 1;
adjust = 0;
iwBig = iwBig2;
- if (fHidden == 0)
- {
- move2( x, dh - h );
+ if (fHidden == 0) {
+ move2(x, dh - h);
resize2(w, h);
}
- else
- {
- move( 0, rdh);
+ else {
+ move(0, rdh);
resize2(w, h);
}
- oldfirstX=x;
- oldtmpw=w;
+ oldfirstX = x;
+ oldtmpw = w;
paintEvent(NULL);
- if (zoomTicksS>=neededTicksS && fSpeed)
- {
- //performace check
- int timing =perf->elapsed();
- zoomStepS=zoomStepS*timing/fzoomSpeed;
- if (zoomStepS<=0) zoomStepS=1;
- if (zoomStepS>200) zoomStepS=200;
- neededTicksS=(int)((fzoomSpeed/zoomStep)-1)*zoomStep/zoomStepS;
+ if ((zoomTicksS >= neededTicksS) && fSpeed) {
+ // Performace check
+ int timing = perf->elapsed();
+ zoomStepS = zoomStepS * timing / fzoomSpeed;
+ if (zoomStepS <= 0) {
+ zoomStepS = 1;
+ }
+ if (zoomStepS > 200) {
+ zoomStepS = 200;
+ }
+ neededTicksS = (int) ((fzoomSpeed / zoomStep) - 1) * zoomStep / zoomStepS;
+ }
+ zoomTicksB = 0;
+ zoomTicksS = 0;
+ if (initialization) {
+ pTest();
}
- zoomTicksB=0;
- zoomTicksS=0;
- if (initialization) pTest();
}
-void KoolDock::enterEvent(TQEvent *)
+void KoolDock::enterEvent (TQEvent *)
{
- if (fExpanded==TRUE && !mksmallTimer->isActive() || mkbigTimer->isActive()) return;
- if (fStayBelow==1 && fHidden==0) setDockAbove();
- if (mksmallTimer->isActive()==TRUE) mksmallTimer->stop();
+ if (((fExpanded == true) && !mksmallTimer->isActive()) || mkbigTimer->isActive()) {
+ return;
+ }
+ if ((fStayBelow == 1) && (fHidden == 0)) {
+ setDockAbove();
+ }
+ if (mksmallTimer->isActive() == true) {
+ mksmallTimer->stop();
+ }
- w=w1;
- x=x1;
- h=h1;
-
- if (!fExpanded)
- {
+ w = w1;
+ x = x1;
+ h = h1;
+
+ if (!fExpanded) {
getTopBG();
- if (dockOpacity > 0) {bitBlt(&bottomBgf,0,0,&bottomBg);KPixmapEffect::fade(bottomBgf, ((float)dockOpacity)*0.01, bgColor);}
-
- adjust=x0-x1;
+ if (dockOpacity > 0) {
+ bitBlt(&bottomBgf, 0, 0, &bottomBg);
+ KPixmapEffect::fade(bottomBgf, ((float) dockOpacity) * 0.01, bgColor);
+ }
+ adjust = x0 - x1;
iwBig = iwSmall;
}
-
- resize2(w,h);
- move2(x,dh-h);
-
+ resize2(w, h);
+ move2(x, dh - h);
+
funcH = iwBig - iwSmall;
iy = (iDist - iwSmall) / 2;
-
- fExpanded=TRUE;
- oldfirstX=x;
- oldtmpw=w;
+
+ fExpanded = true;
+ oldfirstX = x;
+ oldtmpw = w;
paintEvent(NULL);
debug("enterEvent");
- zoomTicksB=0;
- zoomTicksS=0;
-
+ zoomTicksB = 0;
+ zoomTicksS = 0;
perf->start();
- mkbigTimer->start(zoomStep, FALSE);
+ mkbigTimer->start(zoomStep, false);
}
void KoolDock::onleaveEvent(TQEvent *)
{
- if (menuCount>0) return;
- if (mksmallTimer->isActive()==TRUE) return;
- zoomTicksB=0;
- zoomTicksS=0;
+ if (menuCount > 0) {
+ return;
+ }
+ if (mksmallTimer->isActive() == true) {
+ return;
+ }
+ zoomTicksB = 0;
+ zoomTicksS = 0;
perf->start();
debug("onleaveEvent");
- lastXPos = TQWidget::mapFromGlobal ( TQCursor::pos() ).x();
- lastYPos = TQWidget::mapFromGlobal ( TQCursor::pos() ).y();
- if (mkbigTimer->isActive())
- {
+ lastXPos = TQWidget::mapFromGlobal(TQCursor::pos()).x();
+ lastYPos = TQWidget::mapFromGlobal(TQCursor::pos()).y();
+ if (mkbigTimer->isActive()) {
mkbigTimer->stop();
}
- mksmallTimer->start(zoomStep, FALSE);
-
- if(showNames==1)
- {
- xosdw->move2(0,rdh);
- xosd_st=0;
+ mksmallTimer->start(zoomStep, false);
+
+ if (showNames == 1) {
+ xosdw->move2(0, rdh);
+ xosd_st = 0;
}
- if(fHidden==1)
- {
- trackTimer->start(250, FALSE);
+ if (fHidden == 1) {
+ trackTimer->start(250, false);
}
}
-
void KoolDock::edit()
{
editPref();
setupdlg->tabWidget->setCurrentPage(3);
}
-
void KoolDock::run(const TQString& command)
{
-
+
TQString exec;
+ static TQString zz = TQString(0);
+ static int ii = 0;
+ static TQCString yy = "";
kapp->propagateSessionManager();
- _filterData->setData( command.stripWhiteSpace() );
+ _filterData->setData(command.stripWhiteSpace());
TQStringList filters;
filters << "kurisearchfilter" << "tdeshorturifilter";
- KURIFilter::self()->filterURI( *(_filterData), filters );
+ KURIFilter::self()->filterURI(*(_filterData), filters);
- TQString cmd = (_filterData->uri().isLocalFile() ? _filterData->uri().path():_filterData->uri().url());
+ TQString cmd = (_filterData->uri().isLocalFile() ? _filterData->uri().path() :_filterData->uri().url());
// Nothing interesting. Quit!
- if(cmd.isEmpty())
- {
+ if (cmd.isEmpty()) {
KMessageBox::sorry(0L, i18n("You have to enter a command to execute or a URL to be opened first."));
return;
}
- else
- {
- switch( _filterData->uriType() )
- {
+ else {
+ switch (_filterData->uriType()) {
case KURIFilterData::LOCAL_FILE:
case KURIFilterData::LOCAL_DIR:
case KURIFilterData::NET_PROTOCOL:
- case KURIFilterData::HELP:
- {
- if (useList)
- {
- TDEApplication::startServiceByDesktopPath (command, lstDrop, &TQString(0) ,&TQCString(0) ,0 , "" ,true);
+ case KURIFilterData::HELP: {
+ if (useList) {
+ TDEApplication::startServiceByDesktopPath(command, lstDrop, NULL , NULL , &ii , yy ,true);
}
- else
- {
- (void) new KRun( _filterData->uri() );
+ else {
+ (void) new KRun(_filterData->uri());
}
return;
}
case KURIFilterData::EXECUTABLE:
- case KURIFilterData::SHELL:
- {
+ case KURIFilterData::SHELL: {
exec = cmd;
- if( _filterData->hasArgsAndOptions() ) cmd += _filterData->argsAndOptions();
+ if (_filterData->hasArgsAndOptions()) {
+ cmd += _filterData->argsAndOptions();
+ }
break;
}
case KURIFilterData::UNKNOWN:
case KURIFilterData::ERROR:
default:
- KMessageBox::sorry( 0, i18n("<qt>The program name or command <b>%1</b>\n"
- "cannot be found. Please correct the command\n"
- "or URL and try again</qt>").arg( cmd ) );
+ KMessageBox::sorry(0, i18n("<qt>The program name or command <b>%1</b>\n"
+ "cannot be found. Please correct the command\n"
+ "or URL and try again</qt>").arg(cmd));
return;
}
}
- if(KRun::runCommand( cmd, exec, "" ))
- {
+ if (KRun::runCommand(cmd, exec, "")) {
return;
}
- else
- {
- KMessageBox::sorry( 0, i18n("<qt>Could not run <b>%1</b>.\nPlease correct"
- " the command or URL and try again.</qt>").arg( cmd ) );
+ else {
+ KMessageBox::sorry(0, i18n("<qt>Could not run <b>%1</b>.\nPlease correct"
+ " the command or URL and try again.</qt>").arg(cmd));
return;
}
}
-
// Parabolic function
int KoolDock::func(int x)
{
- int res = iwBig - (int)((x*x*funcH)/(funcW*funcW));
+ int res = iwBig - (int) ((x * x * funcH) / (funcW * funcW));
return res;
}
+
int KoolDock::func2(int x)
{
int res;
- if (x<funcW)
- {res = iwBig - (int)((x*x*funcH)/(funcW*funcW));}
- else
- {res=iwSmall;}
+ if (x < funcW) {
+ res = iwBig - (int) ((x * x * funcH) / (funcW * funcW));
+ }
+ else {
+ res = iwSmall;
+ }
return res;
}
-//Here we add windows to the taskbar
+// Here we add windows to the taskbar
void KoolDock::addWindows()
{
// Show task bar
int index;
- if(fShowTaskbar)
- {
+ if (fShowTaskbar) {
KWin::WindowInfo info;
TQValueList<WId>::ConstIterator it;
int i;
Item *item;
- //First we removed every taskbar item
- int count=items.count()-numSystray;
-
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
+ // First we removed every taskbar item
+ int count = items.count() - numSystray;
+
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
item->setCount(0);
}
- for(i=count; i>=numLaunchers; i--)
- {
+ for (i = count; i >= numLaunchers; i--) {
items.remove(i);
}
- //Lets go through all the windows
- if(firstTime)
- {
- for (it=wm->windows().begin(); it != wm->windows().end(); ++it)
- {
+ // Lets go through all the windows
+ if (firstTime) {
+ for (it = wm->windows().begin(); it != wm->windows().end(); ++it) {
addwTask(*it);
}
- firstTime=false;
+ firstTime = false;
}
-
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
+
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
item->setId(item->getId());
- info=item->info;
- index=info.desktop();
- //If it belongs to the current desktop, lets add it
- if (info.valid())
- {
- if(fCurrent==0 || index==KWin::currentDesktop() || index==-1)
- {
+ info = item->info;
+ index = info.desktop();
+ // If it belongs to the current desktop, lets add it
+ if (info.valid()) {
+ if ((fCurrent == 0) || (index == KWin::currentDesktop()) || (index == -1)) {
addTask(item->getId(), i);
}
}
}
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- if (!item->info.valid()) witems.remove(i);
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (!item->info.valid()) {
+ witems.remove(i);
+ }
+ }
doUpdateGeometry();
}
- CurrentFocus=wm->activeWindow();
-
+ CurrentFocus = wm->activeWindow();
updTaskList();
}
void KoolDock::workAreaChanged()
{
- int mdw,mdh,mdt;
- if (xinerama==0)
- {
- mdw=TQApplication::desktop()->width();
+ int mdw, mdh;
+ if (xinerama == 0) {
+ mdw = TQApplication::desktop()->width();
mdh = TQApplication::desktop()->height();
}
- else
- {
- mdw=leftRes;
- mdh=XinDesiredHeight;
+ else {
+ mdw = leftRes;
+ mdh = XinDesiredHeight;
}
- if ((fOrientation & 1)==1)
- {
- mdt=mdw;mdw=mdh;mdh=mdt;
+ if ((fOrientation & 1) == 1) {
+ std::swap(mdw, mdh);
+ }
+ if ((dw != mdw) || (dh != mdh)) {
+ reload();
}
- if (dw!=mdw || dh!=mdh) reload();
}
-//What happens when we change desktops
+// What happens when we change desktops
void KoolDock::currentDesktopChanged(int)
{
- if (initialization) return;
+ if (initialization) {
+ return;
+ }
funcH = iwBig2 - iwSmall;
iwBig = iwBig2;
addWindows();
doUpdateGeometry();
- move(0,rdh);
+ move(0, rdh);
getTopBG();
- if (fExpanded) move2(x1,dh-h1);
- if (fHidden==0 && !fExpanded) move2(x0,dh-h0);
- xosdw->move2(0,rdh);
- oldDesktop=KWin::currentDesktop();
+ if (fExpanded) {
+ move2(x1, dh - h1);
+ }
+ if ((fHidden == 0) && (!fExpanded)) {
+ move2(x0, dh - h0);
+ }
+ xosdw->move2(0, rdh);
+ oldDesktop = KWin::currentDesktop();
}
void KoolDock::windowAdded(WId id)
{
- if (initialization) return;
- if (fShowNav)
- {
+ if (initialization) {
+ return;
+ }
+ if (fShowNav) {
addToTaskList(id);
}
- if (!fShowTaskbar) return;
- KWin::WindowInfo info;
- info = KWin::windowInfo(id);
+ if (!fShowTaskbar) {
+ return;
+ }
+ KWin::WindowInfo info = KWin::windowInfo(id);
TQString name = info.name();
- if (name == "kooldock xosd window")
- {
+ if (name == "kooldock xosd window") {
debug("Not adding OSD window to taskbar.");
return;
}
- if (name == "kooldock")
- {
+ if (name == "kooldock") {
debug("Not adding ourselves.");
return;
}
-
+
debug(TQString("windowAdded(%1)").arg(name));
- if (addwTask(id)) addToTaskList(id);
+ if (addwTask (id)) {
+ addToTaskList(id);
+ }
addTask(id);
doUpdateGeometry();
-
}
void KoolDock::windowRemoved(WId id)
{
- if (initialization) return;
- if (fShowNav)
- {
+ if (initialization) {
+ return;
+ }
+ if (fShowNav) {
rmFromTaskList(id);
}
- if (!fShowTaskbar) return;
+ if (!fShowTaskbar) {
+ return;
+ }
unsigned int i;
Item *item;
debug(TQString("windowRemoved(%1)").arg(id));
- KWin::WindowInfo info;
- info = KWin::windowInfo(id);
+ KWin::WindowInfo info = KWin::windowInfo(id);
TQString name = info.name();
-
- if (name == "kooldock xosd window")
- {
+
+ if (name == "kooldock xosd window") {
debug("Not removing OSD window from taskbar.");
return;
}
- for (i=0; i < witems.count(); i++ )
- {
+ for (i = 0; i < witems.count(); i++) {
item = witems.at(i);
- if(item->getId() == id)
- {
+ if (item->getId() == id) {
rmTask(id,i);
rmwTask(i);
rmFromTaskList(id);
@@ -1650,96 +1699,95 @@ void KoolDock::windowRemoved(WId id)
void KoolDock::windowChanged(WId id, unsigned int properties)
{
- if (initialization) return;
- if (fShowNav)
- {
+ if (initialization) {
+ return;
+ }
+ if (fShowNav) {
rmFromTaskList(id);
addToTaskList(id);
}
- if (!fShowTaskbar) return;
+ if (!fShowTaskbar) {
+ return;
+ }
Item *item;
bool iconChanged, nameChanged;
int i;
- bool toRepaint = FALSE;
- bool hasfound=FALSE;
+ bool toRepaint = false;
+ bool hasfound = false;
int iFound;
-
- KWin::WindowInfo winfo;
- winfo = KWin::windowInfo(id);
-
+
+ KWin::WindowInfo winfo = KWin::windowInfo(id);
+
iconChanged = (properties & NET::WMIcon);
- nameChanged = ((properties & NET::WMName) | (properties & NET::WMVisibleName));
-
+ nameChanged = ((properties & NET::WMName) | (properties & NET::WMVisibleName));
+
properties = 0;
-
- if (id != winId() ) //not add kooldock window
- {
- if (ignored(winfo.name()) == false)
- {
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- //find item in witem (window item) list
- if (item->getId()==id)
- {
- hasfound=true; //remember whether item was found, and its index
- iFound=i;
-
- //Handle icon/name changes
- if (iconChanged) {item->setIcon(KWin::icon(id, iwBig2, iwBig2, TRUE));toRepaint=true;}
- // FIXME: on gcc2.95 item->setName() falls on a loop and gets a segfault. (?)
-#ifndef _GCC295
- if (nameChanged) item->setName(winfo.name());
-#endif
- if ((fShowNotification) && (id != wm->activeWindow()))
- {
+ if (id != winId()) { // Do not add kooldock window
+ if (ignored (winfo.name()) == false) {
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ // Find item in witem (window item) list
+ if (item->getId() == id) {
+ hasfound = true; // Remember whether item was found and its index
+ iFound = i;
+
+ // Handle icon/name changes
+ if (iconChanged) {
+ item->setIcon(KWin::icon(id, iwBig2, iwBig2, true));
+ toRepaint = true;
+ }
+ if (nameChanged) {
+ item->setName(winfo.name());
+ }
+ if ((fShowNotification) && (id != wm->activeWindow())) {
debug(TQString("windowChanged (inactive window changed)"));
- // An inactive window's title changed
- // notify user
- item->anim(TRUE);
- if(onChangeTimer == NULL)
- {
+ // An inactive window's title changed
+ // notify user
+ item->anim(true);
+ if (onChangeTimer == NULL) {
onChangeTimer = new TQTimer(this);
- connect( onChangeTimer, SIGNAL(timeout()), this, SLOT(onChangeTimerTicked()));
- onChangeTimer->start( ON_CHANGE_ANIM_INTERVAL, FALSE );
+ connect(onChangeTimer, SIGNAL(timeout()), this, SLOT(onChangeTimerTicked()));
+ onChangeTimer->start(ON_CHANGE_ANIM_INTERVAL, false);
}
}
item->setId(id);
break;
}
}
- //If window is on window list, and user haven't changed desktop recently...
- if (hasfound && oldDesktop==KWin::currentDesktop())
- {
- if (witems.at(iFound)->getCount()==0) //window icon is not visible on kooldock
- {
+ // If window is on window list and user has not changed desktop recently...
+ if (hasfound && (oldDesktop == KWin::currentDesktop())) {
+ if (witems.at(iFound)->getCount() == 0) { // Window icon is not visible on kooldock
//... check whether it can be added
- if ((fCurrent==0 || winfo.isOnDesktop(KWin::currentDesktop())) && (fMinimizedOnly==0 || winfo.isMinimized())) {toRepaint|=addTask(id);}
+ if (((fCurrent == 0) || winfo.isOnDesktop(KWin::currentDesktop())) && (fMinimizedOnly == 0 || winfo.isMinimized())) {
+ toRepaint |= addTask(id);
+ }
}
- else
- {
+ else {
//... check whether it can be removed
- if ((fCurrent==1 && !winfo.isOnDesktop(KWin::currentDesktop())) || (fMinimizedOnly==1 && !winfo.isMinimized())) {toRepaint|=rmTask(id, iFound);}
+ if (((fCurrent == 1) && (!winfo.isOnDesktop(KWin::currentDesktop()))) || ((fMinimizedOnly == 1) && (!winfo.isMinimized()))) {
+ toRepaint |= rmTask(id, iFound);
+ }
}
rmFromTaskList(id);
addToTaskList(id);
}
- if(toRepaint) {doUpdateGeometry();paintEvent(NULL);}
+ if (toRepaint) {
+ doUpdateGeometry();
+ paintEvent(NULL);
+ }
}
}
}
void KoolDock::systemTrayWindowAdded(WId id)
{
- if (initialization) return;
- if(fSystray==1)
- {
- KWin::WindowInfo info;
- info = KWin::windowInfo(id);
+ if (initialization) {
+ return;
+ }
+ if (fSystray == 1) {
+ KWin::WindowInfo info = KWin::windowInfo(id);
TQString name = info.visibleName();
-
- if (ignored(info.name()) == false)
- {
- TQPixmap pix = KWin::icon(id, iwBig2, iwBig2, TRUE);
+ if (ignored(info.name()) == false) {
+ TQPixmap pix = KWin::icon(id, iwBig2, iwBig2, true);
numSystray++;
items.append(new Item(pix, id, name, iwSmall, iwBig2));
debug(TQString("addSystem Tray(%1)").arg(info.visibleName()));
@@ -1750,43 +1798,50 @@ void KoolDock::systemTrayWindowAdded(WId id)
void KoolDock::systemTrayWindowRemoved(WId id)
{
- if (initialization) return;
- if(fSystray==1)
- {
+ if (initialization) {
+ return;
+ }
+ if (fSystray == 1) {
numSystray--;
- if(numSystray<0) numSystray=0;
+ if (numSystray < 0) {
+ numSystray = 0;
+ }
windowRemoved(id);
}
}
void KoolDock::activeWindowChanged(WId id)
{
- if (initialization) return;
- if (id != winId()) CurrentFocus = id;
-
+ if (initialization) {
+ return;
+ }
+ if (id != winId()) {
+ CurrentFocus = id;
+ }
+
// end notify animation
unsigned int i;
- for (i=0; i<=items.count()-1; i++)
- {
- if (items.at(i)->getId() == id)
- {
- items.at(i)->anim(FALSE);
+ for (i = 0; i <= items.count() - 1; i++) {
+ if (items.at(i)->getId() == id) {
+ items.at(i)->anim(false);
}
}
-
- bool toDelete = TRUE;
- for (i=0; i<=items.count()-1; i++)
- {
- if (items.at(i)->isAnimed()) toDelete = FALSE;
- }
-
- if (toDelete && onChangeTimer != NULL)
- {
- delete(onChangeTimer);
+
+ bool toDelete = true;
+ for (i = 0; i <= items.count() - 1; i++) {
+ if (items.at(i)->isAnimed()) {
+ toDelete = false;
+ }
+ }
+
+ if (toDelete && (onChangeTimer != NULL)) {
+ delete onChangeTimer;
onChangeTimer = NULL;
debug("Deleted onChangeTimer");
}
- if (fGrouping) movetoback(id);
+ if (fGrouping) {
+ movetoback(id);
+ }
paintEvent(NULL);
}
@@ -1794,72 +1849,78 @@ void KoolDock::doUpdateGeometry()
{
int dw1, dw0;
unsigned int i;
- iwBig=iwBig2;
- for (i=0;i<items.count();i++)
- {
- cx[i] = iSpace + i*iDist + iwSmall/2;
- iSize[i]=iwSmall;
- if (!fExpanded) cur_cx[i]=cx[i];
+ iwBig= iwBig2;
+ for (i = 0; i < items.count(); i++) {
+ cx[i] = iSpace + i * iDist + iwSmall / 2;
+ iSize[i] = iwSmall;
+ if (!fExpanded) {
+ cur_cx[i] = cx[i];
+ }
}
- w0 = 2*iSpace + (items.count()-1)*iDist +iwSmall+soffset*2-eoffset*2;
+ w0 = 2 * iSpace + (items.count() - 1) * iDist + iwSmall + soffset * 2 - eoffset * 2;
w = w0;
- w1 = w0 + (int)((iwBig - iwSmall)*0.6*fAmount) + iSpace*2;
+ w1 = w0 + (int) ((iwBig - iwSmall) * 0.6 * fAmount) + iSpace * 2;
x1 = (dw - w1) * fpercentPos / 100;
- if (w1>dw) {x1=0;}
- if (w1>dw) {dw1=dw;} else {dw1=w1;}
- if (w0>dw) {dw0=dw;} else {dw0=w0;}
- x0 = (dw1 - dw0)/2 + x1;
- //x0 = (dw - w0) * fpercentPos / 100;
- //if(xinerama==1) {if (fOrientation && 1)==0) {x0=x0+XinPreviousWidth; x1=x1+XinPreviousWidth;}}
+ if (w1 > dw) {
+ x1 = 0;
+ }
+ if (w1 > dw) {
+ dw1 = dw;
+ }
+ else {
+ dw1 = w1;
+ }
+ if (w0 > dw) {
+ dw0 = dw;
+ }
+ else {
+ dw0 = w0;
+ }
+ x0 = (dw1 - dw0) / 2 + x1;
x = x0;
- h0 = 2*iy + iwSmall;
+ h0 = 2 * iy + iwSmall;
h = h0;
- h1 = 2*iy + iwBig;
-
+ h1 = 2 * iy + iwBig;
+
adjust = 0;
- if(fHidden == 0)
- {
+ if (fHidden == 0) {
resize2(w, h);
- move2( x, dh - h );
+ move2(x, dh - h);
}
-
- //if ((fOrientation & 1)==1) {offscr = TQPixmap(h1, w1);} else {offscr = TQPixmap(w1, h1);}
ii_first = 0;
ii_last = items.count() - 1;
ii_first = 0;
ii_last = ii_last;
- if (fExpanded==TRUE)
- {
- w=w1;
- h=h1;
- x=x1;
+ if (fExpanded == true) {
+ w = w1;
+ h = h1;
+ x = x1;
funcH = iwBig2 - iwSmall;
iy = (iDist - iwSmall) / 2;
- if(fHidden==1)
- {
- move(0,rdh);
+ if (fHidden == 1) {
+ move(0, rdh);
getBottomBG();
getTopBG();
- //move(rx,ry);
}
resize2(w, h);
- move2( x, dh - h );
+ move2(x, dh - h);
}
- else if (fHidden==1)
- {
- move(0,rdh);
+ else if (fHidden == 1) {
+ move(0, rdh);
}
debug(TQString("w1: %1").arg(w1));
debug(TQString("x1: %1").arg(x1));
- if (fExpanded) {last_mx=-10; mMoveEvent(lastXPos,lastYPos);}
- oldfirstX=x;
- oldtmpw=w;
+ if (fExpanded) {
+ last_mx = -10;
+ mMoveEvent(lastXPos, lastYPos);
+ }
+ oldfirstX = x;
+ oldtmpw = w;
paintEvent(NULL);
- xosdw->move2(0,rdh);
-
+ xosdw->move2(0, rdh);
}
bool KoolDock::rmTask(WId id, int iFound)
@@ -1868,71 +1929,67 @@ bool KoolDock::rmTask(WId id, int iFound)
int i, j;
int miFound;
bool hasfound;
- hasfound=false;
- miFound=iFound;
+ hasfound = false;
+ miFound = iFound;
TQCString cls;
-
- if (miFound==-1)
- {
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if (item->getId()==id)
- {hasfound=true;miFound=i;break;}
+
+ if (miFound == -1) {
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getId() == id) {
+ hasfound = true;
+ miFound = i;
+ break;
+ }
}
}
- else
- {
- hasfound=true;
+ else {
+ hasfound = true;
}
- if (hasfound)
- {
- fitem=witems.at(miFound);
- if (fitem->getId()==id)
- {
- if (fitem->getCount()==1)
- {
- cls=fitem->getClass();
- //Removing item
- for (i=numLaunchers, item = items.at(numLaunchers); item; i++, item = items.next())
- {
- if (fGrouping)
- {
- if (cls==item->getClass())
- {
- int cnt=item->getCount();
- //KMessageBox::information(0,TQString("%1").arg(cnt));
+ if (hasfound) {
+ fitem = witems.at(miFound);
+ if (fitem->getId() == id) {
+ if (fitem->getCount() == 1) {
+ cls = fitem->getClass();
+ // Remove item
+ for (i = numLaunchers, item = items.at(numLaunchers); item; i++, item = items.next()) {
+ if (fGrouping) {
+ if (cls == item->getClass()) {
+ int cnt = item->getCount();
fitem->setCount(0);
- if (cnt==0)
- {
+ if (cnt == 0) {
items.remove(i);
return true;
}
- else
- {
- int ir, il=-1, im=-1;
- int jl=-1,jm=-1;
- ir=fitem->getIndex();
- for (j=0, witem = witems.at(0); witem; j++, witem = witems.next())
- {
- if (witem->getClass()==cls)
- {
- if (witem->getIndex()<ir && witem->getIndex()>il)
- {il=witem->getIndex(); jl=witem->getId();}
- if (witem->getIndex()>im)
- {im=witem->getIndex(); jm=witem->getId();}
+ else {
+ int ir, il = -1, im = -1;
+ int jl = -1, jm = -1;
+ ir = fitem->getIndex();
+ for (j = 0, witem = witems.at(0); witem; j++, witem = witems.next()) {
+ if (witem->getClass() == cls) {
+ if ((witem->getIndex() < ir) && (witem->getIndex() > il)) {
+ il = witem->getIndex();
+ jl = witem->getId();
+ }
+ if (witem->getIndex() > im) {
+ im = witem->getIndex();
+ jm = witem->getId();
+ }
}
}
- item->setCount(cnt-1);
- if (jl>=0) {item->setId(jl);return true;}
- if (jm>=0) {item->setId(jm);}
+ item->setCount(cnt - 1);
+ if (jl >= 0) {
+ item->setId(jl);
+ return true;
+ }
+ if (jm >= 0) {
+ item->setId(jm);
+ }
return true;
}
}
}
- else
- {
- if (item->getId()==id)
- {
+ else {
+ if (item->getId() == id) {
items.remove(i);
witems.at(miFound)->setCount(0);
return true;
@@ -1947,13 +2004,14 @@ bool KoolDock::rmTask(WId id, int iFound)
void KoolDock::rmwTask(int iFound)
{
- int i, ind;
- Item *item;
+ Item* item;
+ int i;
+ int ind = witems.at(iFound)->getIndex();
- ind=witems.at(iFound)->getIndex();
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if (item->getIndex()>ind) item->setIndex(item->getIndex()-1);
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getIndex() > ind) {
+ item->setIndex(item->getIndex() - 1);
+ }
}
witems.remove(iFound);
}
@@ -1962,60 +2020,57 @@ bool KoolDock::addTask(WId id, int iFound)
{
Item *item;
int i ;
- int miFound;
- bool hasfound;
- hasfound=false;
- miFound=iFound;
-
- KWin::WindowInfo info;
- info = KWin::windowInfo(id,0,NET::WM2WindowClass);
- const int SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask;
+ bool hasfound = false;
+ int miFound = iFound;
+ KWin::WindowInfo info = KWin::windowInfo(id, 0, NET::WM2WindowClass);
+ const int SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask |
+ NET::ToolbarMask | NET::MenuMask | NET::DialogMask |
+ NET::OverrideMask | NET::TopMenuMask |
+ NET::UtilityMask | NET::SplashMask;
TQString name = info.visibleName();
TQCString cls = info.windowClassClass();
- if (info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Normal || info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Override || info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Dialog || info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Unknown)
- {
- if (info.isMinimized() || fMinimizedOnly==0)
- if (fCurrent==0 || info.isOnDesktop(KWin::currentDesktop()))
- if ((info.state() & NET::SkipTaskbar) == 0)
- if (ignored(info.name()) == false)
- {
- if (miFound==-1)
- {
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if (item->getId()==id)
- {hasfound=true;miFound=i;break;}
- }
- }
- else
- {
- hasfound=true;
- }
+ if (info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Normal ||
+ info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Override ||
+ info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Dialog ||
+ info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Unknown) {
+ if (info.isMinimized() || fMinimizedOnly==0) {
+ if (fCurrent==0 || info.isOnDesktop (KWin::currentDesktop())) {
+ if ((info.state() & NET::SkipTaskbar) == 0) {
+ if (ignored (info.name()) == false) {
+ if (miFound == -1) {
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getId() == id) {
+ hasfound = true;
+ miFound = i;
+ break;
+ }
+ }
+ }
+ else {
+ hasfound=true;
+ }
- if (hasfound)
- {
- if (witems.at(miFound)->getId()==id)
- {
- if (witems.at(miFound)->getCount()==0)
- {
- witems.at(miFound)->setCount(1);
- if (fGrouping)
- {
- hasfound=false;
- for (i=numLaunchers, item = items.at(numLaunchers); item; i++, item = items.next())
- {
- if (item->getClass()==cls)
- {
- item->setCount(item->getCount()+1);
+ if (hasfound) {
+ if (witems.at(miFound)->getId() == id) {
+ if (witems.at(miFound)->getCount() == 0) {
+ witems.at(miFound)->setCount(1);
+ if (fGrouping) {
+ hasfound = false;
+ for (i = numLaunchers, item = items.at(numLaunchers); item; i++, item = items.next()) {
+ if (item->getClass() == cls) {
+ item->setCount(item->getCount() + 1);
+ return true;
+ }
+ }
+ }
+ TQPixmap pix;
+ items.insert(items.count() - numSystray, new Item(pix, id, name, iwSmall, iwBig2, true));
+ items.at(items.count() - 1)->setClass(cls);
+ debug(TQString("addTask(%1)").arg(info.visibleName()));
return true;
}
}
}
- TQPixmap pix;
- items.insert(items.count()-numSystray, new Item(pix, id, name, iwSmall, iwBig2, TRUE));
- items.at(items.count()-1)->setClass(cls);
- debug(TQString("addTask(%1)").arg(info.visibleName()));
- return true;
}
}
}
@@ -2026,22 +2081,24 @@ bool KoolDock::addTask(WId id, int iFound)
bool KoolDock::addwTask(WId id)
{
- KWin::WindowInfo info;
- info = KWin::windowInfo(id,0,NET::WM2WindowClass);
- const int SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask;
+ KWin::WindowInfo info = KWin::windowInfo(id, 0, NET::WM2WindowClass);
+ const int SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask |
+ NET::ToolbarMask | NET::MenuMask | NET::DialogMask |
+ NET::OverrideMask | NET::TopMenuMask |
+ NET::UtilityMask | NET::SplashMask;
TQString name = info.visibleName();
TQCString cls = info.windowClassClass();
-
- if (info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Normal || info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Override || info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Dialog || info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Unknown)
- {
- if ((info.state() & NET::SkipTaskbar) == 0)
- {
- if (ignored(info.name()) == false)
- {
- TQPixmap pix = KWin::icon(id, iwBig2, iwBig2, TRUE);
+
+ if (info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Normal ||
+ info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Override ||
+ info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Dialog ||
+ info.windowType(SUPPORTED_WINDOW_TYPES) == NET::Unknown) {
+ if ((info.state() & NET::SkipTaskbar) == 0) {
+ if (ignored(info.name()) == false) {
+ TQPixmap pix = KWin::icon(id, iwBig2, iwBig2, true);
witems.append(new Item(pix, id, name, iwSmall, iwBig2));
- witems.at(witems.count()-1)->setClass(cls);
- witems.at(witems.count()-1)->setIndex(witems.count()-1);
+ witems.at(witems.count() - 1)->setClass(cls);
+ witems.at(witems.count() - 1)->setIndex(witems.count() - 1);
return true;
}
}
@@ -2052,7 +2109,7 @@ bool KoolDock::addwTask(WId id)
void KoolDock::loadConf()
{
TDEConfig *config = TDEGlobal::config();
-
+
config->setGroup("kooldock");
fShowTaskbar = config->readNumEntry("ShowTaskbar", 0);
fMinimizedOnly = config->readNumEntry("MinimizedOnly", 0);
@@ -2069,18 +2126,20 @@ void KoolDock::loadConf()
iwSmall = config->readNumEntry("SmallIconSize", 32);
iwBig = config->readNumEntry("BigIconSize", 90);
fAmount = config->readNumEntry("BigIconAmount", 5);
- if (fAmount>10) fAmount=10;
- if (fAmount<4) fAmount=4;
+ if (fAmount > 10) {
+ fAmount = 10;
+ }
+ if (fAmount < 4) {
+ fAmount = 4;
+ }
fShowKMenu = config->readNumEntry("ShowKMenu", 0);
fUseKBFX = config->readNumEntry("KBFX", 0);
dockOpacity = config->readNumEntry("DockOpacity", 0);
iSpace = config->readNumEntry("iSpace", 10);
- if (dockOpacity < 0)
- {
+ if (dockOpacity < 0) {
dockOpacity = 0;
}
- else if (dockOpacity > 100)
- {
+ else if (dockOpacity > 100) {
dockOpacity = 100;
}
bgColor = TQColor(config->readEntry("BackgroundColor", "#ccccff"));
@@ -2091,39 +2150,48 @@ void KoolDock::loadConf()
fClipIcons = config->readNumEntry("ClipIconArea", 0);
fpercentPos = config->readNumEntry("percentPos", 50);
fOrientation = config->readNumEntry("fOrientation", 0);
- if (fOrientation<0 || fOrientation>3) fOrientation=0;
+ if ((fOrientation < 0) || (fOrientation > 3)) {
+ fOrientation = 0;
+ }
fzoomSpeed = config->readNumEntry("zoomSpeed", 20);
- fSpeed = config->readNumEntry("speedControl", 0)==1;
- //fSpeed=true;
- if (fzoomSpeed>10)
- {
- if (fzoomSpeed>100)
- {zoomStep=10;}
- else
- {zoomStep=fzoomSpeed/10;}
- }
- else
- {zoomStep=1;}
- if (fSpeed)
- {
- zoomStepB=200;
- zoomStepS=200;
- neededTicksB=1;
- neededTicksS=1;
+ fSpeed = config->readNumEntry("speedControl", 0) == 1;
+ if (fzoomSpeed > 10) {
+ if (fzoomSpeed > 100) {
+ zoomStep = 10;
+ }
+ else {
+ zoomStep = fzoomSpeed / 10;
+ }
}
- else
- {
- zoomStepB=zoomStep;
- zoomStepS=zoomStep;
- neededTicksB=(int)(fzoomSpeed/zoomStep)-1;
- neededTicksS=(int)(fzoomSpeed/zoomStep)-1;
+ else {
+ zoomStep = 1;
+ }
+ if (fSpeed) {
+ zoomStepB = 200;
+ zoomStepS = 200;
+ neededTicksB = 1;
+ neededTicksS = 1;
+ }
+ else {
+ zoomStepB = zoomStep;
+ zoomStepS = zoomStep;
+ neededTicksB = (int) (fzoomSpeed / zoomStep) - 1;
+ neededTicksS = (int) (fzoomSpeed / zoomStep) - 1;
+ }
+
+ if (neededTicksB == 0) {
+ neededTicksB = 1;
+ }
+ if (neededTicksS == 0) {
+ neededTicksS = 1;
+ }
+
+ if (fpercentPos < 0) {
+ fpercentPos = 0;
+ }
+ if (fpercentPos > 100) {
+ fpercentPos = 100;
}
-
- if (neededTicksB==0) neededTicksB=1;
- if (neededTicksS==0) neededTicksS=1;
-
- if (fpercentPos<0) fpercentPos=0;
- if (fpercentPos>100) fpercentPos=100;
fHidden = config->readNumEntry("Hidden", 1);
fHighLightTime = config->readNumEntry("HighLightTime", 2);
fHideOnClick = config->readNumEntry("HideOnClick", 0);
@@ -2132,9 +2200,9 @@ void KoolDock::loadConf()
fLeftImg = config->readEntry("LeftImg");
fRightImg = config->readEntry("RightImg");
fCenterImg = config->readEntry("CenterImg");
- fNWideBg = config->readBoolEntry("nWideBg", TRUE);
- scaleMax = config->readBoolEntry("scaleMax", FALSE);
- fFirstRun = config->readBoolEntry("FirstRun", TRUE);
+ fNWideBg = config->readBoolEntry("nWideBg", true);
+ scaleMax = config->readBoolEntry("scaleMax", false);
+ fFirstRun = config->readBoolEntry("FirstRun", true);
xinerama = config->readNumEntry("Xinerama", 0);
leftRes=config->readNumEntry("leftRes", TQApplication::desktop()->width());
XinDesiredHeight=config->readNumEntry("XinDesiredHeight", TQApplication::desktop()->height());
@@ -2143,70 +2211,66 @@ void KoolDock::loadConf()
Solid = config->readNumEntry("Solid", 1);
fShowShot = config->readBoolEntry("ShowSShot", false);
fGrouping = config->readBoolEntry("iconGrouping", false);
- fShowNav=config->readNumEntry("Navigator", 1);
- fSystray=0;//config->readNumEntry("Systray", 0);
- fCurrent=config->readNumEntry("currentDesktop", 0);
- curTheme=config->readEntry("Theme");
+ fShowNav = config->readNumEntry("Navigator", 1);
+ fSystray = 0;//config->readNumEntry("Systray", 0);
+ fCurrent = config->readNumEntry("currentDesktop", 0);
+ curTheme = config->readEntry("Theme");
- if(config->readNumEntry("xosdBold", 1) == 0)
- {
+ if (config->readNumEntry ("xosdBold", 1) == 0) {
xosdBold = false;
}
- else
- {
+ else {
xosdBold = true;
}
- if(config->readNumEntry("xosdItalic", 1) == 0)
- {
+ if (config->readNumEntry ("xosdItalic", 1) == 0) {
xosdItalic = false;
}
- else
- {
+ else {
xosdItalic = true;
}
-
- if (iwSmall > iwBig)
- {
+
+ if (iwSmall > iwBig) {
iwSmall = 32;
iwBig = 90;
}
- if (!fShowTaskbar)
- {
+ if (!fShowTaskbar) {
fShowNotification = 0;
}
- if (fHidden!=1 && fHidden!=0) fHidden = 1;
- if (fStayBelow!=1 && fStayBelow!=0) fStayBelow = 0;
+ if ((fHidden != 1) && (fHidden != 0)) {
+ fHidden = 1;
+ }
+ if ((fStayBelow != 1) && (fStayBelow != 0)) {
+ fStayBelow = 0;
+ }
}
-
void KoolDock::loadIgnore()
{
TQString line;
- // read the ignorelist into 'ignoreList'
+ // Read the ignorelist into 'ignoreList'
TQFile in(TQString(progPath + "/ignorelist.conf"));
- //clear de ignoreList and the KEditListBox (ignoreBox)
+ // Clear de ignoreList and the KEditListBox (ignoreBox)
ignoreList.clear();
setupdlg->ignoreBox->clear();
- if (in.open(IO_ReadOnly))
- {
- while (in.readLine(line, MAX_LEN) != -1)
- {
- //append the item and strip the last char (new line)
- ignoreList.append(line.mid(0, line.length()-1));
+ if (in.open(IO_ReadOnly)) {
+ while (in.readLine(line, MAX_LEN) != -1) {
+ // Append the item and strip the last char (new line)
+ ignoreList.append(line.mid(0, line.length() - 1));
}
in.close();
- if(!ignoreList.isEmpty()) setupdlg->ignoreBox->insertStringList(ignoreList);
+ if (!ignoreList.isEmpty()) {
+ setupdlg->ignoreBox->insertStringList(ignoreList);
+ }
}
}
-
void KoolDock::saveConf()
{
TDEConfig *config = TDEGlobal::config();
-
+
config->setGroup("kooldock");
config->writeEntry("ShowTaskbar", fShowTaskbar);
config->writeEntry("MinimizedOnly", fMinimizedOnly);
@@ -2250,64 +2314,55 @@ void KoolDock::saveConf()
config->writeEntry("Navigator", fShowNav);
config->writeEntry("Systray", fSystray);
config->writeEntry("currentDesktop", fCurrent);
-
- if (xosdBold == true)
- {
+
+ if (xosdBold == true) {
config->writeEntry("xosdBold", 1);
}
- else
- {
+ else {
config->writeEntry("xosdBold", 0);
}
-
- if (xosdItalic == true)
- {
+
+ if (xosdItalic == true) {
config->writeEntry("xosdItalic", 1);
}
- else
- {
+ else {
config->writeEntry("xosdItalic", 0);
}
-
config->sync();
}
-
void KoolDock::editPref()
{
- bool tmp; //to save some code
-
- // open up the configuration dialog
-
+ bool tmp; // To save some code
+
+ // Open up the configuration dialog
+
// Fill dialog with values from configuration
- tmp=fHidden==1;
-
+ tmp = (fHidden == 1);
setupdlg->chk1->setChecked(tmp);
setupdlg->hideTimer->setEnabled(tmp);
setupdlg->hideOnClick->setEnabled(tmp);
setupdlg->cbStayBelow->setEnabled(!tmp);
- setupdlg->cbStayBelow->setChecked(fStayBelow==1);
+ setupdlg->cbStayBelow->setChecked(fStayBelow == 1);
- tmp=fShowTaskbar==1;
-
+ tmp = (fShowTaskbar == 1);
setupdlg->chk6->setEnabled(tmp);
setupdlg->cbMinimizedOnly->setEnabled(tmp);
setupdlg->chkSshot->setEnabled(tmp);
setupdlg->chkGrouping->setEnabled(tmp);
setupdlg->currentDesk->setEnabled(tmp);
-
- setupdlg->systray->setChecked(fSystray==1);
- setupdlg->currentDesk->setChecked(fCurrent==1);
-
- //Even if start Hidden is disabled we load the stored value
+ setupdlg->systray->setChecked(fSystray == 1);
+
+ setupdlg->currentDesk->setChecked(fCurrent == 1);
+
+ // Even if start Hidden is disabled we load the stored value
setupdlg->hideTimer->setValue(hideTimer);
setupdlg->hideOnClick->setChecked(fHideOnClick == 1);
setupdlg->Steppy->setChecked(fSteppy == 1);
setupdlg->cbCleaner->setChecked(fCleaner == 1);
-
- tmp=showNames==1;
-
+
+ tmp= (showNames == 1);
setupdlg->chk2->setChecked(tmp);
setupdlg->xosdBold->setEnabled(tmp);
setupdlg->xosdItalic->setEnabled(tmp);
@@ -2318,14 +2373,14 @@ void KoolDock::editPref()
setupdlg->xosdFont->setEnabled(tmp);
setupdlg->cbCleaner->setEnabled(tmp);
- if(Solid==1)
- {
+ if (Solid == 1) {
setupdlg->chkSolid->setChecked(true);
setupdlg->chkSolidSlot();
}
- else
- {
- if(!curTheme.isEmpty()) setupdlg->theme->setCurrentText(curTheme);
+ else {
+ if (!curTheme.isEmpty()) {
+ setupdlg->theme->setCurrentText(curTheme);
+ }
setupdlg->chkImg->setChecked(true);
setupdlg->chkSolidSlot();
}
@@ -2349,11 +2404,15 @@ void KoolDock::editPref()
setupdlg->fAmount->setValue(fAmount);
setupdlg->sbSpace->setValue(iSpace);
setupdlg->nWideBg->setChecked(fNWideBg);
- if (scaleMax) {setupdlg->opScale2->setChecked(true);} else {setupdlg->opScale1->setChecked(true);}
+ if (scaleMax) {
+ setupdlg->opScale2->setChecked(true);
+ }
+ else {
+ setupdlg->opScale1->setChecked(true);
+ }
setupdlg->xosdBold->setChecked(xosdBold);
setupdlg->xosdItalic->setChecked(xosdItalic);
- if (xinerama==1)
- {
+ if (xinerama == 1) {
setupdlg->xrma->setChecked(true);
setupdlg->SleftRes->setEnabled(true);
setupdlg->SHeight->setEnabled(true);
@@ -2362,8 +2421,7 @@ void KoolDock::editPref()
setupdlg->SHeight->setValue(XinDesiredHeight);
setupdlg->PWidth->setValue(XinPreviousWidth);
}
- else
- {
+ else {
setupdlg->SleftRes->setEnabled(false);
setupdlg->SHeight->setEnabled(false);
setupdlg->PWidth->setEnabled(false);
@@ -2375,148 +2433,177 @@ void KoolDock::editPref()
setupdlg->chkSshot->setChecked(fShowShot);
setupdlg->chkGrouping->setChecked(fGrouping);
setupdlg->Priority->setValue(fPriority);
- //setupdlg->cbMouseTimer->setValue(fMouseTimer);
- setupdlg->chClipping->setChecked(fClipping==1);
- setupdlg->chClipIcons->setChecked(fClipIcons==1);
+ setupdlg->chClipping->setChecked(fClipping == 1);
+ setupdlg->chClipIcons->setChecked(fClipIcons == 1);
setupdlg->zoomSpeed->setValue(fzoomSpeed);
setupdlg->chkSpeed->setChecked(fSpeed);
setupdlg->percentPos->setValue(fpercentPos);
- if (fOrientation==0) setupdlg->op0->setChecked(true);
- if (fOrientation==1) setupdlg->op1->setChecked(true);
- if (fOrientation==2) setupdlg->op2->setChecked(true);
- if (fOrientation==3) setupdlg->op3->setChecked(true);
- loadIgnore(); //Load Ignore List
-
- if (!setupdlg->isVisible()) if (!noSet) setupdlg->tabWidget->setCurrentPage(0);
- setupdlg->toReloadIcons->setChecked(FALSE);
-
+ if (fOrientation == 0) {
+ setupdlg->op0->setChecked(true);
+ }
+ if (fOrientation == 1) {
+ setupdlg->op1->setChecked(true);
+ }
+ if (fOrientation == 2) {
+ setupdlg->op2->setChecked(true);
+ }
+ if (fOrientation == 3) {
+ setupdlg->op3->setChecked(true);
+ }
+ loadIgnore(); // Load Ignore List
+
+ if (!setupdlg->isVisible()) {
+ if (!noSet) {
+ setupdlg->tabWidget->setCurrentPage(0);
+ }
+ }
+ setupdlg->toReloadIcons->setChecked(false);
+
setupdlg->show();
- KWin::WindowInfo winfo;
- winfo = KWin::windowInfo(setupdlg->winId());
+ KWin::WindowInfo winfo = KWin::windowInfo(setupdlg->winId());
- if (winfo.desktop()!=-1) KWin::setOnDesktop(setupdlg->winId(), KWin::currentDesktop());
+ if (winfo.desktop() !=-1) {
+ KWin::setOnDesktop(setupdlg->winId(), KWin::currentDesktop());
+ }
KWin::activateWindow(setupdlg->winId());
-
}
void KoolDock::loadMenu()
{
TQDir homeDir = TQDir::home();
- if (homeDir.exists(menuPath))
- {
+ if (homeDir.exists(menuPath)) {
TQDir dir(menuPath);
- //First we make sure every index is correct!
- //Lets update the launchers index
+ // First make sure every index is correct!
+ // Update the launchers index
TQString preffix;
- TQStringList fileListRemove=dir.entryList("*.desktop");
- TQStringList fileListRemove2=fileListRemove;
-
- //Not really sure why I couldn't do this within the other for, something like fileListRemove[i].remove(0,2).prepend(preffix), but hell it works
- for(unsigned int i=0; i<fileListRemove2.count(); i++)
- {
+ TQStringList fileListRemove = dir.entryList("*.desktop");
+ TQStringList fileListRemove2 = fileListRemove;
+
+ for (unsigned int i = 0; i < fileListRemove2.count(); i++) {
fileListRemove2[i].remove(0,2);
}
-
- //Rename the files so they reflect their new position
- for(unsigned int i=0; i<fileListRemove.count(); i++)
- {
- if(i<10) preffix=TQString("0%1").arg(i);
- if(i>=10) preffix=TQString("%1").arg(i);
-
+
+ // Rename the files so they reflect their new position
+ for (unsigned int i = 0; i < fileListRemove.count(); i++) {
+ if (i < 10) {
+ preffix = TQString("0%1").arg(i);
+ }
+ if (i >= 10) {
+ preffix = TQString("%1").arg(i);
+ }
dir.rename(fileListRemove[i], TQString("%1%2").arg(preffix).arg(fileListRemove2[i]));
}
- //End updating launchers index
-
- TQStringList fileList = dir.entryList( "*.desktop");
- if(!fileList.isEmpty())
- {
- for ( TQStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it )
- {
- if ( ((*it) != ".") && ((*it) != "..") )
- {
+ // End updating launchers index
+
+ TQStringList fileList = dir.entryList("*.desktop");
+ if (!fileList.isEmpty()) {
+ for (TQStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it) {
+ if (((*it) != ".") && ((*it) != "..")) {
items.append(new Item(menuPath + (*it), iwSmall, iwBig2));
}
}
}
}
- else
- {
+ else {
debug("Config directory doesn't exits");
TQDir progPathDir(progPath);
progPathDir.mkdir(progPath);
TQDir menuPathDir(menuPath);
menuPathDir.mkdir(menuPath);
debug("Created item directory");
-
- // create initial entries.
- addFile(TQString("00_konqueror.desktop"), TQString("konqueror"), TQString("kfmclient openProfile webbrowsing"), TQString("Konqueror Web Browser"), true, false, false, false, TQString("na"));
- addFile(TQString("01_home.desktop"), TQString("kfm_home"), TQString("kfmclient openProfile filemanagement"), TQString("Home directory"), true, false, false, false, TQString("na"));
- addFile(TQString("02_kmail.desktop"), TQString("kmail"), TQString("kmail"), TQString("KMail"), true, false, false, false, TQString("na"));
- addFile(TQString("03_kate.desktop"), TQString("kate"), TQString("kate"), TQString("Kate"), true, false, false, false, TQString("na"));
- addFile(TQString("04_konsole.desktop"), TQString("konsole"), TQString("konsole"), TQString("Konsole"), true, false, false, false, TQString("na"));
- addFile(TQString("05_kcontrol.desktop"), TQString("kcontrol"), TQString("kcontrol"), TQString("Control Center"), true, false, false, false, TQString("na"));
-
+
+ // create initial entries.
+ addFile(TQString("00_konqueror.desktop"),
+ TQString("konqueror"),
+ TQString("kfmclient openProfile webbrowsing"),
+ TQString("Konqueror Web Browser"));
+ addFile(TQString("01_home.desktop"),
+ TQString("kfm_home"),
+ TQString("kfmclient openProfile filemanagement"),
+ TQString("Home directory"));
+ addFile(TQString("02_kmail.desktop"),
+ TQString("kmail"),
+ TQString("kmail"),
+ TQString("KMail"));
+ addFile(TQString("03_kate.desktop"),
+ TQString("kate"),
+ TQString("kate"),
+ TQString("Kate"));
+ addFile(TQString("04_konsole.desktop"),
+ TQString("konsole"),
+ TQString("konsole"),
+ TQString("Konsole"));
+ addFile(TQString("05_kcontrol.desktop"),
+ TQString("kcontrol"),
+ TQString("kcontrol"),
+ TQString("Control Center"));
loadMenu();
}
numLaunchers = items.count();
}
-
void KoolDock::about()
{
TDEAboutApplication about(this, 0, false);
about.exec();
}
-
void KoolDock::onChangeTimerTicked()
{
- if (animValue > 70) animState = FALSE;
- if (animValue < 5) animState = TRUE;
-
- if (animState == TRUE)
- {
+ if (animValue > 70) {
+ animState = false;
+ }
+ if (animValue < 5) {
+ animState = true;
+ }
+
+ if (animState == true) {
animValue = animValue + 5;
}
- else
- {
+ else {
animValue = animValue - 5;
}
paintEvent(NULL);
}
-
void KoolDock::updateBackground(const TQPixmap& pix)
{
- if (pix.width()==1 && pix.height()==1)
- {
- if (fHidden == 0)
- {
- if ((fOrientation & 1)==1) {bottomBg = TQPixmap(h1, dw);} else {bottomBg = TQPixmap(dw, h1);}
- bottomBg.fill (pix.convertToImage().pixel(0,0));
+ if ((pix.width() == 1) && (pix.height() == 1)) {
+ if (fHidden == 0) {
+ if ((fOrientation & 1) == 1) {
+ bottomBg = TQPixmap(h1, dw);
+ }
+ else {
+ bottomBg = TQPixmap(dw, h1);
+ }
+ bottomBg.fill(pix.convertToImage().pixel(0,0));
+ }
+ if (dockOpacity > 0) {
+ bitBlt(&bottomBgf, 0, 0, &bottomBg);
+ KPixmapEffect::fade(bottomBgf, ((float) dockOpacity) * 0.01, bgColor);
}
- if (dockOpacity > 0) {bitBlt(&bottomBgf,0,0,&bottomBg);KPixmapEffect::fade(bottomBgf, ((float)dockOpacity)*0.01, bgColor);}
}
- else
- {
- if (fHidden == 0) bottomBg = TQPixmap(pix);
- if (dockOpacity > 0) {bitBlt(&bottomBgf,0,0,&bottomBg);KPixmapEffect::fade(bottomBgf, ((float)dockOpacity)*0.01, bgColor);}
+ else {
+ if (fHidden == 0) {
+ bottomBg = TQPixmap(pix);
+ }
+ if (dockOpacity > 0) {
+ bitBlt(&bottomBgf, 0, 0, &bottomBg);
+ KPixmapEffect::fade(bottomBgf, ((float) dockOpacity) * 0.01, bgColor);
+ }
}
- uw=w;
+ uw = w;
paintEvent(NULL);
-
}
void KoolDock::toggleAlwaysOnTop()
{
- KWin::WindowInfo info=KWin::windowInfo(cId);
-
- if (info.state() & NET::KeepAbove)
- {
+ KWin::WindowInfo info= KWin::windowInfo(cId);
+
+ if (info.state() & NET::KeepAbove) {
KWin::clearState(cId,NET::KeepAbove);
}
- else
- {
+ else {
KWin::setState(cId,NET::KeepAbove);
KWin::raiseWindow(cId);
}
@@ -2524,14 +2611,12 @@ void KoolDock::toggleAlwaysOnTop()
void KoolDock::toggleKeptBelowOthers()
{
- KWin::WindowInfo info=KWin::windowInfo(cId);
-
- if (info.state() & NET::KeepBelow)
- {
+ KWin::WindowInfo info = KWin::windowInfo(cId);
+
+ if (info.state() & NET::KeepBelow) {
KWin::clearState(cId,NET::KeepBelow);
}
- else
- {
+ else {
KWin::setState(cId,NET::KeepBelow);
KWin::lowerWindow(cId);
}
@@ -2539,34 +2624,32 @@ void KoolDock::toggleKeptBelowOthers()
void KoolDock::toggleFullScreen()
{
- KWin::WindowInfo info=KWin::windowInfo(cId);
-
- if (info.state() & NET::FullScreen)
- {
+ KWin::WindowInfo info = KWin::windowInfo(cId);
+
+ if (info.state() & NET::FullScreen) {
KWin::clearState(cId,NET::FullScreen);
}
- else
- {
+ else {
KWin::setState(cId,NET::FullScreen);
}
}
void KoolDock::moveApp()
{
- KWin::WindowInfo info=KWin::windowInfo(cId);
+ KWin::WindowInfo info = KWin::windowInfo(cId);
activateApp();
-
+
TQCursor::setPos(info.geometry().center());
-
+
NETRootInfo ri(tqt_xdisplay(), NET::WMMoveResize);
ri.moveResizeRequest(cId, info.geometry().center().x(), info.geometry().center().y(), NET::Move);
}
void KoolDock::resizeApp()
{
- KWin::WindowInfo info=KWin::windowInfo(cId);
+ KWin::WindowInfo info = KWin::windowInfo(cId);
activateApp();
-
+
TQCursor::setPos(info.geometry().bottomRight());
NETRootInfo ri(tqt_xdisplay(), NET::WMMoveResize);
@@ -2580,36 +2663,29 @@ void KoolDock::minApp()
int i;
TQPixmap shot;
TQImage tmpImg;
- KWin::WindowInfo info=KWin::windowInfo(cId);
-
- if (info.isMinimized())
- {
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if(item->getId() == cId)
- {
- // set default's item icon
+ KWin::WindowInfo info= KWin::windowInfo(cId);
+
+ if (info.isMinimized()) {
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getId() == cId) {
+ // Set default's item icon
item->setIcon(KWin::icon(cId, iwBig2, iwBig2, TRUE));
}
}
KWin::deIconifyWindow(cId, true);
KWin::activateWindow(cId);
}
- else
- {
- if (fShowShot == TRUE)
- {
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if(item->getId() == cId)
- {
- // take the screenshot
+ else {
+ if (fShowShot == true) {
+ for (i=0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getId() == cId) {
+ // Take the screenshot
shot = TQPixmap::grabWindow(cId);
- // scale the screenshot
+ // Scale the screenshot
tmpImg = shot.convertToImage();
tmpImg.scale(iwBig2, iwBig2);
shot.convertFromImage(tmpImg);
- // set the new item's icon
+ // Set the new item's icon
item->setIcon(shot);
}
}
@@ -2618,109 +2694,91 @@ void KoolDock::minApp()
KWin::iconifyWindow(cId, true);
}
hide();
- TQTimer::singleShot( 100, this, SLOT(refreshBackground()) );
+ TQTimer::singleShot(100, this, SLOT(refreshBackground()));
}
-
void KoolDock::maxApp()
{
Item *item;
int i;
- KWin::WindowInfo info=KWin::windowInfo(cId);
-
- if (fShowShot == TRUE)
- {
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if(item->getId() == cId)
- {
- // set default's item icon
- item->setIcon(KWin::icon(cId, iwBig2, iwBig2, TRUE));
+ KWin::WindowInfo info = KWin::windowInfo(cId);
+
+ if (fShowShot == true) {
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getId() == cId) {
+ // Set default's item icon
+ item->setIcon(KWin::icon(cId, iwBig2, iwBig2, true));
}
}
}
- if (info.isMinimized())
- {
+ if (info.isMinimized()) {
KWin::deIconifyWindow(cId, true);
}
- else
- {
- if (info.state() & NET::Max)
- {
- KWin::clearState(cId, NET::Max);
+ else {
+ if (info.state() & NET::Max) {
+ KWin::clearState(cId, NET::Max);
}
- else
- {
+ else {
KWin::setState(cId, NET::Max);
}
}
KWin::activateWindow(cId);
hide();
- TQTimer::singleShot( 100, this, SLOT(refreshBackground()) );
+ TQTimer::singleShot(100, this, SLOT(refreshBackground()));
}
void KoolDock::restApp()
{
Item *item;
int i;
- KWin::WindowInfo info=KWin::windowInfo(cId);
-
- if (fShowShot == TRUE)
- {
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if(item->getId() == cId)
- {
- // set default's item icon
- item->setIcon(KWin::icon(cId, iwBig2, iwBig2, TRUE));
+ KWin::WindowInfo info = KWin::windowInfo(cId);
+
+ if (fShowShot == true) {
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getId() == cId) {
+ // Set default's item icon
+ item->setIcon(KWin::icon(cId, iwBig2, iwBig2, true));
}
}
}
-
+
KWin::clearState(cId, NET::MaxVert + NET::MaxHoriz);
KWin::deIconifyWindow(cId, true);
KWin::activateWindow(cId);
hide();
- TQTimer::singleShot( 100, this, SLOT(refreshBackground()) );
+ TQTimer::singleShot(100, this, SLOT(refreshBackground()));
}
void KoolDock::minAllApps()
{
int i;
Item *item;
- KWin::WindowInfo info=KWin::windowInfo(cId,0,NET::WM2WindowClass);
- TQCString cls=info.windowClassClass();
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if (!item->info.isMinimized())
- {
- if ((fMinimizedOnly==0 || item->info.isMinimized()) || (fCurrent==0 || item->info.isOnDesktop(info.desktop())))
- {
- if (cls==item->getClass())
- {
+ KWin::WindowInfo info = KWin::windowInfo(cId, 0, NET::WM2WindowClass);
+ TQCString cls = info.windowClassClass();
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (!item->info.isMinimized()) {
+ if (((fMinimizedOnly == 0) || (item->info.isMinimized())) || ((fCurrent == 0) || item->info.isOnDesktop(info.desktop()))) {
+ if (cls == item->getClass()) {
KWin::iconifyWindow(item->getId(), true);
}
}
}
}
-
}
void KoolDock::maxAllApps()
{
int i;
Item *item;
- KWin::WindowInfo info=KWin::windowInfo(cId,0,NET::WM2WindowClass);
- TQCString cls=info.windowClassClass();
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if (!(item->info.state() & NET::Max) || item->info.isMinimized())
- {
- if ((fMinimizedOnly==0 || item->info.isMinimized()) || (fCurrent==0 || item->info.isOnDesktop(info.desktop())))
- {
- if (cls==item->getClass())
- {
- if (item->info.isMinimized()) KWin::deIconifyWindow(item->getId(),true);
+ KWin::WindowInfo info = KWin::windowInfo(cId, 0, NET::WM2WindowClass);
+ TQCString cls = info.windowClassClass();
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (!(item->info.state() & NET::Max) || item->info.isMinimized()) {
+ if (((fMinimizedOnly == 0) || item->info.isMinimized()) || ((fCurrent == 0) || item->info.isOnDesktop(info.desktop()))) {
+ if (cls == item->getClass()) {
+ if (item->info.isMinimized()) {
+ KWin::deIconifyWindow(item->getId(), true);
+ }
KWin::setState(item->getId(), NET::Max);
}
}
@@ -2732,22 +2790,16 @@ void KoolDock::restAllApps()
{
int i;
Item *item;
- KWin::WindowInfo info=KWin::windowInfo(cId,0,NET::WM2WindowClass);
- TQCString cls=info.windowClassClass();
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if (item->info.state() & NET::Max || item->info.isMinimized())
- {
- if ((fMinimizedOnly==0 || item->info.isMinimized()) || (fCurrent==0 || item->info.isOnDesktop(info.desktop())))
- {
- if (cls==item->getClass())
- {
- if (item->info.isMinimized())
- {
- KWin::deIconifyWindow(item->getId(),true);
+ KWin::WindowInfo info = KWin::windowInfo(cId, 0, NET::WM2WindowClass);
+ TQCString cls = info.windowClassClass();
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->info.state() & NET::Max || item->info.isMinimized()) {
+ if (((fMinimizedOnly == 0) || item->info.isMinimized()) || ((fCurrent == 0) || item->info.isOnDesktop(info.desktop()))) {
+ if (cls == item->getClass()) {
+ if (item->info.isMinimized()) {
+ KWin::deIconifyWindow(item->getId(), true);
}
- else
- {
+ else {
KWin::clearState(item->getId(), NET::Max);
}
}
@@ -2760,36 +2812,30 @@ void KoolDock::closeAllApps()
{
int i;
Item *item;
- KWin::WindowInfo info=KWin::windowInfo(cId,0,NET::WM2WindowClass);
- TQCString cls=info.windowClassClass();
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if ((fMinimizedOnly==0 || item->info.isMinimized()) || (fCurrent==0 || item->info.isOnDesktop(info.desktop())))
- {
- if (cls==item->getClass())
- {
+ KWin::WindowInfo info = KWin::windowInfo(cId, 0, NET::WM2WindowClass);
+ TQCString cls = info.windowClassClass();
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (((fMinimizedOnly == 0) || item->info.isMinimized()) || ((fCurrent == 0) || item->info.isOnDesktop(info.desktop()))) {
+ if (cls == item->getClass()) {
NETRootInfo app(tqt_xdisplay(), NET::CloseWindow);
app.closeWindowRequest(item->getId());
}
}
}
}
-
+
void KoolDock::shadeApp()
{
- KWin::WindowInfo info=KWin::windowInfo(cId);
-
- if (info.state() & NET::Shaded)
- {
+ KWin::WindowInfo info = KWin::windowInfo(cId);
+
+ if (info.state() & NET::Shaded) {
KWin::clearState(cId, NET::Shaded);
}
- else
- {
+ else {
KWin::setState(cId, NET::Shaded);
}
-
hide();
- TQTimer::singleShot( 100, this, SLOT(refreshBackground()) );
+ TQTimer::singleShot(100, this, SLOT(refreshBackground()));
}
void KoolDock::activateApp()
@@ -2797,27 +2843,25 @@ void KoolDock::activateApp()
Item *item;
int i;
KWin::WindowInfo info = KWin::windowInfo(cId);
-
- if (fShowShot == TRUE)
- {
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if(item->getId() == cId)
- {
- // set default's item icon
+
+ if (fShowShot == true) {
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getId() == cId) {
+ // Set default's item icon
item->setIcon(KWin::icon(cId, iwBig2, iwBig2, TRUE));
}
}
}
-
- if (info.desktop()!=-1 && info.desktop()!=KWin::currentDesktop())
- {
+
+ if ((info.desktop() != -1) && (info.desktop() != KWin::currentDesktop())) {
goToDesktop(info.desktop());
}
- if (info.isMinimized()) KWin::deIconifyWindow(cId, true);
+ if (info.isMinimized()) {
+ KWin::deIconifyWindow(cId, true);
+ }
KWin::activateWindow(cId);
hide();
- TQTimer::singleShot( 100, this, SLOT(refreshBackground()) );
+ TQTimer::singleShot(100, this, SLOT(refreshBackground()));
}
void KoolDock::closeApp()
@@ -2827,28 +2871,24 @@ void KoolDock::closeApp()
debug(TQString("Closed: %1").arg(cId));
}
-
void KoolDock::editItem()
{
run(TQString("kfmclient openProperties ") + iFilename);
}
-
void KoolDock::sendToDesktop(int desktop)
{
- if (desktop==0) desktop=-1;
- if (iGroup && allApps)
- {
+ if (desktop == 0) {
+ desktop = -1;
+ }
+ if (iGroup && allApps) {
int i;
Item *item;
- KWin::WindowInfo info=KWin::windowInfo(cId,0,NET::WM2WindowClass);
- TQCString cls=info.windowClassClass();
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if ((fMinimizedOnly==0 || item->info.isMinimized()) || (fCurrent==0 || item->info.isOnDesktop(info.desktop())))
- {
- if (cls==item->getClass())
- {
+ KWin::WindowInfo info = KWin::windowInfo(cId, 0, NET::WM2WindowClass);
+ TQCString cls = info.windowClassClass();
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (((fMinimizedOnly == 0) || item->info.isMinimized()) || ((fCurrent == 0) || item->info.isOnDesktop(info.desktop()))) {
+ if (cls == item->getClass()) {
KWin::setOnDesktop(item->getId(), desktop);
}
}
@@ -2858,27 +2898,23 @@ void KoolDock::sendToDesktop(int desktop)
KWin::setOnDesktop(cId, desktop);
}
-
void KoolDock::goToDesktop(int desktop)
{
KWin::setCurrentDesktop(desktop);
}
-
void KoolDock::goToWindow(int win)
{
- cId=(WId)win;
+ cId = (WId) win;
activateApp();
}
-
void KoolDock::removeItem()
{
TQFile::remove(iFilename);
restart();
}
-
void KoolDock::addFile(const TQString& filename,
const TQString& iconname,
const TQString& execname,
@@ -2894,8 +2930,7 @@ void KoolDock::addFile(const TQString& filename,
TQString confFile = locateLocal("config", "kooldockrc");
TQFile out(TQString(menuPath + filename));
- if (out.open(IO_WriteOnly))
- {
+ if (out.open (IO_WriteOnly)) {
TQTextStream out_s(&out);
out_s << "[Desktop Entry]" << endl;
out_s << "Comment=" << endl;
@@ -2912,84 +2947,70 @@ void KoolDock::addFile(const TQString& filename,
out_s << "Terminal=false" << endl;
out_s << "TerminalOptions=" << endl;
out_s << "Type=Application" << endl;
- if(notify == true)
- {
+ if (notify == true) {
out_s << "X-TDE-StartupNotify=true" << endl;
}
- else
- {
+ else {
out_s << "X-TDE-StartupNotify=false" << endl;
}
- if(cuser==true)
- {
+ if (cuser == true) {
out_s << "X-TDE-SubstituteUID=true" << endl;
out_s << "X-TDE-Username=" << puser << endl;
}
- else
- {
+ else {
out_s << "X-TDE-SubstituteUID=false" << endl;
out_s << "X-TDE-Username=" << endl;
}
- if(terminal==true)
- {
+ if (terminal == true) {
out_s << "Terminal=true" << endl;
}
- else
- {
+ else {
out_s << "Terminal=false" << endl;
}
- if(tclose==true)
- {
+ if (tclose == true) {
out_s << "TerminalOptions=\\s--noclose" << endl;
}
- else
- {
+ else {
out_s << "TerminalOptions=" << endl;
}
out.close();
}
}
-
bool KoolDock::ignored(const TQString& appname)
{
- if(ignoreList.count()>0)
- {
- for(unsigned int i=0; i<ignoreList.count(); i++)
- {
- if(ignoreList[i]==appname)
- return(true);
-
+ if (ignoreList.count() > 0) {
+ for (unsigned int i = 0; i < ignoreList.count(); i++) {
+ if (ignoreList[i] == appname) {
+ return true;
+ }
}
}
- return(false);
+ return false;
}
#ifdef _ENABLE_DEBUG
void KoolDock::debug(TQString message)
{
- // debugging function (show messages to stdout)
- kdDebug(0) << "DEBUG: " << message << endl;
+ // Debugging function (show messages to stdout)
+ kdDebug (0) << "DEBUG: " << message << endl;
}
#endif
#ifndef _ENABLE_DEBUG
-void KoolDock::debug(TQString)
+void KoolDock::debug (TQString)
{
}
#endif
void KoolDock::endProg()
{
- if (fHidden==0 && fClipping==1)
- {
- if ((fOrientation & 1)==1)
- {
- setDesktopIconsArea(0,0,dh,dw);
+ if ((fHidden == 0) && (fClipping == 1)) {
+ if ((fOrientation & 1) == 1) {
+ setDesktopIconsArea(0, 0, dh, dw);
}
- else
- {
- setDesktopIconsArea(0,0,dw,dh);
+ else {
+ setDesktopIconsArea(0, 0, dw, dh);
}
}
debug("Clean exit.");
@@ -3002,67 +3023,90 @@ void KoolDock::restart()
cmd = mainPath + " &";
kdDebug(0) << "mainPath: " << mainPath << endl;
debug("Restarting...");
- system(cmd.latin1());
+ int status = system(cmd.latin1());
+ debug(TQString("Status: %1").arg(status));
endProg();
}
void KoolDock::reload()
{
- setupdlg->setEnabled(FALSE);
-
+ setupdlg->setEnabled(false);
+
hide();
- if (wm) delete(wm);
+ if (wm) {
+ delete wm;
+ }
trackTimer->stop();
mkbigTimer->stop();
mksmallTimer->stop();
mTimer->stop();
- if (onChangeTimer != NULL) onChangeTimer->stop();
+ if (onChangeTimer != NULL) {
+ onChangeTimer->stop();
+ }
+ if (trackTimer) {
+ delete trackTimer;
+ }
+ if (mTimer) {
+ delete mTimer;
+ }
+ if (mkbigTimer) {
+ delete mkbigTimer;
+ }
+ if (mksmallTimer) {
+ delete mksmallTimer;
+ }
+ if (onChangeTimer != NULL) {
+ delete onChangeTimer;
+ }
+ if (_filterData) {
+ delete _filterData;
+ }
+ if (rootpix) {
+ delete rootpix;
+ }
+ if (xosdw) {
+ delete xosdw;
+ }
+ if (clipw) {
+ delete clipw;
+ }
+ if (info) {
+ delete info;
+ }
- if (trackTimer) delete(trackTimer);
- if (mTimer) delete(mTimer);
- if (mkbigTimer) delete(mkbigTimer);
- if (mksmallTimer) delete(mksmallTimer);
- if (onChangeTimer != NULL) delete(onChangeTimer);
- if (_filterData) delete(_filterData);
-
- if (rootpix) delete(rootpix);
- if (xosdw) delete(xosdw);
- if (clipw) delete(clipw);
- if (info) delete(info);
-
- if (reloadIcons)
- {
+ if (reloadIcons) {
items.clear();
witems.clear();
}
init1();
init2();
- if (setupdlg->isVisible())
- {
- noSet=true;
+ if (setupdlg->isVisible()) {
+ noSet = true;
editPref();
- if (reloadIcons)
- {
+ if (reloadIcons) {
setupdlg->appClear();
setupdlg->appFill();
}
- noSet=false;
+ noSet = false;
}
}
void KoolDock::chkRestart()
{
- if (initialization) return;
- if (!setupdlg ) return;
+ if (initialization) {
+ return;
+ }
+ if (!setupdlg) {
+ return;
+ }
// this function is called by a timer to check if the dock should be restarted
// or not, depending on what was done in the configuration dialog.
- reloadIcons=setupdlg->toReloadIcons->isChecked();
+ reloadIcons = setupdlg->toReloadIcons->isChecked();
reload();
- reloadIcons=false;
- setupdlg->toReloadIcons->setChecked(FALSE);
+ reloadIcons = false;
+ setupdlg->toReloadIcons->setChecked(false);
}
-
void KoolDock::setMainPath(const TQString& path)
{
mainPath = path;
@@ -3071,106 +3115,145 @@ void KoolDock::setMainPath(const TQString& path)
void KoolDock::setArgs(const TQString& params)
{
args = params;
- if (args=="-options" || args=="-o") editPref();
-
+ if ((args == "-options") || (args == "-o")) {
+ editPref();
+ }
}
void KoolDock::move2(int nx, int ny)
{
- int cx, cy, tmp, xn=0;
- if (xinerama==1) {xn=XinPreviousWidth;}
-
- cx=0;
- if ((fOrientation & 2) == 2) {ny=0; cy=0;} else {ny=dh-h1; cy=dh-h0;}
- if ((fOrientation & 1) == 1)
- {rx=ny; ry=nx;
- tmp=cx;cx=cy;cy=tmp;}
- else
- {rx=nx; ry=ny;}
- //if (fHidden==0) clipw->move(cx,cy);
- if (rx==x0 && ry==dh-h0 && fExpanded==FALSE && w1>dw)
+ int cx, cy, xn=0;
+ if (xinerama == 1) {
+ xn = XinPreviousWidth;
+ }
+
+ cx = 0;
+ if ((fOrientation & 2) == 2) {
+ ny = 0;
+ cy = 0;
+ }
+ else {
+ ny = dh - h1;
+ cy = dh - h0;
+ }
+ if ((fOrientation & 1) == 1)
{
- if (w0>dw)
- {
- Offset=(w1-dw)*lastXPos/dw - rx;
- if ((fOrientation & 1) == 1) ry=0;
- move(xn,ry);
+ rx=ny;
+ ry=nx;
+ std::swap(cx, cy);
+ }
+ else {
+ rx = nx;
+ ry = ny;
+ }
+ if ((rx == x0) && (ry == dh - h0) && (fExpanded == false) && (w1 > dw)) {
+ if (w0 > dw) {
+ Offset = (w1 - dw) * lastXPos/ dw - rx;
+ if ((fOrientation & 1) == 1) {
+ ry = 0;
+ }
+ move(xn, ry);
}
- else
- {
- Offset=0;
- if ((fOrientation & 1) == 1) {ry=0;} else {rx=0;}
- move(rx+xn,ry);
+ else {
+ Offset = 0;
+ if ((fOrientation & 1) == 1) {
+ ry = 0;
+ }
+ else {
+ rx = 0;
+ }
+ move(rx + xn, ry);
}
}
- else
- {
- if ((fOrientation & 1) == 1) {ry=0;} else {rx=0;}
- move(rx+xn,ry);
+ else {
+ if ((fOrientation & 1) == 1) {
+ ry = 0;
+ }
+ else {
+ rx = 0;
+ }
+ move(rx + xn, ry);
}
- rx+=xn;
- //clipw->lower();
+ rx += xn;
}
void KoolDock::resize2(int nw, int nh)
{
- int mw, mh;
- //if (w1>dw && nw>w1)
- nw=dw;
- nh=h1;
- if ((fOrientation & 1) == 1) {rw=nh; rh=nw;} else {rw=nw; rh=nh;}
- if (w1<dw) Offset=0;
- resize(rw,rh);
- nw=dw;
- nh=h0;
- if ((fOrientation & 1) == 1) {mw=nh; mh=nw;} else {mw=nw; mh=nh;}
- //clipw->resize(200, 200);
- //clipw->lower();
+ nw = dw;
+ nh = h1;
+ if ((fOrientation & 1) == 1) {
+ rw = nh;
+ rh = nw;
+ }
+ else {
+ rw = nw;
+ rh = nh;
+ }
+ if (w1 < dw) {
+ Offset = 0;
+ }
+ resize(rw, rh);
+ nw = dw;
+ nh = h0;
}
+
void KoolDock::getBottomBG()
{
- if (fHidden==0) return;
- int p1,p2,p3,p4,pt;
- p1=0;
- if ((fOrientation & 2)==2) {p2=0;} else {p2=dh - h1;}
- p3=dw;
- p4=h1;
- if ((fOrientation & 1)==1)
- {
- pt=p1; p1=p2; p2=pt;
- pt=p3; p3=p4; p4=pt;
+ if (fHidden == 0) {
+ return;
+ }
+ int p1, p2, p3, p4;
+ p1 = 0;
+ if ((fOrientation & 2) ==2) {
+ p2 = 0;
+ }
+ else {
+ p2 = dh - h1;
+ }
+ p3 = dw;
+ p4 = h1;
+ if ((fOrientation & 1) == 1) {
+ std::swap(p1, p2);
+ std::swap(p3, p4);
+ }
+ if (xinerama == 1) {
+ p1 += XinPreviousWidth;
}
- if (xinerama==1) p1+=XinPreviousWidth;
bottomBg = TQPixmap::grabWindow(tqt_xrootwin(), p1, p2, p3, p4);
- //bottomBg = TQPixmap::grabWindow(tqt_xrootwin(), x1, dh - h1, w1, h1);
}
void KoolDock::getTopBG()
{
- int p1,p2,p3,p4,pt;
- p1=0;
- if ((fOrientation & 2)==2) {p2=h0;} else {p2=dh - h1;}
- p3=dw;
- p4=h1 - h0;
- if ((fOrientation & 1)==1)
- {
- pt=p1; p1=p2; p2=pt;
- pt=p3; p3=p4; p4=pt;
+ int p1, p2, p3, p4;
+ p1 = 0;
+ if ((fOrientation & 2) ==2) {
+ p2 = h0;
+ }
+ else {
+ p2 = dh - h1;
+ }
+ p3 = dw;
+ p4 = h1 - h0;
+ if ((fOrientation & 1) ==1) {
+ std::swap(p1, p2);
+ std::swap(p3, p4);
+ }
+ if (xinerama == 1) {
+ p1 += XinPreviousWidth;
}
- if (xinerama==1) p1+=XinPreviousWidth;
topBg = TQPixmap::grabWindow(tqt_xrootwin(), p1, p2, p3, p4);
- //topBg = TQPixmap::grabWindow(tqt_xrootwin(), x1, dh - h1, w1, h1 - h0);
}
void KoolDock::setDesktopIconsArea(int left, int top, int width, int height)
{
- if (fClipIcons==0) return;
+ if (fClipIcons == 0) {
+ return;
+ }
DCOPClient* client = TDEApplication::dcopClient();
if (!client->isAttached()) {
client->attach();
client->registerAs("KoolDock");
}
-
for (int i = 0; i < KWin::numberOfDesktops(); i++) {
TQByteArray data;
TQDataStream args(data, IO_WriteOnly);
@@ -3179,155 +3262,163 @@ void KoolDock::setDesktopIconsArea(int left, int top, int width, int height)
}
}
-void KoolDock::setDockAbove() {
+void KoolDock::setDockAbove()
+{
KWin::setState(winId(), NET::KeepAbove);
raise();
}
-void KoolDock::setDockBelow() {
+void KoolDock::setDockBelow()
+{
KWin::setState(winId(), NET::KeepBelow);
lower();
}
void KoolDock::menuShow()
{
- allApps=false;
- int tcId;
- if (iGroup && menuCount!=0)
- {
- tcId=appMenu->itemParameter(currMenu);
-
- if (tcId==currMenu && menuCount==1)
- {
- allApps=true;
- deskpopup->setItemChecked(dIndex,false);
+ allApps = false;
+
+ if (iGroup && (menuCount != 0)) {
+ int tcId = appMenu->itemParameter(currMenu);
+ if ((tcId == currMenu) && (menuCount == 1)) {
+ allApps = true;
+ deskpopup->setItemChecked(dIndex, false);
return;
}
- cId=tcId;
- KWin::WindowInfo info=KWin::windowInfo(cId,0,NET::WM2AllowedActions);
- deskpopup->setItemChecked(dIndex,false);
- dIndex=info.desktop();
- if (dIndex==-1) dIndex=0;
- deskpopup->setItemChecked(dIndex,true);
- advMenu->setItemChecked(1,info.state() & NET::KeepAbove);
- advMenu->setItemChecked(2,info.state() & NET::KeepBelow);
- advMenu->setItemChecked(3,info.state() & NET::FullScreen);
- advMenu->setItemEnabled(3,info.actionSupported(NET::ActionFullScreen));
+ cId = tcId;
+ KWin::WindowInfo info = KWin::windowInfo(cId, 0, NET::WM2AllowedActions);
+ deskpopup->setItemChecked(dIndex, false);
+ dIndex = info.desktop();
+ if (dIndex == -1) {
+ dIndex = 0;
+ }
+ deskpopup->setItemChecked(dIndex, true);
+ advMenu->setItemChecked(1, info.state() & NET::KeepAbove);
+ advMenu->setItemChecked(2, info.state() & NET::KeepBelow);
+ advMenu->setItemChecked(3, info.state() & NET::FullScreen);
+ advMenu->setItemEnabled(3, info.actionSupported(NET::ActionFullScreen));
}
}
void KoolDock::menuX(int num)
{
- if (iGroup && menuCount!=0)
- {
- currMenu=num;
+ if (iGroup && (menuCount != 0)) {
+ currMenu = num;
}
}
void KoolDock::init1()
{
- initialization=true;
- ptPart=5;
+ initialization = true;
+ ptPart = 5;
// Load the configuration
loadConf();
-
- if (fStayBelow==0 || fHidden==1)
- {
- reparent (0, getWFlags() | WX11BypassWM, pos(),FALSE);
+
+ if ((fStayBelow == 0) || (fHidden == 1)) {
+ reparent(0, getWFlags() | WX11BypassWM, pos(), false);
}
- else
- {
- reparent (0, getWFlags() & !WX11BypassWM, pos(),FALSE);
+ else {
+ reparent(0, getWFlags() & !WX11BypassWM, pos(), false);
}
hide();
-
- // Lets initialize the systray counter
- if (reloadIcons) numSystray=0;
-
- // first, we set our "nice" priority
- if (fPriority > 19) fPriority = DEF_PRIORITY;
- if (fPriority < 0) fPriority = DEF_PRIORITY;
+
+ // Initialize the systray counter
+ if (reloadIcons) {
+ numSystray = 0;
+ }
+
+ // First, set our "nice" priority
+ if (fPriority > 19) {
+ fPriority = DEF_PRIORITY;
+ }
+ if (fPriority < 0) {
+ fPriority = DEF_PRIORITY;
+ }
setpriority(0, 0, fPriority);
debug(TQString("Priority: %1").arg(fPriority));
iwBig2 = iwBig;
-
- lastX=0;
+
+ lastX = 0;
iDist = iwSmall + iSpace;
- funcW = (int)(iDist*fAmount/2);
+ funcW = (int) (iDist * fAmount / 2);
funcH = iwBig - iwSmall;
- iy = iSpace/ 2;
-
+ iy = iSpace / 2;
KWin::setOnAllDesktops(winId(), true);
KWin::setState(winId(), NET::SkipTaskbar | NET::SkipPager);
KWin::setType(winId(), NET::Dock);
- items.setAutoDelete(TRUE);
- popups.setAutoDelete(TRUE);
- desks.setAutoDelete(TRUE);
-
- if(fShowKMenu==1)
- {
- if (fUseKBFX==1)
- {
- if (reloadIcons) items.append(new Item("kmenu", "dcop kicker KBFXInterface showMenu", "KMenu", iwSmall, iwBig2));
+ items.setAutoDelete(true);
+ popups.setAutoDelete(true);
+ desks.setAutoDelete(true);
+
+ if (fShowKMenu == 1) {
+ if (fUseKBFX == 1) {
+ if (reloadIcons) {
+ items.append(new Item("kmenu", "dcop kicker KBFXInterface showMenu", "KMenu", iwSmall, iwBig2));
+ }
}
- else
- {
- if (reloadIcons) items.append(new Item("kmenu", "dcop kicker kicker popupKMenu 0", "KMenu", iwSmall, iwBig2));
+ else {
+ if (reloadIcons) {
+ items.append(new Item("kmenu", "dcop kicker kicker popupKMenu 0", "KMenu", iwSmall, iwBig2));
+ }
}
}
-
- //Lets load the menu entries
- if (reloadIcons) loadMenu();
- if (items.count()==0)
- {
+ // Load the menu entries
+ if (reloadIcons) {
+ loadMenu();
+ }
+ if (items.count() == 0) {
items.append(new Item("kooldock", "kooldock -k; kooldock -o" , "K", iwSmall, iwBig2));
}
// Create the "xosd" widget
xosdw = new xosd();
- rdh=TQApplication::desktop()->height();
- xosdw->move(0,rdh);
-
+ rdh = TQApplication::desktop()->height();
+ xosdw->move(0, rdh);
+
wm = new KWinModule();
-
- info = new NETWinInfo( tqt_xdisplay(), winId(), tqt_xrootwin(), NET::WMState);
- info->setDesktop( NETWinInfo::OnAllDesktops );
+
+ info = new NETWinInfo(tqt_xdisplay(), winId(), tqt_xrootwin(), NET::WMState);
+ info->setDesktop(NETWinInfo::OnAllDesktops);
info->setState(NETWinInfo::SkipTaskbar | NETWinInfo::SkipPager, NETWinInfo::SkipTaskbar | NETWinInfo::SkipPager);
setBackgroundMode(NoBackground);
-
+
// Load the ignore List
loadIgnore();
xosd_st = 0;
xosdw->setFont(xosdFont);
- if (xosdItalic == true) xosdw->setItalic();
- if (xosdBold == true) xosdw->setBold();
+ if (xosdItalic == true) {
+ xosdw->setItalic();
+ }
+ if (xosdBold == true) {
+ xosdw->setBold();
+ }
xosdw->setSize(xosdSize);
xosdw->setShadowOffset(xosdShadowOffset);
xosdw->setColor(xosdColor);
xosdw->setShadowColor(xosdShadowColor);
-
+
// Show task bar
- if (fShowTaskbar)
- {
- //Lets add the necesary windows
- if (reloadIcons) {firstTime=true;addWindows();}
+ if (fShowTaskbar) {
+ // Add the necesary windows
+ if (reloadIcons) {
+ firstTime = true;
+ addWindows();
+ }
connect(wm, SIGNAL(activeWindowChanged(WId)), SLOT(activeWindowChanged(WId)));
-
}
connect(wm, SIGNAL(windowAdded(WId)), SLOT(windowAdded(WId)));
connect(wm, SIGNAL(windowRemoved(WId)), SLOT(windowRemoved(WId)));
connect(wm, SIGNAL(windowChanged(WId, unsigned int)), SLOT(windowChanged(WId, unsigned int)));
- if (fSystray)
- {
+ if (fSystray) {
/* System Tray implementation (hope this works - Francisco) */
connect(wm, SIGNAL(systemTrayWindowAdded(WId)), SLOT(systemTrayWindowAdded(WId)));
connect(wm, SIGNAL(systemTrayWindowRemoved(WId)), SLOT(systemTrayWindowRemoved(WId)));
-
+
TQCString screenstr;
screenstr.setNum(tqt_xscreen());
TQCString trayatom = "_NET_SYSTEM_TRAY_S" + screenstr;
@@ -3339,109 +3430,76 @@ void KoolDock::init1()
// Acquire system tray
XSetSelectionOwner(display, net_system_tray_selection, winId(), CurrentTime);
-
- //WId root = tqt_xrootwin();
-
- if (XGetSelectionOwner (display, net_system_tray_selection) == winId())
- {
- XClientMessageEvent xev;
-
- xev.type = ClientMessage;
- //xev.window = root;
-
- xev.message_type = XInternAtom (display, "MANAGER", False);
- xev.format = 32;
- xev.data.l[0] = CurrentTime;
- xev.data.l[1] = net_system_tray_selection;
- xev.data.l[2] = winId();
- xev.data.l[3] = 0;
- xev.data.l[4] = 0;
-
- //XSendEvent (display, root, False, StructureNotifyMask, (XEvent *)&xev);
- }
}
connect(wm, SIGNAL(currentDesktopChanged(int)), SLOT(currentDesktopChanged(int)));
connect(wm, SIGNAL(workAreaChanged()), SLOT(workAreaChanged()));
-
+
// Pseudo-Transparency code
rootpix = new KRootPixmap(this);
- rootpix->setCustomPainting(TRUE);
- connect(rootpix, SIGNAL(backgroundUpdated (const TQPixmap &)), SLOT(updateBackground(const TQPixmap &)));
+ rootpix->setCustomPainting(true);
+ connect(rootpix, SIGNAL(backgroundUpdated(const TQPixmap &)), SLOT(updateBackground(const TQPixmap &)));
rootpix->start();
debug(TQString("Items loaded: %1").arg(items.count()));
- //Simple work around to support xinerama (user defined)
- if(xinerama==0)
- {
- dw=TQApplication::desktop()->width();
+ // Simple work around to support xinerama (user defined)
+ if (xinerama == 0) {
+ dw = TQApplication::desktop()->width();
dh = TQApplication::desktop()->height();
}
- else
- {
- dw=leftRes;
- dh=XinDesiredHeight;
+ else {
+ dw = leftRes;
+ dh = XinDesiredHeight;
}
-
+
xosdw->setClear(fCleaner);
xosdw->setOrientation(fOrientation & 1, dw, rdh);
-
+
// All icons to small size
unsigned int i;
- for (i=0; i < items.count() + 1; i++)
- {
+ for (i = 0; i < items.count() + 1; i++) {
iSize[i] = iwSmall;
}
- for (i=0; i < items.count() + 1; i++)
- {
- cx[i] = iSpace + i*iDist + iwSmall/2;
+ for (i = 0; i < items.count() + 1; i++) {
+ cx[i] = iSpace + i * iDist + iwSmall / 2;
cur_cx[i] = cx[i];
}
- if ((fOrientation & 1)==1)
- {
- int tmpdw;
- tmpdw=dw;
- dw=dh;
- dh=tmpdw;
+ if ((fOrientation & 1) == 1) {
+ std::swap(dw, dh);
}
- if (fOrientation==2 || fOrientation==1)
- {
+ if ((fOrientation == 2) || (fOrientation == 1)) {
TQString tmpstr;
- tmpstr=fLeftImg;
- fLeftImg=fRightImg;
- fRightImg=tmpstr;
+ tmpstr = fLeftImg;
+ fLeftImg = fRightImg;
+ fRightImg = tmpstr;
}
-
- Offset=0;
-
- xosdw->move2(0,rdh);
+
+ Offset = 0;
+ xosdw->move2(0, rdh);
xosdw->show();
- //setMouseTracking(TRUE);
- fExpanded=FALSE;
- // Timer to track the mouse position
- // When the mouse pointer reaches the bottom of the screen, the bar should popup in a userdefined time (int hideTimer)
-
- track2active=FALSE;
+ fExpanded = false;
+ // Timer to track the mouse position
+ // When the mouse pointer reaches the bottom of the screen, the bar should popup in a userdefined time (int hideTimer)
+ track2active = false;
trackTimer = new TQTimer(this);
connect(trackTimer, SIGNAL(timeout()), this, SLOT(trackTimerEnd()));
-
+
ii_first = 0;
ii_last = items.count() - 1;
-
iOnClick = -1;
onChangeTimer = NULL;
Ybase = 0;
- soffset=0;
- eoffset=0;
- last_ncx=0;
+ soffset = 0;
+ eoffset = 0;
+ last_ncx = 0;
- /* For the the onscreen text (icon names) */
+ // For the the onscreen text (icon names)
nom = "";
aux = "";
mTimer = new TQTimer(this);
connect(mTimer, SIGNAL(timeout()), this, SLOT(mTimerEnd()));
-
+
_filterData = new KURIFilterData();
mkbigTimer = new TQTimer(this);
@@ -3451,116 +3509,152 @@ void KoolDock::init1()
connect(mksmallTimer, SIGNAL(timeout()), this, SLOT(mksmallTimerDo()));
TQWMatrix m;
- m.rotate( -90*fOrientation );
- if (!fLeftImg.isEmpty())
- {
+ m.rotate(-90 * fOrientation);
+ if (!fLeftImg.isEmpty()) {
LeftImg.load(fLeftImg);
- LeftImg = LeftImg.xForm( m );
+ LeftImg = LeftImg.xForm(m);
}
- if (!fRightImg.isEmpty())
- {
+ if (!fRightImg.isEmpty()) {
RightImg.load(fRightImg);
- RightImg = RightImg.xForm( m );
+ RightImg = RightImg.xForm(m);
}
- if (!fCenterImg.isEmpty())
- {
+ if (!fCenterImg.isEmpty()) {
CenterImg.load(fCenterImg);
- CenterImg = CenterImg.xForm( m );
+ CenterImg = CenterImg.xForm(m);
}
-
- if (fHidden==1)
- {
- move (0,rdh);
+
+ if (fHidden == 1) {
+ move(0, rdh);
}
debug("Kooldock has started");
-
- doUpdateGeometry();
- if ((fOrientation & 1)==1) {offscr = TQPixmap(h1, dw); bottomBgf = TQPixmap(h1, dw);} else {offscr = TQPixmap(dw, h1); bottomBgf = TQPixmap(dw, h1);}
-
- soffset = iwSmall/2 + func2(abs(1-funcW)) + func2(abs(iDist+1-funcW)) + func2(abs(2*iDist+1-funcW)) + func2(abs(3*iDist +1-funcW))/2 - ((int)((iwBig - iwSmall)*0.6*fAmount) + iSpace*2)/2 - 4*iwSmall - (int)((3*iDist+1-funcW)*(func(0) + func(iDist) - 2*iwSmall)/(2*iDist))+1;
- eoffset=(int)((iwBig2-iwSmall)*fAmount/100);
+
doUpdateGeometry();
+ if ((fOrientation & 1) == 1) {
+ offscr = TQPixmap(h1, dw);
+ bottomBgf = TQPixmap(h1, dw);
+ }
+ else {
+ offscr = TQPixmap(dw, h1);
+ bottomBgf = TQPixmap(dw, h1);
+ }
+ soffset = iwSmall / 2 + func2(abs(1 - funcW)) +
+ func2(abs(iDist + 1 - funcW)) +
+ func2(abs(2 * iDist + 1 - funcW)) +
+ func2(abs(3 * iDist + 1 -funcW)) / 2 - ((int) ((iwBig - iwSmall) * 0.6 * fAmount) +
+ iSpace * 2) / 2 - 4 * iwSmall - (int) ((3 * iDist + 1 - funcW) * (func(0) + func (iDist) - 2 * iwSmall) / (2 * iDist)) + 1;
+ eoffset= (int) ((iwBig2 - iwSmall) * fAmount / 100);
+ doUpdateGeometry();
}
void KoolDock::init2()
{
clipw = new clip();
-
- if (fHidden==1)
- {
- clipw->resize(0,0);
- clipw->move(-10,-10);
+
+ if (fHidden == 1) {
+ clipw->resize(0, 0);
+ clipw->move(-10, -10);
}
- else
- {
+ else {
int cx, cy;
- cx=0;
- if ((fOrientation & 2) == 2) {cy=0;} else {cy=dh-h0;}
- if ((fOrientation & 1) == 1)
- {clipw->move(cy,cx);clipw->resize(h0,dw);}
- else
- {clipw->move(cx,cy);clipw->resize(dw,h0);}
+ cx = 0;
+ if ((fOrientation & 2) == 2) {
+ cy = 0;
+ }
+ else {
+ cy = dh - h0;
+ }
+ if ((fOrientation & 1) == 1) {
+ clipw->move(cy, cx);
+ clipw->resize(h0, dw);
+ }
+ else {
+ clipw->move(cx, cy);
+ clipw->resize(dw, h0);
+ }
}
KWin::setOnAllDesktops(clipw->winId(), true);
KWin::setState(clipw->winId(), NET::KeepBelow);
clipw->lower();
clipw->show();
-
+
animValue = 0;
- animState = TRUE;
+ animState = true;
- if (fHidden==0)
- {
- resize2(w0,h0);
+ if (fHidden == 0) {
+ resize2(w0, h0);
rootpix->repaint(true);
}
- //Create desktop clipper widget
-
- if (fHidden==0 && fClipping==1)
- {
- //clipping desktop
- if (fOrientation==0) {clipw->clipDesktop(0, 0, 0, 0, 0, 0, 0, 0, 0, h0, 0, dh);setDesktopIconsArea(0,0,dw,dh-h0);}
- if (fOrientation==1) {clipw->clipDesktop(0, 0, 0, h0, 0, dh, 0, 0, 0, 0, 0, 0);setDesktopIconsArea(0,0,dh-h0,dw);}
- if (fOrientation==2) {clipw->clipDesktop(0, 0, 0, 0, 0, 0, h0, 0, dh, 0, 0, 0);setDesktopIconsArea(0,h0,dw,dh);}
- if (fOrientation==3) {clipw->clipDesktop(h0, 0, dh, 0, 0, 0, 0, 0, 0, 0, 0, 0);setDesktopIconsArea(h0,0,dh,dw);}
- }
- if (fStayBelow==1 && fHidden==0) setDockBelow();
- setAcceptDrops(TRUE);
- useList=false;
- if (fSpeed) ptPart=0; else ptPart=1;
- if (fHidden==0) paintEvent(NULL);
- if (ptPart==0)
- enterEvent(NULL);
- else
+ // Create desktop clipper widget
+ if ((fHidden == 0) && (fClipping == 1)) {
+ // Clipping desktop
+ if (fOrientation == 0) {
+ clipw->clipDesktop(0, 0, 0, 0, 0, 0, 0, 0, 0, h0, 0, dh);
+ setDesktopIconsArea(0, 0, dw, dh - h0);
+ }
+ if (fOrientation == 1) {
+ clipw->clipDesktop(0, 0, 0, h0, 0, dh, 0, 0, 0, 0, 0, 0);
+ setDesktopIconsArea(0, 0, dh - h0, dw);
+ }
+ if (fOrientation == 2) {
+ clipw->clipDesktop(0, 0, 0, 0, 0, 0, h0, 0, dh, 0, 0, 0);
+ setDesktopIconsArea(0, h0, dw, dh);
+ }
+ if (fOrientation == 3) {
+ clipw->clipDesktop(h0, 0, dh, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ setDesktopIconsArea(h0, 0, dh, dw);
+ }
+ }
+ if ((fStayBelow == 1) && (fHidden == 0)) {
+ setDockBelow();
+ }
+ setAcceptDrops(true);
+ useList = false;
+ if (fSpeed) {
+ ptPart = 0;
+ }
+ else {
+ ptPart = 1;
+ }
+ if (fHidden == 0) {
+ paintEvent(NULL);
+ }
+ if (ptPart == 0) {
+ enterEvent(NULL);
+ }
+ else {
pTest();
+ }
}
void KoolDock::pTest()
{
-
- if (ptPart==0)
- {
- onleaveEvent(NULL); ptPart=1;
+ if (ptPart == 0) {
+ onleaveEvent(NULL);
+ ptPart = 1;
return;
}
-
- //Finalize initialization
- if(fHidden==1)
- {
- trackTimer->start(250, FALSE);
+
+ // Finalize initialization
+ if (fHidden == 1) {
+ trackTimer->start(250, false);
}
- else
- {
- mTimer->start(250, FALSE);
+ else {
+ mTimer->start(250, false);
+ }
+ oldDesktop = KWin::currentDesktop();
+ initialization = false;
+ if (fShowTaskbar) {
+ addWindows();
}
- oldDesktop=KWin::currentDesktop();
- initialization=false;
- if (fShowTaskbar) addWindows();
show();
- if (fHidden==0) paintEvent(NULL);
- setupdlg->setEnabled(TRUE);
- if (fFirstRun) editPref();
+ if (fHidden == 0) {
+ paintEvent(NULL);
+ }
+ setupdlg->setEnabled(true);
+ if (fFirstRun) {
+ editPref();
+ }
updTaskList();
}
@@ -3568,19 +3662,20 @@ void KoolDock::refreshBackground()
{
getBottomBG();
getTopBG();
- if (dockOpacity > 0) {bitBlt(&bottomBgf,0,0,&bottomBg);KPixmapEffect::fade(bottomBgf, ((float)dockOpacity)*0.01, bgColor);}
+ if (dockOpacity > 0) {
+ bitBlt(&bottomBgf, 0, 0, &bottomBg);
+ KPixmapEffect::fade(bottomBgf, ((float) dockOpacity) * 0.01, bgColor);
+ }
show();
paintEvent(NULL);
}
void KoolDock::dragMoveEvent(TQDragMoveEvent* event)
{
- if (mouseOnLauncher && TQTextDrag::canDecode(event))
- {
+ if (mouseOnLauncher && TQTextDrag::canDecode(event)) {
event->accept();
}
- else
- {
+ else {
event->ignore();
}
}
@@ -3588,46 +3683,47 @@ void KoolDock::dragMoveEvent(TQDragMoveEvent* event)
void KoolDock::dropEvent(TQDropEvent* event)
{
TQString strDrop;
- TQPoint pointer;
- pointer = TQCursor::pos();
+ TQPoint pointer = TQCursor::pos();
int px, py;
-
- px = pointer.x()-pos().x();
- py = pointer.y()-pos().y();
-
+
+ px = pointer.x() - pos().x();
+ py = pointer.y() - pos().y();
+
TQTextDrag::decode(event, strDrop);
- lstDrop=TQStringList::split(TQString("\n"),strDrop,false);
+ lstDrop = TQStringList::split(TQString("\n"), strDrop, false);
- useList=true;
- mPress (px, py, TQt::LeftButton);
- useList=false;
+ useList = true;
+ mPress(px, py, TQt::LeftButton);
+ useList = false;
}
void KoolDock::movetoback(WId id)
{
int i;
- Item *item;
- int ic=-1,jc;
+ Item* item;
+ int ic = -1, jc;
TQCString cls;
-
- //find clicked item in witems list
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- if (item->getId()==id) {ic=i;break;}
-
- if (ic>=0)
- {
- jc=witems.at(ic)->getIndex(); //get item stack index
- for (i=0, item = witems.at(0); item; i++, item = witems.next())
- {
- if (item->getIndex()>jc) item->setIndex(item->getIndex()-1);
+
+ //find clicked item in witems list
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getId() == id) {
+ ic = i;
+ break;
}
- //move clicked item to last position in the stack
- witems.at(ic)->setIndex(witems.count()-1);
+ }
+
+ if (ic >= 0) {
+ jc = witems.at(ic)->getIndex(); // Get item stack index
+ for (i = 0, item = witems.at(0); item; i++, item = witems.next()) {
+ if (item->getIndex() > jc) {
+ item->setIndex(item->getIndex() - 1);
+ }
+ }
+ // Move clicked item to last position in the stack
+ witems.at(ic)->setIndex(witems.count() - 1);
cls = witems.at(ic)->getClass();
- for (i=numLaunchers, item = items.at(numLaunchers); item; i++, item = items.next())
- {
- if (item->getClass()==cls)
- {
+ for (i= numLaunchers, item = items.at(numLaunchers); item; i++, item = items.next()) {
+ if (item->getClass() == cls) {
item->setId(witems.at(ic)->getId());
item->setName(witems.at(ic)->getName());
break;
@@ -3638,22 +3734,29 @@ void KoolDock::movetoback(WId id)
int KoolDock::itemFromPoint(int x)
{
- int i, Xpos=-1;
- for (i=0; i<(int)items.count(); i++)
- {
- Xpos=xFromIndex(i);
- if ((x+iSpace/2)>Xpos && (x-iSpace)<(Xpos+iSize[i])) break;
+ int i, Xpos = -1;
+ for (i = 0; i < (int) items.count(); i++) {
+ Xpos = xFromIndex(i);
+ if (((x + iSpace / 2) > Xpos) && ((x-iSpace) < (Xpos+iSize[i]))) {
+ break;
+ }
}
- currXPos=Xpos;
+ currXPos = Xpos;
return i;
}
int KoolDock::xFromIndex(int i)
{
int Xpos;
- if(i < ii_first){Xpos = cur_cx[i] - iwSmall/2 + SPACE_W;}
- else if(i >= ii_first && i <= ii_last){Xpos = cur_cx[i] - iSize[i]/2 + adjust+soffset;}
- else if(i > ii_last){Xpos = cur_cx[i] - iwSmall/2 + adjust + SPACE_W - 3+soffset*0;}
+ if (i < ii_first) {
+ Xpos = cur_cx[i] - iwSmall / 2 + SPACE_W;
+ }
+ else if ((i >= ii_first) && (i <= ii_last)) {
+ Xpos = cur_cx[i] - iSize[i] / 2 + adjust + soffset;
+ }
+ else if (i > ii_last) {
+ Xpos = cur_cx[i] - iwSmall / 2 + adjust + SPACE_W - 3 + soffset * 0;
+ }
return Xpos;
}
@@ -3667,38 +3770,39 @@ void KoolDock::aboutToHide()
menuCount--;
}
-void KoolDock::createMenu(TDEPopupMenu* tmpMenu, KWin::WindowInfo * info)
+void KoolDock::createMenu(TDEPopupMenu* tmpMenu, KWin::WindowInfo* info)
{
TQString appTitle;
int menustate;
appTitle = info->visibleName();
appTitle.truncate(30);
-
+
tmpMenu->insertTitle(appTitle);
-
tmpMenu->insertItem(i18n("Ad&vanced"), advMenu);
-
+
menustate = tmpMenu->insertItem(SmallIcon("move"), i18n("&Move"), this, SLOT(moveApp()));
tmpMenu->setItemEnabled(menustate, info->actionSupported(NET::ActionMove));
-
+
menustate = tmpMenu->insertItem(i18n("Re&size"), this, SLOT(resizeApp()));
tmpMenu->setItemEnabled(menustate, info->actionSupported(NET::ActionMove));
-
+
menustate = tmpMenu->insertItem(i18n("Mi&nimize"), this, SLOT(minApp()));
- if (info->isMinimized()) tmpMenu->setItemChecked(menustate, true);
+ if (info->isMinimized()) {
+ tmpMenu->setItemChecked(menustate, true);
+ }
tmpMenu->setItemEnabled(menustate, info->actionSupported(NET::ActionMinimize));
-
+
menustate = tmpMenu->insertItem(i18n("Ma&ximize"), this, SLOT(maxApp()));
- if ((info->state() & NET::Max) && !info->isMinimized()) tmpMenu->setItemChecked(menustate, true);
+ if ((info->state() & NET::Max) && !info->isMinimized()) {
+ tmpMenu->setItemChecked(menustate, true);
+ }
tmpMenu->setItemEnabled(menustate, info->actionSupported(NET::ActionMax));
-
+
menustate = tmpMenu->insertItem(i18n("&Shade"), this, SLOT(shadeApp()));
- if (info->state() & NET::Shaded) tmpMenu->setItemChecked(menustate, true);
+ if (info->state() & NET::Shaded) {
+ tmpMenu->setItemChecked(menustate, true);
+ }
tmpMenu->setItemEnabled(menustate, info->actionSupported(NET::ActionShade));
-
- //menustate = tmpMenu->insertItem(i18n("&Restore"), this, SLOT(restApp()));
- //if (!info->isMinimized() && info->state() != NET::Max) tmpMenu->setItemEnabled(menustate, false);
-
tmpMenu->insertItem(SmallIcon("forward"), i18n("&Move to Desktop"), deskpopup);
tmpMenu->insertSeparator();
tmpMenu->insertItem(SmallIcon("window-close"), i18n("&Close"), this, SLOT(closeApp()));
@@ -3706,58 +3810,60 @@ void KoolDock::createMenu(TDEPopupMenu* tmpMenu, KWin::WindowInfo * info)
void KoolDock::updTaskList()
{
-
- if (!fShowNav) return;
-
- desks.setAutoDelete (true);
+ if (!fShowNav) {
+ return;
+ }
+
+ desks.setAutoDelete(true);
//tasklist; menu to access every window throught navigation menu
int j, index, incr, nDesks;
KWin::WindowInfo tmpinfo;
-
- nDesks=KWin::numberOfDesktops();
-
+
+ nDesks = KWin::numberOfDesktops();
+
tasklist->clear();
desks.clear();
- for(index=0; index<=nDesks; index++)
- {
- desks.append (new dInfo);
+ for (index = 0; index <= nDesks; index++) {
+ desks.append(new dInfo);
}
-
+
KWin::WindowInfo info;
TQValueList<WId>::ConstIterator it;
- for (it=wm->windows().begin(); it != wm->windows().end(); ++it)
- {
- tmpinfo=KWin::windowInfo(*it);
-
- const int SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask;
+ for (it = wm->windows().begin(); it != wm->windows().end(); ++it) {
+ tmpinfo = KWin::windowInfo(*it);
+
+ const int SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask |
+ NET::ToolbarMask | NET::MenuMask | NET::DialogMask |
+ NET::OverrideMask | NET::TopMenuMask |
+ NET::UtilityMask | NET::SplashMask;
TQString name = tmpinfo.visibleName();
-
- if (tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Normal || tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Override || tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Dialog || tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Unknown)
- {
- if ((tmpinfo.state() & NET::SkipTaskbar) == 0)
- {
- if (ignored(tmpinfo.name()) == false)
- {
- index=tmpinfo.desktop();
- if (index==-1) index=0;
-
- incr=0;
-
- if (!desks.at(index)->gBool())
- {
- desks.current()->sBool(true);
- if (index==0)
- {tasklist->insertTitle(i18n("All desktops"),-1,desks.current()->gInt());}
- else
- {tasklist->insertTitle(i18n("Desktop %1").arg(index),-1,desks.current()->gInt());}
+
+ if (tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Normal ||
+ tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Override ||
+ tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Dialog ||
+ tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Unknown) {
+ if ((tmpinfo.state() & NET::SkipTaskbar) == 0) {
+ if (ignored (tmpinfo.name()) == false) {
+ index = tmpinfo.desktop();
+ if (index == -1) {
+ index = 0;
+ }
+ incr = 0;
+ if (!desks.at(index)->gBool()) {
+ desks.current()->sBool(true);
+ if (index == 0) {
+ tasklist->insertTitle(i18n("All desktops"), -1, desks.current()->gInt());
+ }
+ else {
+ tasklist->insertTitle(i18n("Desktop %1").arg(index), -1, desks.current()->gInt());
+ }
incr++;
}
- tasklist->insertItem(KWin::icon(*it), tmpinfo.visibleName(), *it, desks.current()->gInt()+incr);
+ tasklist->insertItem(KWin::icon(*it), tmpinfo.visibleName(), *it, desks.current()->gInt() +incr);
incr++;
- for(j=index; j<=nDesks; j++)
- {
+ for (j = index; j <= nDesks; j++) {
desks.at(j)->inc(incr);
}
}
@@ -3769,51 +3875,56 @@ void KoolDock::updTaskList()
void KoolDock::addToTaskList(WId id)
{
int i;
- Item *item;
- int index, rIndex, j, incr=0, decr=0;
- KWin::WindowInfo tmpinfo;
- tmpinfo=KWin::windowInfo(id);
- nDesks=KWin::numberOfDesktops();
+ Item* item;
+ int index, rIndex, j, incr = 0, decr = 0;
+ KWin::WindowInfo tmpinfo = KWin::windowInfo(id);
+ nDesks = KWin::numberOfDesktops();
rIndex = tmpinfo.desktop();
- const int SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask;
+ const int SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask |
+ NET::ToolbarMask | NET::MenuMask | NET::DialogMask |
+ NET::OverrideMask | NET::TopMenuMask |
+ NET::UtilityMask | NET::SplashMask;
TQString name = tmpinfo.visibleName();
-
- if (tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Normal || tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Override || tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Dialog || tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Unknown)
- {
- if ((tmpinfo.state() & NET::SkipTaskbar) == 0)
- {
- if (ignored(tmpinfo.name()) == false)
- {
-
- if (rIndex==0) return;
- index=rIndex;
- if (index==-1) index=0;
-
- if (!desks.at(index)->gBool())
- {
- desks.at(index)->sBool(true);
- if (index==0)
- {tasklist->insertTitle(i18n("All desktops"),-1,desks.at(index)->gInt());}
- else
- {tasklist->insertTitle(i18n("Desktop %1").arg(index),-1,desks.at(index)->gInt());}
+
+ if (tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Normal ||
+ tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Override ||
+ tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Dialog ||
+ tmpinfo.windowType(SUPPORTED_WINDOW_TYPES) == NET::Unknown) {
+ if ((tmpinfo.state() & NET::SkipTaskbar) == 0) {
+ if (ignored(tmpinfo.name()) == false) {
+ if (rIndex == 0) {
+ return;
+ }
+ index = rIndex;
+ if (index == -1) {
+ index = 0;
+ }
+ if (!desks.at(index)->gBool()) {
+ desks.at(index)->sBool(true);
+ if (index == 0) {
+ tasklist->insertTitle(i18n("All desktops"), -1, desks.at(index)->gInt());
+ }
+ else {
+ tasklist->insertTitle(i18n("Desktop %1").arg(index), -1, desks.at(index)->gInt());
+ }
incr++;
}
- else
- {
- if (fShowTaskbar)
- {
- for (i=witems.count(), item = witems.at(i); item; i--, item = witems.prev())
- {
- if (item->getId()==id) break;
- if (item->info.desktop()==rIndex) decr++;
+ else {
+ if (fShowTaskbar) {
+ for (i = witems.count(), item = witems.at(i); item; i--, item = witems.prev()) {
+ if (item->getId() == id) {
+ break;
+ }
+ if (item->info.desktop() == rIndex) {
+ decr++;
+ }
}
}
}
- tasklist->insertItem(KWin::icon(id), tmpinfo.visibleName(), id, desks.at(index)->gInt()+incr-decr);
+ tasklist->insertItem(KWin::icon(id), tmpinfo.visibleName(), id, desks.at(index)->gInt() + incr - decr);
incr++;
- for(j=index; j<=nDesks; j++)
- {
+ for (j = index; j <= nDesks; j++) {
desks.at(j)->inc(incr);
}
}
@@ -3823,30 +3934,24 @@ void KoolDock::addToTaskList(WId id)
void KoolDock::rmFromTaskList(WId id)
{
- nDesks=KWin::numberOfDesktops();
+ nDesks = KWin::numberOfDesktops();
int i, j, k, dec=0;
- int index=0;
- i=tasklist->indexOf(id);
- index=tasklist->idAt(i);
- if (index==id)
- {
+ unsigned int index = 0;
+ i = tasklist->indexOf(id);
+ index = tasklist->idAt(i);
+ if (index == id) {
tasklist->removeItem(id);
dec--;
- for(j=0; j<=nDesks; j++)
- {
- if (desks.at(j)->gBool() && desks.at(j)->gInt()>=i+1)
- {
- if (desks.at(j)->gInt()==i+1)
- {
- if (tasklist->text(tasklist->idAt(i-1)).isNull() && tasklist->text(tasklist->idAt(i)).isNull())
- {
+ for (j = 0; j <= nDesks; j++) {
+ if (desks.at(j)->gBool() && (desks.at(j)->gInt() >= i + 1)) {
+ if (desks.at(j)->gInt() == i + 1) {
+ if (tasklist->text(tasklist->idAt(i - 1)).isNull() && tasklist->text(tasklist->idAt(i)).isNull()) {
dec--;
desks.at(j)->sBool(false);
- tasklist->removeItemAt(i-1);
+ tasklist->removeItemAt(i - 1);
}
}
- for(k=j; k<=nDesks; k++)
- {
+ for (k = j; k <= nDesks; k++) {
desks.at(k)->inc(dec);
}
break;
@@ -3854,4 +3959,3 @@ void KoolDock::rmFromTaskList(WId id)
}
}
}
-