View Issue Details

IDProjectCategoryView StatusLast Update
0015869ScribusUsabilitypublic2024-01-28 18:00
ReporterPeterBenedek Assigned Toale  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Platformx64OSLinux MintOS Version19 (64bit)
Product Version1.5.6.svn 
Summary0015869: Cursor shape continuously change over elements of canvas.
DescriptionTested in Linux Mint 19.x; Scribus 1.5.x

Above frames the cursor it wears strangely. The problem applies to frames.

-- Make TextFrame
-- Move the cursor over the frame
-- Move the cursor slowly
-- Look the cursor: shape of the cursor continuously changes:
* above the frames: white hand --> white arrow
* above the corners: white hand --> white arrow --> black arrow

I slowed the video, but this is happening much faster in reality (unfortunately I could not record the original speed of cursor change).
Extremely distracting behavior.
TagsNo tags attached.
PatchNo

Relationships

has duplicate 0016792 new Cursor flickering and jumping when hovering over handles of text box or other object 

Activities

PeterBenedek

2019-10-23 08:14

developer  

PeterBenedek

2019-10-23 08:17

developer  

ChursorShapeChange.gif (131,231 bytes)   
ChursorShapeChange.gif (131,231 bytes)   

PeterBenedek

2019-10-23 08:40

developer  

ale

2019-11-29 09:41

manager   ~0047162

Last edited: 2019-11-29 09:48

i don't get it on my laptop.
but i got it in a vm on my older desktop computer...

(ah, no it's not the same... i generally got a flickering when hovering an item... but it might be the same issue)

PeterBenedek

2019-11-29 12:17

developer   ~0047163

I don't tried in Windows, but in LinuxMint is very unpleasant.

"ah, no it's not the same..." : yes, it's not the same.

ale

2019-11-29 13:14

manager   ~0047164

here is a patch for the flickering on the corner handles...
i cannot test, since i don't see the flickering, but the replaced code was setting two times the cursor...


if it passing around the Qt::CursorShape is ok, i'd like to refactor the rest of the function to avoid other flickerings too.
(the idea is to only set the cursor at the end of the function and get all other functions / parts to return / set a Qt::CursorShape .
cursor-resize.diff (4,795 bytes)   
diff --git a/scribus/canvasmode_normal.cpp b/scribus/canvasmode_normal.cpp
index db3365b07..05d0802ad 100644
--- a/scribus/canvasmode_normal.cpp
+++ b/scribus/canvasmode_normal.cpp
@@ -765,9 +765,13 @@ void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
 					QRect tx = p.mapRect(QRect(0, 0, static_cast<int>(currItem->width()), static_cast<int>(currItem->height())));
 					if ((tx.intersects(mpo)) && (!currItem->locked()))
 					{
-						m_view->setCursor(QCursor(Qt::OpenHandCursor));
+						Qt::CursorShape cursorShape = Qt::OpenHandCursor;
+
 						if (!currItem->sizeLocked())
-							m_view->HandleCurs(currItem, mpo);
+							cursorShape = m_view->getResizeCursor(currItem, mpo, cursorShape);
+						m_view->setCursor(QCursor(cursorShape));
 					}
 				}
 			}
diff --git a/scribus/scribusview.cpp b/scribus/scribusview.cpp
index 0fe36c428..aa46227f7 100644
--- a/scribus/scribusview.cpp
+++ b/scribus/scribusview.cpp
@@ -1737,11 +1737,11 @@ void ScribusView::dragTimerTimeOut()
 	// 	qApp->changeOverrideCursor(QCursor(loadIcon("dragpix.png")));
 }
 
