linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.4k stars 726 forks source link

Suggestion for improving the menu speed #2597

Closed Garibaldo closed 9 years ago

Garibaldo commented 10 years ago

I was testing the main menu of some Desktop Environments (Mate and Xfce) to find out why their menus are so much faster than Cinnamon's menu. Well, I think I found one of the possible reasons for it. Under Mater or Xfce the menu opens just by a mouse button press, I mean, the menu opens even before the user releases the mouse button. Under Cinnamon the menu only opens after the user releases the mouse button. In my opinion, this contributes substantially to the overall sensation of slowness. I know this may appear to be a negligible detail, but trust me, it makes a huge difference.

So my suggestion:

Make the menu open immediately when the user presses the mouse button. Don't wait for it to open only when the user releases the pressed button .

Garibaldo commented 10 years ago

Interestingly, similar issue happens with the panel pop-ups. When we right-click on the panel, the pop-up menus only open after we release the mouse right-button. But when we right-click on the Desktop, the context menu opens instantaneously. Can you see the difference? Another interesting fact: when I set the menu to open on mouse hover, it opens almost instantaneously.

clfarron4 commented 10 years ago

Yes, I see the difference, and now you mention it I see it.

ManIVIctorious commented 10 years ago

I just tried it out, i don't think that it gets faster only because i set it on mouse hover. More it seems to me that the speedup is caused because it is still cached. You can try to open one or two files and then try to hover over the menu applet and it will take as long as it did on mouse click.

Garibaldo commented 10 years ago

I've tested it again and the menu opens almost instantaneously when I use the option of opening the menu on hover. I had even opened other files and did other things on the computer before trying again. But I need to point out that:

There is some discussion about this subject in this topic: http://forums.linuxmint.com/viewtopic.php?f=208&t=116702

Garibaldo commented 10 years ago

I've set POPUP_ANIMATION_TIME (in /usr/share/cinnamon/js/ui/boxpointer.js) to 0. It appears that it only has some effect on the pop-up menus.

VolMi commented 10 years ago

Now with Cinnamon 2.0.10, the menu opening time after startup has decreased from >6s to <1s, here. That is fantastic, obviously. All the more, the pseudo-delay you mentioned has a vastly increased relative impact.

I support to change the activation trigger for menu and other Cinnamon-elements to "button pressed" rather than "button released". Or more shortly: +1

ghost commented 10 years ago

It's very interesting. You can make a simple test that you propouse: 0- Make a copy of /usr/share/cinnamon/js/ui/popupMenu.js in your desktop. 1- Open terminal 2- execute: sudo gedit /usr/share/cinnamon/js/ui/popupMenu.js 3- Remplace button-release-event for button-press-event 4- Save change 5- Restart Cinnamon 6- Test the result 7- If you don't like the result remplace the /usr/share/cinnamon/js/ui/popupMenu.js for the backup in your desktop.

ghost commented 10 years ago

For the replace, in gedit use menu search and replace and replace all.

ghost commented 10 years ago

If you like to change this in a reaction of all applet, make de same in a file applet.js. and also in the file panelMenu.js All files it's in /usr/share/cinnamon/js/ui/

I tested all, don't have any problem.

Garibaldo commented 10 years ago

@lestcape , I must have done something wrong because I followed all the steps and haven't noticed any difference.

ghost commented 10 years ago

If you change popupMenu.js then when you clicked the item in the menu without release the mouse the app launched. Without a change, you need to release the mouse.

If you change panelMenu.js occurs the same but with right click in the panel.

If you change applet.js occurs the same but when you clicked some applet, like the menu.

ghost commented 10 years ago

@Garibaldo remember that you need restart Cinnamon for the change take effect.

Garibaldo commented 10 years ago

@lestcape, I did exactly that. I've only changed popupMenu.js. I replaced all the occurrences of "button-release-event" with "button-press-event". I saved the file and I did restarted Cinnamon, but the menu didn't open without releasing the button.

ghost commented 10 years ago

@Garibaldo that you want require that you change applet.js not the panelMenu.js

ghost commented 10 years ago

@Garibaldo make this: 0- Make a copy of /usr/share/cinnamon/js/ui/applet.js in your desktop. 1- Open terminal 2- execute: sudo gedit /usr/share/cinnamon/js/ui/applet.js 3- Remplace button-release-event for button-press-event 4- Save change 5- Restart Cinnamon 6- Test the result 7- If you don't like the result remplace the /usr/share/cinnamon/js/ui/applet.js for the backup in your desktop.

Garibaldo commented 10 years ago

Very interesting. Indeed that made my menu opening apparently much faster. Thanks for the tip. It is working well so far. I hope there is no negative consequence with this change.

ghost commented 10 years ago

With the change in popupMenu.js i notice that if you have preview windows(more than one) and you change this file, you can make trouble when select a windows.

This change it's only for test, another extention can use this for any other things and you can broken this mechanism. When a new release of Cinnamon come, this change will be reverted.

Garibaldo commented 10 years ago

Just some updates. I've made the changes only on the "applet.js" file. Actually I've just had to change one occurrence of "button-release-event" to "button-press-event" . I've been using my system for two days now, and, so far, everything is working very nicely, without any problem whatsoever. Now the menu and the panel applets open just by a mouse left-button pressing. The only problem is that every time I update Cinnamon, I have to redo the whole process. So I would suggest to the Cinnamon devs to implement this behavior as default. I can't think a reason to not do so.

mtwebster commented 10 years ago

I just tried this... unfortunately it interferes with the ability to drag and rearrange applets, so more rework would be required to implement this. We will definitely look into it for the next release though, we've already had some discussion on irc over it.

Garibaldo commented 10 years ago

You're right mtwebster, I've just noticed that. Anyway, thank you very much for considering it for the next release. And thanks for the feedback too.

ghost commented 10 years ago

@mtwebster your CPU frecuency applet don't have response to the change in applet.js, maybe you handle the event directly. At less Cinnamon Menu can handle the even directly and check if state of drag it's active. In the other hand, popup menu for the Cinnamon Menu can handle the mouse press event, to avoid the slowly app's start(it's not a menu reaction). This last change can contribute to make a sensation that all system reacted more speed.

ghost commented 10 years ago

The mouse event(BUTTON_PRESS) can be capture using global, to avoid the overriding.

global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
_onCapturedEvent: function(actor, event) {
      try {
         let source = event.get_source();
         if(!this.actor.contains(source)) {
            if(event.type() == Clutter.EventType.BUTTON_PRESS) {
               //if(!Main.layoutManager.keyboardBox.contains(source)) {
                  //this.newNote(this.entry.text);
                  //this.showErrorMessage("me fui");
               //}
            } else
               this.unlock();
         }// else
            //this.showErrorMessage("Sirve");
      } catch(e) {
         this.showErrorMessage(e.message);
      }
   },
Redsandro commented 10 years ago

Now with Cinnamon 2.0.10, the menu opening time after startup has decreased from >6s to <1s, here. That is fantastic, obviously.

Wow, that's a huge difference. But any delay, even up to 1 second, is unacceptable. It's just crazy. Why are we sitting around with the most powerful computers ever and gigabytes of (often unused) memory and not have the contents instantly available? Like Synapse? Like Gnome-do?

This onMouseDown vs onMouseUp is trivial compared to that.

leigh123linux commented 10 years ago

Couldn't you just click quicker ? :-)

KDB2 commented 10 years ago

The menu cannot be dragged if the edition mode is not started. So basically, when the edition mode is on, the "open menu when a click is started" should be off. And if edition mode is off, then "open menu when a click is started" should be on.

Just a though. Maybe a bad one ;)

ManIVIctorious commented 10 years ago

I don't think that this would make anything better as it is now.

Garibaldo commented 10 years ago

@ManIVictorious, are you referring to my original suggestion or just the last comment? I've already test my suggestion and trust me, there is an actual improvement. I'm not saying that the change will make the menu completely instantaneous, but it will certainly be much better, especially with the recent speed improvements already implemented. So, in this case, each millisecond matters. Moreover, there is no reason not to make this change, and every single other DE that I know work this way. In fact I'm surprised with your opposition to the suggestion.

ManIVIctorious commented 10 years ago

Sorry, i was referring to the original comment. I don't think that it makes anything faster only because it is on button-click. The button release is very fast on all mouses i have ever used.

Additionally i sometimes click on applets and decide that i am not really interested in the popup and then i move the mouse away after i have clicked and nothing happens. That is exactly the behavior i would expect.

IMO it would be strange when all applets work on button release and the menu applet on button press.

If this gets implemented i would expect to have a settings entry in which i can configure that all applets should work on button click or all should work on button release, but don't make the menu-applet any special.

ghost commented 10 years ago

A solution to satisfy all people maybe it's put a option in global settings of Cinnamon for applets reaction(all applets) with two state, "On Mouse Pressed" or "On Mouse Release".

Personally for me this issue was no longer significant, once the developers improved the code and reduced the reaction from the menu. But you must always think about the interests of others, and if we give them options, I think it will always be better.

Redsandro commented 10 years ago

Additionally i sometimes click on applets and decide that i am not really interested in the popup and then i move the mouse away after i have clicked and nothing happens. That is exactly the behavior i would expect.

I do this too! Never seen someone else do this. But there seems to be a trend that this is true (onMouseUp) for buttons, but not for menu's (try Nemo/Nautilus) where it is onMouseDown.

However, as long as we agree that this is a silly 'solution' for the real problem.

ghost commented 10 years ago

For the people that can not wait or don't can wait a milliseconds to open a Menu:

https://github.com/lestcape/Menu-Cinnamon-Child/archive/master.zip

Garibaldo commented 10 years ago

Nice! You should upload it to the Spices website, as an applet. Now we can compare both menus side-by-side. In my opinion, your changes made this menu clearly superior to the default one. Thanks.

ghost commented 10 years ago

@Garibaldo @mtwebster said: "I just tried this... unfortunately it interferes with the ability to drag and rearrange applets, so more rework would be required to implement this. We will definitely look into it for the next release though, we've already had some discussion on irc over it."

That you can see this can be done as well(my applet it's only an example). I don't know the Cinnamon final position about this.

It makes no sense to go against the current, we need wait for officially Cinnamon developers speak out about this. Then if Cinnamon developers decided not change the current mechanims, then i can upload this menu, how alternative of Cinnamon Menu to Spices website.

ghost commented 10 years ago

Note that my menu don't displayed when you drag and drop are enabled, and note that it's only an extention of Cinnamon Menu. The latter means if Cinnamon Menu have an internal update to work more fast my menu also update this ability automatically, because i use the code of cinnamon Menu, whatever it was that.

Garibaldo commented 10 years ago

@lestcape, I'm sure the devs will consider it for Cinnamon 2.2, after the Mint 16 release. But I can't see why not upload it to Spices now, since there will be no interference with the other applets, as you've implemented it as an applet itself, as far as I understand. So I see no reason to put it on hold. As an applet, people will have a chance to test it.

ghost commented 10 years ago

@Garibaldo I don't know realy why(maybe because i don't speak English good), but my comments are interpreted as fighting or impositions. It is not my intention and I do not want give more reasons to continue tumbling evil needlessly.

My applet it's a free software, you can redistribute it and/or modify it under the terms of the GNU General Public License.

ghost commented 10 years ago

@Garibaldo you can see this: https://github.com/linuxmint/Cinnamon/issues/2607 and maybe understand why I was said this.

ghost commented 10 years ago

WebSite: https://github.com/lestcape/Configurable-Menu Download: https://github.com/lestcape/Configurable-Menu/archive/master.zip

Garibaldo commented 10 years ago

@lestcape , Excellent! Have you seen this applet http://cinnamon-spices.linuxmint.com/applets/view/129 yet? It is very interesting. Maybe you can get some ideas from it. By the way, I just don't understand the clock thing. Why would anyone want a clock on the menu? Anyway, very nice applet. I look forward to the final version.

Garibaldo commented 10 years ago

@lestcape , now I've tested a bit more your menu applet and I have to say, it is pretty great! Thank you very much. Sorry for asking again, but are you going to upload it to Spices? More people should know about it.

ghost commented 10 years ago

@Garibaldo upload to Spices it's the final idea, i can no upload the other because the developers of Cinnamon told me that he don't want to share the code of applet menu. Well, this menu use a copy of cinnamon menu, not the original. The case it's that i try to be compatible with Cinnamon menu. Because if internal api changed, all menu become broken. That happen now with others menu. I try to write a better menu but with the greatest possible use of code cinnamon. That will help me to be able to update my code as soon as possible.

By datetime do not worry, it's just that I'm starting. Only been two days of work, eventually it will not be I guess. The point is that I have spare space. You are invited to think too and I think you could help.

My principal problem with Cinnamon menu is the height and i resolved it. See: https://github.com/linuxmint/Cinnamon/issues/2281

ghost commented 10 years ago

http://cinnamon-spices.linuxmint.com/applets/view/163

Garibaldo commented 10 years ago

@lestcape , I have a suggestion for you: after you've finished your amazing menu applet, I think you should open separated pull requests here in Cinnamon github with some of your menu improvements, so that the default menu could use at least some of them. I know that the devs are very busy right now fixing the bugs for the final release of Mint 16, but I'm sure they would consider your contributions after the release, so there is no hurry for now. I know that Clem is a little conservative with some design changes, that's probably why he rejected this http://cinnamon-spices.linuxmint.com/applets/view/129 , but I think he might bring to Cinnamon at least some of your ideas. Meanwhile, keep adding cool features to your applet. :-)