native_linbsd_x11.go 1.5 KB

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