Handling the selection

In working on a program that needed to respond to a selection
request for a target other than STRING (COMPOUND_TEXT, to be exact),
I noticed that the existing support for selections in gdk/gtk is not
really complete - it ignores requests for anything other than the
STRING target including the TARGETS, TIMESTAMP, and MULTIPLE targets,
which, according to the ICCCM are required.

The MULTIPLE target seems completely inane to me - lots of required
client complexity for a small performance increase in very rare
situations ... maybe we _should_ just ignore it ... but it was pretty
easy to implement a simple TARGETS and TIMESTAMP.

However, though this does improve things a bit (you can then paste
from an entry into a xterm), it falls short of what I need, so
I'm considering going for a more complete implementation - but
before diving into the morass (The equivalent code in Tk is 2000
lines) I thought I'd solicit people's (especially Peter's) opinions
about what, where, and how.

There seem to be a couple of possible options:

1) Pass along requests for all targets application and let it deal.

Pro: easy
Con: gdk/gtk is supposed to hide gunky X stuff from the application
     and this is about as gunky as it gets. (for those who have looked
     at this stuff, I don't think I have to say anything more than

2) Handle the worst of the gunk (in particular INCR and MULTIPLE) in
gdk and pass the rest on to the application.

Con: I'm not sure how feasible this separation of gunk and ungunk is.

3) Create a higher level abstraction in gtk (gdk?) - for instance, Tk does
this by allowing clients to register handlers for various types
of targets.

Pro: easiest interface for the application.
Con: most complicated implementation.

Right now I'm leaning towards some combination of 2 and 3. I'd be
interested in hearing what people's needs are in this area. (And also,
since I have little experience in this area, if people think these
ideas make sense at all.)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]