matlab steals focus
I've encounted a strange, and undesired, behaviour with matlab 7.x (maybe eralier versions too), and I've tried all fvwm options available and I still can't get it to work right. My conclution is that matlab must break some rule. I write this in hope that someone knows of a way to go around that behaviour. Now to a description of the problem: I always run matlab in a terminal (-nodesktop), and I want that terminal to stay focused, even If you issue a command like figure(1). The problem is that, despite that I have FocusStyle * !GrabFocus, OverrideGrabFocus, !FocusByProgram in my config, matlap gives the focus to figure 1 if I isseu the command. If a figure already is active it will focus and raise. Otherwise it will start up focused. Even if I do 'Style Figure * NeverFocus' the figure will be focused on the command figure(1) (or when clicking on the window (but I use EnterToFocus, !LeaveToUnfocus, and not ClickToFocus, so it's matlab doing that focusing too). I tried to look at the focus code myself to see if there was anything I could do to force matlab not to focus it's figures on itself, but wasn't able to make out how the code worked. I did however find that when starting matlab with -nojvm it does not steal the focus at all. However I sometimes need the jvm, so it's not a good solution. I need some help by someone who know the specification, and more of the X-protocol than I do. I have two major questions: 1. Is it possible to make fvwm not allow the said focus change to happen? 2. Is matlab breaking any standard (and in that case what), and do you think it's worth submitting a bug report to MathWorks about it? /Viktor
Re: matlab steals focus
On Sat, Dec 03, 2005 at 11:28:47PM +0100, Viktor Griph wrote: I've encounted a strange, and undesired, behaviour with matlab 7.x (maybe eralier versions too), and I've tried all fvwm options available and I still can't get it to work right. My conclution is that matlab must break some rule. I write this in hope that someone knows of a way to go around that behaviour. I've had a similar problem with a different proprietary application, it used XSetInputFocus() whenever it wanted my attention, very annoying :) If this is what it's doing, afaik there is no way around it. I solved it with a preload library, for example, try this: $ cat libmatlab.c #include X11/Xlib.h int XSetInputFocus(Display *d, Window w, int i, Time t) { return 0;} $ gcc -shared -fPIC libmatlab.c -o libmatlab.so $ LD_PRELOAD=`pwd`/libmatlab.so matlab -nodesktop If it works, you could create a wrapper script to set LD_PRELOAD before starting matlab (dont have matlab here to test). Hope this helps, Tavis. -- - [EMAIL PROTECTED] | finger me for my pgp key. --- pgp3QmN4Qm8vY.pgp Description: PGP signature
Re: matlab steals focus
On Sat, 3 Dec 2005, Tavis Ormandy wrote: On Sat, Dec 03, 2005 at 11:28:47PM +0100, Viktor Griph wrote: I've encounted a strange, and undesired, behaviour with matlab 7.x (maybe eralier versions too), and I've tried all fvwm options available and I still can't get it to work right. My conclution is that matlab must break some rule. I write this in hope that someone knows of a way to go around that behaviour. I've had a similar problem with a different proprietary application, it used XSetInputFocus() whenever it wanted my attention, very annoying :) If this is what it's doing, afaik there is no way around it. I solved it with a preload library, for example, try this: $ cat libmatlab.c #include X11/Xlib.h int XSetInputFocus(Display *d, Window w, int i, Time t) { return 0;} $ gcc -shared -fPIC libmatlab.c -o libmatlab.so $ LD_PRELOAD=`pwd`/libmatlab.so matlab -nodesktop If it works, you could create a wrapper script to set LD_PRELOAD before starting matlab (dont have matlab here to test). Hope this helps, Tavis. Thank you! It works perfectly. Of course it would be best not to have to do rappers, so I would still want to know what standard matlab breaks. (I guess it's ICCCM, but if anyone that knows more precise where matlab does wrong it would hale me write a good bug report. /Viktor
Re: matlab steals focus
On Sat, Dec 03, 2005 at 11:28:47PM +0100, Viktor Griph wrote: I've encounted a strange, and undesired, behaviour with matlab 7.x (maybe eralier versions too), and I've tried all fvwm options available and I still can't get it to work right. My conclution is that matlab must break some rule. I write this in hope that someone knows of a way to go around that behaviour. Now to a description of the problem: I always run matlab in a terminal (-nodesktop), and I want that terminal to stay focused, even If you issue a command like figure(1). The problem is that, despite that I have FocusStyle * !GrabFocus, OverrideGrabFocus, !FocusByProgram in my config, matlap gives the focus to figure 1 if I isseu the command. If a figure already is active it will focus and raise. Otherwise it will start up focused. Even if I do 'Style Figure * NeverFocus' the figure will be focused on the command figure(1) (or when clicking on the window (but I use EnterToFocus, !LeaveToUnfocus, and not ClickToFocus, so it's matlab doing that focusing too). I tried to look at the focus code myself to see if there was anything I could do to force matlab not to focus it's figures on itself, but wasn't able to make out how the code worked. I did however find that when starting matlab with -nojvm it does not steal the focus at all. However I sometimes need the jvm, so it's not a good solution. I need some help by someone who know the specification, and more of the X-protocol than I do. I have two major questions: 1. Is it possible to make fvwm not allow the said focus change to happen? No. Every application can set the focus to any window or subwindow at any time. The window manager is not involved in this process at all. All the fvwm styles affect only applications that try to cooperate with the window manager by honouring the ICCCM2 rules. 2. Is matlab breaking any standard (and in that case what), and do you think it's worth submitting a bug report to MathWorks about it? That depends on what type of focus policy matlab requests. Use FvwmIdent on the matlab window. If the focus policy says locally active or globally active, matlab is allowed to do that. If it says passive or no input matlab is breaking the ICCCM2 rules. I've never seen a company fixing a bug reported by someone from the open source community, so I doubt filing a report would be useful. Ciao Dominik ^_^ ^_^ -- Dominik Vogt, [EMAIL PROTECTED] signature.asc Description: Digital signature
Re: matlab steals focus
On Sun, 4 Dec 2005, Dominik Vogt wrote: On Sat, Dec 03, 2005 at 11:28:47PM +0100, Viktor Griph wrote: I've encounted a strange, and undesired, behaviour with matlab 7.x (maybe eralier versions too), and I've tried all fvwm options available and I still can't get it to work right. My conclution is that matlab must break some rule. I write this in hope that someone knows of a way to go around that behaviour. Now to a description of the problem: I always run matlab in a terminal (-nodesktop), and I want that terminal to stay focused, even If you issue a command like figure(1). The problem is that, despite that I have FocusStyle * !GrabFocus, OverrideGrabFocus, !FocusByProgram in my config, matlap gives the focus to figure 1 if I isseu the command. If a figure already is active it will focus and raise. Otherwise it will start up focused. Even if I do 'Style Figure * NeverFocus' the figure will be focused on the command figure(1) (or when clicking on the window (but I use EnterToFocus, !LeaveToUnfocus, and not ClickToFocus, so it's matlab doing that focusing too). I tried to look at the focus code myself to see if there was anything I could do to force matlab not to focus it's figures on itself, but wasn't able to make out how the code worked. I did however find that when starting matlab with -nojvm it does not steal the focus at all. However I sometimes need the jvm, so it's not a good solution. I need some help by someone who know the specification, and more of the X-protocol than I do. I have two major questions: 1. Is it possible to make fvwm not allow the said focus change to happen? No. Every application can set the focus to any window or subwindow at any time. The window manager is not involved in this process at all. All the fvwm styles affect only applications that try to cooperate with the window manager by honouring the ICCCM2 rules. 2. Is matlab breaking any standard (and in that case what), and do you think it's worth submitting a bug report to MathWorks about it? That depends on what type of focus policy matlab requests. Use FvwmIdent on the matlab window. If the focus policy says locally active or globally active, matlab is allowed to do that. If it says passive or no input matlab is breaking the ICCCM2 rules. It says Passive. I've never seen a company fixing a bug reported by someone from the open source community, so I doubt filing a report would be useful. I had the idea that if I report it to the helpdesk at my university, and have them report it further it will be reported from a large customer of them and it would be in their interest to fix it. But you might be right that they won't care about it. Thanks for your reply. /Viktor