small divelist issue with select_prev_dive(), select_next_dive()

Linus Torvalds torvalds at linux-foundation.org
Wed Jan 30 12:48:49 PST 2013


On Thu, Jan 31, 2013 at 2:05 AM, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> currently, if you import multiple dives, its possible to navigate in
> the divelist using the up/down arrow keys.
> we override select_prev_dive(), select_next_dive() since we want to
> skip the selection of trips and automatically expand them navigating
> in the dives inside.

That's not the only reason we do it - we also want to skip the
divetrip itself, etc etc.

And yes, it screws up the gtk selection logic, because gtk maintains
its own extra state.

In fact, this has been a constant pain with the gtk selections. The
gtk selections work fine if you take the raw gtk semantics for them,
but those semantics are broken, and cannot be maintained across
multiple views (ie when we switch from the trip-overview to the purely
linear sorting). And the gtk selection semantics work fine with arrow
keys with no extra code at all, but then you get the wrong thing
happening for any special semantivcs you have (ie our trips), but also
absolutely broken focus handling, and the arrow keys don't work if
you're in the profile-only mode etc etc.

So every time we try to fix some semantic problem with the native gtk
selections, it's hugely painful. It's almost totally impossible to get
the gtk "select range" case right too, for the exact same reason that
you noticed with the enter key: gtk maintains that internal "selection
anchor" thing, and it does not seem to be exposed *any* way
programmaticaly. So when you override the selection logic, you cannot
override the anchor.

Or if you can, it's very much non-obvious.

If you can figure it out, that would be very lovely indeed.

                   Linus


More information about the subsurface mailing list