Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVsevolod Kukol <sevoku@microsoft.com>2022-02-07 17:54:13 +0300
committerGitHub <noreply@github.com>2022-02-07 17:54:13 +0300
commitdbc2e154d977555e93efdc466c92285a51b86aa9 (patch)
tree46e70a668dc9cc42eed526b4b81615f2ce0cc0a2
parent4671fb8adf9f25d65eab95f9c39d23a9083e2f8d (diff)
parent3340e0c02ca51582184b891ead50060b48c0d9f3 (diff)
Merge pull request #1081 from leculver/delegateFix
Delegate fix
-rw-r--r--Xwt.XamMac/Xwt.Mac/ViewBackend.cs26
1 files changed, 18 insertions, 8 deletions
diff --git a/Xwt.XamMac/Xwt.Mac/ViewBackend.cs b/Xwt.XamMac/Xwt.Mac/ViewBackend.cs
index 26175b1e..34527b29 100644
--- a/Xwt.XamMac/Xwt.Mac/ViewBackend.cs
+++ b/Xwt.XamMac/Xwt.Mac/ViewBackend.cs
@@ -535,6 +535,13 @@ namespace Xwt.Mac
static Selector becomeFirstResponderSel = new Selector ("becomeFirstResponder");
static Selector resignFirstResponderSel = new Selector ("resignFirstResponder");
+ static DelegateIntPtrIntPtrIntPtrNSDragOperation draggingEnteredDelegate = new DelegateIntPtrIntPtrIntPtrNSDragOperation(DraggingEntered);
+ static DelegateIntPtrIntPtrIntPtrNSDragOperation draggingUpdatedDelegate = new DelegateIntPtrIntPtrIntPtrNSDragOperation(DraggingUpdated);
+ static DelegateIntPtrIntPtrIntPtrVoid draggingExitedDelegate = new DelegateIntPtrIntPtrIntPtrVoid(DraggingExited);
+ static DelegateIntPtrIntPtrIntPtrBool prepareForDragOperationDelegate = new DelegateIntPtrIntPtrIntPtrBool(PrepareForDragOperation);
+ static DelegateIntPtrIntPtrIntPtrBool performDragOperationDelegate = new DelegateIntPtrIntPtrIntPtrBool(PerformDragOperation);
+ static DelegateIntPtrIntPtrIntPtrVoid concludeDragOperationDelegate = new DelegateIntPtrIntPtrIntPtrVoid(ConcludeDragOperation);
+
static HashSet<Type> typesConfiguredForDragDrop = new HashSet<Type> ();
static HashSet<Type> typesConfiguredForFocusEvents = new HashSet<Type> ();
@@ -543,12 +550,12 @@ namespace Xwt.Mac
lock (typesConfiguredForDragDrop) {
if (typesConfiguredForDragDrop.Add (type)) {
Class c = new Class (type);
- c.AddMethod (draggingEnteredSel.Handle, new DelegateIntPtrIntPtrIntPtrNSDragOperation(DraggingEntered), "i@:@");
- c.AddMethod (draggingUpdatedSel.Handle, new DelegateIntPtrIntPtrIntPtrNSDragOperation(DraggingUpdated), "i@:@");
- c.AddMethod (draggingExitedSel.Handle, new DelegateIntPtrIntPtrIntPtrVoid(DraggingExited), "v@:@");
- c.AddMethod (prepareForDragOperationSel.Handle, new DelegateIntPtrIntPtrIntPtrBool(PrepareForDragOperation), "B@:@");
- c.AddMethod (performDragOperationSel.Handle, new DelegateIntPtrIntPtrIntPtrBool(PerformDragOperation), "B@:@");
- c.AddMethod (concludeDragOperationSel.Handle, new DelegateIntPtrIntPtrIntPtrVoid(ConcludeDragOperation), "v@:@");
+ c.AddMethod (draggingEnteredSel.Handle, draggingEnteredDelegate, "i@:@");
+ c.AddMethod (draggingUpdatedSel.Handle, draggingUpdatedDelegate, "i@:@");
+ c.AddMethod (draggingExitedSel.Handle, draggingExitedDelegate, "v@:@");
+ c.AddMethod (prepareForDragOperationSel.Handle, prepareForDragOperationDelegate, "B@:@");
+ c.AddMethod (performDragOperationSel.Handle, performDragOperationDelegate, "B@:@");
+ c.AddMethod (concludeDragOperationSel.Handle, concludeDragOperationDelegate, "v@:@");
}
}
}
@@ -558,13 +565,16 @@ namespace Xwt.Mac
delegate void DelegateIntPtrIntPtrIntPtrVoid(IntPtr p1, IntPtr p2, IntPtr p3);
delegate bool DelegateIntPtrIntPtrIntPtrBool(IntPtr p1, IntPtr p2, IntPtr p3);
+ static DelegateIntPtrIntPtrBool onBecomeFirstResponderDelegate = new DelegateIntPtrIntPtrBool(OnBecomeFirstResponder);
+ static DelegateIntPtrIntPtrBool onResignFirstResponderDelegate = new DelegateIntPtrIntPtrBool(OnResignFirstResponder);
+
static void SetupFocusEvents (Type type)
{
lock (typesConfiguredForFocusEvents) {
if (typesConfiguredForFocusEvents.Add (type)) {
Class c = new Class (type);
- c.AddMethod (becomeFirstResponderSel.Handle, new DelegateIntPtrIntPtrBool(OnBecomeFirstResponder), "B@:");
- c.AddMethod (resignFirstResponderSel.Handle, new DelegateIntPtrIntPtrBool(OnResignFirstResponder), "B@:");
+ c.AddMethod (becomeFirstResponderSel.Handle, onBecomeFirstResponderDelegate, "B@:");
+ c.AddMethod (resignFirstResponderSel.Handle, onResignFirstResponderDelegate, "B@:");
}
}
}