zorldo

Goofing around with Ebiten
git clone git://bsandro.tech/zorldo
Log | Files | Refs | README

native_linbsd.go (1534B)


      1 // +build linux,!wayland freebsd,!wayland
      2 
      3 package glfw
      4 
      5 //#include <stdlib.h>
      6 //#define GLFW_EXPOSE_NATIVE_X11
      7 //#define GLFW_EXPOSE_NATIVE_GLX
      8 //#define GLFW_INCLUDE_NONE
      9 //#include "glfw/include/GLFW/glfw3.h"
     10 //#include "glfw/include/GLFW/glfw3native.h"
     11 import "C"
     12 import "unsafe"
     13 
     14 func GetX11Display() *C.Display {
     15 	ret := C.glfwGetX11Display()
     16 	panicError()
     17 	return ret
     18 }
     19 
     20 // GetX11Adapter returns the RRCrtc of the monitor.
     21 func (m *Monitor) GetX11Adapter() C.RRCrtc {
     22 	ret := C.glfwGetX11Adapter(m.data)
     23 	panicError()
     24 	return ret
     25 }
     26 
     27 // GetX11Monitor returns the RROutput of the monitor.
     28 func (m *Monitor) GetX11Monitor() C.RROutput {
     29 	ret := C.glfwGetX11Monitor(m.data)
     30 	panicError()
     31 	return ret
     32 }
     33 
     34 // GetX11Window returns the Window of the window.
     35 func (w *Window) GetX11Window() C.Window {
     36 	ret := C.glfwGetX11Window(w.data)
     37 	panicError()
     38 	return ret
     39 }
     40 
     41 // GetGLXContext returns the GLXContext of the window.
     42 func (w *Window) GetGLXContext() C.GLXContext {
     43 	ret := C.glfwGetGLXContext(w.data)
     44 	panicError()
     45 	return ret
     46 }
     47 
     48 // GetGLXWindow returns the GLXWindow of the window.
     49 func (w *Window) GetGLXWindow() C.GLXWindow {
     50 	ret := C.glfwGetGLXWindow(w.data)
     51 	panicError()
     52 	return ret
     53 }
     54 
     55 // SetX11SelectionString sets the X11 selection string.
     56 func SetX11SelectionString(str string) {
     57 	s := C.CString(str)
     58 	defer C.free(unsafe.Pointer(s))
     59 	C.glfwSetX11SelectionString(s)
     60 }
     61 
     62 // GetX11SelectionString gets the X11 selection string.
     63 func GetX11SelectionString() string {
     64 	s := C.glfwGetX11SelectionString()
     65 	return C.GoString(s)
     66 }