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)
92 B_NORMAL_PRIORITY, (
void*)
this);
137 (B_WILL_DRAW | B_FRAME_EVENTS),
172 || ((info->buffer_state & B_BUFFER_RESIZED)
173 || (info->buffer_state & B_BUFFER_RESET)
174 || (info->driver_state == B_MODE_CHANGED));
177 switch(info->buffer_state & B_DIRECT_MODE_MASK) {
181 case B_DIRECT_MODIFY:
193 _bits = (uint8*) info->bits;
213 BDirectWindow::DirectConnected(info);
227 msg.AddInt32(
"window-x", (
int)origin.x);
228 msg.AddInt32(
"window-y", (
int)origin.y);
232 BDirectWindow::FrameMoved(origin);
239 msg.AddInt32(
"window-w", (
int)
width + 1);
240 msg.AddInt32(
"window-h", (
int)
height + 1);
257 msg.AddBool(
"focusGained",
active);
261 virtual void Zoom(BPoint origin,
278 BDirectWindow::Show();
287 BDirectWindow::Hide();
295 BDirectWindow::Minimize(minimize);
298 BMessage msg(minState);
313 if (msg->FindPoint(
"where", &where) == B_OK
314 && msg->FindInt32(
"be:transit", &transit) == B_OK) {
322 if (msg->FindInt32(
"buttons", &buttons) == B_OK) {
331 if (msg->FindInt32(
"buttons", &buttons) == B_OK) {
336 case B_MOUSE_WHEEL_CHANGED:
338 if (msg->FindFloat(
"be:wheel_delta_x", &
x) == B_OK
339 && msg->FindFloat(
"be:wheel_delta_y", &
y) == B_OK) {
348 int8 bytes[4] = { 0, 0, 0, 0 };
349 while (i < 4 && msg->FindInt8(
"byte",
i, &
byte) == B_OK) {
353 if (msg->FindInt32(
"key", &
key) == B_OK) {
359 case B_UNMAPPED_KEY_DOWN:
360 if (msg->FindInt32(
"key", &
key) == B_OK) {
366 case B_UNMAPPED_KEY_UP:
367 if (msg->FindInt32(
"key", &
key) == B_OK) {
382 BDirectWindow::DispatchMessage(msg,
target);
424 BDirectWindow::MessageReceived(
message);
466 if(transit == B_EXITED_VIEW) {
477 msg.AddInt32(
"x", (
int)where.x);
478 msg.AddInt32(
"y", (
int)where.y);
487 msg.AddBool(
"focusGained", focusGained);
499 if( !(buttonStateChange) ) {
504 if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
506 B_PRIMARY_MOUSE_BUTTON);
508 if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
510 B_PRIMARY_MOUSE_BUTTON);
512 if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
514 B_PRIMARY_MOUSE_BUTTON);
522 msg.AddInt32(
"button-id",
button);
523 msg.AddInt32(
"button-state",
state);
530 msg.AddInt32(
"xticks",
x);
531 msg.AddInt32(
"yticks",
y);
535 void _KeyEvent(int32 keyCode,
const int8 *keyUtf8,
const ssize_t &
len, int32 keyState) {
538 msg.AddInt32(
"key-state", keyState);
539 msg.AddInt32(
"key-scancode", keyCode);
540 if (keyUtf8 !=
NULL) {
541 msg.AddData(
"key-utf8", B_INT8_TYPE, (
const void*)keyUtf8,
len);
543 be_app->PostMessage(&msg);
552 msg.AddInt32(
"window-id",
_id);
553 be_app->PostMessage(&msg);
560 msg->FindString(
"window-title", &title) != B_OK
570 msg->FindInt32(
"window-x", &
x) != B_OK ||
571 msg->FindInt32(
"window-y", &
y) != B_OK
581 msg->FindInt32(
"window-w", &
w) != B_OK ||
582 msg->FindInt32(
"window-h", &
h) != B_OK
591 if(msg->FindBool(
"window-border", &bEnabled) != B_OK) {
594 SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK);
599 if(msg->FindBool(
"window-resizable", &bEnabled) != B_OK) {
603 SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
605 SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
612 }
else if(IsHidden()) {
623 msg->FindBool(
"fullscreen", &fullscreen) != B_OK
627 SetFullScreen(fullscreen);
void _SetTitle(BMessage *msg)
virtual bool QuitRequested()
virtual void DirectConnected(direct_buffer_info *info)
virtual void MessageReceived(BMessage *message)
bool _connection_disabled
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
void _MouseButtonEvent(int32 buttons)
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