Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ task:
install_script:
- apk add build-base autoconf autoconf-archive automake gzip pkgconfig $CC
xorg-server-dev libxcomposite-dev libxext-dev libxfixes-dev
libxinerama-dev imlib2-dev
libxrandr-dev imlib2-dev
<< : *common_script

task:
Expand All @@ -77,7 +77,7 @@ task:
- apt-get update
- apt-get install -y autoconf autoconf-archive make pkg-config $CC
libx11-dev libxcomposite-dev libxext-dev libxfixes-dev
libxinerama-dev libimlib2-dev
libxrandr-dev libimlib2-dev
<< : *common_script

task:
Expand All @@ -92,7 +92,7 @@ task:
- CC: gcc
install_script:
- pkg install -y autoconf autoconf-archive automake pkgconf gcc libX11
libXcomposite libXext libXfixes libXinerama imlib2
libXcomposite libXext libXfixes libXrandr imlib2
<< : *common_script

task:
Expand All @@ -108,7 +108,7 @@ task:
install_script:
- brew update
- brew install autoconf autoconf-archive automake make pkg-config gcc libx11
libxcomposite libxext libxfixes libxinerama imlib2
libxcomposite libxext libxfixes libxrandr imlib2
<< : *common_script

task:
Expand All @@ -118,7 +118,7 @@ task:
install_script:
- apk add build-base pkgconfig
xorg-server-dev libxcomposite-dev libxext-dev
libxfixes-dev libxinerama-dev imlib2-dev
libxfixes-dev libxrandr-dev imlib2-dev
matrix:
- name: alpine-latest-bare-build
test_script:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/full-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: install_dependencies
run: |
sudo apt install tcc libimlib2-dev libxcomposite-dev libxfixes-dev \
autoconf-archive libbsd-dev libxinerama-dev cppcheck
autoconf-archive libbsd-dev libxrandr-dev cppcheck
- name: distcheck
run: |
./autogen.sh
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ scrot requires a few projects and libraries:
- libXcomposite [(can be found in X.Org)](https://gitlab.freedesktop.org/xorg/lib/libxcomposite)
- libXext [(can be found in X.Org)](https://gitlab.freedesktop.org/xorg/lib/libxext)
- libXfixes [(can be found in X.Org)](https://gitlab.freedesktop.org/xorg/lib/libxfixes)
- libXinerama [(can be found in X.Org)](https://gitlab.freedesktop.org/xorg/lib/libxinerama)
- libXrandr [(can be found in X.Org)](https://gitlab.freedesktop.org/xorg/lib/libxrandr)

The [deps.pc](./deps.pc) file documents minimum version requirement for some of
the libraries.
Expand Down
2 changes: 1 addition & 1 deletion deps.pc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Name: scrot's mandatory dependencies
Description: ditto
Version: infinite
Cflags: -D_XOPEN_SOURCE=700L
Requires: x11 imlib2 >= 1.11.0 xcomposite >= 0.2.0 xext xfixes >= 5.0.1 xinerama >= 1.1.3
Requires: x11 imlib2 >= 1.11.0 xcomposite >= 0.2.0 xext xfixes >= 5.0.1 xrandr >= 1.5
2 changes: 1 addition & 1 deletion man/scrot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ OPTIONS
(vertical/horizontal). Default: h
-l, --line STYLE STYLE indicates the style of the line when the -s
option is used; see SELECTION STYLE.
-M, --monitor NUM Capture Xinerama monitor number NUM.
-M, --monitor NUM Capture Xrandr monitor number NUM.
-m, --multidisp For multiple heads, screenshot all of them in order.
-o, --overwrite By default scrot does not overwrite the output
FILE, use this option to enable it.
Expand Down
28 changes: 9 additions & 19 deletions src/scrot.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xutil.h>
#include <X11/extensions/Xcomposite.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xinerama.h>
#include <X11/extensions/Xrandr.h>

#include "options.h"
#include "scrot.h"
Expand Down Expand Up @@ -949,27 +949,17 @@ static Imlib_Image scrotGrabShotMulti(void)

static Imlib_Image scrotGrabShotMonitor(void)
{
int eventBase, errBase;
int numMonitors;
XRRMonitorInfo *monitors = XRRGetMonitors(disp, root, True, &numMonitors);
if (!monitors)
errx(EXIT_FAILURE, "XRRGetMonitors() failed");

if (!XineramaQueryExtension(disp, &eventBase, &errBase))
errx(EXIT_FAILURE, "Xinerama extension not found");

int numScreens = 0;
XineramaScreenInfo *screens = XineramaQueryScreens(disp, &numScreens);

if (!screens && !numScreens)
errx(EXIT_FAILURE, "Xinerama not active");

if (!numScreens)
errx(EXIT_FAILURE, "Xinerama active but did not find any output device");

if (opt.monitor >= numScreens)
if (opt.monitor >= numMonitors)
errx(EXIT_FAILURE, "monitor %d not found", opt.monitor);

scrotAssert(screens); /* silence clang-tidy */
XineramaScreenInfo *mon = &screens[opt.monitor];
int x = mon->x_org, y = mon->y_org, w = mon->width, h = mon->height;
XFree(screens);
XRRMonitorInfo *m = monitors + opt.monitor;
int x = m->x, y = m->y, h = m->height, w = m->width;
XRRFreeMonitors(monitors);

scrotNiceClip(&x, &y, &w, &h);
return scrotGrabRectAndPointer(x, y, w, h, false);
Expand Down