-void ScribusView::HandleCurs(PageItem *currItem, QRect mpo)
+Qt::CursorShape ScribusView::getResizeCursor(PageItem *currItem, QRect mpo, Qt::CursorShape cursorShape)
 {
 	QPoint tx, tx2;
 	QTransform ma;
-	//	ma.translate(-Doc->minCanvasCoordinate.x()*m_canvas->scale(), -Doc->minCanvasCoordinate.y()*m_canvas->scale());
+
 	m_canvas->Transform(currItem, ma);
 	tx = ma.map(QPoint(static_cast<int>(currItem->width()), 0));
 	tx2 = ma.map(QPoint(0, static_cast<int>(currItem->height())));
@@ -1749,9 +1749,9 @@ void ScribusView::HandleCurs(PageItem *currItem, QRect mpo)
 	{
 		double rr = fabs(currItem->rotation());
 		if (((rr >= 0.0) && (rr < 45.0)) || ((rr >= 135.0) && (rr < 225.0)) || ((rr >=315.0) && (rr <= 360.0)))
-			setCursor(QCursor(Qt::SizeBDiagCursor));
+			cursorShape = Qt::SizeBDiagCursor;
 		if (((rr >= 45.0) && (rr < 135.0)) || ((rr >= 225.0) && (rr < 315.0)))
-			setCursor(QCursor(Qt::SizeFDiagCursor));
+			cursorShape = Qt::SizeFDiagCursor;
 	}
 	tx = ma.map(QPoint(static_cast<int>(currItem->width()), static_cast<int>(currItem->height())/2));
 	tx2 = ma.map(QPoint(0, static_cast<int>(currItem->height())/2));
@@ -1759,9 +1759,9 @@ void ScribusView::HandleCurs(PageItem *currItem, QRect mpo)
 	{
 		double rr = fabs(currItem->rotation());
 		if (((rr >= 0.0) && (rr < 45.0)) || ((rr >= 135.0) && (rr < 225.0)) || ((rr >= 315.0) && (rr <= 360.0)))
-			setCursor(QCursor(Qt::SizeHorCursor));
+			cursorShape = Qt::SizeHorCursor;
 		if (((rr >= 45.0) && (rr < 135.0)) || ((rr >= 225.0) && (rr < 315.0)))
-			setCursor(QCursor(Qt::SizeVerCursor));
+			cursorShape = Qt::SizeVerCursor;
 	}
 	tx = ma.map(QPoint(static_cast<int>(currItem->width())/2, 0));
 	tx2 = ma.map(QPoint(static_cast<int>(currItem->width())/2, static_cast<int>(currItem->height())));
@@ -1769,9 +1769,9 @@ void ScribusView::HandleCurs(PageItem *currItem, QRect mpo)
 	{
 		double rr = fabs(currItem->rotation());
 		if (((rr >= 0.0) && (rr < 45.0)) || ((rr >= 135.0) && (rr < 225.0)) || ((rr >= 315.0) && (rr <= 360.0)))
-			setCursor(QCursor(Qt::SizeVerCursor));
+			cursorShape = Qt::SizeVerCursor;
 		if (((rr >= 45.0) && (rr < 135.0)) || ((rr >= 225.0) && (rr < 315.0)))
-			setCursor(QCursor(Qt::SizeHorCursor));
+			cursorShape = Qt::SizeHorCursor;
 	}
 	tx = ma.map(QPoint(static_cast<int>(currItem->width()), static_cast<int>(currItem->height())));
 	tx2 = ma.map(QPoint(0, 0));
@@ -1782,11 +1782,13 @@ void ScribusView::HandleCurs(PageItem *currItem, QRect mpo)
 			double rr = fabs(currItem->rotation());
 			if (((rr >= 0.0) && (rr < 45.0)) || ((rr >= 135.0) && (rr < 225.0)) ||
 					((rr >= 315.0) && (rr <= 360.0)))
-				setCursor(QCursor(Qt::SizeFDiagCursor));
+				cursorShape = Qt::SizeFDiagCursor;
 			if (((rr >= 45.0) && (rr < 135.0)) || ((rr >= 225.0) && (rr < 315.0)))
-				setCursor(QCursor(Qt::SizeBDiagCursor));
+				cursorShape = Qt::SizeBDiagCursor;
 		}
 	}
+
+	return cursorShape;
 }
 
 void ScribusView::SelectItemNr(uint nr, bool draw, bool single)
diff --git a/scribus/scribusview.h b/scribus/scribusview.h
index d05424e2a..50f3f6758 100644
--- a/scribus/scribusview.h
+++ b/scribus/scribusview.h
@@ -176,7 +176,8 @@ public:
 	bool PointOnLine(QPoint Start, QPoint Ende, QRect MArea);
 	void TransformPoly(int mode, int rot = 1, double scaling = 1.0);
 	bool slotSetCurs(int x, int y);
