Browse Source
Merge pull request #7 from NikolayXHD/mousewheel_overflow_exception
Use the same LParam to point conversion as other projects in solution
pull/8/head
RussKie
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
15 additions and
5 deletions
-
Project/ICSharpCode.TextEditor.csproj
-
Project/Src/Gui/TextAreaControl.cs
-
Project/Src/Util/Win32Util.cs
|
|
@ -205,6 +205,7 @@ |
|
|
|
</Compile> |
|
|
|
<Compile Include="Src\Document\BookmarkManager\Bookmark.cs" /> |
|
|
|
<Compile Include="Src\Document\BookmarkManager\BookmarkEventHandler.cs" /> |
|
|
|
<Compile Include="Src\Util\Win32Util.cs" /> |
|
|
|
<EmbeddedResource Include="Resources\ASPX.xshd" /> |
|
|
|
<EmbeddedResource Include="Resources\ActionScript.xshd" /> |
|
|
|
<EmbeddedResource Include="Resources\Ada.xshd" /> |
|
|
|
|
|
@ -517,17 +517,15 @@ namespace ICSharpCode.TextEditor |
|
|
|
if (m.Msg == 0x007B) |
|
|
|
if (ShowContextMenu != null) |
|
|
|
{ |
|
|
|
var lParam = m.LParam.ToInt64(); |
|
|
|
int x = unchecked((short)(lParam & 0xffff)); |
|
|
|
int y = unchecked((short)((lParam & 0xffff0000) >> 16)); |
|
|
|
if (x == -1 && y == -1) |
|
|
|
Point location = m.LParam.ToPoint(); |
|
|
|
if (location.X == -1 && location.Y == -1) |
|
|
|
{ |
|
|
|
var pos = Caret.ScreenPosition; |
|
|
|
ShowContextMenu?.Invoke(this, new MouseEventArgs(MouseButtons.None, clicks: 0, pos.X, pos.Y + TextArea.TextView.FontHeight, delta: 0)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var pos = PointToClient(new Point(x, y)); |
|
|
|
var pos = PointToClient(location); |
|
|
|
ShowContextMenu?.Invoke(this, new MouseEventArgs(MouseButtons.Right, clicks: 1, pos.X, pos.Y, delta: 0)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
@ -0,0 +1,11 @@ |
|
|
|
using System; |
|
|
|
using System.Drawing; |
|
|
|
|
|
|
|
namespace ICSharpCode.TextEditor.Util |
|
|
|
{ |
|
|
|
public static class Win32Util |
|
|
|
{ |
|
|
|
public static Point ToPoint(this IntPtr lparam) => |
|
|
|
new Point(unchecked((int)lparam.ToInt64())); |
|
|
|
} |
|
|
|
} |