SDL 2.0
SDL_BWin Class Reference

#include <SDL_BWin.h>

+ Inheritance diagram for SDL_BWin:
+ Collaboration diagram for SDL_BWin:

Public Member Functions

 SDL_BWin (BRect bounds, window_look look, uint32 flags)
 
virtual ~SDL_BWin ()
 
virtual void DirectConnected (direct_buffer_info *info)
 
virtual void FrameMoved (BPoint origin)
 
virtual void FrameResized (float width, float height)
 
virtual bool QuitRequested ()
 
virtual void WindowActivated (bool active)
 
virtual void Zoom (BPoint origin, float width, float height)
 
virtual void Show ()
 
virtual void Hide ()
 
virtual void Minimize (bool minimize)
 
virtual void DispatchMessage (BMessage *msg, BHandler *target)
 
virtual void MessageReceived (BMessage *message)
 
bool IsShown ()
 
int32 GetID ()
 
uint32 GetRowBytes ()
 
int32 GetFbX ()
 
int32 GetFbY ()
 
bool ConnectionEnabled ()
 
bool Connected ()
 
clipping_rect * GetClips ()
 
int32 GetNumClips ()
 
uint8 * GetBufferPx ()
 
int32 GetBytesPerPx ()
 
bool CanTrashWindowBuffer ()
 
bool BufferExists ()
 
bool BufferIsDirty ()
 
BBitmap * GetBitmap ()
 
void SetID (int32 id)
 
void SetBufferExists (bool bufferExists)
 
void LockBuffer ()
 
void UnlockBuffer ()
 
void SetBufferDirty (bool bufferDirty)
 
void SetTrashBuffer (bool trash)
 
void SetBitmap (BBitmap *bitmap)
 

Private Member Functions

void _MouseMotionEvent (BPoint &where, int32 transit)
 
void _MouseFocusEvent (bool focusGained)
 
void _MouseButtonEvent (int32 buttons)
 
void _SendMouseButton (int32 button, int32 state)
 
void _MouseWheelEvent (int32 x, int32 y)
 
void _KeyEvent (int32 keyCode, const int8 *keyUtf8, const ssize_t &len, int32 keyState)
 
void _RepaintEvent ()
 
void _PostWindowEvent (BMessage &msg)
 
void _SetTitle (BMessage *msg)
 
void _MoveTo (BMessage *msg)
 
void _ResizeTo (BMessage *msg)
 
void _SetBordered (BMessage *msg)
 
void _SetResizable (BMessage *msg)
 
void _Restore ()
 
void _SetFullScreen (BMessage *msg)
 

Private Attributes

int32 _last_buttons
 
int32 _id
 
bool _mouse_focused
 
bool _shown
 
bool _inhibit_resize
 
BRect * _prev_frame
 
bool _connected
 
bool _connection_disabled
 
bool _buffer_created
 
bool _buffer_dirty
 
bool _trash_window_buffer
 
uint8 * _bits
 
uint32 _row_bytes
 
clipping_rect _bounds
 
BLocker * _buffer_locker
 
clipping_rect * _clips
 
int32 _num_clips
 
int32 _bytes_per_px
 
thread_id _draw_thread_id
 
BBitmap * _bitmap
 

Detailed Description

Definition at line 64 of file SDL_BWin.h.

Constructor & Destructor Documentation

◆ SDL_BWin()

SDL_BWin::SDL_BWin ( BRect  bounds,
window_look  look,
uint32  flags 
)
inline

Definition at line 68 of file SDL_BWin.h.

69 : BDirectWindow(bounds, "Untitled", look, B_NORMAL_WINDOW_FEEL, flags)
70 {
71 _last_buttons = 0;
72
73#if SDL_VIDEO_OPENGL
74 _SDL_GLView = NULL;
75 _gl_type = 0;
76#endif
77 _shown = false;
78 _inhibit_resize = false;
79 _mouse_focused = false;
81
82 /* Handle framebuffer stuff */
86 _buffer_locker = new BLocker();
87 _bitmap = NULL;
88 _clips = NULL;
89
90#ifdef DRAWTHREAD
91 _draw_thread_id = spawn_thread(HAIKU_DrawThread, "drawing_thread",
92 B_NORMAL_PRIORITY, (void*) this);
93 resume_thread(_draw_thread_id);
94#endif
95 }
int32 HAIKU_DrawThread(void *data)
GLbitfield flags
#define NULL
Definition: begin_code.h:167
int32 _last_buttons
Definition: SDL_BWin.h:636
thread_id _draw_thread_id
Definition: SDL_BWin.h:657
bool _connected
Definition: SDL_BWin.h:645
bool _trash_window_buffer
Definition: SDL_BWin.h:649
bool _connection_disabled
Definition: SDL_BWin.h:646
bool _buffer_created
Definition: SDL_BWin.h:647
clipping_rect * _clips
Definition: SDL_BWin.h:654
bool _buffer_dirty
Definition: SDL_BWin.h:648
BRect * _prev_frame
Definition: SDL_BWin.h:642
bool _inhibit_resize
Definition: SDL_BWin.h:640
bool _mouse_focused
Definition: SDL_BWin.h:638
BBitmap * _bitmap
Definition: SDL_BWin.h:659
BLocker * _buffer_locker
Definition: SDL_BWin.h:653
bool _shown
Definition: SDL_BWin.h:639

References _bitmap, _buffer_created, _buffer_dirty, _buffer_locker, _clips, _connected, _connection_disabled, _draw_thread_id, _inhibit_resize, _last_buttons, _mouse_focused, _prev_frame, _shown, _trash_window_buffer, HAIKU_DrawThread(), and NULL.

◆ ~SDL_BWin()

virtual SDL_BWin::~SDL_BWin ( )
inlinevirtual

Definition at line 97 of file SDL_BWin.h.

98 {
99 Lock();
101 int32 result;
102
103#if SDL_VIDEO_OPENGL
104 if (_SDL_GLView) {
105 _SDL_GLView->UnlockGL();
106 RemoveChild(_SDL_GLView); /* Why was this outside the if
107 statement before? */
108 }
109
110#endif
111 Unlock();
112#if SDL_VIDEO_OPENGL
113 if (_SDL_GLView) {
114 delete _SDL_GLView;
115 }
116#endif
117
118 delete _prev_frame;
119
120 /* Clean up framebuffer stuff */
121 _buffer_locker->Lock();
122#ifdef DRAWTHREAD
123 wait_for_thread(_draw_thread_id, &result);
124#endif
125 free(_clips);
126 delete _buffer_locker;
127 }
SDL_EventEntry * free
Definition: SDL_events.c:82
GLuint64EXT * result

References _buffer_locker, _clips, _connection_disabled, _draw_thread_id, _prev_frame, and free.

Member Function Documentation

◆ _KeyEvent()

void SDL_BWin::_KeyEvent ( int32  keyCode,
const int8 *  keyUtf8,
const ssize_t &  len,
int32  keyState 
)
inlineprivate

Definition at line 535 of file SDL_BWin.h.

535 {
536 /* Create a message to pass along to the BeApp thread */
537 BMessage msg(BAPP_KEY);
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);
542 }
543 be_app->PostMessage(&msg);
544 }
@ BAPP_KEY
Definition: SDL_BApp.h:62
GLenum GLsizei len

References BAPP_KEY, and NULL.

Referenced by DispatchMessage().

◆ _MouseButtonEvent()

void SDL_BWin::_MouseButtonEvent ( int32  buttons)
inlineprivate

Definition at line 495 of file SDL_BWin.h.

495 {
496 int32 buttonStateChange = buttons ^ _last_buttons;
497
498 /* Make sure at least one button has changed state */
499 if( !(buttonStateChange) ) {
500 return;
501 }
502
503 /* Add any mouse button events */
504 if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
506 B_PRIMARY_MOUSE_BUTTON);
507 }
508 if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
510 B_PRIMARY_MOUSE_BUTTON);
511 }
512 if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
514 B_PRIMARY_MOUSE_BUTTON);
515 }
516
517 _last_buttons = buttons;
518 }
#define SDL_BUTTON_MIDDLE
Definition: SDL_mouse.h:283
#define SDL_BUTTON_RIGHT
Definition: SDL_mouse.h:284
#define SDL_BUTTON_LEFT
Definition: SDL_mouse.h:282
void _SendMouseButton(int32 button, int32 state)
Definition: SDL_BWin.h:520

References _last_buttons, _SendMouseButton(), SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, and SDL_BUTTON_RIGHT.

Referenced by DispatchMessage().

◆ _MouseFocusEvent()

void SDL_BWin::_MouseFocusEvent ( bool  focusGained)
inlineprivate

Definition at line 484 of file SDL_BWin.h.

484 {
485 _mouse_focused = focusGained;
486 BMessage msg(BAPP_MOUSE_FOCUS);
487 msg.AddBool("focusGained", focusGained);
488 _PostWindowEvent(msg);
489
490/* FIXME: Why were these here?
491 if false: be_app->SetCursor(B_HAND_CURSOR);
492 if true: SDL_SetCursor(NULL); */
493 }
@ BAPP_MOUSE_FOCUS
Definition: SDL_BApp.h:70
void _PostWindowEvent(BMessage &msg)
Definition: SDL_BWin.h:551

References _mouse_focused, _PostWindowEvent(), and BAPP_MOUSE_FOCUS.

Referenced by _MouseMotionEvent().

◆ _MouseMotionEvent()

void SDL_BWin::_MouseMotionEvent ( BPoint &  where,
int32  transit 
)
inlineprivate

Definition at line 465 of file SDL_BWin.h.

465 {
466 if(transit == B_EXITED_VIEW) {
467 /* Change mouse focus */
468 if(_mouse_focused) {
469 _MouseFocusEvent(false);
470 }
471 } else {
472 /* Change mouse focus */
473 if (!_mouse_focused) {
474 _MouseFocusEvent(true);
475 }
476 BMessage msg(BAPP_MOUSE_MOVED);
477 msg.AddInt32("x", (int)where.x);
478 msg.AddInt32("y", (int)where.y);
479
480 _PostWindowEvent(msg);
481 }
482 }
@ BAPP_MOUSE_MOVED
Definition: SDL_BApp.h:59
void _MouseFocusEvent(bool focusGained)
Definition: SDL_BWin.h:484

References _mouse_focused, _MouseFocusEvent(), _PostWindowEvent(), and BAPP_MOUSE_MOVED.

Referenced by DispatchMessage().

◆ _MouseWheelEvent()

void SDL_BWin::_MouseWheelEvent ( int32  x,
int32  y 
)
inlineprivate

Definition at line 527 of file SDL_BWin.h.

527 {
528 /* Create a message to pass along to the BeApp thread */
529 BMessage msg(BAPP_MOUSE_WHEEL);
530 msg.AddInt32("xticks", x);
531 msg.AddInt32("yticks", y);
532 _PostWindowEvent(msg);
533 }
@ BAPP_MOUSE_WHEEL
Definition: SDL_BApp.h:61
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

References _PostWindowEvent(), and BAPP_MOUSE_WHEEL.

Referenced by DispatchMessage().

◆ _MoveTo()

void SDL_BWin::_MoveTo ( BMessage *  msg)
inlineprivate

Definition at line 567 of file SDL_BWin.h.

567 {
568 int32 x, y;
569 if(
570 msg->FindInt32("window-x", &x) != B_OK ||
571 msg->FindInt32("window-y", &y) != B_OK
572 ) {
573 return;
574 }
575 MoveTo(x, y);
576 }

Referenced by MessageReceived().

◆ _PostWindowEvent()

void SDL_BWin::_PostWindowEvent ( BMessage &  msg)
inlineprivate

Definition at line 551 of file SDL_BWin.h.

551 {
552 msg.AddInt32("window-id", _id);
553 be_app->PostMessage(&msg);
554 }
int32 _id
Definition: SDL_BWin.h:637

References _id.

Referenced by _MouseFocusEvent(), _MouseMotionEvent(), _MouseWheelEvent(), _RepaintEvent(), _SendMouseButton(), FrameMoved(), FrameResized(), Hide(), Minimize(), QuitRequested(), Show(), WindowActivated(), and Zoom().

◆ _RepaintEvent()

void SDL_BWin::_RepaintEvent ( )
inlineprivate

Definition at line 546 of file SDL_BWin.h.

546 {
547 /* Force a repaint: Call the SDL exposed event */
548 BMessage msg(BAPP_REPAINT);
549 _PostWindowEvent(msg);
550 }
@ BAPP_REPAINT
Definition: SDL_BApp.h:63

References _PostWindowEvent(), and BAPP_REPAINT.

◆ _ResizeTo()

void SDL_BWin::_ResizeTo ( BMessage *  msg)
inlineprivate

Definition at line 578 of file SDL_BWin.h.

578 {
579 int32 w, h;
580 if(
581 msg->FindInt32("window-w", &w) != B_OK ||
582 msg->FindInt32("window-h", &h) != B_OK
583 ) {
584 return;
585 }
586 ResizeTo(w, h);
587 }
GLfloat GLfloat GLfloat GLfloat h
GLubyte GLubyte GLubyte GLubyte w

Referenced by MessageReceived().

◆ _Restore()

void SDL_BWin::_Restore ( )
inlineprivate

Definition at line 609 of file SDL_BWin.h.

609 {
610 if(IsMinimized()) {
611 Minimize(false);
612 } else if(IsHidden()) {
613 Show();
614 } else if(_prev_frame != NULL) { /* Zoomed */
615 MoveTo(_prev_frame->left, _prev_frame->top);
616 ResizeTo(_prev_frame->Width(), _prev_frame->Height());
617 }
618 }
virtual void Show()
Definition: SDL_BWin.h:276
virtual void Minimize(bool minimize)
Definition: SDL_BWin.h:294

References _prev_frame, Minimize(), NULL, and Show().

Referenced by MessageReceived().

◆ _SendMouseButton()

void SDL_BWin::_SendMouseButton ( int32  button,
int32  state 
)
inlineprivate

Definition at line 520 of file SDL_BWin.h.

520 {
521 BMessage msg(BAPP_MOUSE_BUTTON);
522 msg.AddInt32("button-id", button);
523 msg.AddInt32("button-state", state);
524 _PostWindowEvent(msg);
525 }
@ BAPP_MOUSE_BUTTON
Definition: SDL_BApp.h:60
struct xkb_state * state
SDL_Texture * button

References _PostWindowEvent(), BAPP_MOUSE_BUTTON, button, and state.

Referenced by _MouseButtonEvent().

