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

List:       kde-core-devel
Subject:    Re: QClipboard
From:       Lubos Lunak <l.lunak () sh ! cvut ! cz>
Date:       2001-11-27 9:45:10
[Download RAW message or body]

On Mon 26. November 2001 20:08, Thomas Zander wrote:
> On Sun, Nov 25, 2001 at 01:08:22PM +0100, Lubos Lunak wrote:
> >  Hello,
> >
> >  sorry it took so long. Could people having QClipboard related problems
> > try the attached qclipboard_x11.cpp patch? The second one probably will
> > help too (long live broken design, long live global state variables!). In
> > case you won't be able to reproduce the problems with it, I'll send it to
> > TT, as that was my part of the deal.
>
> You ROCK! This solves all my known problems with all clipboards. I gave it
> a good beating!

 Ok, I'm CC-ing qt-bugs. However, I've been told there were clipboard related 
problems also with Qt2 (I'm not aware of any myself), and the bug my patch 
fixes was clearly introduced while adding selection support in Qt3. *shrug* 

> ps. QTs design for 2 clipboards is really cool, and klipper works great
> with them :)

 I wasn't talking about QClipboard supporting both clipboard and selection, I 
meant QClipboard::setSelectionMode() specifically, which I consider broken 
design. But I've heard it will be handled in a better way in Qt3.1 .

-- 
 Lubos Lunak
 llunak@suse.cz ; l.lunak@kde.org
 http://dforce.sh.cvut.cz/~seli

["qclipboard_x11.cpp.patch" (text/x-diff)]

--- qclipboard_x11.cpp.sav	Sun Oct 21 23:19:38 2001
+++ qclipboard_x11.cpp	Sun Nov 25 12:55:04 2001
@@ -557,6 +557,7 @@ bool QClipboard::event( QEvent *e )
 	    if (timer_flags & 0x02) // clear clipboard
 		clipboardData()->clear();
 	    timer_event_clear = FALSE;
+            timer_flags = 0;
 
 	    return TRUE;
 	} else
@@ -937,17 +938,15 @@ QMimeSource* QClipboard::data() const
 {
     QClipboardData *d;
 
-    if (inSelectionMode) {
+    if (inSelectionMode)
 	d = selectionData();
-	timer_flags |= 0x01;
-    } else {
+    else
 	d = clipboardData();
-	timer_flags |= 0x02;
-    }
 
     if ( ! d->source() && ! timer_event_clear ) {
 	d->setSource(new QClipboardWatcher());
-
+        
+        timer_flags |= ( inSelectionMode ? 0x01 : 0x02 );
 	if (! timer_id) {
 	    // start a zero timer - we will clear cached data when the timer
 	    // times out, which will be the next time we hit the event loop...

["qlineedit.cpp.patch" (text/x-diff)]

--- qlineedit.cpp.sav	Sun Oct 21 23:20:02 2001
+++ qlineedit.cpp	Sun Nov 25 12:22:53 2001
@@ -1147,7 +1147,7 @@ void QLineEdit::mouseReleaseEvent( QMous
 	if (QApplication::clipboard()->supportsSelection()) {
 	    QApplication::clipboard()->setSelectionMode(TRUE);
 	    insert( QApplication::clipboard()->text() );
-	    QApplication::clipboard()->setSelectionMode(TRUE);
+	    QApplication::clipboard()->setSelectionMode(FALSE);
 	}
 	return;
     }


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

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