Now that the focus_magic function is responsible for updating the
status-bar when there are no windows, remove superfluous checks from a
couple of places that were previously needed.
Fixed a typo in a comment while there.
Make the focus_magic function responsible for updating the status-bar
output when there is no window available. Now, any window related output
gets cleared when iconifying the last available window.
Instead of checking if any of the window related enabled options are set
and updating the status-bar over and over again, delegate that job to a
small wrapper function.
Instead of hand rolling a dynamic array, just use a tail queue by taking
advantage of the queue(3) macros.
Simplifies the code, since there's no need to (re)allocate the array and
to keep track of its size and length.
ok marco
If requesting the window name with _NET_WM_NAME fails, fallback to
requesting it with WM_NAME. While here, make the property request
through the get_property wrapper function.
Makes scrotwm show the titles for xterm (and probably others) windows.
While focusing on a window, update the status-bar if any of the window
related enabled options is set, so that its output matches reality.
Easily reproducible by firing up scrotwm and opening a new window.
ok marco
Rather than using fprintf(3) to display a formatted error message on
stderr (and, occasionally in conjunction with strerror(3)), use the
warn(3) functions. A few cases that also used perror(3) were changed
accordingly, as well.
While there, remove an extra fprintf(3) call in conf_load which is
already followed by an err(3).
ok marco
SUS says that if there wasn't enough space to copy the expanded format
to the buffer, strftime(3) will not NUL terminate it. It would work on
some implementations (eg on OpenBSD), though.
Therefore, take advantage of the return value to prevent using the
character array with unspecified contents with a very large clock
format.
Besides, the strlcat(3) call below relies on the destination buffer
being NUL terminated.
ok marco
Instead of hand rolling a dynamic array, just use a tail queue by taking
advantage of the queue(3) macros.
Simplifies the code, since there's no need to (re)allocate the array and
to keep track of its size and length.
Instead of hand rolling a dynamic array, just use a tail queue by taking
advantage of the queue(3) macros.
Simplifies the code, since there's no need to (re)allocate the array and
to keep track of its size and length.
This gives applications a chance to redraw the window contents to the actual, unchanged, window geometry.
Fixes issues with gvim, emacs, firefox, feh and many other applications.
ok marco
- Improve debug output.
- Improve code styling compliance.
- Use the X,Y,WIDTH,HEIGHT macros where applicable on ws_win and swm_region objects.
- Fix handling of _NET_MOVERESIZE_WINDOW client message.
ok marco
- Remove X11BASE and replace it with LOCALBASE, since the former is
deprecated.
- Silently ignore if included files are not found. This way we do not
depend on the FreeBSD ports tree being installed.
- Add definitions for LOCALBASE and PREFIX in case they are not given
from the included files.
- Change MANDIR to ${PREFIX}/man instead of ${PREFIX}/share/man, to
better match reality.
ok marco
Now that asprintf(3) return value is checked in conf_load(), make the
code release the memory returned by fparseln(3) and fclose(3) the
configuration file FILE pointer.
Style nit fixed while there.
ok marco