◆ _SetBordered()

void SDL_BWin::_SetBordered ( BMessage *  msg)
inlineprivate

Definition at line 589 of file SDL_BWin.h.

589 {
590 bool bEnabled;
591 if(msg->FindBool("window-border", &bEnabled) != B_OK) {
592 return;
593 }
594 SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK);
595 }

Referenced by MessageReceived().

◆ _SetFullScreen()

void SDL_BWin::_SetFullScreen ( BMessage *  msg)
inlineprivate

Definition at line 620 of file SDL_BWin.h.

620 {
621 bool fullscreen;
622 if(
623 msg->FindBool("fullscreen", &fullscreen) != B_OK
624 ) {
625 return;
626 }
627 SetFullScreen(fullscreen);
628 }

Referenced by MessageReceived().

◆ _SetResizable()

void SDL_BWin::_SetResizable ( BMessage *  msg)
inlineprivate

Definition at line 597 of file SDL_BWin.h.

597 {
598 bool bEnabled;
599 if(msg->FindBool("window-resizable", &bEnabled) != B_OK) {
600 return;
601 }
602 if (bEnabled) {
603 SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
604 } else {
605 SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
606 }
607 }

Referenced by MessageReceived().

◆ _SetTitle()

void SDL_BWin::_SetTitle ( BMessage *  msg)
inlineprivate

Definition at line 557 of file SDL_BWin.h.

557 {
558 const char *title;
559 if(
560 msg->FindString("window-title", &title) != B_OK
561 ) {
562 return;
563 }
564 SetTitle(title);
565 }

Referenced by MessageReceived().

◆ BufferExists()

bool SDL_BWin::BufferExists ( )
inline

Definition at line 445 of file SDL_BWin.h.

445{ return _buffer_created; }

References _buffer_created.

◆ BufferIsDirty()

bool SDL_BWin::BufferIsDirty ( )
inline

Definition at line 446 of file SDL_BWin.h.

446{ return _buffer_dirty; }

References _buffer_dirty.

◆ CanTrashWindowBuffer()

bool SDL_BWin::CanTrashWindowBuffer ( )
inline

Definition at line 444 of file SDL_BWin.h.

444{ return _trash_window_buffer; }

References _trash_window_buffer.

◆ Connected()

bool SDL_BWin::Connected ( )
inline

Definition at line 439 of file SDL_BWin.h.

439{ return _connected; }

References _connected.

◆ ConnectionEnabled()

bool SDL_BWin::ConnectionEnabled ( )
inline

Definition at line 438 of file SDL_BWin.h.

438{ return !_connection_disabled; }

References _connection_disabled.

◆ DirectConnected()

virtual void SDL_BWin::DirectConnected ( direct_buffer_info *  info)
inlinevirtual

Definition at line 165 of file SDL_BWin.h.

165 {
167 return;
168 }
169
170 /* Determine if the pixel buffer is usable after this update */
172 || ((info->buffer_state & B_BUFFER_RESIZED)
173 || (info->buffer_state & B_BUFFER_RESET)
174 || (info->driver_state == B_MODE_CHANGED));
175 LockBuffer();
176
177 switch(info->buffer_state & B_DIRECT_MODE_MASK) {
178 case B_DIRECT_START:
179 _connected = true;
180
181 case B_DIRECT_MODIFY:
182 if(_clips) {
183 free(_clips);
184 _clips = NULL;
185 }
186
187 _num_clips = info->clip_list_count;
188 _clips = (clipping_rect *)malloc(_num_clips*sizeof(clipping_rect));
189 if(_clips) {
190 memcpy(_clips, info->clip_list,
191 _num_clips*sizeof(clipping_rect));
192
193 _bits = (uint8*) info->bits;
194 _row_bytes = info->bytes_per_row;
195 _bounds = info->window_bounds;
196 _bytes_per_px = info->bits_per_pixel / 8;
197 _buffer_dirty = true;
198 }
199 break;
200
201 case B_DIRECT_STOP:
202 _connected = false;
203 break;
204 }
205#if SDL_VIDEO_OPENGL
206 if(_SDL_GLView) {
207 _SDL_GLView->DirectConnected(info);
208 }
209#endif
210
211
212 /* Call the base object directconnected */
213 BDirectWindow::DirectConnected(info);
214
215 UnlockBuffer();
216
217 }
#define memcpy
Definition: SDL_malloc.c:630
#define malloc
Definition: SDL_qsort.c:47
int32 _num_clips
Definition: SDL_BWin.h:655
void UnlockBuffer()
Definition: SDL_BWin.h:457
clipping_rect _bounds
Definition: SDL_BWin.h:652
void LockBuffer()
Definition: SDL_BWin.h:456
uint32 _row_bytes
Definition: SDL_BWin.h:651
int32 _bytes_per_px
Definition: SDL_BWin.h:656
uint8 * _bits
Definition: SDL_BWin.h:650

