SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: btmrm on September 29, 2010, 11:59:09 pm

Title: Window Focus on OS X
Post by: btmrm on September 29, 2010, 11:59:09 pm
So I searched the forums and I can't seem to find any posts that actually have a resolution to the window focus problems on OS X.

I have an installation of 15.0.13 I purchased yesterday without any custom macros/code running.

I can edit, take my hands off the keyboard and watch the focus pop away from the window I was editing in. This is really annoying and not something I would have expected for $300+.

Maybe it's my fault for not trying the OS X version before buying but I've used the Windows version for years without any such annoyance.

Has anyone figured this out? Even if it's not completely solved is there at least of list of options I can take to at least minimize it?

Ugh...

Title: Re: Window Focus on OS X
Post by: btmrm on September 30, 2010, 12:12:31 am
More...

I found that once the focus pops and the editor cursor goes from bar to block, I can keep hitting the arrows keys, after about 15 strikes (beeps) the focus pops back into the editor window.
Title: Re: Window Focus on OS X
Post by: btmrm on September 30, 2010, 12:50:27 am
Spoke too fast... was coincidence. If I just sit an wait long enough it comes back. I tried turning on all notifications to see if it would give me a clue - nothing.
Title: Re: Window Focus on OS X
Post by: dmw on September 30, 2010, 05:11:12 am
I've seen this too, but I just assumed it was something quirky with my system and haven't taken the time to investigate.
Title: Re: Window Focus on OS X
Post by: ScottW, VP of Dev on September 30, 2010, 06:20:51 pm
Can you post very specific instructions for how to reproduce this? Please include specific mouse and keyboard actions.  Thanks. I'll have someone look into this.
Title: Re: Window Focus on OS X
Post by: btmrm on September 30, 2010, 07:58:24 pm
Unfortunately, I do not have a single exact reproduce case that can force the behavior on demand.

Sometimes it happens while I'm typing.
Sometimes it happens while I'm selecting text.
Sometimes it happens while my hands are off the keyboard.
It happens with all the file types I have edited so far (cpp, c, java, xml).
It doesn't happen at regular intervals.
If I have a single editor window maximized I get the bar to block cursor and can't type.
If I have multiple editor windows visible I can see the window border change colors and lose focus as the cursor changes.
It's only the editor window. I don't have focus problems with other windows.

