GNOME Bugzilla – Bug 361670
Flat reviewing immediately after minimizing Orca main window fails
Last modified: 2006-10-15 03:09:42 UTC
Please describe the problem: If you use a flat review command immediately after minimizing the Orca main window, flat review fails. Steps to reproduce: 1. Be sure that show Orca Main Window is enabled in the Orca preferences dialog. 2. Launch Orca 3. Launch Gedit and type a line of text 4. Alt Tab back to the Orca main window 5. Use Alt Space, N to minimize it. (Focus should be returned to Gedit automatically) 6. Press KP_8 to review the current line Actual results: Flat review fails and the following error is generated: Traceback (most recent call last):
+ Trace 75964
consumed = self._function(script, inputEvent)
self._reviewCurrentLine(inputEvent, clickCount)
self.updateBrailleReview()
line.addRegions(regions)
self.regions.extend(regions)
Expected results: Flat review wouldn't fail. Does this happen every time? Yes. Other information:
Created attachment 74553 [details] Full debug.out
I get a slightly different traceback when I try this: Traceback (most recent call last):
+ Trace 76023
Investigating now...
Created attachment 74586 [details] Orca debug output where it doesn't fail. Classic. Turn on Orca debugging for me and add a few more print statements in, and the problem goes away. Now I need to compare the two debug files to see what the differences are.
Created attachment 74667 [details] [review] Patch to hopefully fix the problem. Will and I brainstormed this problem earlier today. What's happening is that the orca main window was getting a "window:activate" event, even though it had just been iconified! See about line 2901 in the first debug.out attachment. This was setting the active script to be for Orca: vvvvv PROCESS OBJECT EVENT window:activate vvvvv OBJECT EVENT: window:activate detail=(0,0) app.name='-c' name='Orca Screen Reader / Magnifier' role='frame' state='ENABLED ICONIFIED RESIZABLE SENSITIVE SHOWING VISIBLE' relations='' ACTIVE SCRIPT: -c (module=orca.default) LOCUS OF FOCUS: app='-c' name='Orca Screen Reader / Magnifier' role='frame' event='window:activate' The patch consists of two parts: 1/ Does process "window:activate" events if one of the states is ICONIFIED. 2/ If we get None back from calling context.getCurrentBrailleRegions(), then just cons up an empty region list and a regionWithFocus of None. Joanie, as I'm not seeing this anymore, could you give the patch a try please and provide feedback? Thanks.
Created attachment 74673 [details] Full debug.out after patch Hi Rich. I just applied the patch. I'm afraid I'm still seeing the problem, but getting a different error. New error: Traceback (most recent call last):
+ Trace 76230
braille.panToOffset(regionWithFocus.brailleOffset \
This occurs on both of the machines I've tried it on thus far. Sorry!!! New debug.out attached.
Created attachment 74674 [details] [review] Take 2: Patch to hopefully fix the problem. No need to apologize for finding bugs. ;-) It was untested. Same as this one, but it was fairly clear what was going wrong. This one obsoletes the other one. Or alternatively, it just adjust a bit of code further on. Could you give this a try please? Thanks.
Okay, can I apologize for asking silly questions then? ;-) Does "obsoletes" mean that this new patch should be applied to a clean build (i.e. as if the previous patch had never been applied)? The reason I ask is that this patch does not seem to include the change to focus_tracking_presenter.py that was in the previous patch. Although, that said, it seems that it doesn't really matter as the end result wound up being the same. Here's what I tried: 1. Started with a clean build and applied the new patch. Results: No error (yea!), but flat review didn't review the text in gedit. 2. Manually made the change to focus_tracking_presenter.py and tried again. Results: Same as above.
I should probably stop for today. I'm obviously tired. That "Take 2" patch doesn't fully obsolete the previous patch. As you correctly point out, you would still need the changes to focus_tracking_presenter.py. And even then, from your feedback, it looks like the patch still needs work. I'll continue to look at it on Monday morning. Thanks Joanie.
Created attachment 74700 [details] debug.out resulting from my proposed change Hi Rich. I spent some time today looking at the problem, your patch, etc. Here's what seems **to me** to be going on: The patch to focus_tracking_presenter.py seems to ensure that correct script (for the test case, that would be the gedit script) remains active. However, the event still gets processed and when it does, locusOfFocus stops being what it should (e.g.gedit) and seems instead to become a non-existent entity. It therefore seems *to me* that when you get a window:activate event and the state of the window in question happens to be iconified, that you just want to ignore the whole thing and move on. So could you do something like this: try: if not event.source.state.count( \ atspi.Accessibility.STATE_ICONIFIED): if event.type == "window:activate": # We'll let someone else decide if it's important # to stop speech or not. #speech.stop() orca_state.activeScript = self._getScript(event.source.app) debug.println(debug.LEVEL_FINE, "ACTIVE SCRIPT: " \ + orca_state.activeScript.name) s = self._getScript(event.source.app) s.processObjectEvent(event) if retryCount: debug.println(debug.LEVEL_WARNING, " SUCCEEDED AFTER %d TRIES" % retryCount) break When I made the above change, the problem went away. In my *very brief* testing, I didn't notice any side effects. The debug.out is what resulted from my trying to reproduce the problem after making the above change.
I just noticed that I didn't edit the above correctly in terms of indentation when I was stripping out leading white space for the comment. Need more Ritalin and/or fewer distractions... ;-) It should be: try: if not event.source.state.count( \ atspi.Accessibility.STATE_ICONIFIED): if event.type == "window:activate": # We'll let someone else decide if it's important # to stop speech or not. #speech.stop() orca_state.activeScript = self._getScript(event.source.app) debug.println(debug.LEVEL_FINE, "ACTIVE SCRIPT: " \ + orca_state.activeScript.name) s = self._getScript(event.source.app) s.processObjectEvent(event) if retryCount: debug.println(debug.LEVEL_WARNING, " SUCCEEDED AFTER %d TRIES" % retryCount) break The above is what I actually tried, what the debug.out is from, etc. My apologies. On a different note, should the check for iconified be after the check for window:activate instead of before it? In other words, while the state of the window is iconified, can an event other than window:activate occur that should be handled by processObjectEvent that is no longer being handled?
Created attachment 74734 [details] [review] Hopefully the final fix for this problem. Nice one Joanie. We are going to have to give you checkin priviledges soon at this rate. Obsoleting my previous one.
Changes checked into CVS HEAD. Closing as FIXED. Joanie, if you could give it a final test (you are welcome to change the state to VERIFIED if you like), we can hopefully put this one to bed.
Hi Rich. I think we need to rouse it. I just built from CVS and the fix didn't work. So I diffed my working files with the new ones from CVS. What the CVS default.py has that my working one lacks are the following lines: if event.type == "object:state-changed:focused": if event.detail1: self.onFocus(event) else: orca.setLocusOfFocus(event, None) return (see 2031-2036) When I comment those lines out, things work correctly. With them in, I think we're causing the same problem, namely setting locusOfFocus to something non-existent. HTH.
Those lines were the "fix" for bug #355893. I've removed them from CVS HEAD and reopened that bug. Thanks Joanie. Could you also confirm that doing that means that this bug is now fixed please?
Fix confirmed!