geany / geany-osx

Things needed to bundle Geany for OSX
Other
24 stars 14 forks source link

Default theme bundled with Geany for macOS causes right-click menu problems #24

Closed willbprog127 closed 2 years ago

willbprog127 commented 3 years ago

Greetings!

Using Geany 1.37 on macOS 1.14.6 (Mojave) Intel there is a problem with the default theme. When selecting text in the editor then right-clicking on this selected text, often the right-click menu will appear then disappear, and then an Undo has been performed. So far it appears to be random but frequent enough to cause problems and frustration.

As a workaround, I had to quit Geany, go into the Resources->etc folder in the app bundle and rename the gtk-3.0 folder to gtk-3.0~. After restarting Geany, a slightly different theme is in use and the right-click menu behavior is now working properly.

It appears that the excessive animation of the Geany-bundled default theme is causing the problem. After renaming the etc->gtk-3.0 folder, the GTK-macOS default theme seems to handle the right-click and menu navigation correctly.

Thanks!

willbprog127 commented 3 years ago

Here is a video of the issue. The problem happens every other time in this video. It is performing 'Undo' when I right-click without any action on my part (except right-clicking code).

https://www.youtube.com/watch?v=N0DrJyxmOfc

elextr commented 3 years ago

Happens on:

10:34:28: Geany INFO        : Geany 1.38 (git >= e027e240), en_AU.UTF-8
10:34:28: Geany INFO        : GTK 3.24.20, GLib 2.64.6
10:34:28: Geany INFO        : OS: Linux Mint 20 (ulyana)

if:

  1. the right mouse button is held not clicked
  2. while its held the cursor moves to the top menu item (undo) due to shakey hands, cosmic winds or something else
  3. undo happens when right mouse button is released

This is of course how its meant to work when mouse down is separate from mouse up, ie the time between is greater than the mouse click period.

If the click speed is set faster than the menu animation and the user or GTK waits for the menu to appear then the mouse operation will be seen as a separate "down" and "up" which makes the menu execute whatever operation is selected. So if the cursor moves while waiting it can select the nearest menu item. Hence changing the theme to remove animation and making the menu appear before the click timeout "solves" the problem. Its possible also that the different theme has more of a border on the menu that means the cursor has to be moved further, stopping it hitting the undo item.

So its not really a "bug" as such, everything happening is meant to happen, just that a combination of timings and theme values that makes it easy to make an action happen when a user didn't expect it.

AFAIK the themes for macosx are delivered as they come without Geany changing anything, I guess its up to @techee if supporting modifications is acceptable.

willbprog127 commented 3 years ago

Thanks for your reply.

1. the right mouse button is held not clicked

I am not holding the right mouse button. The action happens during a normal right-click. I do not have issues with native macOS apps, Firefox, etc. in regards to right-clicking -- this only happens with Geany.

2. while its held the cursor moves to the top menu item (undo) due to shakey hands, cosmic winds or something else

Not cosmic winds -- I'm in an ultra-secure mega-shielded location 😉

It's disappointing that this happens because Geany has been my favorite coding environment for years -- mostly on Linux. Now that I'm on macOS, I'm really hoping to keep using Geany, although renaming the conf file directory is a small price to pay. 😃

elextr commented 3 years ago

The mouse generates two actions, a "mouse button down" and a "mouse button up", and a timeout is used to change that pair to a single "click" if they are close enough together. I don't know what that timeout is for macos or if it can be changed, it probably can but how that interacts with GTK I don't know. On GTK a right "click" brings up the menu and leaves it there, a right "mouse down" brings up the menu until a right "mouse up" and then removes it and activates the selected item (if any). That is the behaviour you describe, and suggests that the "click" is being seen as separate "mouse down" and "mouse up" but I am an Apple free zone and can't test it.

I should point out all this happens inside the GTK layer, Geany just sees the activate signal from the menu, so its not something Geany controls.

Native apps, Firefox etc don't use GTK on top of the macos GUI layer, so they may operate differently.

There is really only one person supporting Geany on macos, so maybe you can give him a hand by trying to debug it further.

I'm in an ultra-secure mega-shielded location

but the internet is still getting into your evil villains lair :grin:

techee commented 3 years ago

@willbprog127 I created a new Geany binary with an updated theme that is based on

https://github.com/vinceliuice/WhiteSur-gtk-theme

The installer is here if you want to give it a try

https://download.geany.org/snapshots/geany-1.38_test_osx.dmg

Not sure if it fixes the problem for you or not. I actually never saw the problem you described but have seen this behavior e.g. on combo-boxes in Geany settings where you have to keep the mouse pressed while selecting from the popup menu, otherwise the first item gets selected. Unfortunately, this happens with the new theme too.

This most probably is a problem in the macOS GTK version which isn't 100% mirroring the linux behavior. Maybe one could also modify the theme somehow to avoid this, I'm just afraid I don't know GTK theming enough to do this myself.

willbprog127 commented 3 years ago

@techee Thank you! I will try it out when able. :smile:

techee commented 2 years ago

I've just uploaded a new version here

https://download.geany.org/snapshots

which uses a different theme and which I believe fixes the problem (it does on my machine at least). Closing this issue. If the problem persists on your machine, please feel free to reopen this bug report.