Bug 86478 - Drop target has severe graphical artifacts
Summary: Drop target has severe graphical artifacts
Status: RESOLVED FIXED
Alias: None
Product: kget
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: James Richard Tyrer
URL:
Keywords:
: 87542 87681 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-03 08:30 UTC by Michael Pyne
Modified: 2004-08-26 05:31 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Graphical distortion in KGet drop target (3.16 KB, image/png)
2004-08-03 08:33 UTC, Michael Pyne
Details
kdenetwork/kget/pics/target.png (3.54 KB, image/png)
2004-08-26 01:15 UTC, James Richard Tyrer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Pyne 2004-08-03 08:30:54 UTC
Version:           v0.8.3 (using KDE 3.2.92 (3.3 beta2), compiled sources)
Compiler:          gcc version 3.3.3 20040412 (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6)
OS:                Linux (i686) release 2.6.7

I noticed that the KGet icon in Konqueror seemed to be different and decided to see if the drop target looked different as well.  After selecting the "Show Drop Target" action in Konq, the drop target appeared, which was circular as usual, but now seems to suffer from graphical glitches.

I will attach a screenshot of what I'm talking about as well.

This also occurs if you open KGet manually, and choose "View -> Drop Target" from the menu.
Comment 1 Michael Pyne 2004-08-03 08:33:25 UTC
Created attachment 6976 [details]
Graphical distortion in KGet drop target

This is what my drop target now looks like.

Before I forget, I should probably mention that my X Server is x.org 6.7, using
the fglrx driver.
Comment 2 Mike Peacock 2004-08-10 17:56:18 UTC
Hi, I am using KDE 3.3 rc1 compilied from sources and I'm experencing the same problem as Mr. Pyne as my drop target looks exactly like the screenshot.  I am also using x.org 6.7 but the savage4 graphic driver.
Comment 3 Víctor Fernández Martínez 2004-08-24 15:46:44 UTC
The same happens to me. I can confirm this. I'm using KDE 3.3.0 compiled from sources under Mandrakelinux 10.0.
Comment 4 Mike Peacock 2004-08-24 20:15:59 UTC
Hi, I can also confirm this still happens in both stable 3.3.0 and the current CVS HEAD from 23/08/04.
Comment 5 Stephan Binner 2004-08-24 20:42:13 UTC
*** Bug 87681 has been marked as a duplicate of this bug. ***
Comment 6 Stephan Binner 2004-08-24 21:38:26 UTC
*** Bug 87542 has been marked as a duplicate of this bug. ***
Comment 7 Mike Peacock 2004-08-25 00:12:10 UTC
I need to correct my previous statement.  In stable 3.3.0 it happens but in the latest CVS HEAD the drop target now shows the same as it did in previous releases, the black arrow with the silver grey background.
Comment 8 James Richard Tyrer 2004-08-26 01:13:28 UTC
The first problem is that the PNG file is too large.

Attached PNG file will fix that.

Then there is the background.  I didn't add one but it appears that the transparent background does not work.  I'm not sure exactly what is happening but it appears to be some attempt at transparency that doesn't work correctly since the background in different depending on where the drop target opens.

--
JRT
Comment 9 James Richard Tyrer 2004-08-26 01:15:14 UTC
Created attachment 7290 [details]
kdenetwork/kget/pics/target.png

I suggest adding a background to this.

--
JRT
Comment 10 Michael Pyne 2004-08-26 04:15:16 UTC
Poking around at the code, it appears that the code at line 150 of droptarget.cpp uses the XSHAPE extension, but the mask is assumed to be a circle instead of (in this case) an arrow shape.

Perhaps the ctor should be modified to create the alpha mask from the transparency areas?
Comment 11 Michael Pyne 2004-08-26 05:29:36 UTC
CVS commit by mpyne: 

Fix bug 86478 (Drop target has severe graphical artifacts) in HEAD.  Now the code uses the drop target's own mask for the SHAPE extension instead of always using a circle. 

Although this is a bugfix, this has interesting possibilites regarding allowing the user to set their own drop target.  Developers who have a hackergotchi may want to try replacing $KDEHOME/share/apps/kget/pics/target.png with their hackergotchi icon to turn your mug into a drop target. ;-) 

karli, you can change the icon to the arrow again if you'd like.

This patch works for at least Matt Rogers and myself.

CCMAIL:86478@bugs.kde.org


  M +10 -24    droptarget.cpp   1.24


--- kdenetwork/kget/droptarget.cpp  #1.23:1.24
@@ -48,7 +48,4 @@
 #include "settings.h"
 #include "droptarget.h"
-#define TARGET_WIDTH   70
-#define TARGET_HEIGHT  69
-
 
 DropTarget::DropTarget():QWidget()
@@ -58,9 +55,10 @@ DropTarget::DropTarget():QWidget()
     
     QRect desk = KGlobalSettings::desktopGeometry(this);
+    QPixmap bgnd = UserIcon( "target" );
 
     if (x != -1 &&
         x >= desk.left() && y >= desk.top() &&
-        (x + TARGET_WIDTH) <= desk.right() &&
-        (y + TARGET_HEIGHT) <= desk.bottom() )
+        (x + bgnd.width()) <= desk.right() &&
+        (y + bgnd.height()) <= desk.bottom() )
     {
         move(ksettings.dropPosition);
@@ -69,5 +67,5 @@ DropTarget::DropTarget():QWidget()
     else
     {
-        setGeometry(desk.x()+200, desk.y()+200, TARGET_WIDTH, TARGET_HEIGHT);
+        setGeometry(desk.x()+200, desk.y()+200, bgnd.width(), bgnd.height());
         KWin::setState(winId(), NET::SkipTaskbar | NET::StaysOnTop);
     }
@@ -75,28 +73,16 @@ DropTarget::DropTarget():QWidget()
     b_sticky = ksettings.dropState & NET::Sticky;
 
-    // setup mask
-    mask.resize(TARGET_WIDTH, TARGET_HEIGHT);
-    mask.fill(color0);
-
-    QPainter p2;
-
-    p2.begin(&mask);
-    p2.setBrush(color1);
-    p2.drawChord( 0, 0,TARGET_WIDTH,TARGET_HEIGHT,5760,5760);
-    p2.end();
-
     // setup pixmaps
 
-    int offsetx = -10;
-    int offsety = -5;
+    if (!bgnd.mask())
+        kdError(5001) << "Drop target pixmap has no mask!\n";
+    else
+        mask = *bgnd.mask();
 
-    QPixmap bgnd = QPixmap(TARGET_WIDTH, TARGET_HEIGHT);
-    QPixmap tmp = UserIcon( "target" );
-    bitBlt(&bgnd, offsetx, offsety, &tmp );
     setBackgroundPixmap( bgnd );
 
     // popup menu for right mouse button
     popupMenu = new KPopupMenu();
-    popupMenu->setTitle(kapp->caption());
+    popupMenu->insertTitle(kapp->caption());
     popupMenu->setCheckable(true);
 


Comment 12 Michael Pyne 2004-08-26 05:31:56 UTC
CVS commit by mpyne: 

Backport fix for bug 86478 (Drop target has severe graphical artifacts) to KDE 3.3.

CCMAIL:86478-done@bugs.kde.org


  M +10 -24    droptarget.cpp   1.23.6.1


--- kdenetwork/kget/droptarget.cpp  #1.23:1.23.6.1
@@ -48,7 +48,4 @@
 #include "settings.h"
 #include "droptarget.h"
-#define TARGET_WIDTH   70
-#define TARGET_HEIGHT  69
-
 
 DropTarget::DropTarget():QWidget()
@@ -58,9 +55,10 @@ DropTarget::DropTarget():QWidget()
     
     QRect desk = KGlobalSettings::desktopGeometry(this);
+    QPixmap bgnd = UserIcon( "target" );
 
     if (x != -1 &&
         x >= desk.left() && y >= desk.top() &&
-        (x + TARGET_WIDTH) <= desk.right() &&
-        (y + TARGET_HEIGHT) <= desk.bottom() )
+        (x + bgnd.width()) <= desk.right() &&
+        (y + bgnd.height()) <= desk.bottom() )
     {
         move(ksettings.dropPosition);
@@ -69,5 +67,5 @@ DropTarget::DropTarget():QWidget()
     else
     {
-        setGeometry(desk.x()+200, desk.y()+200, TARGET_WIDTH, TARGET_HEIGHT);
+        setGeometry(desk.x()+200, desk.y()+200, bgnd.width(), bgnd.height());
         KWin::setState(winId(), NET::SkipTaskbar | NET::StaysOnTop);
     }
@@ -75,28 +73,16 @@ DropTarget::DropTarget():QWidget()
     b_sticky = ksettings.dropState & NET::Sticky;
 
-    // setup mask
-    mask.resize(TARGET_WIDTH, TARGET_HEIGHT);
-    mask.fill(color0);
-
-    QPainter p2;
-
-    p2.begin(&mask);
-    p2.setBrush(color1);
-    p2.drawChord( 0, 0,TARGET_WIDTH,TARGET_HEIGHT,5760,5760);
-    p2.end();
-
     // setup pixmaps
 
-    int offsetx = -10;
-    int offsety = -5;
+    if (!bgnd.mask())
+        kdError(5001) << "Drop target pixmap has no mask!\n";
+    else
+        mask = *bgnd.mask();
 
-    QPixmap bgnd = QPixmap(TARGET_WIDTH, TARGET_HEIGHT);
-    QPixmap tmp = UserIcon( "target" );
-    bitBlt(&bgnd, offsetx, offsety, &tmp );
     setBackgroundPixmap( bgnd );
 
     // popup menu for right mouse button
     popupMenu = new KPopupMenu();
-    popupMenu->setTitle(kapp->caption());
+    popupMenu->insertTitle(kapp->caption());
     popupMenu->setCheckable(true);