You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, July 27th 2005, 12:24am

Clipboard headaches

I was hoping that someone here might be able to help me with a problem that I am having.

I am working on an application that runs on several platforms including Linux. On linux all of our windowing calls are made directly to X so we don't have to depend on any intermediary libraries. (I know it could be more efficient to use qt or gtk but this code was written a long time ago and now it isn't feasible to re-write.)

My problem is thus: The application copies text to the clipboard perfectly well in gnome but I must be doing something wrong because kde doesn't see it at all. When I copy it empties the clipboard but doesn't paste the copied text. Oddly enough when I ran xclipboard to verify that I was copying not only did the text show up in xclipboard but kde saw it and pasted correctly. When I exited xclipboard it ceased to work again.

I tried stopping klipper but that had no effect. In kde I can paste to gnome apps such as gedit or window manager agnostic apps such as firefox.

Anyone have a clue what I might be doing wrong?
Computer Science is no more about computers than astronomy is about telescopes.
-- Edsger W. Dijkstra

Latem

Beginner

Posts: 31

Location: New Brunswick, Canada

Occupation: Student/Programmer

  • Send private message

2

Wednesday, July 27th 2005, 1:25pm

Hmm, I am not sure. You may be aware of this, but you lose clipboard data if you copy from an app and then close it. So if you are doing this: copy text in app A, close app A, try to paste into app B; and that is not working than that is expected behaviour. If you keep app A open, then it should work. Otherwise, I don't know what could be the problem. Sorry.

Latem
The march of progress:
C:
printf("%10.2f", x);
C++:
cout << setw(10) << setprecision(2) << showpoint << x;
Java:
java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++) System.out.print(' ');
System.out.print(s);

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

3

Wednesday, July 27th 2005, 2:06pm

Maybe you are copying to the wrong clipboard.

X11 applications currently use two of the three possible clipboard buffers, one for the select and paste with middle mouse button and one for "real" clipboard (similar to the one use in Windows)

If your application is for example only copying to the first buffer, a paste from the second buffer doesn't necessarily see it.

Clipboard applications like xclipboard or KDE's klipper can be used to keep those buffers in sync on the users demand, but usually this isn't necessary if applications access the two buffers as recommended here:

http://freedesktop.org/wiki/Standards_2fclipboards_2dspec

Cheers,
_
Qt/KDE Developer
Debian User