nmaier / mintrayr

Mozilla extension: Minimize windows into the system tray (Firefox, Thunderbird, Seamonkey, Instantbird)
https://tn123.org/mintrayr/
Mozilla Public License 2.0
84 stars 37 forks source link

Incompatibility with sizemodechange events #96

Closed vanowm closed 11 years ago

vanowm commented 11 years ago

It seems mintrayr stops sizemodechange event from firing on minimize and makes it incompatible with other extensions that relay on that event. Because of that window.windowState doesn't get update either.

(Windows 7 x64, FF 16 - 19.0a1)

nmaier commented 11 years ago

Yeah, "swallowing" the size event is unfortunately something necessary, because minimized windows aren't allowed to show context menus per mozilla code. /wontfix

vanowm commented 11 years ago

You lost me at context menus. What does it have to do with sizemodechange and window.windowState? Anyway, as of now, the extension does not provide any means of detecting when windows is minimized, this is unacceptable. At least set properly the window.windowState and create/send out event to observers - this would be somewhat sufficient...

nmaier commented 11 years ago

You lost me at context menus. What does it have to do with sizemodechange and window.windowState?

The gecko platform code checks the window state before displaying native popup windows. And context menus are internally popup windows. When minimized, Gecko simply refuses to display them.

You cannot set windowState. Setting windowState will attempt minimize the window. It is not just a value, but a getter/setter construct.

If you find a another way than this ugly hack, throw me a pull request. Otherwise it will stay.

vanowm commented 11 years ago

I assume the context menu is the menu for tray icon?

If so, I think there is a way create "invisible" window and use it for context menu.

But the easiest (not perfect) solution is to send notification to observers.

observerService.notifyObservers(null, "window-changed-state", "minimized");
observerService.notifyObservers(null, "window-changed-state", "restored");

If windowState cannot be used, then perhaps _windowState could be. All that is not even close ideal, but at least something. What do you think?

nmaier commented 11 years ago

I assume the context menu is the menu for tray icon?

Yep

If so, I think there is a way create "invisible" window and use it for context menu.

Last time I checked: Nope. Maybe time to give it another try.

What's your use case, btw?

vanowm commented 11 years ago

My extension minimizes window at certain conditions. And because there is no way of knowing if window is already minimized or not, it creates issues (#97) Is there a way you could create a new branch where we could work with making context menu working on PROPERLY minimized window? (I'm not very comfortable working with Git yet)

nmaier commented 11 years ago

What's your extension? Anything publicly available? And wouldn't it be enough to fix #97?

vanowm commented 11 years ago

Get notification when a window was hidden in tray (and restored from tray) as well as being able to check the state of a window at any time - would be enough for my extension. However I do believe on a long run mintray should be properly fixed, because at current state it could affect other native functionality.

My extension is MasterPassword+ Right now I implemented a very ugly hack based on window size and position and it doesn't quiet work properly.

nmaier commented 11 years ago

If so, I think there is a way create "invisible" window and use it for context menu.

Last time I checked: Nope. Maybe time to give it another try.

Seems it is possible to abuse the hiddenWindow now. Removed the windowState hack in favor of a less invasive (but still very nasty) hiddenWindow hack.

vanowm commented 10 years ago

Whatever changes were made break entire extension. Current source is unusable.