Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
OpenCorePKG_MOD
提交
7aa17b6a
O
OpenCorePKG_MOD
项目概览
btwise
/
OpenCorePKG_MOD
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OpenCorePKG_MOD
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7aa17b6a
编写于
4月 02, 2021
作者:
M
Marvin Häuser
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OpenCanopy: Support OcAppleEventEx pointer scaling
上级
6b8b363d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
31 deletion
+70
-31
Changelog.md
Changelog.md
+1
-0
Platform/OpenCanopy/Input/InputSimAbsPtr.c
Platform/OpenCanopy/Input/InputSimAbsPtr.c
+69
-31
未找到文件。
Changelog.md
浏览文件 @
7aa17b6a
...
...
@@ -52,6 +52,7 @@ OpenCore Changelog
-
Added identifiers for Rocket Lake and Tiger Lake CPUs
-
Added PickerAudioAssist 'disk image' indication
-
Fixed PickerAudioAssist indications played twice in rare cases
-
Improved OpenCanopy pointer acceleration
#### v0.6.7
-
Fixed ocvalidate return code to be non-zero when issues are found
...
...
Platform/OpenCanopy/Input/InputSimAbsPtr.c
浏览文件 @
7aa17b6a
...
...
@@ -7,7 +7,7 @@
#include <Uefi.h>
#include <Protocol/
AppleEvent
.h>
#include <Protocol/
OcAppleEventEx
.h>
#include <Protocol/AbsolutePointer.h>
#include <Library/BaseLib.h>
...
...
@@ -22,11 +22,15 @@
#include "../OpenCanopy.h"
#include "../GuiIo.h"
#include "ProcessorBind.h"
#define ABS_DOUBLE_CLICK_RADIUS 25U
#define IS_POWER_2(x) (((x) & ((x) - 1)) == 0 && (x) != 0)
#define POINTER_SCALE 2U
struct
GUI_POINTER_CONTEXT_
{
OC_APPLE_EVENT_EX_PROTOCOL
*
OcAppleEventEx
;
APPLE_EVENT_PROTOCOL
*
AppleEvent
;
EFI_ABSOLUTE_POINTER_PROTOCOL
*
AbsPointer
;
APPLE_EVENT_HANDLE
AppleEventHandle
;
...
...
@@ -36,6 +40,7 @@ struct GUI_POINTER_CONTEXT_ {
GUI_PTR_POSITION
RawPos
;
GUI_PTR_POSITION
CurPos
;
GUI_PTR_POSITION
AbsLastDownPos
;
UINT32
OldEventExScale
;
BOOLEAN
AbsPrimaryDown
;
BOOLEAN
AbsDoubleClick
;
UINT8
UiScale
;
...
...
@@ -116,8 +121,6 @@ InternalAppleEventNotification (
{
APPLE_POINTER_EVENT_TYPE
EventType
;
GUI_POINTER_CONTEXT
*
Context
;
GUI_PTR_POSITION
NewPos
;
GUI_PTR_POSITION
NewRaw
;
INT64
NewCoord
;
Context
=
NotifyContext
;
...
...
@@ -137,30 +140,28 @@ InternalAppleEventNotification (
// Use a factor of 2 for pointer acceleration.
//
NewRaw
.
Pos
.
X
=
(
UINT32
)
Information
->
PointerPosition
.
Horizontal
;
NewCoord
=
(
INT64
)
Context
->
CurPos
.
Pos
.
X
+
2
*
((
INT64
)
NewRaw
.
Pos
.
X
-
Context
->
RawPos
.
Pos
.
X
);
if
(
NewCoord
<
0
)
{
NewPos
.
Pos
.
X
=
0
;
}
else
if
(
NewCoord
>
Context
->
MaxX
)
{
NewPos
.
Pos
.
X
=
Context
->
MaxX
;
if
(
Context
->
OcAppleEventEx
!=
NULL
)
{
Context
->
CurPos
.
Pos
.
X
=
(
UINT32
)
Information
->
PointerPosition
.
Horizontal
;
Context
->
CurPos
.
Pos
.
Y
=
(
UINT32
)
Information
->
PointerPosition
.
Vertical
;
}
else
{
NewPos
.
Pos
.
X
=
(
UINT32
)
NewCoord
;
}
NewRaw
.
Pos
.
Y
=
(
UINT32
)
Information
->
PointerPosition
.
Vertical
;
NewCoord
=
(
INT64
)
Context
->
CurPos
.
Pos
.
X
+
POINTER_SCALE
*
((
INT64
)
Information
->
PointerPosition
.
Horizontal
-
Context
->
RawPos
.
Pos
.
X
);
if
(
NewCoord
<
0
)
{
Context
->
CurPos
.
Pos
.
X
=
0
;
}
else
if
(
NewCoord
>
Context
->
MaxX
)
{
Context
->
CurPos
.
Pos
.
X
=
Context
->
MaxX
;
}
else
{
Context
->
CurPos
.
Pos
.
X
=
(
UINT32
)
NewCoord
;
}
NewCoord
=
(
INT64
)
Context
->
CurPos
.
Pos
.
Y
+
2
*
((
INT64
)
NewRaw
.
Pos
.
Y
-
Context
->
RawPos
.
Pos
.
Y
);
if
(
NewCoord
<
0
)
{
NewPos
.
Pos
.
Y
=
0
;
}
else
if
(
NewCoord
>
Context
->
MaxY
)
{
NewPos
.
Pos
.
Y
=
Context
->
MaxY
;
}
else
{
NewPos
.
Pos
.
Y
=
(
UINT32
)
NewCoord
;
NewCoord
=
(
INT64
)
Context
->
CurPos
.
Pos
.
Y
+
POINTER_SCALE
*
((
INT64
)
Information
->
PointerPosition
.
Vertical
-
Context
->
RawPos
.
Pos
.
Y
);
if
(
NewCoord
<
0
)
{
Context
->
CurPos
.
Pos
.
Y
=
0
;
}
else
if
(
NewCoord
>
Context
->
MaxY
)
{
Context
->
CurPos
.
Pos
.
Y
=
Context
->
MaxY
;
}
else
{
Context
->
CurPos
.
Pos
.
Y
=
(
UINT32
)
NewCoord
;
}
}
Context
->
CurPos
.
Uint64
=
NewPos
.
Uint64
;
Context
->
RawPos
.
Uint64
=
NewRaw
.
Uint64
;
}
if
((
EventType
&
APPLE_EVENT_TYPE_LEFT_BUTTON
)
!=
0
)
{
...
...
@@ -387,12 +388,37 @@ GuiPointerConstruct (
Context
.
RawPos
.
Pos
.
Y
=
DefaultY
;
Context
.
UiScale
=
UiScale
;
Status
=
OcHandleProtocolFallback
(
gST
->
ConsoleInHandle
,
&
gAppleEventProtocolGuid
,
(
VOID
**
)
&
Context
.
AppleEvent
Context
.
OcAppleEventEx
=
OcGetProtocol
(
&
gOcAppleEventExProtocolGuid
,
DEBUG_INFO
,
"GuiPointerConstruct"
,
"OcAppleEventEx"
);
if
(
!
EFI_ERROR
(
Status
))
{
if
(
Context
.
OcAppleEventEx
!=
NULL
)
{
Context
.
AppleEvent
=
&
Context
.
OcAppleEventEx
->
AppleEvent
;
if
(
Context
.
OcAppleEventEx
->
Revision
!=
OC_APPLE_EVENT_EX_PROTOCOL_REVISION
)
{
DEBUG
((
DEBUG_WARN
,
"OCUI: OcAppleEventEx %u is unsupported
\n
"
,
Context
.
OcAppleEventEx
->
Revision
));
}
DEBUG
((
DEBUG_WARN
,
"OCUI: Found OcAppleEventEx %u
\n
"
,
Context
.
OcAppleEventEx
->
Revision
));
}
else
{
Context
.
AppleEvent
=
OcGetProtocol
(
&
gAppleEventProtocolGuid
,
DEBUG_WARN
,
"GuiPointerConstruct"
,
"AppleEvent"
);
}
Status
=
EFI_UNSUPPORTED
;
if
(
Context
.
AppleEvent
!=
NULL
)
{
if
(
Context
.
AppleEvent
->
Revision
>=
APPLE_EVENT_PROTOCOL_REVISION
)
{
Dimension
.
Horizontal
=
(
INT32
)
DefaultX
;
Dimension
.
Vertical
=
(
INT32
)
DefaultY
;
...
...
@@ -409,8 +435,13 @@ GuiPointerConstruct (
&
Context
.
AppleEventHandle
,
&
Context
);
}
else
{
Status
=
EFI_UNSUPPORTED
;
if
(
Context
.
OcAppleEventEx
!=
NULL
)
{
Context
.
OldEventExScale
=
Context
.
OcAppleEventEx
->
SetPointerScale
(
Context
.
OcAppleEventEx
,
POINTER_SCALE
);
}
}
if
(
EFI_ERROR
(
Status
))
{
...
...
@@ -458,6 +489,13 @@ GuiPointerDestruct (
Context
->
AppleEvent
->
UnregisterHandler
(
Context
->
AppleEventHandle
);
if
(
Context
->
OcAppleEventEx
!=
NULL
)
{
Context
->
OcAppleEventEx
->
SetPointerScale
(
Context
->
OcAppleEventEx
,
Context
->
OldEventExScale
);
}
if
(
Context
->
AbsPollEvent
!=
NULL
)
{
EventLibCancelEvent
(
Context
->
AbsPollEvent
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录