Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Focus the window when clicking on it (now a caret is correctly render…

…ed when editing text fields)
  • Loading branch information...
commit 46e2f7ba6384fda38f101545aa1ac347e3d900f5 1 parent f150623
Jeroen Dierckx authored
View
14 src/UnityBerkeliumPlugin.cpp
@@ -144,6 +144,20 @@ PLUGIN_API Berkelium::Rect Berkelium_Window_getLastDirtyRect(int windowID)
return result;
}
+PLUGIN_API void Berkelium_Window_focus(int windowID)
+{
+ UnityBerkeliumWindow *pWindow = getWindow(windowID);
+ if(pWindow)
+ pWindow->getBerkeliumWindow()->focus();
+}
+
+PLUGIN_API void Berkelium_Window_unfocus(int windowID)
+{
+ UnityBerkeliumWindow *pWindow = getWindow(windowID);
+ if(pWindow)
+ pWindow->getBerkeliumWindow()->unfocus();
+}
+
PLUGIN_API void Berkelium_Window_mouseDown(int windowID, int button)
{
UnityBerkeliumWindow *pWindow = getWindow(windowID);
View
6 test-project/Assets/Plugins/UnityBerkelium.cs
@@ -57,6 +57,12 @@ public class Window
[DllImport ("UnityBerkeliumPlugin", EntryPoint="Berkelium_Window_getLastDirtyRect")]
public static extern Rect getLastDirtyRect(int windowID);
+ [DllImport ("UnityBerkeliumPlugin", EntryPoint="Berkelium_Window_focus")]
+ public static extern void focus(int windowID);
+
+ [DllImport ("UnityBerkeliumPlugin", EntryPoint="Berkelium_Window_unfocus")]
+ public static extern void unfocus(int windowID);
+
[DllImport ("UnityBerkeliumPlugin", EntryPoint="Berkelium_Window_mouseDown")]
public static extern void mouseDown(int windowID, int button);
View
BIN  test-project/Assets/Plugins/UnityBerkeliumPlugin.dll
Binary file not shown
View
3  test-project/Assets/Scripts/RenderWebsite.cs
@@ -188,6 +188,9 @@ void OnMouseDown()
{
int x = /*width -*/ (int) (hit.textureCoord.x * width);
int y = height - (int) (hit.textureCoord.y * height);
+
+ // Focus the window
+ UnityBerkelium.Window.focus(m_TextureID);
UnityBerkelium.Window.mouseMove(m_TextureID, x, y);
UnityBerkelium.Window.mouseDown(m_TextureID, 0);
Please sign in to comment.
Something went wrong with that request. Please try again.