system.linux.bmx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. Strict
  2. Import BRL.System
  3. Import "system.linux.c"
  4. Import "-lXxf86vm"
  5. Import pub.stdc
  6. Extern
  7. Function bbSystemStartup()
  8. Function bbSystemPoll()
  9. Function bbSystemWait()
  10. Function bbSetMouseVisible(visible)
  11. Function bbMoveMouse(x,y)
  12. Function bbSystemDisplay()
  13. Function bbSystemEventHandler( callback(xevent:Byte Ptr) )
  14. Function bbSystemPostSyncOp( syncOp( syncInfo:Object,asyncRet ),syncInfo:Object,asyncRet )
  15. Function bbSystemStartAsyncOp( asyncOp( asyncInfo ),asyncInfo,syncOp( syncInfo:Object,asyncRet ),syncInfo:Object )
  16. Function bbSystemAsyncFD()
  17. Function bbSystemFlushAsyncOps()
  18. Function bbSystemDesktopWidth:Int()
  19. Function bbSystemDesktopHeight:Int()
  20. Function bbSystemDesktopDepth:Int()
  21. Function bbSystemDesktopHertz:Int()
  22. End Extern
  23. Const XKeyPress=2
  24. Const XKeyRelease=3
  25. Function XKeyHandler(keyevent,key,mask)
  26. WriteStdout "XKeyHandler "+keyevent+","+key+","+mask+"~n"
  27. End Function
  28. Type TLinuxSystemDriver Extends TSystemDriver
  29. Method New()
  30. bbSystemStartup
  31. End Method
  32. Method Poll()
  33. bbSystemPoll()
  34. End Method
  35. Method Wait()
  36. bbSystemWait()
  37. End Method
  38. Method Emit( osevent:Byte Ptr,source:Object )
  39. Throw "simon come here"
  40. End Method
  41. Method SetMouseVisible( visible )
  42. bbSetMouseVisible(visible)
  43. End Method
  44. Method MoveMouse( x,y )
  45. bbMoveMouse x,y
  46. End Method
  47. Method Notify( text$,serious )
  48. WriteStdout text+"~r~n"
  49. End Method
  50. Method Confirm( text$,serious )
  51. WriteStdout text+" (Yes/No)?"
  52. Local t$=ReadStdin().ToLower()
  53. If t[..1]="y" Return 1
  54. Return 0
  55. End Method
  56. Method Proceed( text$,serious )
  57. WriteStdout text+" (Yes/No/Cancel)?"
  58. Local t$=ReadStdin().ToLower()
  59. If t[..1]="y" Return 1
  60. If t[..1]="n" Return 0
  61. Return -1
  62. End Method
  63. Method RequestFile$( text$,exts$,save,file$ )
  64. WriteStdout "Enter a filename:"
  65. Return ReadStdin()
  66. End Method
  67. Method RequestDir$( text$,path$ )
  68. WriteStdout "Enter a directory name:"
  69. Return ReadStdin()
  70. End Method
  71. Method OpenURL( url$ )
  72. If getenv_("KDE_FULL_DESKTOP")
  73. system_ "kfmclient exec ~q"+url+"~q"
  74. ElseIf getenv_("GNOME_DESKTOP_SESSION_ID")
  75. system_ "gnome-open ~q"+url+"~q"
  76. EndIf
  77. End Method
  78. Method DesktopWidth:Int()
  79. Return bbSystemDesktopWidth()
  80. End Method
  81. Method DesktopHeight:Int()
  82. Return bbSystemDesktopHeight()
  83. End Method
  84. Method DesktopDepth:Int()
  85. Return bbSystemDesktopDepth()
  86. End Method
  87. Method DesktopHertz:Int()
  88. Return bbSystemDesktopHertz()
  89. End Method
  90. End Type