Skip to content

Commit 2ea7a12

Browse files
committed
simpler line width calculation
1 parent bd0ffe6 commit 2ea7a12

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ AS_IF([test "x$orig_CFLAGS" = "x"], [
2828
AX_APPEND_LINK_FLAGS(["-flto"])
2929
])
3030
m4_foreach([SCROT_FLAG],
31-
[["-O3"], ["-Wall"], ["-Wextra"], ["-Wpedantic"], ["-fno-math-errno"]], [
31+
[["-O3"], ["-Wall"], ["-Wextra"], ["-Wpedantic"]], [
3232
AX_APPEND_COMPILE_FLAGS(["SCROT_FLAG"])
3333
AS_IF([test "x$LTO_ENABLED" = "xyes"], [
3434
AX_APPEND_LINK_FLAGS(["SCROT_FLAG"])

deps.pc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ Name: scrot's mandatory dependencies
22
Description: ditto
33
Version: infinite
44
Cflags: -D_XOPEN_SOURCE=700L
5-
Libs: -lm
65
Requires: x11 imlib2 >= 1.11.0 xcomposite >= 0.2.0 xext xfixes >= 5.0.1 xinerama >= 1.1.3

man/scrot.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ SELECTION STYLE
175175

176176
Without the -l option, a default style is used:
177177

178-
mode=auto,style=solid,width=$dpi/75,opacity=100
178+
mode=auto,style=solid,width=...,opacity=100 # FIXME: width
179179

180180
Example:
181181

src/scrot_selection.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3535

3636
#include <err.h>
3737
#include <errno.h>
38-
#include <math.h>
3938
#include <stdint.h>
4039
#include <stdlib.h>
4140
#include <string.h>
@@ -425,11 +424,8 @@ Imlib_Image scrotSelectionSelectMode(void)
425424
}
426425

427426
if (opt.lineWidth == 0) {
428-
double mmToInches = 1 / 25.4;
429-
double inchesDiag = hypot(scr->mwidth, scr->mheight) * mmToInches;
430-
double pixelsDiag = hypot(scr->width, scr->height);
431-
double dpi = round(pixelsDiag / inchesDiag);
432-
opt.lineWidth = fmin(fmax(round(dpi / 75.0), 1), 8);
427+
int width = (scr->height + scr->width) / (scr->mheight + scr->mwidth);
428+
opt.lineWidth = MIN(MAX(width/4, 1), 8);
433429
}
434430

435431
if (opt.delaySelection)

src/util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4343

4444
#define ARRAY_COUNT(X) (sizeof(X) / sizeof(0[X]))
4545
#define MAX(A, B) ((A) > (B) ? (A) : (B))
46+
#define MIN(A, B) ((A) < (B) ? (A) : (B))
4647

4748
typedef struct {
4849
char *buf;

0 commit comments

Comments
 (0)