Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fa50baf3
Commit
fa50baf3
authored
Mar 31, 2014
by
Huw Davies
Committed by
Alexandre Julliard
Mar 31, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Keep track of fractions of WHEEL_DELTA when scrolling.
parent
2f07df59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
9 deletions
+30
-9
editor.c
dlls/riched20/editor.c
+29
-9
editstr.h
dlls/riched20/editstr.h
+1
-0
No files found.
dlls/riched20/editor.c
View file @
fa50baf3
...
...
@@ -2858,6 +2858,8 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
ed
->
horz_si
.
nPage
=
0
;
ed
->
horz_si
.
nPos
=
0
;
ed
->
wheel_remain
=
0
;
OleInitialize
(
NULL
);
return
ed
;
...
...
@@ -2936,6 +2938,13 @@ static inline int get_default_line_height( ME_TextEditor *editor )
return
height
;
}
static
inline
int
calc_wheel_change
(
int
*
remain
,
int
amount_per_click
)
{
int
change
=
amount_per_click
*
(
float
)
*
remain
/
WHEEL_DELTA
;
*
remain
-=
WHEEL_DELTA
*
change
/
amount_per_click
;
return
change
;
}
static
const
char
*
const
edit_messages
[]
=
{
"EM_GETSEL"
,
"EM_SETSEL"
,
...
...
@@ -4145,6 +4154,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
case
WM_KILLFOCUS
:
ME_CommitUndo
(
editor
);
/* End coalesced undos for typed characters */
editor
->
bHaveFocus
=
FALSE
;
editor
->
wheel_remain
=
0
;
ME_HideCaret
(
editor
);
ME_SendOldNotify
(
editor
,
EN_KILLFOCUS
);
return
0
;
...
...
@@ -4273,8 +4283,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
case
WM_MOUSEWHEEL
:
{
int
gcWheelDelta
;
UINT
pulScrollLines
;
int
delta
;
BOOL
ctrl_is_down
;
if
((
editor
->
nEventMask
&
ENM_MOUSEEVENTS
)
&&
...
...
@@ -4283,9 +4292,16 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
ctrl_is_down
=
GetKeyState
(
VK_CONTROL
)
&
0x8000
;
gcWheelDelta
=
GET_WHEEL_DELTA_WPARAM
(
wParam
);
delta
=
GET_WHEEL_DELTA_WPARAM
(
wParam
);
/* if scrolling changes direction, ignore left overs */
if
((
delta
<
0
&&
editor
->
wheel_remain
<
0
)
||
(
delta
>
0
&&
editor
->
wheel_remain
>
0
))
editor
->
wheel_remain
+=
delta
;
else
editor
->
wheel_remain
=
delta
;
if
(
abs
(
gcWheelDelta
)
>=
WHEEL_DELTA
)
if
(
editor
->
wheel_remain
)
{
if
(
ctrl_is_down
)
{
int
numerator
;
...
...
@@ -4295,14 +4311,18 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
}
else
{
numerator
=
editor
->
nZoomNumerator
*
100
/
editor
->
nZoomDenominator
;
}
numerator
=
numerator
+
(
gcWheelDelta
/
WHEEL_DELTA
)
*
10
;
numerator
+=
calc_wheel_change
(
&
editor
->
wheel_remain
,
10
)
;
if
(
numerator
>=
10
&&
numerator
<=
500
)
ME_SetZoom
(
editor
,
numerator
,
100
);
}
else
{
SystemParametersInfoW
(
SPI_GETWHEELSCROLLLINES
,
0
,
&
pulScrollLines
,
0
);
/* FIXME follow the original */
if
(
pulScrollLines
)
ME_ScrollDown
(
editor
,
pulScrollLines
*
(
-
gcWheelDelta
/
WHEEL_DELTA
)
*
8
);
UINT
max_lines
=
3
;
int
lines
=
0
;
SystemParametersInfoW
(
SPI_GETWHEELSCROLLLINES
,
0
,
&
max_lines
,
0
);
if
(
max_lines
)
lines
=
calc_wheel_change
(
&
editor
->
wheel_remain
,
(
int
)
max_lines
);
if
(
lines
)
ME_ScrollDown
(
editor
,
-
lines
*
get_default_line_height
(
editor
)
);
}
}
break
;
...
...
dlls/riched20/editstr.h
View file @
fa50baf3
...
...
@@ -443,6 +443,7 @@ typedef struct tagME_TextEditor
SCROLLINFO
vert_si
,
horz_si
;
BOOL
bMouseCaptured
;
int
wheel_remain
;
}
ME_TextEditor
;
typedef
struct
tagME_Context
...
...
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