The focus always comes back to the editor window if I stop and wait about 5-10 seconds. In the meantime, any keystroke just beeps as if nothing has focus (i.e. I can't see any other form/control that has focus). Obviously I can force it back by clicking the mouse in the editor window or using Atl+Tab to refocus the app.

I posted here because I don't have an explicit on-demand reproducible case - hoping someone else might have figure it out or at least could help in further diagnostics.
Title: Re: Window Focus on OS X
Post by: MartyL on September 30, 2010, 08:09:01 pm
I think that this problem is related to SlickEdit's toast messages. Try disabling all pop-ups in Tools > Options > Application Options > Notifications.

I have noticed some strange window behavior regarding the toasts, even in Windows 7. The intervals sound suspiciously similar, as well.
Title: Re: Window Focus on OS X
Post by: btmrm on September 30, 2010, 08:30:19 pm

Thanks for the suggestion but disabling the notifications didn't resolve it.
Title: Re: Window Focus on OS X
Post by: btmrm on September 30, 2010, 08:48:18 pm
OK, I can reproduce this with some very simple steps on my travel machine which is...

Macbook Pro 13"
2.53 GHz Intel Core 2 Duo
256GB SSD HD
8 GB RAM
OS X 10.6.4

CUA Keybindings

I open a .cpp source file that is part of my project (~200 lines).
Goto the first line, first column.
Hold down the down-arrow key and scroll to the bottom
When the cursor reaches the bottom hold down the up-arrow and scroll to the top
keep repeating the full scroll up-down sequence - after about 3 passes my editor windows always loses focus
Title: Re: Window Focus on OS X
Post by: rajkej on October 03, 2010, 08:54:41 pm
I've had the same problem even with version 14 and most of the time focus returns quick enough to suit my typing. But I think the problem has gotten worse with the latest release 15.0.1.
Title: Re: Window Focus on OS X
Post by: Scott H on October 13, 2010, 01:47:22 pm
We've been trying very hard to replicate this here, with no luck.  For those that are seeing this, can you please let us know a few things:

1. What tool windows you have open?
2. What other apps you have running alongside SlickEdit?
3. Have you applied any special color coding outside the default?

We'll continue to look into this... thanks for the help tracking it down.
Title: Re: Window Focus on OS X
Post by: rajkej on October 13, 2010, 01:49:48 pm
Tool windows:
 Open File and Preview window
Other apps:
 Terminal, Mail, IChat, X11 usually running an Xterm, Chrome
No special color coding
Title: Re: Window Focus on OS X
Post by: Scott H on October 13, 2010, 02:31:55 pm
Thanks, still no luck here though.  One other thought, can you tell me what your x11 options are?  Here's what I have:

XQuartz 2.3.5
Emulate 3 mouse button: no
Follow system keyboard layout: no
Enable key equivalents under x11: no
Full screen mode: no
Use system alert effect: no

Title: Re: Window Focus on OS X
Post by: rajkej on October 13, 2010, 02:44:11 pm
XQuartz: 2.3.5
Emulate 3 mouse button: no
Follow system keyboard layout: no
Enable key equivalents under x11: no
Full screen mode: no
**Use system alert effect: yes
Enable syncing: yes
update pasteboard when clipboard changes: no
update clipboard when pasteboard changes: yes
update primary when pasteboard changes: yes
update pasteboard immediately...: yes
click through interactive windows: no
focus follows mouse: no
*focus on new windows: yes (hmmm. this could be a source)

I marked differences with **. See that last one, maybe there is some type of periodic x11 msg or window pop-up that causes focus to change and then go away?

For me this oddness happens maybe once an hour or so. Thanks for looking into it.
Title: Re: Window Focus on OS X
Post by: Scott H on October 13, 2010, 04:50:28 pm
I found this posted on another board:  http://xquartz.macosforge.org/trac/ticket/133

"For my case, the offending application is ARDAgent. This app runs if you have System Preferences -> Sharing -> Remote Management checked (which you might do if you're trying to defeat a security issue 10.5.X currently has). After unchecking this, X11 no longer loses focus unexpectedly. Are you running ARDAgent?"

"I did have ARDAgent running because of the security issue - Remote Management turned on but no options selected and set to "Only these users" with no users listed. I had noticed that in console I was getting a log message exactly once per minute from ARDAgent about a stray process with the same pid. This coincided with the loss of focus in X11."

Can you see if ARDAgent is running and if you see those messages in the Console?  I tried running it and still had no loss of focus, but I also don't get the pid message the person in the other thread mentioned.
Title: Re: Window Focus on OS X
Post by: rajkej on October 13, 2010, 05:13:06 pm
I do not have ARDAgent running.

I'm going to run for a while with the 'focus on new windows' and 'use system alert effect' settings disabled.
Title: Re: Window Focus on OS X
Post by: btmrm on October 14, 2010, 12:21:56 am
Here are the answers for me...

1.) Tool Windows Open


2.) What other apps are running...

Typically I'm running Eclipse Helios and Chrome but I have ran without them and still have the focus issue.

3.) Yes. I have a custom color scheme with a custom symbol color scheme.

The custom symbol color scheme only has 3 rules:

Symbol Declaration: import
Symbol Declaration: var
Symbol Declaration: gvar:Static

4.) X11 Settings...

XQuartz 2.3.5 (xorg-server 1.4.2-apple53)

Emulate three button mouse: unchecked
Follow system keyboard layout: unchecked
Enable key equivalents under X11: unchecked

