DXGL r817 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r816
|
r817
|
r818
>
Date:
19:34, 28 May 2018
Author:
admin
Status:
new
Tags:
Comment:
Rewrite the SetCursorPos hook.
Modified paths:
/ddraw/hooks.c
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/hooks.c
—
—
@@ -746,7 +746,10 @@
747
747
HWND_HOOK *wndhook;
748
748
LONG sizes[6];
749
749
POINT pt;
750
- int winWidth, winHeight;
750
+ BOOL error;
751
+ int oldx, oldy;
752
+ float mulx, muly;
753
+ int translatex, translatey;
751
754
752
755
if (dxglcfg.DebugNoMouseHooks) {
753
756
return _SetCursorPos(x, y);
—
—
@@ -756,13 +759,31 @@
757
760
if (!wndhook) {
758
761
return _SetCursorPos(x, y);
759
762
}
760
-
761
- pt.x = 0;
762
- pt.y = 0;
763
- glDirectDraw7_GetSizes(wndhook->lpDD7, sizes);
764
- ClientToScreen(wndhook->hwnd, &pt);
765
-
766
- return _SetCursorPos(x * sizes[4] / sizes[2] + pt.x, y * sizes[5] / sizes[3] + pt.y);
763
+ if (((dxglcfg.scaler != 0) || ((dxglcfg.fullmode >= 2) && (dxglcfg.fullmode <= 4)))
764
+ && glDirectDraw7_GetFullscreen(wndhook->lpDD7))
765
+ {
766
+ oldx = x;
767
+ oldy = y;
768
+ glDirectDraw7_GetSizes(wndhook->lpDD7, sizes);
769
+ mulx = (float)sizes[0] / (float)sizes[2];
770
+ muly = (float)sizes[1] / (float)sizes[3];
771
+ oldx = (int)((float)oldx * mulx);
772
+ oldy = (int)((float)oldy * muly);
773
+ translatex = (sizes[4] - sizes[0]) / 2;
774
+ translatey = (sizes[5] - sizes[1]) / 2;
775
+ oldx += translatex;
776
+ oldy += translatey;
777
+ if ((dxglcfg.fullmode >= 2) && (dxglcfg.fullmode <= 4))
778
+ {
779
+ pt.x = 0;
780
+ pt.y = 0;
781
+ ClientToScreen(wndhook->hwnd, &pt);
782
+ oldx += pt.x;
783
+ oldy += pt.y;
784
+ }
785
+ return _SetCursorPos(oldx, oldy);
786
+ }
787
+ else return _SetCursorPos(x, y);
767
788
}
768
789
HCURSOR WINAPI HookSetCursor(HCURSOR hCursor)
769
790
{
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version