References _bits, _bounds, _buffer_dirty, _bytes_per_px, _clips, _connected, _connection_disabled, _num_clips, _row_bytes, _trash_window_buffer, free, LockBuffer(), malloc, memcpy, NULL, and UnlockBuffer().

◆ DispatchMessage()

virtual void SDL_BWin::DispatchMessage ( BMessage *  msg,
BHandler *  target 
)
inlinevirtual

Definition at line 304 of file SDL_BWin.h.

305 {
306 BPoint where; /* Used by mouse moved */
307 int32 buttons; /* Used for mouse button events */
308 int32 key; /* Used for key events */
309
310 switch (msg->what) {
311 case B_MOUSE_MOVED:
312 int32 transit;
313 if (msg->FindPoint("where", &where) == B_OK
314 && msg->FindInt32("be:transit", &transit) == B_OK) {
315 _MouseMotionEvent(where, transit);
316 }
317
318 /* FIXME: Apparently a button press/release event might be dropped
319 if made before before a different button is released. Does
320 B_MOUSE_MOVED have the data needed to check if a mouse button
321 state has changed? */
322 if (msg->FindInt32("buttons", &buttons) == B_OK) {
323 _MouseButtonEvent(buttons);
324 }
325 break;
326
327 case B_MOUSE_DOWN:
328 case B_MOUSE_UP:
329 /* _MouseButtonEvent() detects any and all buttons that may have
330 changed state, as well as that button's new state */
331 if (msg->FindInt32("buttons", &buttons) == B_OK) {
332 _MouseButtonEvent(buttons);
333 }
334 break;
335
336 case B_MOUSE_WHEEL_CHANGED:
337 float x, y;
338 if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK
339 && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
340 _MouseWheelEvent((int)x, (int)y);
341 }
342 break;
343
344 case B_KEY_DOWN:
345 {
346 int32 i = 0;
347 int8 byte;
348 int8 bytes[4] = { 0, 0, 0, 0 };
349 while (i < 4 && msg->FindInt8("byte", i, &byte) == B_OK) {
350 bytes[i] = byte;
351 i++;
352 }
353 if (msg->FindInt32("key", &key) == B_OK) {
354 _KeyEvent((SDL_Scancode)key, &bytes[0], i, SDL_PRESSED);
355 }
356 }
357 break;
358
359 case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */
360 if (msg->FindInt32("key", &key) == B_OK) {
362 }
363 break;
364
365 case B_KEY_UP:
366 case B_UNMAPPED_KEY_UP: /* modifier keys are unmapped */
367 if (msg->FindInt32("key", &key) == B_OK) {
369 }
370 break;
371
372 default:
373 /* move it after switch{} so it's always handled
374 that way we keep Haiku features like:
375 - CTRL+Q to close window (and other shortcuts)
376 - PrintScreen to make screenshot into /boot/home
377 - etc.. */
378 /* BDirectWindow::DispatchMessage(msg, target); */
379 break;
380 }
381
382 BDirectWindow::DispatchMessage(msg, target);
383 }
#define SDL_RELEASED
Definition: SDL_events.h:49
#define SDL_PRESSED
Definition: SDL_events.h:50
GLenum target
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:44
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)
Definition: SDL_x11sym.h:50
void _MouseWheelEvent(int32 x, int32 y)
Definition: SDL_BWin.h:527
void _MouseMotionEvent(BPoint &where, int32 transit)
Definition: SDL_BWin.h:465
void _KeyEvent(int32 keyCode, const int8 *keyUtf8, const ssize_t &len, int32 keyState)
Definition: SDL_BWin.h:535
void _MouseButtonEvent(int32 buttons)
Definition: SDL_BWin.h:495
GLuint64 key
Definition: gl2ext.h:2192

References _KeyEvent(), _MouseButtonEvent(), _MouseMotionEvent(), _MouseWheelEvent(), i, NULL, SDL_PRESSED, and SDL_RELEASED.

◆ FrameMoved()

virtual void SDL_BWin::FrameMoved ( BPoint  origin)
inlinevirtual

Definition at line 224 of file SDL_BWin.h.

224 {
225 /* Post a message to the BApp so that it can handle the window event */
226 BMessage msg(BAPP_WINDOW_MOVED);
227 msg.AddInt32("window-x", (int)origin.x);
228 msg.AddInt32("window-y", (int)origin.y);
229 _PostWindowEvent(msg);
230
231 /* Perform normal hook operations */
232 BDirectWindow::FrameMoved(origin);
233 }
@ BAPP_WINDOW_MOVED
Definition: SDL_BApp.h:73

References _PostWindowEvent(), and BAPP_WINDOW_MOVED.

◆ FrameResized()

virtual void SDL_BWin::FrameResized ( float  width,
float  height 
)
inlinevirtual

Definition at line 235 of file SDL_BWin.h.

235 {
236 /* Post a message to the BApp so that it can handle the window event */
237 BMessage msg(BAPP_WINDOW_RESIZED);
238
239 msg.AddInt32("window-w", (int)width + 1);
240 msg.AddInt32("window-h", (int)height + 1);
241 _PostWindowEvent(msg);
242
243 /* Perform normal hook operations */
244 BDirectWindow::FrameResized(width, height);
245 }
@ BAPP_WINDOW_RESIZED
Definition: SDL_BApp.h:74
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572

References _PostWindowEvent(), and BAPP_WINDOW_RESIZED.

◆ GetBitmap()

BBitmap * SDL_BWin::GetBitmap ( )
inline

Definition at line 447 of file SDL_BWin.h.

447{ return _bitmap; }

References _bitmap.

◆ GetBufferPx()

uint8 * SDL_BWin::GetBufferPx ( )
inline

Definition at line 442 of file SDL_BWin.h.

442{ return _bits; }

References _bits.

◆ GetBytesPerPx()

int32 SDL_BWin::GetBytesPerPx ( )
inline

Definition at line 443 of file SDL_BWin.h.

443{ return _bytes_per_px; }

References _bytes_per_px.

◆ GetClips()

clipping_rect * SDL_BWin::GetClips ( )
inline

Definition at line 440 of file SDL_BWin.h.

440{ return _clips; }

References _clips.

◆ GetFbX()

int32 SDL_BWin::GetFbX ( )
inline

Definition at line 436 of file SDL_BWin.h.

436{ return _bounds.left; }

References _bounds.

◆ GetFbY()

int32 SDL_BWin::GetFbY ( )
inline

Definition at line 437 of file SDL_BWin.h.

437{ return _bounds.top; }

References _bounds.

◆ GetID()

int32 SDL_BWin::GetID ( )
inline

Definition at line 434 of file SDL_BWin.h.

434{ return _id; }

References _id.

◆ GetNumClips()

int32 SDL_BWin::GetNumClips ( )
inline

Definition at line 441 of file SDL_BWin.h.

441{ return _num_clips; }

References _num_clips.

◆ GetRowBytes()

uint32 SDL_BWin::GetRowBytes ( )
inline

Definition at line 435 of file SDL_BWin.h.

435{ return _row_bytes; }

References _row_bytes.

◆ Hide()

virtual void SDL_BWin::Hide ( )
inlinevirtual

Definition at line 286 of file SDL_BWin.h.

286 {
287 BDirectWindow::Hide();
288 _shown = false;
289
290 BMessage msg(BAPP_HIDE);
291 _PostWindowEvent(msg);
292 }
@ BAPP_HIDE
Definition: SDL_BApp.h:69

References _PostWindowEvent(), _shown, and BAPP_HIDE.

Referenced by MessageReceived().

◆ IsShown()

bool SDL_BWin::IsShown ( )
inline

Definition at line 433 of file SDL_BWin.h.

433{ return _shown; }

References _shown.

◆ LockBuffer()

void SDL_BWin::LockBuffer ( )
inline

Definition at line 456 of file SDL_BWin.h.

456{ _buffer_locker->Lock(); }

References _buffer_locker.

Referenced by DirectConnected().

◆ MessageReceived()

virtual void SDL_BWin::MessageReceived ( BMessage *  message)
inlinevirtual

Definition at line 386 of file SDL_BWin.h.

386 {
387 switch (message->what) {
388 /* Handle commands from SDL */
389 case BWIN_SET_TITLE:
391 break;
392 case BWIN_MOVE_WINDOW:
394 break;
397 break;
400 break;
403 break;
404 case BWIN_SHOW_WINDOW:
405 Show();
406 break;
407 case BWIN_HIDE_WINDOW:
408 Hide();
409 break;
411 BWindow::Zoom();
412 break;
414 Minimize(true);
415 break;
417 _Restore();
418 break;
419 case BWIN_FULLSCREEN:
421 break;
422 default:
423 /* Perform normal message handling */
424 BDirectWindow::MessageReceived(message);
425 break;
426 }
427
428 }
@ BWIN_SET_BORDERED
Definition: SDL_BWin.h:58
@ BWIN_SET_RESIZABLE
Definition: SDL_BWin.h:59
@ BWIN_SHOW_WINDOW
Definition: SDL_BWin.h:52
@ BWIN_MOVE_WINDOW
Definition: SDL_BWin.h:50
@ BWIN_MAXIMIZE_WINDOW
Definition: SDL_BWin.h:54
@ BWIN_FULLSCREEN
Definition: SDL_BWin.h:60
@ BWIN_HIDE_WINDOW
Definition: SDL_BWin.h:53
@ BWIN_MINIMIZE_WINDOW
Definition: SDL_BWin.h:55
@ BWIN_RESTORE_WINDOW
Definition: SDL_BWin.h:56
@ BWIN_SET_TITLE
Definition: SDL_BWin.h:57
@ BWIN_RESIZE_WINDOW
Definition: SDL_BWin.h:51
GLuint GLsizei const GLchar * message
void _SetFullScreen(BMessage *msg)
Definition: SDL_BWin.h:620
void _SetTitle(BMessage *msg)
Definition: SDL_BWin.h:557
void _SetResizable(BMessage *msg)
Definition: SDL_BWin.h:597
void _ResizeTo(BMessage *msg)
Definition: SDL_BWin.h:578
void _MoveTo(BMessage *msg)
Definition: SDL_BWin.h:567
void _Restore()
Definition: SDL_BWin.h:609
void _SetBordered(BMessage *msg)
Definition: SDL_BWin.h:589
virtual void Hide()
Definition: SDL_BWin.h:286

