Skip to content

Commit

Permalink
Introduce the new InputGesture feature
Browse files Browse the repository at this point in the history
supporting Edge Swipe, Edge Drag, Tap, and Palm Cover gestures
  • Loading branch information
duna.oh authored and oduna00 committed Nov 12, 2024
1 parent 6cc6154 commit 9b47677
Show file tree
Hide file tree
Showing 11 changed files with 1,181 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Text;

namespace Tizen.NUI.WindowSystem
{
internal static partial class Interop
{
internal static class InputGesture
{
const string lib = "libcapi-ui-efl-util.so.0";

internal static string LogTag = "Tizen.NUI.WindowSystem";

[DllImport(lib, EntryPoint = "efl_util_gesture_initialize")]
internal static extern IntPtr Initialize();

[DllImport(lib, EntryPoint = "efl_util_gesture_deinitialize")]
internal static extern ErrorCode Deinitialize(IntPtr gestureHandler);

[DllImport(lib, EntryPoint = "efl_util_gesture_edge_swipe_new")]
internal static extern IntPtr EdgeSwipeNew(IntPtr gestureHandler, int fingers, int edge);

[DllImport(lib, EntryPoint = "efl_util_gesture_edge_swipe_free")]
internal static extern ErrorCode EdgeSwipeFree(IntPtr gestureHandler, IntPtr gestureData);

[DllImport(lib, EntryPoint = "efl_util_gesture_edge_swipe_size_set")]
internal static extern ErrorCode EdgeSwipeSizeSet(IntPtr gestureData, int edgeSize, int startPoint, int endPoint);

[DllImport(lib, EntryPoint = "efl_util_gesture_edge_drag_new")]
internal static extern IntPtr EdgeDragNew(IntPtr gestureHandler, int fingers, int edge);

[DllImport(lib, EntryPoint = "efl_util_gesture_edge_drag_free")]
internal static extern ErrorCode EdgeDragFree(IntPtr gestureHandler, IntPtr gestureData);

[DllImport(lib, EntryPoint = "efl_util_gesture_edge_drag_size_set")]
internal static extern ErrorCode EdgeDragSizeSet(IntPtr gestureData, int edgeSize, int startPoint, int endPoint);

[DllImport(lib, EntryPoint = "efl_util_gesture_tap_new")]
internal static extern IntPtr TapNew(IntPtr gestureHandler, int fingers, int repeats);

[DllImport(lib, EntryPoint = "efl_util_gesture_tap_free")]
internal static extern ErrorCode TapFree(IntPtr gestureHandler, IntPtr gestureData);

[DllImport(lib, EntryPoint = "efl_util_gesture_palm_cover_new")]
internal static extern IntPtr PalmCoverNew(IntPtr gestureHandler);

[DllImport(lib, EntryPoint = "efl_util_gesture_palm_cover_free")]
internal static extern ErrorCode PalmCoverFree(IntPtr gestureHandler, IntPtr gestureData);

[DllImport(lib, EntryPoint = "efl_util_gesture_grab")]
internal static extern ErrorCode GestureGrab(IntPtr gestureHandler, IntPtr gestureData);

[DllImport(lib, EntryPoint = "efl_util_gesture_ungrab")]
internal static extern ErrorCode GestureUngrab(IntPtr gestureHandler, IntPtr gestureData);

[DllImport(lib, EntryPoint = "efl_util_gesture_edge_swipe_cb_set")]
internal static extern ErrorCode SetEdgeSwipeCb(IntPtr gestureHandler, EdgeSwipeCb cbFunc, IntPtr usergestureData);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void EdgeSwipeCb(IntPtr usergestureData, int mode, int fingers, int sx, int sy, int edge);

[DllImport(lib, EntryPoint = "efl_util_gesture_edge_drag_cb_set")]
internal static extern ErrorCode SetEdgeDragCb(IntPtr gestureHandler, EdgeDragCb cbFunc, IntPtr usergestureData);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void EdgeDragCb(IntPtr usergestureData, int mode, int fingers, int cx, int cy, int edge);

[DllImport(lib, EntryPoint = "efl_util_gesture_tap_cb_set")]
internal static extern ErrorCode SetTapCb(IntPtr gestureHandler, TapCb cbFunc, IntPtr usergestureData);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void TapCb(IntPtr usergestureData, int mode, int fingers, int repeats);

[DllImport(lib, EntryPoint = "efl_util_gesture_palm_cover_cb_set")]
internal static extern ErrorCode SetPalmCoverCb(IntPtr gestureHandler, PalmCoverCb cbFunc, IntPtr usergestureData);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void PalmCoverCb(IntPtr usergestureData, int mode, int duration, int cx, int cy, int size, double pressure);

internal enum ErrorCode
{
None = Tizen.Internals.Errors.ErrorCode.None, // Successful
OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, // Out of memory
InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, // Invalid parameter
InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation, // Invalid operation
PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, // Permission denied
NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, // NOT supported
};
}
}
}
58 changes: 58 additions & 0 deletions src/Tizen.NUI.WindowSystem/src/public/EdgeDragEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright(c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.ComponentModel;

namespace Tizen.NUI.WindowSystem
{
/// <summary>
/// This class contains the data related to the EdgeDrag event.
/// </summary>
/// This class is need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public class EdgeDragEventArgs : EventArgs
{
internal EdgeDragEventArgs(int mode, int fingers, int cx, int cy, int edge)
{
Mode = mode;
Fingers = fingers;
Cx = cx;
Cy = cy;
Edge = edge;
}
/// <summary>
/// Mode
/// </summary>
public int Mode{ get; internal set; }
/// <summary>
/// Fingers
/// </summary>
public int Fingers{ get; internal set;}
/// <summary>
/// Cx
/// </summary>
public int Cx{ get; internal set;}
/// <summary>
/// Cy
/// </summary>
public int Cy{ get; internal set;}
/// <summary>
/// Edge
/// </summary>
public int Edge{ get; internal set;}
}
}
58 changes: 58 additions & 0 deletions src/Tizen.NUI.WindowSystem/src/public/EdgeSwipeEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright(c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.ComponentModel;

namespace Tizen.NUI.WindowSystem
{
/// <summary>
/// This class contains the data related to the EdgeSwipe event.
/// </summary>
/// This class is need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public class EdgeSwipeEventArgs : EventArgs
{
internal EdgeSwipeEventArgs(int mode, int fingers, int sx, int sy, int edge)
{
Mode = mode;
Fingers = fingers;
Sx = sx;
Sy = sy;
Edge = edge;
}
/// <summary>
/// Mode
/// </summary>
public int Mode{ get; internal set; }
/// <summary>
/// Fingers
/// </summary>
public int Fingers{ get; internal set;}
/// <summary>
/// Sx
/// </summary>
public int Sx{ get; internal set;}
/// <summary>
/// Sy
/// </summary>
public int Sy{ get; internal set;}
/// <summary>
/// Edge
/// </summary>
public int Edge{ get; internal set;}
}
}
Loading

0 comments on commit 9b47677

Please sign in to comment.