Permalink
Browse files

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

…ed when editing text fields)
  • Loading branch information...
OpenJeDi committed Sep 16, 2010
1 parent f150623 commit 46e2f7ba6384fda38f101545aa1ac347e3d900f5
@@ -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);
@@ -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);
Binary file not shown.
@@ -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);

0 comments on commit 46e2f7b

Please sign in to comment.