! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
xfrun4 does not pre-select the previously entered command
Status:
RESOLVED: FIXED
Product:
Xfce-utils

Comments

Description Dejan Cabrilo 2007-01-27 13:39:43 CET
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20070124 BonEcho/2.0.0.1
Build Identifier: 

When I start xfrun4 (the Run program dialog), sometimes it pre-selects the text already in the input box, sometimes it doesn't. When it doesn't, the input box still gets the focus, but I have to delete the previously entered command (instead of just typing over it).

Reproducible: Sometimes

Steps to Reproduce:
1. Run xfrun4

Actual Results:  
Sometimes, the text in the input box isn't preselected (highlighted).

Expected Results:  
It should always be pre-selected, so I can just type over it.
Comment 1 Dejan Cabrilo 2007-01-27 18:29:40 CET
Forgot to mention. I'm using gtk2 2.10.6 if it might have something to do with this.
Comment 2 Leonid Evdokimov 2008-02-10 07:15:55 CET
I confirm that the bug exists and annoys me sometimes.
I use gtk+-2.12.1 and xfce-base/xfce-utils-4.4.2

Usually I can reproduce it if I open xfrun4, run firefox, open xfrun4, press escape to close it, *wait some seconds (20-30)*, open xfrun4 again and "firefox" is not selected. But it's not steps to ALWAYS reproduce it. Looks like race condition somewhere.
It always pre-selects command when xfrun4 is "cache-hot" (at least I can't prove opposite) and rather often does not when it's "cache-cold".
Comment 3 Mike Massonnet editbugs 2008-02-25 22:19:37 CET
I can reproduce this too on both my laptop (svn) and my AMD64 machine (4.4.2).  I patched xfrun with attachment from bug #3820 and it works nice.
Comment 4 Mike Massonnet editbugs 2008-02-25 22:23:15 CET
(In reply to comment #3)
> I can reproduce this too on both my laptop (svn) and my AMD64 machine (4.4.2). 
> I patched xfrun with attachment from bug #3820 and it works nice.
> 

Or not.  It just didn't select the text right now.
Comment 5 Pascal Volk 2008-03-24 16:44:09 CET
There is an additional problem with xfrun: The arrow-down key is more often than not ignored. So I have to walk from bottom-up with the arrow-up key to select an entry.
Comment 6 Ryan Daly 2008-10-09 13:28:50 CEST
I'm also seeing this bug.  I'm running Xfce v4.4.2.
Comment 7 Christian Dywan 2008-10-24 11:19:07 CEST
For me it's pretty obvious: if I select text in any application before running xfrun4, the entry does not select all text as it should.

I suppose I'm lucky to rarely select something in the window I have open right before hitting Alt+F2.
Comment 8 Frank Schmitt 2008-10-24 11:28:25 CEST
I see the same problem and can confirm that you can reproduce the bug like this: Select some text in Firefox (probably an other Gtk-Application will do as well, but it seems it is specific for Gtk-Applications) and start xfrun4. The last item will not be highlighted.

While I am writing this text inside the Bugzilla text box in Firefox, I can reproduce the effect as well, so it is probably a question of keyboard focus. Maybe one needs to call something like a "gtk_grab_keyboard_focus" (I made this function up, but maybe there is something like this)
Comment 9 Brian J. Tarricone (not reading bugmail) 2008-10-24 18:19:09 CEST
Ah-ha!  I had no idea it had to do with whether or not text was selected in another app.  This is useful, thanks.
Comment 10 Frank Schmitt 2008-10-31 12:10:09 CET
The problem can be fixed easily by adding the line

gtk_editable_select_region(GTK_EDITABLE(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(comboboxentry)))),0,-1);

in xfrun_dialog_init() after 

if(gtk_tree_model_get_iter_first(dialog->priv->completion_model, &itr)) {
...
}
Comment 11 Frank Schmitt 2008-10-31 12:29:28 CET
The comment below was for 4.6. In 4.4 the same works, too.

--- xfce-utils-4.4.2/xfrun.orig/xfrun-dialog.c	2007-11-17 20:31:32.000000000 +0100
+++ xfce-utils-4.4.2/xfrun/xfrun-dialog.c	2008-10-31 13:23:05.000000000 +0100
@@ -233,6 +233,7 @@
     gtk_widget_show(btn);
     gtk_box_pack_end(GTK_BOX(bbox), btn, FALSE, FALSE, 0);
     GTK_WIDGET_SET_FLAGS(btn, GTK_CAN_DEFAULT);
+    gtk_editable_select_region(GTK_ENTRY(entry),0,-1);
     gtk_widget_grab_default(btn);
     g_signal_connect(G_OBJECT(btn), "clicked",
                      G_CALLBACK(xfrun_run_clicked), dialog);
Comment 12 Frank Schmitt 2008-10-31 14:35:51 CET
Sorry for the noise, but the proposed method doesn't work in all cases. However, I think I now have found both the real cause of the problem and it's solution.

If xfrun is build with dbus support, what happens is that the text in the edit (4.4) or comboboxedit (4.6) is set as selected when the Dialog is left. If between this point and the next invocation text is selected in some other Gtk application, the selection is lost. Therefore you have to select the text immediately before the dialog is shown. For Xfce 4.4 I have prepared a patch which  have tested now for quite a length of time and all my prevoius recipes for triggering the bug are fixed now.
Comment 13 Frank Schmitt 2008-10-31 14:37:51 CET
Created attachment 1935 
Patch against 4.4 which fixes the bug

Select the text before showing the dialog
Comment 14 Brian J. Tarricone (not reading bugmail) 2008-10-31 18:07:32 CET
I doubt there will be any more releases in the 4.4 series.  Does the patch apply to 4.6?
Comment 15 Frank Schmitt 2008-10-31 19:15:40 CET
It applies with offset. I add one against 4.5.91 which I just tested
Comment 16 Frank Schmitt 2008-10-31 19:16:28 CET
Created attachment 1937 
Patch against 4.5.91 which fixes the bug
Comment 17 Mike Massonnet editbugs 2009-02-22 15:21:48 CET
Works for me.
Comment 18 Yves-Alexis Perez editbugs 2009-02-22 15:59:48 CET
Has it been applied for 99.1? I don't seem to be able to reproduce it anymore :)
Comment 19 Brian J. Tarricone (not reading bugmail) 2009-02-22 19:10:17 CET
No, it hadn't been, but I just checked it in.
Comment 20 Mike Massonnet editbugs 2009-02-22 20:38:33 CET
Cool!  And yeah I ment the patch works for me, I had this bug every now and then.  Thanks Brian :)

Bug #2836

Reported by:
Dejan Cabrilo
Reported on: 2007-01-27
Last modified on: 2009-07-14

People

Assignee:
Brian J. Tarricone (not reading bugmail)
CC List:
7 users

Version

Attachments

Patch against 4.4 which fixes the bug (1.78 KB, text/plain)
2008-10-31 14:37 CET , Frank Schmitt
no flags
Patch against 4.5.91 which fixes the bug (1.79 KB, text/plain)
2008-10-31 19:16 CET , Frank Schmitt
no flags

Additional information