Lost keyboard focus after import (Ubuntu) [patch]

This section is now closed.
Forum rules
Audacity 1.3.x is now obsolete. Please use the current Audacity 2.x.x package for your distribution or compile Audacity from the source code.
autark
Posts: 31
Joined: Sun Dec 12, 2010 10:05 am
Operating System: Please select

Lost keyboard focus after import (Ubuntu) [patch]

Post by autark » Mon Jan 03, 2011 5:21 pm

I experience a loss of keyboard focus after importing tracks. (Ubuntu 10.10, Audacity 1.3.12/SVN HEAD)

How to reproduce:
1) Import (SHIFT+CTRL+I) an audio file (e.g., a flac file).
2) Press SPACE to start playing the imported track.

Expected result: The track should start playing.
Actual result: Nothing happens at all.

3) Press CTRL + A to select all.

Expected result: The whole track should be selected.
Actual result: Nothing happens at all.

4) Press SHIFT+CTRL+I to import another audio file.

Expected result: The import dialog should come up.
Actual result: Nothing happens at all.

100 % reproducible.

I have come up with a small patch (to SVN HEAD) that explicitly sets focus to the track panel after import. That solves the problem for me. I have not tested on other platforms than Ubuntu 64-bit.
--
Cheers,
Per Ångström
Attachments
track-focus-after-import-patch.txt
A small patch against current SVN HEAD to explicitly set focus to the track panel after importing a track.
(288 Bytes) Downloaded 127 times

autark
Posts: 31
Joined: Sun Dec 12, 2010 10:05 am
Operating System: Please select

Re: Lost keyboard focus after import (Ubuntu) [patch]

Post by autark » Tue Feb 15, 2011 4:37 pm

No reaction at all. What did I do wrong?

bgravato
Posts: 2098
Joined: Wed Jan 13, 2010 8:56 pm
Operating System: Linux Debian

Re: Lost keyboard focus after import (Ubuntu) [patch]

Post by bgravato » Tue Feb 15, 2011 5:16 pm

I can reproduce the same in Audacity 1.3.12beta from the official Debian package on x86 (32 bits).

I remember I experienced something similar some time ago. I think I posted it somewhere here on the forum... but that was a long time ago I doubt I'll found that thread again :|
Include as much details as you can in your post (Audacity version, Operating System, Equipment used, etc).
Please post your question in the appropriate forum (regarding audacity version and operating system).

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Lost keyboard focus after import (Ubuntu) [patch]

Post by steve » Tue Feb 22, 2011 12:30 am

Thanks autark. I've applied the patch and it's working fine.

The bug does not appear to be listed on Bugzilla, so I'll add it along with your patch.
I'll also bring it to the attention of the developers as it looks like an issue that can be cleared very quickly.

If you think that you might be fixing other bugs, it might be worth you signing up on the developers mailing list, then you can post patches to them directly.
https://lists.sourceforge.net/lists/lis ... city-devel
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Lost keyboard focus after import (Ubuntu) [patch]

Post by steve » Tue Feb 22, 2011 12:37 am

9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Lost keyboard focus after import (Ubuntu) [patch]

Post by steve » Tue Feb 22, 2011 1:35 pm

autark wrote:I have come up with a small patch (to SVN HEAD) that explicitly sets focus to the track panel after import. That solves the problem for me. I have not tested on other platforms than Ubuntu 64-bit.
The patch works nicely on Ubuntu 10.10 (32-bit), but unfortunately it breaks things on other platforms.

On Windows the problem does not occur. If focus prior to import a control in the toolbar or the selection bar, then the focus is returned to that control. With this patch, focus is moved away from where it was (which is where focus should be).

It looks like what is needed is a way to return focus to wherever it was prior to import. If I get any more information about this I'll post it here.

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Lost keyboard focus after import (Ubuntu) [patch]

Post by Edgar » Tue Feb 22, 2011 5:22 pm

As I am on Windows7 the patch is not easily read due to CR/Linefeed issues but I think it is adding the set focus line--just a single addition of one line of code. As this reportedly causes problems on Windows it could easily be conditionally compiled:

Code: Select all


   }

   GetDirManager()->FillBlockfilesCache();
#if defined( __WXGTK__ )//I've also seen # if defined(__linux__)
      mTrackPanel->SetFocus();
#endif
   return true;
}
As I only compile on Win7 I cannot thoroughly test this.

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Lost keyboard focus after import (Ubuntu) [patch]

Post by steve » Tue Feb 22, 2011 5:48 pm

Thanks Edgar.

This is the original patch - hopefully easier to read:

Code: Select all

Index: src/Project.cpp
===================================================================
--- src/Project.cpp	(revision 10843)
+++ src/Project.cpp	(working copy)
@@ -3400,6 +3400,7 @@
    }
 
    GetDirManager()->FillBlockfilesCache();
+   mTrackPanel->SetFocus();
    return true;
 }
so your new patch would be like this?

Code: Select all

Index: src/Project.cpp
===================================================================
--- src/Project.cpp	(revision 10843)
+++ src/Project.cpp	(working copy)
@@ -3400,6 +3400,7 @@
    }
 
    GetDirManager()->FillBlockfilesCache();
+ #if defined( __WXGTK__ )//I've also seen # if defined(__linux__)
+       mTrackPanel->SetFocus();
+ #endif
    return true;
 }
What does "#if defined( __WXGTK__ )" do?

Do you have a Bugzilla account Edgar?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Lost keyboard focus after import (Ubuntu) [patch]

Post by steve » Tue Feb 22, 2011 5:59 pm

steve wrote: Do you have a Bugzilla account Edgar?
Just been notified of an update to Bug 294. I see you do have an account :D
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

bgravato
Posts: 2098
Joined: Wed Jan 13, 2010 8:56 pm
Operating System: Linux Debian

Re: Lost keyboard focus after import (Ubuntu) [patch]

Post by bgravato » Tue Feb 22, 2011 6:02 pm

steve wrote:What does "#if defined( __WXGTK__ )" do?
It will only compile the code between '#if' and '#endif', if '__WXGTK__' is defined (somewhere else before in the code).

For example:

Code: Select all

#define HELLO
#if defined(HELLO)
printf("Hello!");
#endif
This will compile the printf code and "Hello!" will be printed.

If you comment out the first line:

Code: Select all

// #define HELLO
#if defined(HELLO)
printf("Hello!");
#endif
In this case the printf code will be ignore by the pre-processor and won't be compiled.

This is common practice, for example, when writing code for different architectures when some part of the code only applies to a certain architecture.
Include as much details as you can in your post (Audacity version, Operating System, Equipment used, etc).
Please post your question in the appropriate forum (regarding audacity version and operating system).

Locked