Colors: From Display
Full-screen mode: unchecked
Use system alert effect: unchecked

Enable Syncing: checked
Update Pasteboard when CLIPBOARD changes: checked
Update CLIPBOARD when Pasteboard changes: checked
Update PRIMARY (middle-click) when Pasteboard changes: checked
Update Pasteboard immediately when new text is selected: unchecked

Click-through Inactive Windows: unchecked
Focus Follows Mouse: unchecked
Focus On New Windows: checked

Authenticate connections: checked
Allow connections from network clients: unchecked

5.) I am not running ARDAgent


Title: Re: Window Focus on OS X
Post by: garion911 on October 14, 2010, 02:53:19 am
This may or may not be related. Just some observations.

I also occasionally see odd focus issues on OSX, but I'm running the Linux version of Slick, via ssh -X.. I've had it switch away from Slick in the middle of typing. Slick is the only X11 app running (remote or otherwise).

I've also noticed that this seems to happen when a webpage refreshes (I use Chrome).. No idea if thats related or not, as Chrome is OSX native, and not using X11.

Title: Re: Window Focus on OS X
Post by: rajkej on October 18, 2010, 05:36:01 pm
I'm going to run for a while with the 'focus on new windows' and 'use system alert effect' settings disabled.

Tried running with the settings above to no avail. Still having the problem at the same frequency (once per hour or so).
Title: Re: Window Focus on OS X
Post by: btmrm on October 18, 2010, 05:50:21 pm

I have also done some more testing. It doesn't seem to be related to a particular language. I get the same behavior whether it be a .h, .c, .cpp, .java, .xml, .txt, .log et cetera.


Title: Re: Window Focus on OS X
Post by: Scott H on October 19, 2010, 01:53:10 pm
This is very frustrating.  I've run with the different configurations you've all mentioned for several hours apiece and have not seen this problem on my Mac here.  I still need to try it with Chrome on a page that refreshes, but other than that I'm not having any luck reproducing this.  When this problem happens, do you notice anything in the console window that might occur at the same time as SlickEdit losing the focus?  Thanks for being patient, I'm doing my best to even just see this problem happen.
Title: Re: Window Focus on OS X
Post by: rajkej on October 23, 2010, 09:59:16 pm
I've been away for a while and didn't notice your question until today. I'll try to keep an eye on the console and other status bars next time it happens and let you know what I see. Thanks for continuing to look into this.

Do you use spaces on the Mac? I have spaces enabled with 4 spaces. Usually my browser is in one space and my editor/x-windows are in another. Could that have some effect on this? i.e. if the browser was in the background vs the foreground of another space maybe that makes a difference.
Title: Re: Window Focus on OS X
Post by: btmrm on October 27, 2010, 04:40:29 am
I am also running with a bunch of tag files (c++ and java). It sure seems like my focus issue is related to something periodically processing in the background with a high priority. Or, something is about to display a window but it takes too long to gather up the information and eventually it times out and doesn't display the window and focus pops back. Every time I lose focus, I can take my hands off the keyboard and by the time I count to 10-15 it pops back to the cursor location and I'm typing again.

