Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Spectacle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Graphics
Spectacle
Commits
28d7aa17
Commit
28d7aa17
authored
Apr 04, 2016
by
Kai Uwe Broulik
🍇
Committed by
Boudhayan Gupta
Apr 04, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cursor positioning and size in hidpi displays
REVIEW: 127246
parent
cd5189d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/PlatformBackends/X11ImageGrabber.cpp
src/PlatformBackends/X11ImageGrabber.cpp
+9
-5
No files found.
src/PlatformBackends/X11ImageGrabber.cpp
View file @
28d7aa17
...
...
@@ -222,10 +222,13 @@ QPixmap X11ImageGrabber::blendCursorImage(const QPixmap &pixmap, int x, int y, i
// of the screen we're grabbing, and see if the cursor is actually visible in
// the region
QPoint
cursorPos
=
QCursor
::
pos
();
QRect
screenRect
(
x
,
y
,
width
,
height
);
const
qreal
dpr
=
pixmap
.
devicePixelRatio
();
if
(
!
(
screenRect
.
contains
(
cursorPos
)))
{
// cursor position operates on application's device pixel ratio, not the pixmap!
QPoint
cursorPos
=
QCursor
::
pos
()
/
dpr
*
qApp
->
devicePixelRatio
();
QRect
screenRect
(
x
/
dpr
,
y
/
dpr
,
width
/
dpr
,
height
/
dpr
);
if
(
!
screenRect
.
contains
(
cursorPos
))
{
return
pixmap
;
}
...
...
@@ -247,14 +250,15 @@ QPixmap X11ImageGrabber::blendCursorImage(const QPixmap &pixmap, int x, int y, i
// process the image into a QImage
QImage
cursorImage
=
QImage
((
quint8
*
)
pixelData
,
cursorReply
->
width
,
cursorReply
->
height
,
QImage
::
Format_ARGB32_Premultiplied
);
cursorImage
.
setDevicePixelRatio
(
dpr
);
// a small fix for the cursor position for fancier cursors
cursorPos
-=
QPoint
(
cursorReply
->
xhot
,
cursorReply
->
yhot
);
cursorPos
-=
QPoint
(
cursorReply
->
xhot
,
cursorReply
->
yhot
)
/
dpr
;
// now we translate the cursor point to our screen rectangle
cursorPos
-=
QPoint
(
x
,
y
);
cursorPos
-=
QPoint
(
x
,
y
)
/
dpr
;
// and do the painting
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment