14
$\begingroup$

Between Mathematica 5.2 and later versions, there has been a change in determining which notebook gets the palette input focus, which leads to quite unfortunate behaviour if you use focus-follows-mouse as I do.

For those who don't know focus-follows-mouse: This mode gives the keyboard input focus to the window which currently contains the mouse pointer. Now consider the following situations: There are two notebooks and a palette open (one of the notebooks might be the help window, which under Mathematica is basically just a notebook). Let's say, the first notebook is on the left, the second one is in the middle, and the palette is on the right. Let's also say that I'm working on the left notebook, and now want to use the palette. Therefore I move the mouse to the palette and press the button I want.

In Mathematica 5.2 this had exactly the intended effect: Mathematica remembered that I last interacted with the left notebook, and inserted the input generated by the palette there. However in Mathematica 8.0 the input is instead inserted in the right notebook.

Of course it's not hard to understand how this happens (and indeed, the problem is not restricted to Mathematica, but occurs also e.g. with Gimp; however the fact that Mathematica 5.2 got it right gives me hope that it's just some option I have to toggle or some initialization I have to edit to regain the behaviour). When I move the mouse pointer from the left notebook to the palette, it of course crosses the right notebook which is in between, and therefore focus-on-mouse gives the keyboard input focus to that window. Of course it loses the input focus again when I move on to the palette (which ultimately gets the input focus), but newer Mathematica versions obviously record which window had input focus last and use that to determine which notebook the palette should act on.

Therefore my question is: Is there some option I can set to recover the old Mathematica-5.2 behaviour? Or if not, is there a way to get it with some Mathematica programming (which I then could put into an init file)?

Edit

As I said in a comment to an answer that was deleted in the mean time, I've found out that Mathematica 7 still behaves in the way I want. So the change was obviously introduced in between 7 and 8. I'm adding that here so that the information is visible to those who cannot see deleted answers (and in case the deleted answer including comments might eventually go away completely).

Also note that (as I also wrote in that comment) SelectedNotebook[] changes the same way (i.e. follows focus unconditionally in version 8, but changes only on interaction in v7).

$\endgroup$
6
  • $\begingroup$ I can not reproduce this problem with Mathematica 8.0.4 running under OS X 10.6.8 on a Mac. Are you sure this isn't a problem with your OS? $\endgroup$
    – m_goldberg
    Commented Oct 17, 2012 at 13:39
  • $\begingroup$ Do you have Focus-follows-mouse on OS X (I never worked with it, so I can't tell, but e.g. Windows doesn't have it)? Because the problem description only makes sense with Focus-follows-mouse. The point is, previous versions of Mathematica contain code that creates the good behaviour (and that code must have been there on purpose, because a naive implementation will give the exact behaviour I see with 8.0.0.0), and therefore I think that code might also be in 8.0.0.0, but just not activated for some reason (I hope it's still there). Of course it could also be a bug which was fixed in 8.0.4. $\endgroup$
    – celtschk
    Commented Oct 17, 2012 at 15:40
  • $\begingroup$ Ah, and note that those previous versions show the good behaviour runnning on the very same computer, under the very same operating system. Oh, and I just noted that I made a mistake in my description of focus-follows-mouse; fixed now. $\endgroup$
    – celtschk
    Commented Oct 17, 2012 at 15:47
  • $\begingroup$ AFIK, OS X doesn't have focus-follows-mouse. Keyboard focus remains with the active window even if the mouse focus moves to, say, a floating palette. $\endgroup$
    – m_goldberg
    Commented Oct 18, 2012 at 1:43
  • $\begingroup$ I'd like to add a related difference between 5.2 and 8 which annoyes me a bit: select (highlight) any Keyword, say "Solve", in the code, then press F1 to get help. The window with the help system opens and displayes the explanation of that keyword. Now continue to work in your notebook hereby moving the cursor to another position. Now you wish to come back to the help for our keyword "Solve". Pressing F1 in 5.2 leads you where you want, 8 doesn't (but to the character at your pursor position). So some automatic focusing mechanism in 8 leads to an unwanted (from my point of view) effect. $\endgroup$ Commented Jul 16, 2014 at 10:41

0

Browse other questions tagged or ask your own question.