haiku: Remove BDirectWindow, fix OpenGL handling.

From e6cc4e7f4b8189be55dd3b0e13e54e59f73d7672 Mon Sep 17 00:00:00 2001
From: X512 <danger_mail@list.ru>
Date: Thu, 30 Jan 2020 04:01:58 +0900
Subject: libsdl2: Remove BDirectWindow, fix OpenGL handling.

* BDirectWindow changed to BWindow.
* Implemented fullscreen.
* Introduced view for non-OpenGL drawing.
* Drawing thread removed, window thread is used instead.
* Use BGLView as OpenGL context. Implement proper context switching and OpenGL
  locking. Only one context per window is supported. BGLView should be not
  deleted when window is closed, it deleted when deleting context.
This commit is contained in:
kenmays 2022-01-12 06:42:17 -08:00 committed by Sam Lantinga
parent 407d4e470a
commit 094e94402d

View file

@ -21,6 +21,7 @@
#ifndef SDL_BAPP_H #ifndef SDL_BAPP_H
#define SDL_BAPP_H #define SDL_BAPP_H
#include <Path.h>
#include <InterfaceKit.h> #include <InterfaceKit.h>
#include <LocaleRoster.h> #include <LocaleRoster.h>
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
@ -93,6 +94,15 @@ public:
} }
virtual void RefsReceived(BMessage* message) {
char filePath[512];
entry_ref entryRef;
for (int32 i = 0; message->FindRef("refs", i, &entryRef) == B_OK; i++) {
BPath referencePath = BPath(&entryRef);
SDL_SendDropFile(NULL, referencePath.Path());
}
return;
}
/* Event-handling functions */ /* Event-handling functions */
virtual void MessageReceived(BMessage* message) { virtual void MessageReceived(BMessage* message) {
@ -198,6 +208,10 @@ public:
} }
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
BGLView *GetCurrentContext() {
return _current_context;
}
void SetCurrentContext(BGLView *newContext) { void SetCurrentContext(BGLView *newContext) {
if(_current_context) if(_current_context)
_current_context->UnlockGL(); _current_context->UnlockGL();
@ -250,9 +264,6 @@ private:
if (SDL_ShowCursor(-1) && be_app->IsCursorHidden()) if (SDL_ShowCursor(-1) && be_app->IsCursorHidden())
be_app->ShowCursor(); be_app->ShowCursor();
} }
/* Tell the application that the mouse passed over, redraw needed */
HAIKU_UpdateWindowFramebuffer(NULL,win,NULL,-1);
} }
void _HandleMouseButton(BMessage *msg) { void _HandleMouseButton(BMessage *msg) {