diff --git a/src/scrot_selection.c b/src/scrot_selection.c index 8834d250..7eaa9014 100644 --- a/src/scrot_selection.c +++ b/src/scrot_selection.c @@ -53,6 +53,15 @@ static void selection_deallocate(void) *sel = NULL; } +void selection_set_line_width(struct selection_t* const sel) +{ + assert(sel != NULL); + sel->rect.x -= opt.line_width; + sel->rect.y -= opt.line_width; + sel->rect.w += opt.line_width; + sel->rect.h += opt.line_width; +} + static void create_cursors(void) { struct selection_t *const sel = *selection_get(); diff --git a/src/selection_classic.c b/src/selection_classic.c index 51cc20bf..cb1585a8 100644 --- a/src/selection_classic.c +++ b/src/selection_classic.c @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern void selection_calculate_rect(int x0, int y0, int x1, int y1); extern struct selection_t** selection_get(void); +extern void selection_set_line_width(struct selection_t* const sel); struct selection_classic_t { XGCValues gcval; @@ -114,11 +115,12 @@ void selection_classic_draw(void) void selection_classic_motion_draw(int x0, int y0, int x1, int y1) { - struct selection_t const *const sel = *selection_get(); + struct selection_t *const sel = *selection_get(); if (sel->rect.w) { selection_classic_draw(); } selection_calculate_rect(x0, y0, x1, y1); + selection_set_line_width(sel); selection_classic_draw(); } diff --git a/src/selection_edge.c b/src/selection_edge.c index 91914ebc..92e98660 100644 --- a/src/selection_edge.c +++ b/src/selection_edge.c @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern void selection_calculate_rect(int x0, int y0, int x1, int y1); extern struct selection_t** selection_get(void); +extern void selection_set_line_width(struct selection_t* const sel); struct selection_edge_t { Window wndDraw; @@ -148,11 +149,6 @@ void selection_edge_motion_draw(int x0, int y0, int x1, int y1) struct selection_t *const sel = *selection_get(); selection_calculate_rect(x0, y0, x1, y1); - - sel->rect.x -= opt.line_width; - sel->rect.y -= opt.line_width; - sel->rect.w += opt.line_width; - sel->rect.h += opt.line_width; - + selection_set_line_width(sel); selection_edge_draw(); }