References _MoveTo(), _ResizeTo(), _Restore(), _SetBordered(), _SetFullScreen(), _SetResizable(), _SetTitle(), BWIN_FULLSCREEN, BWIN_HIDE_WINDOW, BWIN_MAXIMIZE_WINDOW, BWIN_MINIMIZE_WINDOW, BWIN_MOVE_WINDOW, BWIN_RESIZE_WINDOW, BWIN_RESTORE_WINDOW, BWIN_SET_BORDERED, BWIN_SET_RESIZABLE, BWIN_SET_TITLE, BWIN_SHOW_WINDOW, Hide(), Minimize(), and Show().

◆ Minimize()

virtual void SDL_BWin::Minimize ( bool  minimize)
inlinevirtual

Definition at line 294 of file SDL_BWin.h.

294 {
295 BDirectWindow::Minimize(minimize);
296 int32 minState = (minimize ? BAPP_MINIMIZE : BAPP_RESTORE);
297
298 BMessage msg(minState);
299 _PostWindowEvent(msg);
300 }
@ BAPP_RESTORE
Definition: SDL_BApp.h:67
@ BAPP_MINIMIZE
Definition: SDL_BApp.h:66

References _PostWindowEvent(), BAPP_MINIMIZE, and BAPP_RESTORE.

Referenced by _Restore(), and MessageReceived().

◆ QuitRequested()

virtual bool SDL_BWin::QuitRequested ( )
inlinevirtual

Definition at line 247 of file SDL_BWin.h.

247 {
248 BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED);
249 _PostWindowEvent(msg);
250
251 /* We won't allow a quit unless asked by DestroyWindow() */
252 return false;
253 }
@ BAPP_WINDOW_CLOSE_REQUESTED
Definition: SDL_BApp.h:72

References _PostWindowEvent(), and BAPP_WINDOW_CLOSE_REQUESTED.

◆ SetBitmap()

void SDL_BWin::SetBitmap ( BBitmap *  bitmap)
inline

Definition at line 460 of file SDL_BWin.h.

460{ _bitmap = bitmap; }
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap

References _bitmap.

◆ SetBufferDirty()

void SDL_BWin::SetBufferDirty ( bool  bufferDirty)
inline

Definition at line 458 of file SDL_BWin.h.

458{ _buffer_dirty = bufferDirty; }

References _buffer_dirty.

◆ SetBufferExists()

void SDL_BWin::SetBufferExists ( bool  bufferExists)
inline

Definition at line 455 of file SDL_BWin.h.

455{ _buffer_created = bufferExists; }

References _buffer_created.

◆ SetID()

void SDL_BWin::SetID ( int32  id)
inline

Definition at line 454 of file SDL_BWin.h.

454{ _id = id; }
GLuint id

References _id.

◆ SetTrashBuffer()

void SDL_BWin::SetTrashBuffer ( bool  trash)
inline

Definition at line 459 of file SDL_BWin.h.

459{ _trash_window_buffer = trash; }

References _trash_window_buffer.

◆ Show()

virtual void SDL_BWin::Show ( )
inlinevirtual

Definition at line 276 of file SDL_BWin.h.

276 {
277 while(IsHidden()) {
278 BDirectWindow::Show();
279 }
280 _shown = true;
281
282 BMessage msg(BAPP_SHOW);
283 _PostWindowEvent(msg);
284 }
@ BAPP_SHOW
Definition: SDL_BApp.h:68

References _PostWindowEvent(), _shown, and BAPP_SHOW.

Referenced by _Restore(), and MessageReceived().

◆ UnlockBuffer()

void SDL_BWin::UnlockBuffer ( )
inline

Definition at line 457 of file SDL_BWin.h.

457{ _buffer_locker->Unlock(); }

References _buffer_locker.

Referenced by DirectConnected().

◆ WindowActivated()

virtual void SDL_BWin::WindowActivated ( bool  active)
inlinevirtual

Definition at line 255 of file SDL_BWin.h.

255 {
256 BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */
257 msg.AddBool("focusGained", active);
258 _PostWindowEvent(msg);
259 }
@ BAPP_KEYBOARD_FOCUS
Definition: SDL_BApp.h:71
SDL_atomic_t active
Definition: SDL_events.c:77

References _PostWindowEvent(), active, and BAPP_KEYBOARD_FOCUS.

◆ Zoom()

