[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    kicker strut patch
From:       Matthias Elter <me () caldera ! de>
Date:       2000-09-12 9:36:01
[Download RAW message or body]

Hi

The attached kicker patch

- sets correct struts
- fixes user hide
- fixes auto hide
- fixes workarea updates

Bye,
Matthias

-- 
    _____     ___
   /  __/____/  /                Caldera (Deutschland) GmbH
  /  /_/ __  / /__           Naegelsbachstr. 49c, 91052 Erlangen
 /_____//_/ /____/          Matthias Elter,  email: me@caldera.de
==== /_____/ ======   phone: ++49 9131 7192 300, fax: ++49 9131 7192 399
 Caldera OpenLinux                  http://www.caldera.de

["kicker-strut.patch" (text/x-c++)]

? diff
Index: panel.cpp
===================================================================
RCS file: /home/kde/kdebase/kicker/core/panel.cpp,v
retrieving revision 1.10
diff -u -b -B -r1.10 panel.cpp
--- panel.cpp	2000/09/12 07:55:59	1.10
+++ panel.cpp	2000/09/12 09:33:00
@@ -98,15 +98,11 @@
 
    // left/top hide button
   _ltHB = new HideButton(position(), this);
-  // _ltHB->setFocusPolicy(QWidget::StrongFocus);
-  // _ltHB->setMouseTracking(true);
   _ltHB->installEventFilter( this );
   connect( _ltHB, SIGNAL( clicked() ), this, SLOT( hideLeft() ) );
 
    // right/bottom hide button
   _rbHB = new HideButton( position(), this );
-  // _rbHB->setFocusPolicy(QWidget::StrongFocus);
-  // _rbHB->setMouseTracking(true);
   _rbHB->installEventFilter( this );
   connect( _rbHB, SIGNAL( clicked() ), this, SLOT( hideRight() ) );
 
@@ -115,7 +111,6 @@
   _appletAreaBox->enableX11EventFilter(true);
   _appletAreaBox->setFrameStyle(QFrame::WinPanel  | QFrame::Raised);
   _appletAreaBox->setLineWidth(1);
-  // _appletAreaBox->setMouseTracking(true);
   _appletAreaBox->installEventFilter( this );
 
   // applet area
@@ -135,7 +130,7 @@
 
 Panel::~Panel()
 {
-  kdDebug() << "panel destructor" << endl;
+  kdDebug() << "Panel::~Panel()" << endl;
   delete _opMnu;
   writeConfig();
 }
@@ -350,20 +344,21 @@
 
 QRect Panel::initialGeometry()
 {
-    QRect r = QApplication::desktop()->geometry();
-    QRect a = PGlobal::kwin_module->workArea();
+    QValueList<WId> exclude;
+    exclude.append(winId());
+    QRect a = PGlobal::kwin_module->workArea(exclude);
 
     switch( _pos ) {
     case Left:
-        return QRect(  r.left(), a.top(), _panelsize, r.bottom()+1 - a.top() );
+        return QRect(  a.left(), a.top(), _panelsize, a.bottom()+1 - a.top() );
     case Right:
-        return QRect(  r.right() - _panelsize + 1, a.top(), _panelsize, r.bottom()+1 - a.top() );
+        return QRect(  a.right() - _panelsize + 1, a.top(), _panelsize, a.bottom()+1 - a.top() );
     case Top:
-        return QRect(  r.left(), r.top(), r.width(), _panelsize );
+        return QRect(  a.left(), a.top(), a.width(), _panelsize );
     case Bottom:
-    default:
-        return QRect(  r.left(), r.bottom() - _panelsize + 1, r.width(), _panelsize );
+        return QRect(  a.left(), a.bottom() - _panelsize + 1, a.width(), _panelsize );
     }
+    return QRect(  a.left(), a.bottom() - _panelsize + 1, a.width(), _panelsize );
 }
 
 /* 1 is the initial speed, hide_show_animation is the top speed. */
@@ -372,28 +367,26 @@
 
 void Panel::hideLeft()
 {
-    _rbHB->setFocus();
     animatedHide(true);
 }
 
 void Panel::hideRight()
 {
-    _ltHB->setFocus();
     animatedHide(false);
 }
 
 void Panel::animatedHide(bool left)
 {
-    blockUserInput( TRUE );
-    QRect geom( initialGeometry() );
+    blockUserInput(true);
+    QRect geom(initialGeometry());
 
-    if ( geom != geometry() ) {
+    if (geom != geometry()) {
 
 	// SHOW
 
 	if ( isVertical() ) {
 
-	    int strut = _ltHB->geometry().bottom();
+	    int strut = _ltHB->height();
 
 	    if (_hideAnim) {
 
@@ -403,9 +396,10 @@
 		    qApp->syncX();
 		    qApp->processEvents();
 		}
+	    }
 	    }
-	} else {
-	    int strut = _ltHB->geometry().right();
+	else {
+	    int strut = _ltHB->width();
 	    if(_hideAnim)
 		{
 		    for (int i = geom.width()-strut; i>0;i-=PANEL_SPEED(i,geom.width()) )
@@ -422,15 +416,18 @@
 	_userHidden = false;
 	updateWindowManager();
 	raise();
-    } else {
+    }
+    else {
+	
 	// HIDE
 
+	lower();
 	_userHidden = true;
 	// Don't bother autohiding when the user's done it already.
 	_autohideTimer->stop();
 
 	if ( isVertical() ) {
-	    int strut = _ltHB->geometry().bottom();
+	    int strut = _ltHB->height();
 	    if(_hideAnim)
 		{
 		    for (int i = 0;
@@ -443,9 +440,10 @@
 			    qApp->processEvents();
 			}
 		}
-	    move(geom.x(), left ? strut - geom.height() : geom.height() - strut);
-	} else {
-	    int strut = _ltHB->geometry().right();
+	    move(geom.x(), left ? strut + geom.top() - geom.height() : geom.bottom() - strut + 1);
+	}
+	else {
+	    int strut = _ltHB->width();
 	    if(_hideAnim)   {
 		for (int i = 0;
 		     i < geom.width() - strut;
@@ -456,7 +454,7 @@
 		    qApp->processEvents();
 		}
 	    }
-	    move(left ? strut - geom.width() : geom.width() - strut, geom.y());
+	    move(left ? strut + geom.left() - geom.width() : geom.right() - strut + 1, geom.y());
 	}
 	updateWindowManager();
     }
@@ -530,6 +528,9 @@
           newpos = QPoint(geom.left(), geom.top());
         }
 
+    if (hide)
+	lower();
+
   if(_autoHideAnim)
         {
           switch( _pos ) {
@@ -562,10 +563,13 @@
                 break;
           }
         }
-  move(newpos);
+    
+    if(!hide)
   raise();
+    
+    move(newpos);
   blockUserInput(false);
-  // updateWindowManager();
+    updateWindowManager();
 }
 
 bool Panel::eventFilter( QObject* o, QEvent * e)
@@ -709,11 +713,16 @@
   hide();
   QApplication::syncX();
   QValueList<QRect> rects;
-  QRect r(QApplication::desktop()->geometry());
-  rects.append( QRect(  r.left(), r.top(), _panelsize, r.height() ) );
-  rects.append( QRect(  r.right() - _panelsize + 1, r.top(), _panelsize, r.height() ) );
-  rects.append( QRect(  r.left(), r.top(), r.width(), _panelsize ) );
-  rects.append( QRect(  r.left(), r.bottom() - _panelsize + 1, r.width(), _panelsize ) );
+
+  QValueList<WId> exclude;
+  exclude.append(winId());
+  QRect a = PGlobal::kwin_module->workArea(exclude);
+  //QRect r(QApplication::desktop()->geometry());
+
+  rects.append( QRect(  a.left(), a.top(), _panelsize, a.height() ) );
+  rects.append( QRect(  a.right() - _panelsize + 1, a.top(), _panelsize, a.height() ) );
+  rects.append( QRect(  a.left(), a.top(), a.width(), _panelsize ) );
+  rects.append( QRect(  a.left(), a.bottom() - _panelsize + 1, a.width(), _panelsize ) );
   Position newpos = (Position) UserRectSel::select(rects, _pos);
   setPosition(newpos);
   show();
@@ -733,16 +742,18 @@
     int w = width();
     int h = height();
 
+    QRect r(QApplication::desktop()->geometry());
+
     if ( _userHidden )
         w = h = 0;
-    else if ( _autoHide )
+    else if ( _autoHidden)
         w = h = 1;
 
     switch (_pos) {
-    case Top:     KWin::setStrut( winId(), 0, 0,  h, 0 ); break;
-    case Bottom:  KWin::setStrut( winId(), 0, 0, 0, h ); break;
-    case Right:   KWin::setStrut( winId(), 0, w, 0, 0 ); break;
-    case Left:    KWin::setStrut( winId(), w, 0, 0, 0 ); break;
+    case Top:     KWin::setStrut( winId(), 0, 0,  pos().y() + h, 0 ); break;
+    case Bottom:  KWin::setStrut( winId(), 0, 0, 0, (r.bottom() - pos().y() - height()) + h); break;
+    case Right:   KWin::setStrut( winId(), 0, (r.right() - pos().x() - width()) + w, 0, 0 ); break;
+    case Left:    KWin::setStrut( winId(), pos().x() + w, 0, 0, 0 ); break;
     }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic