Gentoo, wxWidgets and Audacity positioning

Hello.

I’ve been using Audacity for many years, being a retired sound engineer I find it most useful tool to enhance my records. Just one little thing, every time I start Audacity I must drag it to my main screen. It opens on my primary display only about 1 time out of 20. It goes into random places, mostly upper left corner of my top monitor. Some applications open where the mouse cursor is, something like this would be most useful for me. And other applications remember the position they were when used last time and open there, this would be great also.

Thanks, and have a nice day.

To me this sounds like a bug. But I am on Windows and also no longer have multi-monitor capabilities, so I am unable to replicate this issue.

Not necessarily a bug, methinks it is a missing feature. Therefore I’m posting it in this subforum. I’m no Xorg expert myself, but I believe when an application is Xinerama aware then it can determine there is more than one monitor, although Xorg represents all monitors as one single big screen. But even without Xinerama support it is possible to make applications to remember their position, for instance Claws Mail opens always where it was when used last time, many other applications do the same.

Are you talking about physical display monitors, or virtual desktops?

I’ve just tested with Audacity 3.0.0 on Xubuntu 20.04 LTS (and Windows 10) with two physical monitors. Audacity is reliably opening on the display, and with the window size that I used last. That is, if I launch Audacity, move it to the second display and then exit, on next launch it opens on the second display. If last used on the primary display, then it next opens on the primary display.

In short, this does not appear to be an Audacity issue per se.

You could try resetting the main Audacity preferences to see if that sorts it out. To do that, quit Audacity, then delete the file “audacity.cfg” from the hidden folder: “~/audacity-data/” (where “~/” means your home directory).

I see, you use the latest Audacity, while I’m still at 2.4.2 due to customized wxWidgets the 3 branch is using. It is entirely possible my feature request was already outdated when I posted it.
Thanks for replies everyone.

I did also test with Audacity 2.4.2 on Windows (before updating to Audacity 3.0.0) and the behaviour was identical - Audacity opens on the same display with the same window size as last used.

I can’t easily test with 2.4.2 on Linux, but Audacity 2.3.3 (the default deb build in the Ubuntu 20.04 repository) behaves the same.

If you are using a Flatpak or Snapd build of Audacity 2.4.2 then it could be a problem with the build or sandboxing.

Well, we really cannot compare Windows with Xorg, they are very different underneath. I glanced over audacity.cfg and I can see window size set there, but not position. I’m running Gentoo, meaning building from source using Gentoo ebuild.

media-sound/audacity
     Available versions:  2.4.2-r1^t {alsa doc ffmpeg +flac id3tag jack +ladspa +lv2 mad ogg oss portmidi +portmixer portsmf sbsms twolame vamp +vorbis +vst}
     Installed versions:  2.4.2-r1^t(01:37:37 PM 08/24/2020)(alsa ffmpeg flac id3tag ladspa lv2 mad ogg portmixer vorbis vst -doc -jack -oss -portmidi -portsmf -sbsms -twolame -vamp)
     Homepage:            https://web.audacityteam.org/
     Description:         Free crossplatform audio editor

I also do not see any compile time options which may affect this behavior. Me scratching head …

True, but I don’t think this part of the code has changed for quite a long time.

Here is what I get in terminal. Tells not much to me, perhaps you can see something related to the issue I’m having??

 ~ $ audacity

(audacity:29868): Gtk-WARNING **: 09:47:16.097: A floating object was finalized. This means that someone
called g_object_unref() on an object that had only a floating
reference; the initial floating reference is not owned by anyone
and must be removed with g_object_ref_sink().
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.4/work/alsa-lib-1.2.4/src/pcm/pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.4/work/alsa-lib-1.2.4/src/pcm/pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.4/work/alsa-lib-1.2.4/src/pcm/pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.4/work/alsa-lib-1.2.4/src/pcm/pcm_route.c:877:(find_matching_chmap) Found no matching channel map
Expression 'stream->playback.pcm' failed in '/var/tmp/portage/media-sound/audacity-2.4.2-r1/work/audacity-Audacity-2.4.2/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c', line: 4628
Expression 'stream->playback.pcm' failed in '/var/tmp/portage/media-sound/audacity-2.4.2-r1/work/audacity-Audacity-2.4.2/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c', line: 4628
Expression 'stream->playback.pcm' failed in '/var/tmp/portage/media-sound/audacity-2.4.2-r1/work/audacity-Audacity-2.4.2/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c', line: 4628
Expression 'stream->playback.pcm' failed in '/var/tmp/portage/media-sound/audacity-2.4.2-r1/work/audacity-Audacity-2.4.2/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c', line: 4628
Expression 'stream->playback.pcm' failed in '/var/tmp/portage/media-sound/audacity-2.4.2-r1/work/audacity-Audacity-2.4.2/lib-src/portaudio-v19/src/hostapi/alsa/pa_linux_alsa.c', line: 4628

(audacity:29868): Gtk-CRITICAL **: 09:47:17.314: gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug


(audacity:29868): Gtk-CRITICAL **: 09:47:17.363: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

(audacity:29868): Gtk-CRITICAL **: 09:47:17.364: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

No.

This is the section that handles window size and position:

[Window]
X=2504
Y=82
Width=916
Height=938
Maximized=0
Normal_X=2504
Normal_Y=82
Normal_Width=916
Normal_Height=938
Iconized=0

The first two items (X and Y) are the position of the top left corner of the Audacity window.

My primary display is 1920 x 1080, and the second monitor extends the display to the right, so “X=2504” places the Audacity window on the secondary display, 82 px down from the top, 2504 - 1920 = 584 px from the left.

Now we are getting somewhere, not sure where, though …

[Window]
X=1274
Y=1406
...

I had this, and when I started Audacity it opened in top left corner. I closed Audacity and opened the audacity.cfg again, both values were set to “0”. So it does record its position, but it does not read it, or if it does read it for some reason the mechanism Audacity is using to position its window is failing in my computer.

Now it is clear it is not a missing feature as I thought, it is a malfunctioning feature.

What could be done about it? :question:

:smiley:


How do you configure your displays?
(As I’m using Xfce, I use xfce4-display-settings to extend the Desktop to the right onto the second monitor)

I have kinda spartan setup, no GUI tools of any kind, I have three displays connected and when I was finished configuring them with xrandr I simply put xrandr commands into ~/.xinitrc, as a temporary measure of course, with intention to write proper conf into /etc/X11/xorg.conf.d/*. Has been like this for a few years now …
To sum it up, other applications are able to restore their position, so far the only one is Audacity which is not. So it must do something differently. I could start it with strace, but it would produce a mountain of info, any idea what filter to use? I’m no programmer, just a casual computer user. All ideas how to attempt to debug it are most welcome.

Edit: Since this is Gentoo and I have minimalist setup it is possible there is something missing in my system which is used by Audacity to position its window. The developer who is writing that part of code for Audacity would know what is needed, I guess?

I think this is handled by wxWidgets.

In ProjectWindow.cpp we have:

   wxRect windowRect;
   gPrefs->Read(wxT("/Window/X"), &windowRect.x, defaultRect.x);
   gPrefs->Read(wxT("/Window/Y"), &windowRect.y, defaultRect.y);
   gPrefs->Read(wxT("/Window/Width"), &windowRect.width, defaultRect.width);
   gPrefs->Read(wxT("/Window/Height"), &windowRect.height, defaultRect.height);

which should create a “wxRect” at the specified location and size.

Did you build Audacity with this version of wxWidgets?

Now it is getting interesting, I expected to see wxWidgets version which was pulled in as dependency. And there’s none. But I noticed there is eselect module for wxWidgets, so I executed it and got this:

# eselect wxwidgets list
Available wxWidgets profiles:
  [1]   gtk3-unicode-3.0-gtk3 *

Since there is no reason for anybody but Gentoo users to know what eselect is - it is a tool to enable and choose available versions of supported software and libraries. My understanding of this output is wxWidgets functionality in Gentoo is provided via gtk3 package. Now I have to start digging into dependencies and USE flags to understand how this all exactly fits together. Actually, it starts looking like a Gentoo ebuild bug, possible missing dependency.

Thanks a lot, steve. This is not a critical issue, I will see what can be done. If there is a solution found I will post it back here.

Audacity does not yet fully support gtk3. I’m not aware of any major problems, but there’s a few places where text in the GUI is a bit weird - other than that it seems OK, but I’ve not tested thoroughly with gtk3.