I also walked through one by one and matched my configuration with that of my Windows SlickEdit installation (doesn't exhibit any issues). The settings are virtually the same. Just some minor path differences.

If you can't reproduce with your configurations and we don't have any other diagnostics then it doesn't sound promising.

Sad to say, because of my coding speed I just couldn't keep using SlickEdit on my Macbook Pro because of this issue. It was too disruptive. At this point I'm eating the $360. It is what it is... I'll just check back periodically to see if someone stumbles onto anything.

BTW, I tried running SlickEdit with CrossOver Mac as a possible option but it hangs periodically. No biggie - I didn't expect it to work anyway.

Thanks for all the effort everyone - back to work for me.

Title: Re: Window Focus on OS X
Post by: Graeme on October 27, 2010, 09:13:30 am
Maybe you have a service running that steals the focus.  Does OS X have any tools that let you monitor process execution like process monitor on Windows does?  You could try and monitor which process is executing when you lose focus  - or write a program to log which process has the focus or is active and check the log when you lose focus.  I think I've noticed occasional programs on Windows that steal the focus for no reason sometimes - too long ago to remember which though. 

I would have thought you would get the same problem whatever editor you used  - unless it's something in slickedit that causes it e.g. an update check.  Maybe you should leave slickedit running and see if your other editor loses focus.
Title: Re: Window Focus on OS X
Post by: rajkej on October 27, 2010, 12:41:58 pm
I've not seen this problem with x-windows or any other programs. The problem only happens when SlickEdit is the main program in focus and I'm typing. I haven't been able to spot anything in the console or other windows yet. Sometimes it takes me a moment to recognize the problem is happening (I'm typing and finally realize that nothing is being put into the window) and by the time I look, focus has returned.  For me, I seem to only loose about 1-3 seconds of typing so it doesn't seem as extreme as btmrm's case of 10+ seconds.
Title: Re: Window Focus on OS X
Post by: btmrm on October 27, 2010, 01:30:28 pm
As far as other editors go.

I have tested Gnu Emacs, MacVim, TextMate, BBEdit, & Eclipse Helios on the same system. None of them have focus problems.
Title: Re: Window Focus on OS X
Post by: ScottW, VP of Dev on October 27, 2010, 02:10:05 pm
rajkej: you describe this as a loss of focus. Are you sure that's what this is? Is there a visible sign that the window has lost focus: cursor disappears or window border changes color? Do the characters you type come out in a different window? Or is the only observable symptom that the characters you are typing don't appear in SlickEdit? Do the characters show up after the pause or are they just gone?

I'm wondering if this isn't some kind of hang bug rather than a focus issue.
Title: Re: Window Focus on OS X
Post by: ScottW, VP of Dev on October 27, 2010, 02:17:43 pm
btmrm: On the first page you said that you can readily reproduce this by scrolling all the way to the bottom and back to the top several times. Can you repeat that test with the profiler running:

1) Start SlickEdit.
2) Turn on the profiler. From the SlickEdit command line, type: profile on.
3) Reproduce the problem.
4) Stop the profiler. From the SlickEdit command line, type: profile save "<filename>", where <filename> is the name of the file to save, like "profile.txt".

Send that file to product support or post it here. Anyone else who can readily reproduce this, please do the same. It's best if you have a case where you can reproduce it on demand. The greater the percentage of time spent with lost focus, the easier it will be for us to figure out what's going wrong.
Title: Re: Window Focus on OS X
Post by: btmrm on October 27, 2010, 03:31:36 pm
profile on
reproduced
immediately saved after the focus returned to my editor window

profile.txt is attached

Title: Re: Window Focus on OS X
Post by: ScottW, VP of Dev on October 28, 2010, 01:57:47 pm
Did you just scroll down and up again, like you said earlier? Knowing what you did helps us make sense of what's in there.
Title: Re: Window Focus on OS X
Post by: rajkej on October 28, 2010, 02:13:02 pm
rajkej: you describe this as a loss of focus. Are you sure that's what this is? Is there a visible sign that the window has lost focus: cursor disappears or window border changes color? Do the characters you type come out in a different window? Or is the only observable symptom that the characters you are typing don't appear in SlickEdit? Do the characters show up after the pause or are they just gone?

I'm wondering if this isn't some kind of hang bug rather than a focus issue.

I had to ponder this for a bit and test it again. It seems to me that the window that I'm editing in loses focus. I use the editor in "multiple files share window" mode and I usually split the window vertically so I have two files open at a time. When the problem happens, the window I'm editing does lose focus and seems to flash and redraw. The keystrokes I was typing are lost. Its hard to see what is actually happening when this occurs because it is over pretty quickly (2 seconds or so) and it takes about a second or two for me to realize that its happening.  Could it have something to do with autosave or backup? I'm not sure. It doesn't seem to occur every 10 minutes (my autosave setting) but it could be happening on that boundary.  I don't know of a manner in which to reproduce this problem.

