Re: [evolution-patches] Patch for focus_in event behavior in GtkHTML



In fact, this patch is broken, it prevents me from cut & pasting text
from other apps...

Hmm.

On Fri, 2003-05-02 at 14:42, Ettore Perazzoli wrote:
> This one I am not 100% sure about.
> 
> Basically, the problem is, if the gtk-entry-select-on-focus GtkSetting
> is set, tabbing around in the composer will (with my e-entry patch)
> select the text in the to/cc/bcc fields.  On the other hand, when you
> tab from the subject field into the HTML widget nothing happens, you can
> be left with the subject text still selected while the cursor is in the
> HTML widget, which is kinda disconcerting.
> 
> This patch makes GtkHTML clear the primary selection if it gets tabbed
> into, when gtk-entry-select-on-focus is set (and only if GtkHTML doesn't
> already own the selection at that point).  This way we make the HTML
> widget consistent with the entries in the fact that it owns the
> selection when you tab in -- although in this case it owns an empty
> selection instead of selecting the whole text (which would be obviously
> wrong for the text editor).
> 
> What do you think?
> 
> (BTW, this is a problem that GtkTextView has too.)
> 
> -- Ettore
> 
> 
> ______________________________________________________________________
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
> retrieving revision 1.1786
> diff -u -p -r1.1786 ChangeLog
> --- ChangeLog	29 Apr 2003 20:16:04 -0000	1.1786
> +++ ChangeLog	2 May 2003 18:35:58 -0000
> @@ -1,3 +1,9 @@
> +2003-05-02  Ettore Perazzoli  <ettore ximian com>
> +
> +	* gtkhtml.c (focus_in_event): If the gtk-entry-select-on-focus
> +	GtkSetting is set and we are not owning the primary selection,
> +	clear it.
> +
>  2003-04-29  Larry Ewing  <lewing ximian com>
>  
>  	* htmltext.c (calc_word_width): walk the string in our own loop
> Index: gtkhtml.c
> ===================================================================
> RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
> retrieving revision 1.506
> diff -u -p -r1.506 gtkhtml.c
> --- gtkhtml.c	29 Apr 2003 16:02:49 -0000	1.506
> +++ gtkhtml.c	2 May 2003 18:35:58 -0000
> @@ -1581,8 +1581,8 @@ focus_in_event (GtkWidget *widget,
>  		GdkEventFocus *event)
>  {
>  	GtkHTML *html = GTK_HTML (widget);
> +	gboolean select_on_focus;
>  
> -	/* printf ("focus in\n"); */
>  	if (!html->iframe_parent) {
>  		GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
>  		html_engine_set_focus (html->engine, TRUE);
> @@ -1594,6 +1594,18 @@ focus_in_event (GtkWidget *widget,
>  
>  	html->priv->need_im_reset = TRUE;
>  	gtk_im_context_focus_in (html->priv->im_context);
> +
> +	g_object_get (G_OBJECT (gtk_widget_get_settings (widget)),
> +		      "gtk-entry-select-on-focus",
> +		      &select_on_focus,
> +		      NULL);
> +
> +	if (select_on_focus) {
> +		GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
> +
> +		if (gtk_clipboard_get_owner (clipboard) != G_OBJECT (widget->window))
> +			gtk_clipboard_clear (clipboard);
> +	}
>  
>  	return FALSE;
>  }

Attachment: signature.asc
Description: This is a digitally signed message part



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