x11displayd.inc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. Type
  2. TX11FlagsEnum = (PTC_X11_FULLSCREEN,
  3. PTC_X11_LEAVE_DISPLAY,
  4. PTC_X11_LEAVE_WINDOW,
  5. PTC_X11_TRY_DGA,
  6. PTC_X11_TRY_XF86VIDMODE,
  7. PTC_X11_TRY_XRANDR,
  8. PTC_X11_TRY_XSHM,
  9. PTC_X11_DITHER,
  10. PTC_X11_FULLSCREEN_CURSOR_VISIBLE,
  11. PTC_X11_WINDOWED_CURSOR_INVISIBLE);
  12. TX11Flags = Set Of TX11FlagsEnum;
  13. Type
  14. TX11Display = Class(TObject)
  15. Protected
  16. Function NextEvent(Var AEvent : TPTCEvent; AWait : Boolean; Const AEventMask : TPTCEventMask) : Boolean; Virtual; Abstract;
  17. Function PeekEvent(AWait : Boolean; Const AEventMask : TPTCEventMask) : TPTCEvent; Virtual; Abstract;
  18. Function GetX11Format(Const AFormat : TPTCFormat) : TPTCFormat;
  19. { initialise the keyboard mapping table }
  20. Procedure SetKeyMapping;
  21. { Data access }
  22. Function GetWidth : Integer;
  23. Function GetHeight : Integer;
  24. Function GetPitch : Integer; Virtual; Abstract;
  25. Function GetFormat : TPTCFormat;
  26. Function GetArea : TPTCArea;
  27. { Conversion object }
  28. FCopy : TPTCCopy;
  29. FClear : TPTCClear;
  30. FPalette : TPTCPalette;
  31. FArea : TPTCArea;
  32. FClip : TPTCArea;
  33. FEventQueue : TEventQueue;
  34. FFlags : TX11Flags;
  35. FWidth, FHeight : DWord;
  36. FFormat : TPTCFormat;
  37. FDisplay : PDisplay;
  38. FScreen : Integer;
  39. FCMap : TColormap;
  40. FColours : PXColor;
  41. FFunctionKeys : PInteger;
  42. FNormalKeys : PInteger;
  43. {m_thread : pthread_t;}
  44. Public
  45. Constructor Create(ADisplay : PDisplay; AScreen : Integer; Const AFlags : TX11Flags); Virtual;
  46. Destructor Destroy; Override;
  47. Procedure Open(ATitle : String; AWidth, AHeight : Integer; Const AFormat : TPTCFormat); Virtual; Abstract;
  48. { This will always return a windowed console. The first version
  49. fills the whole window, the second one has a custom size }
  50. Procedure Open(AWindow : TWindow; Const AFormat : TPTCFormat); Virtual; Abstract;
  51. Procedure Open(AWindow : TWindow; Const AFormat : TPTCFormat; AX, AY, AWidth, AHeight : Integer); Virtual; Abstract;
  52. Procedure Close; Virtual; Abstract;
  53. Procedure Update; Virtual; Abstract;
  54. Procedure Update(Const AArea : TPTCArea); Virtual; Abstract;
  55. Function Lock : Pointer; Virtual; Abstract;
  56. Procedure Unlock; Virtual; Abstract;
  57. { load pixels to console }
  58. Procedure Load(Const APixels : Pointer; AWidth, AHeight, APitch : Integer;
  59. Const AFormat : TPTCFormat; Const APalette : TPTCPalette); Virtual;
  60. Procedure Load(Const APixels : Pointer; AWidth, AHeight, APitch : Integer;
  61. Const AFormat : TPTCFormat; Const APalette : TPTCPalette;
  62. Const ASource, ADestination : TPTCArea); Virtual;
  63. { save console pixels }
  64. Procedure Save(APixels : Pointer; AWidth, AHeight, APitch : Integer;
  65. Const AFormat : TPTCFormat; Const APalette : TPTCPalette); Virtual;
  66. Procedure Save(APixels : Pointer; AWidth, AHeight, APitch : Integer;
  67. Const AFormat : TPTCFormat; Const APalette : TPTCPalette;
  68. Const ASource, ADestination : TPTCArea); Virtual;
  69. { clear surface }
  70. Procedure Clear(Const AColor : TPTCColor); Virtual;
  71. Procedure Clear(Const AColor : TPTCColor; Const AArea : TPTCArea); Virtual;
  72. { Console palette }
  73. Procedure Palette(Const APalette : TPTCPalette); Virtual; Abstract;
  74. Function Palette : TPTCPalette; Virtual;
  75. { console clip area }
  76. Procedure Clip(Const AArea : TPTCArea);
  77. { cursor control }
  78. Procedure SetCursor(AVisible : Boolean); Virtual; Abstract;
  79. { Data access }
  80. Function Clip : TPTCArea;
  81. Function IsFullScreen : Boolean; Virtual; Abstract;
  82. { Set flags (only used internally now!) }
  83. Procedure SetFlags(AFlags : TX11Flags);
  84. Procedure GetModes(Var AModes : TPTCModeDynArray); Virtual; Abstract;
  85. { X11 helper functions for your enjoyment }
  86. { return the display we are using }
  87. Function GetX11Display : PDisplay;
  88. { return the screen we are using }
  89. Function GetX11Screen : Integer;
  90. { return our window (0 if DGA) }
  91. Function GetX11Window : TWindow; Virtual; Abstract;
  92. Property Width : Integer Read GetWidth;
  93. Property Height : Integer Read GetHeight;
  94. Property Pitch : Integer Read GetPitch;
  95. Property Area : TPTCArea Read GetArea;
  96. Property Format : TPTCFormat Read GetFormat;
  97. End;