-	void HandleCurs(PageItem *currItem, QRect mpo);
+	// \brief return a resize cursor if the mouse is on a handle.
+	Qt::CursorShape getResizeCursor(PageItem *currItem, QRect mpo, Qt::CursorShape cursorShape = Qt::ArrowCursor);
 	void Deselect(bool prop = true);
 	void SelectItemNr(uint nr, bool draw = true, bool single = false);
 	void SelectItem(PageItem *pi, bool draw = true, bool single = false);
cursor-resize.diff (4,795 bytes)   

ale

2019-11-29 16:39

manager   ~0047165

now that i re-read the the list above, it's the same.

so this is a partial patch...

it can be applied and if it gets applied i'll create a further patch to more generally solve the issues with the cursor being set multiple times.

cbradney

2019-11-30 16:54

administrator   ~0047172

Patch applied

ale

2019-11-30 20:00

manager   ~0047176

i made a test with a break in the debugger and the patch will not solve the flickering.

i'm taking notes here:

https://demo.codimd.org/0iRU018mRzy7mubMvwflwQ?view

and later i will copy the full analysis in a note in this ticket.

it's a collaborative document and you're welcome to comment in there, here or on irc.

PeterBenedek

2019-12-14 08:10

developer   ~0047265

One more thing: the blinking is related to the placement order.

I changed: Document setup -- Guides -- Placement
If the placement:
-- Margins
-- Content object
-- Guides
the cursor doesn't blink over the object

If the placement:
-- Margins
-- Guides
-- Content object
the cursor does blink over the object

ale

2019-12-14 08:23

manager   ~0047267

the cursor is set multiple times for each frame.
over dozens and dozens of lines of code.

i'm waiting for 0015976 being reviewed before continuing my jurney in the world of cursors...

i remove the "patch" label from this ticket, since the patch attached has been applied but it does not (yet) solve the full problem.

ale

2024-01-28 18:00

manager   ~0050946

here an example of the cursor flickering over a line...

Issue History

Date Modified Username Field Change
2019-10-23 08:14 PeterBenedek New Issue
2019-10-23 08:14 PeterBenedek File Added: CursorShapeChange.mp4
2019-10-23 08:15 PeterBenedek File Added: output.gif
2019-10-23 08:16 PeterBenedek File Deleted: output.gif
2019-10-23 08:17 PeterBenedek File Added: ChursorShapeChange.gif
2019-10-23 08:24 PeterBenedek Description Updated
2019-10-23 08:40 PeterBenedek File Added: CursorChange_OriginalSpeed.mp4
2019-10-23 08:51 PeterBenedek Summary Cursor shape continuously change above over elements of canvas. => Cursor shape continuously change over elements of canvas.
2019-11-29 09:41 ale Note Added: 0047162
2019-11-29 09:48 ale Note Edited: 0047162
2019-11-29 12:17 PeterBenedek Note Added: 0047163
2019-11-29 13:14 ale File Added: cursor-resize.diff
2019-11-29 13:14 ale Note Added: 0047164
2019-11-29 15:21 ale Summary Cursor shape continuously change over elements of canvas. => [PATCH] Cursor shape continuously change over elements of canvas.
2019-11-29 15:21 ale Patch No => Yes
2019-11-29 15:22 ale Assigned To => ale
2019-11-29 15:22 ale Status new => assigned
2019-11-29 16:39 ale Note Added: 0047165
2019-11-30 16:54 cbradney Note Added: 0047172
2019-11-30 20:00 ale Note Added: 0047176
2019-12-14 07:49 PeterBenedek File Added: cursor_corner_blinking.gif
2019-12-14 08:10 PeterBenedek Note Added: 0047265
2019-12-14 08:12 PeterBenedek File Deleted: cursor_corner_blinking.gif
2019-12-14 08:23 ale Note Added: 0047267
2019-12-14 08:23 ale Summary [PATCH] Cursor shape continuously change over elements of canvas. => Cursor shape continuously change over elements of canvas.
2019-12-14 08:23 ale Patch Yes => No
2022-05-10 08:54 PeterBenedek Relationship added has duplicate 0016792
2024-01-28 18:00 ale Note Added: 0050946