Code:
procedure oX11Window.CreateWindow(X, Y, BPP: Int64);
var
FeedEvent: tXEvent;
begin
dpy := XOpenDisplay(Nil);
if Dpy = Nil then
DebugWriteln('Error connecting to X Server');
WindowHeight := Y;
WindowWidth := X;
OriginalWindowHeight := Y;
OriginalWindowWidth := X;
if (BPP <= 0) or (BPP >= Attributes[2]) then
BPP := Attributes[2] //24 bit is a good default if you you dont want anything specific
else
Attributes[2] := BPP;
BitDepth := Attributes[2];
Root := DefaultRootWindow(Dpy);
Vi := glXChooseVisual(Dpy, 0, Attributes);
if Vi = Nil then
DebugWriteln('No Visual found');
cmap := XCreateColormap(Dpy, Root, Vi^.Visual, AllocNone);
Swa.ColorMap := Cmap;
Swa.Event_Mask := ExposureMask Or KeyPressMask Or KeyReleaseMask or PointerMotionMask Or ButtonPressMask Or ButtonReleaseMask or StructureNotifyMask;
Win := XCreateWindow(Dpy, Root, 0, 0, WindowWidth, WindowHeight, 0, Vi^.Depth, InputOutput, Vi^.Visual, CWColormap Or CWEventMask, @Swa);
XSelectInput(Dpy, Root, Swa.Event_mask);
XMapWindow(Dpy, Win);
XStoreName(Dpy, Win, PChar(Name));
Glc := glXCreateContext(Dpy, Vi, Nil, True);
DebugWrite('CTXT');
glXMakeCurrent(Dpy, Win, Glc);
glEnable( GL_TEXTURE_2D );
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glViewport( 0, 0, WindowWidth, WindowHeight );
glClear( GL_COLOR_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(0, WindowWidth, WindowHeight, 0, -16, 16);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
KillAtom := XInternAtom(Dpy, 'WM_DELETE_WINDOW', 0);
WMDataAtom := XInternAtom(Dpy, 'WM_PROTOCOLS', False);
XSetWMProtocols(Dpy , Root, @KillAtom, 1);
//enable fullscreen mode if requested
if FullScreen = True then
begin
WMStateAtom := XInternAtom(Dpy, '_NET_WM_STATE', False);
WMFullScreenAtom := XInternAtom(Dpy, '_NET_WM_STATE_FULLSCREEN', FullScreen);
with FeedEvent do
begin
_Type := ClientMessage;
XClient.Window := Win;
XClient.Message_type := WMStateAtom;
XClient.Format := 32;
XClient.Data.L[0] := 1;
XClient.Data.L[1] := WMFullScreenAtom;
XClient.Data.L[2] := 0;
XSendEvent(Dpy, DefaultRootWindow(Dpy), False, SubStructureNotifyMask, @FeedEvent);
end;
end;
end;
Edit: The exact line that seems to be dodgy is this:
Bookmarks