Maybe I'll turn off autosave for a day or two...
Title: Re: Window Focus on OS X
Post by: Dennis on October 28, 2010, 03:46:32 pm
Try temporariliy turning off Symbol Coloring and re-running the profiling session.

   View > Symbol Coloring > Enable Symbol Coloring (toggle off)

Also, watch the CPU guage and also how much time you spend between turning profiling on and saving the data.

Finally, try not to click outside of slickedit while profiling, since this introduces extra data into the profiling results (calls to on_got_focus(), etc).
Title: Re: Window Focus on OS X
Post by: btmrm on October 28, 2010, 05:27:29 pm
To answer the previous question. Yes. I was just scrolling and not editing.
Title: Re: Window Focus on OS X
Post by: btmrm on October 28, 2010, 07:20:51 pm
A run with symbol coloring toggled off....

Attached profile2.txt
Title: Re: Window Focus on OS X
Post by: btmrm on October 28, 2010, 07:30:56 pm
I saved the profile as soon as the focus returned. Now, I know nothing about these files and profiling for slickedit but I see this...

codehelp.ex   27332   CodeHelpActive   4   18   29   89   18   29   89
stdprocs.ex   12226   _on_got_focus   3   31   3742   7479   24   31   79
complete.ex   6560   list_matches   17   43   25825   104833   18   3478   12007

Which appears to be the only _on_got_focus.

I'd like to point out that, at no time during this test, did I see any other windows popup (like code completion or tooltips or parameter info). Was I supposed to see window for the above list_matches?

Just throwing darts ;)

Title: Re: Window Focus on OS X
Post by: Dennis on October 29, 2010, 02:16:00 pm
I mispoke pointing on _on_gotfocus().  That is normal because you'll get that whenever a control gets focus, so switching to/from the command line to do the profiling would have triggered that event.  There was a pair of calls to _on_activate_app(), which does mean that another app got focus and then returned it to SlickEdit.  Did you have to click on SLickEdit to get focus back, or did it just come back to you.  Can you keep an eye on the active processes and see if there is something out there being mischevious?
Title: Re: Window Focus on OS X
Post by: Dennis on October 29, 2010, 02:16:53 pm
Let me add, that the profiling results shows very little time spent processing, so if SlickEdit was doing anything, it wasn't in the macros (and SlickEdit does nearly everything through macros).
Title: Re: Window Focus on OS X
Post by: rajkej on October 29, 2010, 02:17:58 pm
Is autosave done in the macros?
Title: Re: Window Focus on OS X
Post by: btmrm on October 29, 2010, 04:13:47 pm
I don't have to click on the app to get the focus back.

When I get some time I will run through it again and watch the processes.
Title: Re: Window Focus on OS X
Post by: btmrm on October 29, 2010, 09:42:46 pm
As with my case, it loses focus for a good 5-10 secs so I decided to attempt to capture it...

See the attached screenshot. Note I had to make the windows smaller and close some of the tool windows I normally run with. I also had to blur some of the info in the image for privacy reasons.

The cursor at line 70 popped, slickedit jumped to the top and spiked my disk.

Title: Re: Window Focus on OS X
Post by: Scott H on November 05, 2010, 03:37:40 pm
If I could make another request for you to try something... would you be able to make a copy of one of your files, give it an extension of .aaa and open it in SlickEdit?  Make sure it's in Plain Text mode (Document > Select Mode).  This will turn off all tagging and updating as you scroll with the keyboard.  Now try scrolling up and down in the file with the keyboard again and let me know if you have that problem.

Sorry for having to keep coming back and asking you to try new stuff, we're just trying to narrow down the possibilities of what's causing this.  Thanks!