I'm using xcas 1.2.3 (of Ubuntu 18.04).
xcas has an autosave feature: every minute, or so, it saves the session (if changes exist in it), to "~/xcas_auto_XXXXXXXX.xws".
Unfortunately, this seemingly nice feature makes life unbearable for Linux users:
After autosaving, xcas moves the focus to its window. So if the user is busy doing some other task (browsing the internet, writing an article, playing solitaire, ...), he's suddenly switched to xcas. This is highly annoying. It means that every minute or so (maybe less) I need to switch back to the application I was yanked out of.
The problem exists in all the window managers I tried:
- xmonad
- LXDE
- jwm
(I don't have Unity, sorry.)
(In LXDE the problem is less acute: the user can put xcas in a separate desktop to alleviate the problem, as xcas won't cause the current desktop to change. But in the other window managers this workaround doesn't work: xcas does switch the desktop to the one it's on.)
"autosave" feature moves focus to the application
Modérateur : xcasadmin
Re: "autosave" feature moves focus to the application
Xcas 1.2.3 is really old, you should upgrade to Xcas 1.5.0.
Re: "autosave" feature moves focus to the application
Thanks: I upgraded to 1.5.0 and the problem is gone.
Re: "autosave" feature moves focus to the application
(A year has passed.)
An update:
I've upgraded to Ubuntu 20.04, and installed xcas 1.5.0 (using Ubuntu's official package manager).
The problem has returned: 'xcas' steals the focus. Highly annoying.
I found two solutions:
(1) Before switching to some other app, save the session.
(2) Before switching to some other app, switch (inside xcas) to a tab that doesn't contain unsaved modifications. E.g., click "File > New session".
And, as I mentioned earlier, with some Window Managers you can solve the problem by putting xcas on a separate desktop. This works in LXDE (as I mentioned), and I now see that it works in GNOME too, but GNOME would pop up an annoying notification message ("FLTK, Xcas 1.5.0 (linux 64) is ready") whenever xcas asks for the focus (a workaround: turn on "Do Not Disturb", but this has consequences).
(To the list of Window Managers for which you can not solve the problem by moving xcas to a separate desktop I now add XFCE.)
An update:
I've upgraded to Ubuntu 20.04, and installed xcas 1.5.0 (using Ubuntu's official package manager).
The problem has returned: 'xcas' steals the focus. Highly annoying.
I found two solutions:
(1) Before switching to some other app, save the session.
(2) Before switching to some other app, switch (inside xcas) to a tab that doesn't contain unsaved modifications. E.g., click "File > New session".
And, as I mentioned earlier, with some Window Managers you can solve the problem by putting xcas on a separate desktop. This works in LXDE (as I mentioned), and I now see that it works in GNOME too, but GNOME would pop up an annoying notification message ("FLTK, Xcas 1.5.0 (linux 64) is ready") whenever xcas asks for the focus (a workaround: turn on "Do Not Disturb", but this has consequences).
(To the list of Window Managers for which you can not solve the problem by moving xcas to a separate desktop I now add XFCE.)
Re: "autosave" feature moves focus to the application
Nothing has changed in Xcas in the auto-save code, it's still working with old distributions (here on debian7 and xfce). If it does not work with new distributions, I have no idea what can be done. Perhaps a new version of FLTK is required because X11 made some changes (in that case the packaged version of giac should work since they are certainly using the latest FLTK version).
Re: "autosave" feature moves focus to the application
Hi,
I have the same problem in Ubuntu 20.04. The problem is possibly in the function
in History.cc, somewhere between the lines 1964 and 1982 where Fl::focus is called...
I have the same problem in Ubuntu 20.04. The problem is possibly in the function
Code : Tout sélectionner
bool History_Pack::save_as(const char * filename,const char * ch,bool autosave_rm,bool warn_user,bool savecontext)
Re: "autosave" feature moves focus to the application
A diff of an attempt to fix this:
Code : Tout sélectionner
diff History.h History.h~
183c183
< bool save_as(const char * filename,const char * ch,bool autosave_rm,bool warn_user,bool file_save_context,bool ignorefocus=false) ;
---
> bool save_as(const char * filename,const char * ch,bool autosave_rm,bool warn_user,bool file_save_context) ;
diff History.cc History.cc~
1760c1760
< bool res=pack->save_as(autosave_filename.c_str(),0,false,warn_user,false,true);
---
> bool res=pack->save_as(autosave_filename.c_str(),0,false,warn_user,false);
1901c1901
< bool History_Pack::save_as(const char * filename,const char * ch,bool autosave_rm,bool warn_user,bool savecontext,bool ignorefocus){
---
> bool History_Pack::save_as(const char * filename,const char * ch,bool autosave_rm,bool warn_user,bool savecontext){
1934c1934
< pos=ignorefocus?-1:focus(Xcas_input_focus);
---
> pos=focus(Xcas_input_focus);
1965c1965
< if (!ignorefocus) Fl::focus(Xcas_input_focus);
---
> Fl::focus(Xcas_input_focus);
1970c1970
< if (!ignorefocus) focus(pos,true);
---
> focus(pos,true);
diff Xcas1.cc Xcas1.cc~
526,532c526
< static int last_save;
< struct timeval cur;
< struct timezone tz;
< if (initialized==-1){
< gettimeofday(&cur,&tz);
< last_save=cur.tv_sec;
< }
---
> static time_t last_save=time(0);
604,605c598,599
< gettimeofday(&cur,&tz);
< if (autosave_time>0 && !autosave_disabled && autosave_function && double(cur.tv_sec-last_save)>autosave_time){
---
> time_t current=time(0);
> if (autosave_time>0 && !autosave_disabled && autosave_function && double(current-last_save)>autosave_time){
607c601
< last_save=cur.tv_sec;
---
> last_save=current;
609c603
< last_save=cur.tv_sec-autosave_time/2;
---
> last_save=current-autosave_time/2;
610a605,607
> struct timeval cur;
> struct timezone tz;
> gettimeofday(&cur,&tz);