eclipse-platform / eclipse.platform.swt

Eclipse SWT
https://www.eclipse.org/swt/
Eclipse Public License 2.0
118 stars 139 forks source link

[GTK] Get rid of SWT use of $HOME/.swt/trims.prefs #1168

Open iloveeclipse opened 7 months ago

iloveeclipse commented 7 months ago

While investigating https://github.com/eclipse-platform/eclipse.platform.swt/issues/1161 and the fix, we've noticed (once again) that SWT does some really unexpected things - in this case it always reads/writes $HOME/.swt/trims.prefs file.

https://github.com/eclipse-platform/eclipse.platform.swt/blob/5b437ee2bd8cdda7083a9f2ceeadb172a583ed37/bundles/org.eclipse.swt/Eclipse%20SWT/gtk/org/eclipse/swt/widgets/Display.java#L551

https://github.com/eclipse-platform/eclipse.platform.swt/blob/5b437ee2bd8cdda7083a9f2ceeadb172a583ed37/bundles/org.eclipse.swt/Eclipse%20SWT/gtk/org/eclipse/swt/widgets/Display.java#L4855

This was introduced via 1efa844f5448fd981224ed57c5cc069ec4754711 to fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=445900.

There are few issues with this approach because the value is not versioned/annotated in any way so we will have issues with:

This above can easily happen if users are working in a multi - OS environment, running VNC sessions connected to different hosts but using same account.

Just using some values written by an unknown SWT application at unknown point in time with unknown desktop/window manager from unknown OS seem to be totally wrong.

The code was written for GTK2, we should see if we can get rid of reading/writing to $HOME/.swt/trims.prefs on GTK3 and cleanup code around it.

Conments / help is welcome.

iloveeclipse commented 7 months ago

@SyntevoAlex : is this interesting for you may be?

SyntevoAlex commented 7 months ago

I investigated it for a while, but it wasn't trivial, and I was told to forget it, because the problem isn't so important. See #568