| @@ -60,10 +60,7 @@ type | |||||
| {$region messages -fold} | {$region messages -fold} | ||||
| procedure TRenderControl.WndProc(var Message: TLMessage); | procedure TRenderControl.WndProc(var Message: TLMessage); | ||||
| var | |||||
| handled: Boolean; | |||||
| begin | begin | ||||
| handled := false; | |||||
| case Message.msg of | case Message.msg of | ||||
| //LM_ACTIVATEITEM, | //LM_ACTIVATEITEM, | ||||
| //LM_CHANGED, | //LM_CHANGED, | ||||
| @@ -269,10 +266,8 @@ begin | |||||
| CN_SYSCHAR, | CN_SYSCHAR, | ||||
| CN_NOTIFY: | CN_NOTIFY: | ||||
| begin | begin | ||||
| if Assigned(fTarget) then begin | |||||
| if Assigned(fTarget) then | |||||
| Message.Result := fTarget.Perform(Message.msg, Message.wParam, Message.lParam); | Message.Result := fTarget.Perform(Message.msg, Message.wParam, Message.lParam); | ||||
| handled := true; | |||||
| end; | |||||
| end; | end; | ||||
| end; | end; | ||||
| inherited WndProc(Message); | inherited WndProc(Message); | ||||
| @@ -422,6 +417,7 @@ procedure TglcContextGtk2GLX.OpenContext; | |||||
| var | var | ||||
| Attribs: array of GLint; | Attribs: array of GLint; | ||||
| tmpContext: GLXContext; | tmpContext: GLXContext; | ||||
| glxID: GLXDrawable; | |||||
| begin | begin | ||||
| inherited OpenContext; | inherited OpenContext; | ||||
| @@ -453,7 +449,8 @@ begin | |||||
| SetLength(Attribs, 1); | SetLength(Attribs, 1); | ||||
| Attribs[High(Attribs)] := 0; | Attribs[High(Attribs)] := 0; | ||||
| glXMakeCurrent(FDisplay, GDK_DRAWABLE_XID(GTK_WIDGET(FWidget)^.window), tmpContext); | |||||
| glxID := GDK_DRAWABLE_XID(GTK_WIDGET(FWidget)^.window); | |||||
| glXMakeCurrent(FDisplay, glxID, tmpContext); | |||||
| ReadImplementationProperties; | ReadImplementationProperties; | ||||
| if not Assigned(glXCreateContextAttribsARB) or not GLX_ARB_create_context then begin | if not Assigned(glXCreateContextAttribsARB) or not GLX_ARB_create_context then begin | ||||
| glXDestroyContext(FDisplay, tmpContext); | glXDestroyContext(FDisplay, tmpContext); | ||||
| @@ -500,6 +497,8 @@ begin | |||||
| end; | end; | ||||
| procedure TglcContextGtk2GLX.Activate; | procedure TglcContextGtk2GLX.Activate; | ||||
| var | |||||
| glxID: GLXDrawable; | |||||
| begin | begin | ||||
| if not Assigned(FWidget) then exit; | if not Assigned(FWidget) then exit; | ||||
| // make sure the widget is realized | // make sure the widget is realized | ||||
| @@ -507,30 +506,36 @@ begin | |||||
| if not GTK_WIDGET_REALIZED(FWidget) then exit; | if not GTK_WIDGET_REALIZED(FWidget) then exit; | ||||
| // make current | // make current | ||||
| glXMakeCurrent(FDisplay, GDK_DRAWABLE_XID(GTK_WIDGET(FWidget)^.window), FContext); | |||||
| glxID := GDK_DRAWABLE_XID(GTK_WIDGET(FWidget)^.window); | |||||
| glXMakeCurrent(FDisplay, glxID, FContext); | |||||
| end; | end; | ||||
| procedure TglcContextGtk2GLX.Deactivate; | procedure TglcContextGtk2GLX.Deactivate; | ||||
| var | |||||
| glxID: GLXDrawable; | |||||
| begin | begin | ||||
| if not Assigned(FWidget) then exit; | if not Assigned(FWidget) then exit; | ||||
| glXMakeCurrent(FDisplay, GDK_DRAWABLE_XID(GTK_WIDGET(FWidget)^.window), nil); | |||||
| glxID := GDK_DRAWABLE_XID(GTK_WIDGET(FWidget)^.window); | |||||
| glXMakeCurrent(FDisplay, glxID, nil); | |||||
| end; | end; | ||||
| function TglcContextGtk2GLX.IsActive: boolean; | function TglcContextGtk2GLX.IsActive: boolean; | ||||
| var | |||||
| glxID: GLXDrawable; | |||||
| begin | begin | ||||
| glxID := GDK_DRAWABLE_XID(GTK_WIDGET(FWidget)^.window); | |||||
| Result:= (FContext = glXGetCurrentContext()) and | Result:= (FContext = glXGetCurrentContext()) and | ||||
| Assigned(FWidget) and | Assigned(FWidget) and | ||||
| (GDK_DRAWABLE_XID(GTK_WIDGET(FWidget)^.window) = glXGetCurrentDrawable()); | |||||
| (glxID = glXGetCurrentDrawable()); | |||||
| end; | end; | ||||
| procedure TglcContextGtk2GLX.SwapBuffers; | procedure TglcContextGtk2GLX.SwapBuffers; | ||||
| var | var | ||||
| drawable: PGdkDrawable; | |||||
| glxID: GLXDrawable; | |||||
| begin | begin | ||||
| if not Assigned(FWidget) then exit; | if not Assigned(FWidget) then exit; | ||||
| drawable:= GTK_WIDGET(FWidget)^.window; | |||||
| glXSwapBuffers(FDisplay, GDK_DRAWABLE_XID(drawable)); | |||||
| glxID := GDK_DRAWABLE_XID(GTK_WIDGET(FWidget)^.window); | |||||
| glXSwapBuffers(FDisplay, glxID); | |||||
| end; | end; | ||||
| procedure TglcContextGtk2GLX.SetSwapInterval(const aInterval: GLint); | procedure TglcContextGtk2GLX.SetSwapInterval(const aInterval: GLint); | ||||
| @@ -547,7 +552,7 @@ begin | |||||
| raise Exception.Create('not yet implemented'); | raise Exception.Create('not yet implemented'); | ||||
| end; | end; | ||||
| class function TglcContextGtk2GLX.ChangeDisplaySettings(const aWidth, aHeight, | |||||
| class function TglcContextGtk2GLX.{%H-}ChangeDisplaySettings(const aWidth, aHeight, | |||||
| aBitPerPixel, aFreq: Integer; const aFlags: TglcDisplayFlags): Boolean; | aBitPerPixel, aFreq: Integer; const aFlags: TglcDisplayFlags): Boolean; | ||||
| begin | begin | ||||
| raise Exception.Create('not yet implemented'); | raise Exception.Create('not yet implemented'); | ||||
| @@ -559,4 +564,4 @@ begin | |||||
| end; | end; | ||||
| end. | end. | ||||