virtual void SDL_BWin::Zoom ( BPoint  origin,
float  width,
float  height 
)
inlinevirtual

Definition at line 261 of file SDL_BWin.h.

263 {
264 BMessage msg(BAPP_MAXIMIZE); /* Closest thing to maximization Haiku has */
265 _PostWindowEvent(msg);
266
267 /* Before the window zooms, record its size */
268 if( !_prev_frame )
269 _prev_frame = new BRect(Frame());
270
271 /* Perform normal hook operations */
272 BDirectWindow::Zoom(origin, width, height);
273 }
@ BAPP_MAXIMIZE
Definition: SDL_BApp.h:65

References _PostWindowEvent(), _prev_frame, and BAPP_MAXIMIZE.

Field Documentation

◆ _bitmap

BBitmap* SDL_BWin::_bitmap
private

Definition at line 659 of file SDL_BWin.h.

Referenced by GetBitmap(), SDL_BWin(), and SetBitmap().

◆ _bits

uint8* SDL_BWin::_bits
private

Definition at line 650 of file SDL_BWin.h.

Referenced by DirectConnected(), and GetBufferPx().

◆ _bounds

clipping_rect SDL_BWin::_bounds
private

Definition at line 652 of file SDL_BWin.h.

Referenced by DirectConnected(), GetFbX(), and GetFbY().

◆ _buffer_created

bool SDL_BWin::_buffer_created
private

Definition at line 647 of file SDL_BWin.h.

Referenced by BufferExists(), SDL_BWin(), and SetBufferExists().

◆ _buffer_dirty

bool SDL_BWin::_buffer_dirty
private

Definition at line 648 of file SDL_BWin.h.

Referenced by BufferIsDirty(), DirectConnected(), SDL_BWin(), and SetBufferDirty().

◆ _buffer_locker

BLocker* SDL_BWin::_buffer_locker
private

Definition at line 653 of file SDL_BWin.h.

Referenced by LockBuffer(), SDL_BWin(), UnlockBuffer(), and ~SDL_BWin().

◆ _bytes_per_px

int32 SDL_BWin::_bytes_per_px
private

Definition at line 656 of file SDL_BWin.h.

Referenced by DirectConnected(), and GetBytesPerPx().

◆ _clips

clipping_rect* SDL_BWin::_clips
private

Definition at line 654 of file SDL_BWin.h.

Referenced by DirectConnected(), GetClips(), SDL_BWin(), and ~SDL_BWin().

◆ _connected

bool SDL_BWin::_connected
private

Definition at line 645 of file SDL_BWin.h.

Referenced by Connected(), DirectConnected(), and SDL_BWin().

◆ _connection_disabled

bool SDL_BWin::_connection_disabled
private

Definition at line 646 of file SDL_BWin.h.

Referenced by ConnectionEnabled(), DirectConnected(), SDL_BWin(), and ~SDL_BWin().

◆ _draw_thread_id

thread_id SDL_BWin::_draw_thread_id
private

Definition at line 657 of file SDL_BWin.h.

Referenced by SDL_BWin(), and ~SDL_BWin().

◆ _id

int32 SDL_BWin::_id
private

Definition at line 637 of file SDL_BWin.h.

Referenced by _PostWindowEvent(), GetID(), and SetID().

◆ _inhibit_resize

bool SDL_BWin::_inhibit_resize
private

Definition at line 640 of file SDL_BWin.h.

Referenced by SDL_BWin().

◆ _last_buttons

int32 SDL_BWin::_last_buttons
private

Definition at line 636 of file SDL_BWin.h.

Referenced by _MouseButtonEvent(), and SDL_BWin().

◆ _mouse_focused

bool SDL_BWin::_mouse_focused
private

Definition at line 638 of file SDL_BWin.h.

Referenced by _MouseFocusEvent(), _MouseMotionEvent(), and SDL_BWin().

◆ _num_clips

int32 SDL_BWin::_num_clips
private

Definition at line 655 of file SDL_BWin.h.

Referenced by DirectConnected(), and GetNumClips().

◆ _prev_frame

BRect* SDL_BWin::_prev_frame
private

Definition at line 642 of file SDL_BWin.h.

Referenced by _Restore(), SDL_BWin(), Zoom(), and ~SDL_BWin().

◆ _row_bytes

uint32 SDL_BWin::_row_bytes
private

Definition at line 651 of file SDL_BWin.h.

Referenced by DirectConnected(), and GetRowBytes().

◆ _shown

bool SDL_BWin::_shown
private

Definition at line 639 of file SDL_BWin.h.

Referenced by Hide(), IsShown(), SDL_BWin(), and Show().

◆ _trash_window_buffer

bool SDL_BWin::_trash_window_buffer
private

Definition at line 649 of file SDL_BWin.h.

Referenced by CanTrashWindowBuffer(), DirectConnected(), SDL_BWin(), and SetTrashBuffer().


The documentation for this class was generated from the following file: