Closed Bug 207339 Opened 17 years ago Closed 4 years ago
There is no way for the embedders to get notified about selection changes
Updating sensitivity of menus like Edit->Copy and Edit->Clut requires a way to be notified on selection changes. nsICommandManager->addCommandObserver ("cmd_cut"); would look like the proper way to do it, but unfortunately it doesnt appear to work (no notifications at all). In mozilla this is done with XULCommandDispatcher.
The same is true for focus and undo/redo. The problem is that in nsGlobalWindow.cpp XULDispatcher is used to notify about action changes instead of CommandManager API. All that I've been able to find about Command manager / XULDispatcher relation is: http://www.mozilla.org/projects/embedding/commandhandling.html. Am I getting it wrong or we are supposed to abandon the use of XULDispatcher for CommandManager ? Are there bugs opened about it ?
The command observer stuff only works in composer right now. There are ways to do what you want using non-frozen APIs. Look at the Camino source code for examples.
I've seen Camino code. Though unfortunately not all toolkits have a validateMenuItem api. In gtk the only way I found to make it work is to update sensitivity on menu showing and to reenable all items on menu hide (so that accellerators still works when there will be changes on the state of the command). That's just a bad hack, I'm not even sure it fully works :/ Can you explain which is the frozen api you are talking about ? The command api supports observers already ... Is there a plan to move using the commands api in mozilla browser too and any bug opened about it ?
Just to comment that the mozilla-based browser that OLPC uses needs this functionality.
Marking a bunch of bugs in the "Embedding: APIs" component INCOMPLETE in preparation to archive that component. If I have done this incorrectly, please reopen the bugs and move them to a more correct component as we don't have "embedding" APIs any more.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.