Go to the documentation of this file.
29 #include "../../SDL_internal.h"
40 #include <InterfaceKit.h>
41 #include <game/DirectWindow.h>
43 #include <opengl/GLView.h>
46 #include "../../main/haiku/SDL_BApp.h"
69 : BDirectWindow(bounds,
"Untitled", look, B_NORMAL_WINDOW_FEEL,
flags)
93 B_NORMAL_PRIORITY, (
void*)
this);
138 (B_WILL_DRAW | B_FRAME_EVENTS),
143 _SDL_GLView->SetEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, B_NO_POINTER_HISTORY);
174 || ((info->buffer_state & B_BUFFER_RESIZED)
175 || (info->buffer_state & B_BUFFER_RESET)
176 || (info->driver_state == B_MODE_CHANGED));
179 switch(info->buffer_state & B_DIRECT_MODE_MASK) {
183 case B_DIRECT_MODIFY:
199 _bits = (uint8*) info->bits;
219 BDirectWindow::DirectConnected(info);
233 msg.AddInt32(
"window-x", (
int)origin.x);
234 msg.AddInt32(
"window-y", (
int)origin.y);
238 BDirectWindow::FrameMoved(origin);
245 msg.AddInt32(
"window-w", (
int)
width + 1);
246 msg.AddInt32(
"window-h", (
int)
height + 1);
263 msg.AddBool(
"focusGained",
active);
267 virtual void Zoom(BPoint origin,
284 BDirectWindow::Show();
293 BDirectWindow::Hide();
301 BDirectWindow::Minimize(minimize);
304 BMessage msg(minState);
319 if (msg->FindPoint(
"where", &where) == B_OK
320 && msg->FindInt32(
"be:transit", &transit) == B_OK) {
326 if (msg->FindInt32(
"buttons", &buttons) == B_OK) {
332 if (msg->FindInt32(
"buttons", &buttons) == B_OK) {
337 case B_MOUSE_WHEEL_CHANGED:
339 if (msg->FindFloat(
"be:wheel_delta_x", &
x) == B_OK
340 && msg->FindFloat(
"be:wheel_delta_y", &
y) == B_OK) {
349 int8 bytes[4] = { 0, 0, 0, 0 };
350 while (i < 4 && msg->FindInt8(
"byte",
i, &
byte) == B_OK) {
354 if (msg->FindInt32(
"key", &
key) == B_OK) {
360 case B_UNMAPPED_KEY_DOWN:
361 if (msg->FindInt32(
"key", &
key) == B_OK) {
367 case B_UNMAPPED_KEY_UP:
368 if (msg->FindInt32(
"key", &
key) == B_OK) {
383 BDirectWindow::DispatchMessage(msg,
target);
425 BDirectWindow::MessageReceived(
message);
467 if(transit == B_EXITED_VIEW) {
478 msg.AddInt32(
"x", (
int)where.x);
479 msg.AddInt32(
"y", (
int)where.y);
488 msg.AddBool(
"focusGained", focusGained);
499 if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
502 if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
505 if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
514 msg.AddInt32(
"button-id",
button);
515 msg.AddInt32(
"button-state",
state);
522 msg.AddInt32(
"xticks",
x);
523 msg.AddInt32(
"yticks",
y);
527 void _KeyEvent(int32 keyCode,
const int8 *keyUtf8,
const ssize_t &
len, int32 keyState) {
530 msg.AddInt32(
"key-state", keyState);
531 msg.AddInt32(
"key-scancode", keyCode);
532 if (keyUtf8 !=
NULL) {
533 msg.AddData(
"key-utf8", B_INT8_TYPE, (
const void*)keyUtf8,
len);
535 be_app->PostMessage(&msg);
544 msg.AddInt32(
"window-id",
_id);
545 be_app->PostMessage(&msg);
552 msg->FindString(
"window-title", &title) != B_OK
562 msg->FindInt32(
"window-x", &
x) != B_OK ||
563 msg->FindInt32(
"window-y", &
y) != B_OK
573 msg->FindInt32(
"window-w", &
w) != B_OK ||
574 msg->FindInt32(
"window-h", &
h) != B_OK
583 if(msg->FindBool(
"window-border", &bEnabled) != B_OK) {
586 SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK);
591 if(msg->FindBool(
"window-resizable", &bEnabled) != B_OK) {
595 SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
597 SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
604 }
else if(IsHidden()) {
615 msg->FindBool(
"fullscreen", &fullscreen) != B_OK
619 SetFullScreen(fullscreen);
void _SetTitle(BMessage *msg)
virtual bool QuitRequested()
virtual void DirectConnected(direct_buffer_info *info)
virtual void MessageReceived(BMessage *message)
bool _connection_disabled
void _MouseButtonEvent(int32 buttons, Uint8 state)
virtual void Minimize(bool minimize)
GLint GLint GLsizei width
GLuint GLsizei const GLchar * message
virtual void FrameResized(float width, float height)
void _MouseMotionEvent(BPoint &where, int32 transit)
void _SetBordered(BMessage *msg)
bool CanTrashWindowBuffer()
virtual void FrameMoved(BPoint origin)
void _ResizeTo(BMessage *msg)
SDL_Scancode
The SDL keyboard scancode representation.
virtual void DispatchMessage(BMessage *msg, BHandler *target)
void _SetResizable(BMessage *msg)
SDL_BWin(BRect bounds, window_look look, uint32 flags)
GLfloat GLfloat GLfloat GLfloat h
virtual BGLView * CreateGLView(Uint32 gl_flags)
void _MouseFocusEvent(bool focusGained)
virtual void Zoom(BPoint origin, float width, float height)
virtual void RemoveGLView()
void _MouseWheelEvent(int32 x, int32 y)
GLint GLint GLint GLint GLint x
void _MoveTo(BMessage *msg)
void SetBitmap(BBitmap *bitmap)
GLint GLint GLsizei GLsizei height
#define SDL_BUTTON_MIDDLE
int32 HAIKU_DrawThread(void *data)
void _PostWindowEvent(BMessage &msg)
void _KeyEvent(int32 keyCode, const int8 *keyUtf8, const ssize_t &len, int32 keyState)
void SetBufferExists(bool bufferExists)
GLint GLint GLint GLint GLint GLint y
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
virtual void SwapBuffers(void)
thread_id _draw_thread_id
bool _trash_window_buffer
virtual void WindowActivated(bool active)
@ BAPP_WINDOW_CLOSE_REQUESTED
void _SetFullScreen(BMessage *msg)
void SetBufferDirty(bool bufferDirty)
void _SendMouseButton(int32 button, int32 state)
void SetTrashBuffer(bool trash)
clipping_rect * GetClips()
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
GLubyte GLubyte GLubyte GLubyte w