This commit updates the author.
It also contains the following changes:
- initializes Xlib support for concurrent threads
- fix minor device number calculation for large values
- fix crash if there are multiple pty slave folders
fix minor device number calculation for large values
Unfortunately the extraction of the minor device number from the tty_nr
was wrong.
The man page of procfs states that 'The minor device number is contained
[in the tty_nr] in the combination of bits 31 to 20 and 7 to 0' but it did not state
that you need to shift the bits together.
So I just missed that step.
This commit adds the correct placement of the bits to the calculation of the minor device number.
fix crash if there are multiple pty slave folders
If a system uses multiple pty slave folders it is possible that while
searching for the pty file a FileNotFoundError is raised which crashs
the program. In this case the correct behavior would be to look for the
pty file in the next folder. So this commit ignores the
FileNotFoundError for the call of the stat function.
Gcc changed its default behaviour in version 10.
-fno-common is now used by default instead of -fcommon.
Therefore the usage of the extern keyword is required.
While copying the entry of the property screen_width to create the
entry of the property screen_height it was forgotten
to rename the function Display_get_screen_width to
Display_get_screen_height.
Python-xlib misses some essential features like shm support.
This is why the Xshm module was written,
but this leads to redundant dependencies.
So this commit removes python-xlib as dependency.
During the translation of the code the determination of the pid of a
window was also improved.
The XRes extension is now used to determine the pid of a window.
os.pidfile_open should be os.pidfd_open.
This was not noticed as the linux kernel this software is tested on does
not support the required syscalls.
os.pidfile was replaced by os.open
as os.pidfd_open requires at least linux 5.3 and
signal.pidfd_send_signal requires at least linux 5.1.
see also 7483451577
In some situations some programs like zsh are replacing their file
descriptors temporarily.
E.g. zsh replaces (at least on my system) stdout with a pipe on using widgets
(these changes are reverted after finishing using the widget)
So by now the tty_nr is used to figure out the pseudo tty of the
terminal emulator.
Also this change contains the removal of psutil.
The process information is gathered now by using the proc file system.
Reasons:
- the only os supported by this program is linux
- only the function to retrieve the ppid of a process was used
In python3.9 asyncio.Task.all_task() and asyncio.Task.current_task() were removed.
See: https://docs.python.org/3/whatsnew/3.9.html#removed
They advise to use asyncio.all_task() and asyncio.current_task()
instead.
At the time of this commit python3.6 is still used by 10% of the users
(counted by the reported python version of the downloads).
So we need to reduce the readability by adding redundant try except
blocks.
In some situations worker processes turned into orphans.
To fix this (1.) a new session is created for the canvas process and
it's killed by its pgid if it won't exit within a second
(if it's told to do so).
(2.) Also the missing shutdown call for the ProcessPoolExecutor was added.
L,P PNGs with transparency will be converted to RGBA PNGs
to surpress the following warning (pillow):
Palette images with Transparency expressed in bytes should be
converted to RGBA images
There are common sizes in which images are
likely to be displayed in.
(smaller or equal to the screen size)
If images reach a specific resolution the
principle of spatial locality doesn't apply anymore
to resize operations to common sizes
(e.g. 6000x6000 to 300x300).
So to reduce cache misses and therefore avoid
a worse performance images are stored by default up to a size
which is about the same as the screen size.
Images will be fully loaded if it's required by their
image scaler or if they should be displayed with a size
which is bigger than the screen size.
Reason:
Xshm is used to draw on windows (via original Xlib / c extension).
So there are at least two connections to the X11 server.
-> Race condition between drawing on windows (Xlib)
and creating them (python-Xlib)
Sometimes pillow restores pngs as webp
(or at least it reports png to be webp)
Using a function on these objects lead to a crash.
It can be fixed by using less data (info & palette removed)
to restore an image.