[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdebase/kwin/kcmkwin/kwindecoration
From: Sandro Giessl <sandro () giessl ! com>
Date: 2004-12-09 22:28:55
Message-ID: 20041209222855.F0A201B94D () office ! kde ! org
[Download RAW message or body]
CVS commit by giessl:
FEATURE
Add drop visualizer to the titlebar preview.
M +50 -3 buttons.cpp 1.15
M +3 -0 buttons.h 1.9
--- kdebase/kwin/kcmkwin/kwindecoration/buttons.cpp #1.14:1.15
@@ -280,8 +280,48 @@ void ButtonDropSite::dragMoveEvent( QDra
{
QPoint p = e->pos();
- if (leftDropArea().contains(p) || rightDropArea().contains(p) || buttonAt(p) \
) + if (leftDropArea().contains(p) || rightDropArea().contains(p) || \
buttonAt(p) ) { e->accept();
- else
+
+ // 2 pixel wide drop visualizer...
+ QRect r = contentsRect();
+ int x = -1;
+ if (leftDropArea().contains(p) ) {
+ x = leftDropArea().left();
+ } else if (rightDropArea().contains(p) ) {
+ x = rightDropArea().right()+1;
+ } else {
+ ButtonDropSiteItem *item = buttonAt(p);
+ if (item) {
+ if (p.x() < item->rect.left()+item->rect.width()/2 ) \
{ + x = item->rect.left();
+ } else {
+ x = item->rect.right()+1;
+ }
+ }
+ }
+ if (x != -1) {
+ QRect tmpRect(x, r.y(), 2, r.height() );
+ if (tmpRect != m_oldDropVisualizer) {
+ cleanDropVisualizer();
+ m_oldDropVisualizer = tmpRect;
+ update(tmpRect);
+ }
+ }
+
+ } else {
e->ignore();
+
+ cleanDropVisualizer();
+ }
+}
+
+void ButtonDropSite::cleanDropVisualizer()
+{
+ if (m_oldDropVisualizer.isValid())
+ {
+ QRect rect = m_oldDropVisualizer;
+ m_oldDropVisualizer = QRect(); // rect is invalid
+ update(rect);
+ }
}
@@ -294,9 +334,11 @@ void ButtonDropSite::dragEnterEvent( QDr
void ButtonDropSite::dragLeaveEvent( QDragLeaveEvent* /* e */ )
{
- // Do nothing...
+ cleanDropVisualizer();
}
void ButtonDropSite::dropEvent( QDropEvent* e )
{
+ cleanDropVisualizer();
+
QPoint p = e->pos();
@@ -544,4 +586,9 @@ void ButtonDropSite::drawContents( QPain
offset = geometry().width() - 3 - rightoffset;
drawButtonList( p, buttonsRight, offset );
+
+ if (m_oldDropVisualizer.isValid() )
+ {
+ p->fillRect(m_oldDropVisualizer, Dense4Pattern);
+ }
}
--- kdebase/kwin/kcmkwin/kwindecoration/buttons.h #1.8:1.9
@@ -180,4 +180,7 @@ class ButtonDropSite: public QFrame
bool getItemIterator(ButtonDropSiteItem *item, ButtonList* &list, \
ButtonList::iterator &iterator);
+ void cleanDropVisualizer();
+ QRect m_oldDropVisualizer;
+
ButtonDropSiteItem *m_selected;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic