Quellcode durchsuchen

Refactored clipboard functions.

Brucey vor 5 Jahren
Ursprung
Commit
b03c0f03dd
4 geänderte Dateien mit 25 neuen und 22 gelöschten Zeilen
  1. 4 0
      glfw.mod/common.bmx
  2. 21 0
      glfw.mod/glfw.bmx
  3. 0 2
      glfwwindow.mod/common.bmx
  4. 0 20
      glfwwindow.mod/glfwwindow.bmx

+ 4 - 0
glfw.mod/common.bmx

@@ -33,6 +33,10 @@ Extern
 	Function glfwSwapInterval(interval:Int)
 	Function bmx_glfw_glfwGetTime:Double()="glfwGetTime"
 	Function bmx_glfw_glfwSetTime(time:Double)="glfwSetTime"
+
+	Function bmx_glfw_glfwSetClipboardString(window:Byte Ptr, txt:Byte Ptr)="glfwSetClipboardString"
+	Function bmx_glfw_glfwGetClipboardString:Byte Ptr(window:Byte Ptr)="glfwGetClipboardString"
+
 End Extern
 
 Const GLFW_NO_API:Int = 0

+ 21 - 0
glfw.mod/glfw.bmx

@@ -58,3 +58,24 @@ End Rem
 Function SetTime(time:Double)
 	bmx_glfw_glfwSetTime(time)
 End Function
+
+Rem
+bbdoc: Sets the system clipboard to the specified #String.
+End Rem
+Function SetClipboard(txt:String)
+	Local t:Byte Ptr = txt.ToUTF8String()
+	bmx_glfw_glfwSetClipboardString(Null, t)
+	MemFree(t)
+End Function
+
+Rem
+bbdoc: Returns the contents of the system clipboard, if it contains or is convertible to a #String.
+about: If the clipboard is empty or if its contents cannot be converted, #Null is returned and a #GLFW_FORMAT_UNAVAILABLE error is generated.
+End Rem
+Function GetClipboard:String()
+	Local t:Byte Ptr = bmx_glfw_glfwGetClipboardString(Null)
+	If t Then
+		Return String.FromUTF8String(t)
+	End If
+End Function
+

+ 0 - 2
glfwwindow.mod/common.bmx

@@ -93,8 +93,6 @@ Extern
 	Function bmx_glfw_glfwCreateStandardCursor:Byte Ptr(shape:Int)="glfwCreateStandardCursor"
 	Function bmx_glfw_glfwDestroyCursor(cursor:Byte Ptr)="glfwDestroyCursor"
 	Function bmx_glfw_glfwSetCursor(window:Byte Ptr, cursor:Byte Ptr)="glfwSetCursor"
-	Function bmx_glfw_glfwSetClipboardString(window:Byte Ptr, txt:Byte Ptr)="glfwSetClipboardString"
-	Function bmx_glfw_glfwGetClipboardString:Byte Ptr(window:Byte Ptr)="glfwGetClipboardString"
 
 End Extern
 

+ 0 - 20
glfwwindow.mod/glfwwindow.bmx

@@ -623,26 +623,6 @@ Type TGLFWWindow
 		bmx_glfw_glfwSetCursor(windowPtr, cursor.cursorPtr)
 	End Method
 
-	Rem
-	bbdoc: Sets the system clipboard to the specified #String.
-	End Rem
-	Method SetClipboard(txt:String)
-		Local t:Byte Ptr = txt.ToUTF8String()
-		bmx_glfw_glfwSetClipboardString(windowPtr, t)
-		MemFree(t)
-	End Method
-	
-	Rem
-	bbdoc: Returns the contents of the system clipboard, if it contains or is convertible to a #String.
-	about: If the clipboard is empty or if its contents cannot be converted, #Null is returned and a #GLFW_FORMAT_UNAVAILABLE error is generated.
-	End Rem
-	Method GetClipboard:String()
-		Local t:Byte Ptr = bmx_glfw_glfwGetClipboardString(windowPtr)
-		If t Then
-			Return String.FromUTF8String(t)
-		End If
-	End Method
-	
 	Rem
 	bbdoc: Called when the window position changes.
 	End Rem