CLIPBOARD selection doesn't save content

Peter Clifton pcjc2 at cam.ac.uk
Sat Apr 3 07:17:42 PDT 2010


On Sat, 2010-04-03 at 11:09 +0200, Quintus wrote:
> Hi,
> 
> > If you can, try it under gnome too
> 
> That's quite easy to do - I'm already working under GNOME, I never tried
> KDE.

Ok, I was tired, and misread Ubuntu Karmic for Kbuntu for some reason!

> > as the last time I worked with any
> > clipboard code, I found its clipboard manager more cooperative at saving
> > non-standard data-types than when testing under KDE.
> 
> Is text a non-standard data type? I can't believe this.

No, but our app uses some, such as "application/x-geda-schematic". This
saves fine under Gnome, but appeared to have issues saving after program
close under KDE last time someone tested it.

> > Also, the clipboard manager in gnome will only request the clipboard
> > contents and take over from my app when the app closes. We explicitly
> > call gtk_clipboard_store() as we tear down the app.
> 
> Sounds reasonable, but that's GTK-specific. Since I'm writing a
> general-purpose extension, it should work wherever X11 is installed. I
> looked at your code, and then tried to integrate this into my function
> by only using Xlib's functions.

Its GTK specific of course.. our app uses GTK, you could look how GTK
implemented these functions. I was vaguely curious, so I already posted
some of that code.

>  This is how it looks now:

Sorry - the xlib code is too low level for me to follow easily - there
is a reason I use GTK / GDK for this kind of stuff ;)

> Maybe I don't get the idea, but when I call XConvertSelection() I'm
> always sent a SelectionNotify event as a completion notify. Have I to
> react to this in any way besides checking for success? I don't think so,
> but then... What's achieved with the call? As far as I understood, you
> first check wheather there is a clipoard manager. If so, you change the
> CLIPBOARD property of my window to the list of supported targets. Why?
> In the call to XConvertSelection() you request that the
> CLIPBOARD_MANAGER selection is converted to SAVE_TARGETS which then is
> written to my window as the CLIPBOARD property. This doesn't make any
> sense to me, CLIPBOARD_MANAGER holds a text string, and not a list of
> targets and therefore doesn't request the clipboard manager to take
> responsibility for the CLIPBOARD selection.
> ...is at least my interpretation of your code correct?

Not my code.. a paste from GTK/GDK's sources. I'm not that familiar with
all the internal details.

[snip]

> As you can see, I had to kill the process since it never completed the
> for loop. I'm quite sure I'm only missing a little detail, but what is
> it? And where does the MULTIPLE request suddenly come from?

I think you need to take a look at the ICCCM spec:

http://tronche.com/gui/x/icccm/sec-2.html

Regards,

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me)




More information about the xorg mailing list