Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking outside of Surge XT window with open menus can lead to undefined mouse focus behavior #5692

Closed
ServusCarolus opened this issue Dec 30, 2021 · 9 comments · Fixed by #6327
Labels
Bug Report Item submitted using the Bug Report template Linux Issues which only occur on Linux UX Issues related to user experience (UX) - mouse, touch, keyboard, MIDI inputs, etc.
Milestone

Comments

@ServusCarolus
Copy link

Bug Description:
Using the Cinnamon 5.0.7 desktop on Manjaro Linux, after respectively left- or right-clicking on the Surge XT patch browser rectangle or another component that can open a menu, then clicking outside the focus of the Surge XT window instead of clicking on a menu item or pressing ESC, the mouse pointer will show undefined behavior either regarding pointing mode or visibility.

Surge Version
Two versions are tested: standalone and VST3

Standalone
Version: Surge XT 0.99.main.c01a819f
Build: 2021-12-30 @ 12:35:57 on 'elbereth/local' with 'GNU-11.1.0' using JUCE 6.1.2
System: Linux 64-bit Standalone on AMD Ryzen 7 1700 Eight-Core Processor
Sample Rate: 48.0 kHz

VST3
Version: Surge XT 0.99.main.c01a819f
Build: 2021-12-30 @ 12:35:57 on 'elbereth/local' with 'GNU-11.1.0' using JUCE 6.1.2
System: Linux 64-bit VST3 on AMD Ryzen 7 1700 Eight-Core Processor
Sample Rate: 48.0 kHz

Reproduction Steps:
Steps to reproduce the behavior:

Standalone: Clicking on Patch Browser, then desktop

  1. Open Surge XT using Cinnamon desktop.
  2. Left- or right-click on the patch browser rectangle.
  3. While the menu is open, move the mouse pointer outside the main Surge UI window and left or right click on the desktop background.
  4. Move mouse pointer over Surge UI.
  5. The mouse pointer is in a window-resizing mode: Moving the pointer over the Surge UI will attempt to resize the window. One must hover over the Surge window edge, wait for the resizing arrow to appear, then left-click. Then see if normal focus has resumed. Otherwise repeat until successful.

