Fixed cursor update to apply always

**Root Cause:**
The functions `createHighlighterOrPenCursor` and `getEraserCursor` were
returning early if the cursor type had not changed. This prevented the
updated of the cursor size, based on the new setting.
presentation
tobidot 6 years ago
parent 9d678fa4e0
commit 98f5459824
  1. 9
      src/gui/XournalppCursor.cpp

@ -307,13 +307,8 @@ void XournalppCursor::updateCursor() {
auto XournalppCursor::getEraserCursor() -> GdkCursor* {
if (CRSR_ERASER == this->currentCursor) {
return nullptr; // cursor already set
}
this->currentCursor = CRSR_ERASER;
// Eraser's size follow a quadratic increment, so the cursor will do the same
double cursorSize = control->getToolHandler()->getThickness() * 2 * control->getZoomControl()->getZoom();
cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, cursorSize, cursorSize);
@ -337,7 +332,6 @@ auto XournalppCursor::getHighlighterCursor() -> GdkCursor* {
return createCustomDrawDirCursor(48, this->drawDirShift, this->drawDirCtrl);
}
return createHighlighterOrPenCursor(5, 120 / 255.0);
}
@ -366,9 +360,6 @@ auto XournalppCursor::createHighlighterOrPenCursor(int size, double alpha) -> Gd
gulong flavour = (big ? 1 : 0) | (bright ? 2 : 0) | static_cast<gulong>(64 * alpha) << 2 |
static_cast<gulong>(size) << 9 | static_cast<gulong>(rgb) << 14;
if (CRSR_PENORHIGHLIGHTER == this->currentCursor && flavour == this->currentCursorFlavour) {
return nullptr;
}
this->currentCursor = CRSR_PENORHIGHLIGHTER;
this->currentCursorFlavour = flavour;

Loading…
Cancel
Save