Add a screenshot capture feature
commitd045ffcf7d37f60df09cac32698ee4c4b10e1a42
authorDavid Maciejak <david.maciejak@gmail.com>
Tue, 7 Mar 2023 11:46:50 +0000 (7 19:46 +0800)
committerCarlos R. Mafra <crmafra@gmail.com>
Tue, 7 Mar 2023 17:30:59 +0000 (7 17:30 +0000)
treede02915a2123a626663966c615aabb28e90c9924
parent6c69dc32a0f86078fe32878f5ba70fd9ed2bfd54
Add a screenshot capture feature

This patch adds a feature to take screenshots directly from Window Maker.
Having the feature embeded direclty inside Window Maker allows us to take
advantage of how Window Maker is managing and handling Windows.
Three new actions can be bound to a key shortcut from WPrefs.
The screenshot files are saved in ~/GNUstep/Library/WindowMaker/Screenshots/
dir, with a "screenshot_%Y-%m-%d_at_%H:%M:%S" format followed by the
extension. Preferably as a PNG or JPG file if available.
Meaning, to work Window Maker via WRaster needs to support
at least one of those format.

"Capture the entire screen" is quite standard, it takes a screenshot
of the whole screen area (even in multiheads env).
"Capture a portion of the screen" requires the user to draw a rectangle which
will be captured.
Those two first are quite straightforward, just taking a live picture of
the screen.
The last one is "Capture a window" which works in best effort mode,
it catures the focused window. As Window Maker by default is not using
any compositor (like for example Xcompmgr) it can only dump the content
displayed on the screen.
If a window is minimized or out of the screen, there is high chance the
image will be split or some area greyed in case other windows overlapped it.
WPrefs.app/KeyboardShortcuts.c
WindowMaker/Defaults/WindowMaker.in
src/WindowMaker.h
src/defaults.c
src/event.c
src/keybind.h
src/screen.c
src/screen.h
src/startup.c