Standalone: Clicking on Patch Browser, then app window

  1. Open Surge XT using Cinnamon desktop.
  2. Left- or right-click on the patch browser rectangle.
  3. While the menu is open, move the mouse pointer outside the main Surge UI window onto an open app window and click to change focus.
  4. Move mouse pointer over Surge UI.
  5. If the pointer passed over the desktop background at any time when moving from the Surge UI to the app window, the mouse pointer is in a window-resizing mode: Moving the pointer over the Surge UI will attempt to resize the window. One must hover over the Surge window edge, wait for the resizing arrow to appear, then left-click. Then see if normal focus has resumed. Otherwise repeat until successful.
  6. If the pointer did not move over the desktop background, then one may move the pointer back over the Surge UI (but not over the desktop background. One of two things will happen subsequently:
  7. If one left-clicked on the patch browser, one must simply left-click once in the Surge UI to change focus, then a second time to interact with UI elements.
  8. If one right-clicked on the patch browser, as soon as one moves the pointer over the UI, a slider or some other element may be auto-selected and changed as a result. Another left-click will be needed to release that selection. The slider would have to be set back where it was.

Standalone: Right-clicking on UI menu, then desktop

  1. Open Surge XT using Cinnamon desktop.
  2. Right-click on a UI element to open a menu.
  3. While the menu is open, move the mouse pointer outside the main Surge UI window and left or right click on the desktop background.
  4. Move mouse pointer over Surge UI.
  5. The mouse pointer is in a window-resizing mode: Moving the pointer over the Surge UI will attempt to resize the window. One must hover over the Surge window edge, wait for the resizing arrow to appear, then left-click. Then see if normal focus has resumed. Otherwise repeat until successful.

Standalone: Right-clicking on UI menu, then app window

  1. Open Surge XT using Cinnamon desktop.
  2. Right-click on a UI element to open a menu.
  3. While the menu is open, move the mouse pointer outside the main Surge UI window onto an open app window and click to change focus.
  4. Move mouse pointer over Surge UI.
  5. If the pointer passed over the desktop background at any time when moving from the Surge UI to the app window, one click on the Surge UI restores focus and expected interaction. This is actually the expected behavior.
  6. If the pointer did not move over the desktop background, then as soon as one moves the pointer over the UI, a slider or some other element may be auto-selected and changed as a result. Another left-click will be needed to release that selection. The slider would have to be set back where it was.

VST3: Left-clicking on Patch Browser, then desktop

  1. Open Surge XT UI.
  2. Left-click on the patch browser rectangle.
  3. While the menu is open, move the mouse pointer outside the main Surge UI window and left or right click on the desktop background.
  4. Move mouse pointer over Surge UI.
  5. As soon as one moves the pointer over the UI, a slider or some other element may be auto-selected and changed as a result. Another left-click will be needed to release that selection. The slider would have to be set back where it was.

Otherwise, in the VST3, right-clicking on the patch browser, then desktop; clicking on the patch browser, then an app window; and right-clicking on a UI menu, then an app window all produce the expected behavior, regardless of whether the pointer transects the desktop or not.

Expected Behavior:
One would expect that the mode of the mouse pointer would not change, only the focus, and the menus, etc., would just close. One would click back on to the UI without any additional interactions.

Computer Information:

  • OS: Linux elbereth 5.10.84-1-MANJARO #1 SMP PREEMPT Wed Dec 8 09:50:30 UTC 2021 x86_64 GNU/Linux
  • Desktop: Cinnamon 5.0.7
  • Host: Carla
  • Version: 2.4.1

Additional Information:
I use the following script to update the standalone modules, then update the VST3 folders manually:

#!/bin/bash
cd ~/git_repos/surge
git pull -p
git submodule update --init --recursive
#cmake -Bbuild
#cmake --build build --config Release --target surge-staged-assets
cmake -Bignore/sxt -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/charles/.local
cmake --build ignore/sxt --config Release --parallel 8
cmake --install ignore/sxt

@ServusCarolus ServusCarolus added the Bug Report Item submitted using the Bug Report template label Dec 30, 2021
@mkruselj
Copy link
Collaborator

mkruselj commented Jan 1, 2022

Cannot confirm on Windows, at least. My guess is this is probably somewhere deep in JUCE itself, so probably not much we can do about it, but @baconpaul will most certainly have some more thoughts.

@mkruselj mkruselj added Linux Issues which only occur on Linux UX Issues related to user experience (UX) - mouse, touch, keyboard, MIDI inputs, etc. labels Jan 1, 2022
@baconpaul
Copy link
Collaborator

Those were exactly my thoughts (along with being appreciative for the detailed bug report) but I am yet to look

@mkruselj mkruselj added this to the Currently Unscheduled milestone Apr 5, 2022
@haenkel
Copy link
Contributor

haenkel commented May 8, 2022

I can confirm the above with a Cinamon desktop

and slightly different behaviour with the default Ubuntu20 desktop, (EDIT: it's the same in ubuntu)
where a click outside of the UI doesn't close the menu.

Same also happens with b-step ('options' is the only popup there)

While on cinamon I played with some conditionals in juce's PopupMenu.cpp
and got to a point where the above stops happening ... but also broke patch selection.

So no solution yet but something somewhere here:
https://github.com/juce-framework/JUCE/blob/master/modules/juce_gui_basics/menus/juce_PopupMenu.cpp#L728

@haenkel
Copy link
Contributor

haenkel commented May 8, 2022

If I add to bool windowIsStillValid()

if (doesAnyJuceCompHaveFocus() == false)
        {
            dismissMenu (nullptr);
            return false;
        }

then the reported problem is gone while patch selection still works.

@baconpaul
Copy link
Collaborator

Oh excellent

Shall I post up on the juce forum? Or would you like to? I'm sure they would merge this or something very close to it!

@haenkel
Copy link
Contributor

haenkel commented May 8, 2022

I don't have an account in their forum, so if you could tell them would be great.
There is surely a better solution but good enough for "problem goes away if you do this",
from there they know best what to do.

@baconpaul
Copy link
Collaborator

https://forum.juce.com/t/problem-with-menus-cursors-linux-with-patch-that-solves/51350

@haenkel
Copy link
Contributor

haenkel commented Jul 4, 2022

juce-framework/JUCE@f5d2642
This is now in develop and fixes this.
As a bonus it also fixes a bug where typein loses focus when opened via click on button (eg. save button)
I never ran into this before reading this issue, but once you know it's there it can be annoying
so I pr a cherry-pick to the surge-juce-fork

@baconpaul
Copy link
Collaborator

Oh cool I merged the surge branch change just now. Thanks!

haenkel added a commit to haenkel/surge that referenced this issue Jul 4, 2022
- includes latest cherrypick from develop
- fix a broken link in readme

closes surge-synthesizer#5692
baconpaul pushed a commit that referenced this issue Jul 4, 2022
- includes latest cherrypick from develop
- fix a broken link in readme

closes #5692
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Item submitted using the Bug Report template Linux Issues which only occur on Linux UX Issues related to user experience (UX) - mouse, touch, keyboard, MIDI inputs, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants