Re: 6 API-ish issues



On Tue, Jan 29, 2002 at 09:34:24PM -0500, Owen Taylor wrote:

[ GtkEntry selections ]

> GTK+-1.2 had a "selected but not the selection state, drawn in a different
> color. (Not SECONDARY, just not in an X selection; SECONDARY would defeat
> the purpose since only one app could have SECONDARY.)
> 
> The biggest problem with doing this for GTK+-2.0 is that we already
> use two selected colors -- selected/focus, and selected/unfocused. 
> There's no way users would ever figure this out.

Is selected/unfocused useful? The primary selection is still active and
ready to be pasted, even without the focus, so why is it shown shaded?

> Thinking about this some more, it would be a real pain to not select
> since the ::grab-focus action signal needs to select the contents of
> the target widget; so, it's almost impossible for the entry to
> tell whether a call to ->grab_focus() comes from the user or programmer.
> 
> Considering that I think the right thing to do is virtually always to
> select, and making gtk_widget_grab_focus() not select would be quite
> hard to implement, I think it's pretty clear that we should leave
> it the way it is for now.
> 
> Maybe in a future version, we can add some
> gtk_entry_focus_without_selecting() call.

I don't think this helps. Whether the contents of an entry should be
selected depends on what it's used for, not how the focus entered it.

Eg, in ROX-Filer's pathname box (which shows the current directory and
filename), the text should never be automatically selected. Not from a
grab_focus; not from a Tab; not from a mouse click.

I quite like Tim's solution:

typedef enum
{
	GTK_TEXT_SELECTION_NONE,
	GTK_TEXT_SELECTION_FOCUS,
	GTK_TEXT_SELECTION_THEMABLE
} GtkTextSelectionType;

Themable would be the default, presumably. Actually, I'm not sure there's
much need for 'Focus'. If the default theme always selects, then this
would only even change the behaviour for someone who had explicity
disabled auto-selection (ie, because they hate it). Also, if a programmer
really wants to force the selection then they can do that manually.

However, it's currently quite difficult to make an entry that doesn't
destroy the primary selection, even if you remove the selection as soon as
the entry gets the focus. (although it is possible to hack around it)


-- 
Thomas Leonard			http://rox.sourceforge.net
tal00r ecs soton ac uk		tal197 users sourceforge net



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