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);
244 BDirectWindow::FrameResized(width, height);
257 msg.AddBool(
"focusGained", active);
261 virtual void Zoom(BPoint origin,
272 BDirectWindow::Zoom(origin, width, height);
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);
387 switch (message->what) {
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);
517 _last_buttons = buttons;
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);
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
void _ResizeTo(BMessage *msg)
virtual void WindowActivated(bool active)
bool _connection_disabled
GLint GLint GLint GLint GLint x
GLuint GLsizei const GLchar * message
void _MouseButtonEvent(int32 buttons)
GLfloat GLfloat GLfloat GLfloat h
SDL_BWin(BRect bounds, window_look look, uint32 flags)
void _SendMouseButton(int32 button, int32 state)
clipping_rect * GetClips()
void SetBitmap(BBitmap *bitmap)
void SetBufferExists(bool bufferExists)
GLint GLint GLsizei width
void _SetFullScreen(BMessage *msg)
void _MouseFocusEvent(bool focusGained)
virtual void DispatchMessage(BMessage *msg, BHandler *target)
virtual void Minimize(bool minimize)
virtual void Zoom(BPoint origin, float width, float height)
virtual void MessageReceived(BMessage *message)
virtual void RemoveGLView()
virtual void FrameResized(float width, float height)
GLubyte GLubyte GLubyte GLubyte w
#define SDL_BUTTON_MIDDLE
GLint GLint GLint GLint GLint GLint y
void _MoveTo(BMessage *msg)
void SetBufferDirty(bool bufferDirty)
void _SetResizable(BMessage *msg)
virtual void FrameMoved(BPoint origin)
void _SetTitle(BMessage *msg)
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)
void _SetBordered(BMessage *msg)
virtual void SwapBuffers(void)
bool _trash_window_buffer
void _PostWindowEvent(BMessage &msg)
GLint GLint GLsizei GLsizei height
void _KeyEvent(int32 keyCode, const int8 *keyUtf8, const ssize_t &len, int32 keyState)
void _MouseMotionEvent(BPoint &where, int32 transit)
virtual BGLView * CreateGLView(Uint32 gl_flags)
bool CanTrashWindowBuffer()
virtual void DirectConnected(direct_buffer_info *info)
void SetTrashBuffer(bool trash)
thread_id _draw_thread_id
int32 BE_DrawThread(void *data)
SDL_Scancode
The SDL keyboard scancode representation.
void _MouseWheelEvent(int32 x, int32 y)
virtual bool QuitRequested()