SDL  2.0
SDL_BWin.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #ifndef SDL_BWin_h_
23 #define SDL_BWin_h_
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "../../SDL_internal.h"
30 #include "SDL.h"
31 #include "SDL_syswm.h"
32 #include "SDL_bframebuffer.h"
33 
34 #ifdef __cplusplus
35 }
36 #endif
37 
38 #include <stdio.h>
39 #include <AppKit.h>
40 #include <InterfaceKit.h>
41 #include <game/DirectWindow.h>
42 #if SDL_VIDEO_OPENGL
43 #include <opengl/GLView.h>
44 #endif
45 #include "SDL_events.h"
46 #include "../../main/haiku/SDL_BApp.h"
47 
48 
61 };
62 
63 
64 class SDL_BWin:public BDirectWindow
65 {
66  public:
67  /* Constructor/Destructor */
68  SDL_BWin(BRect bounds, window_look look, uint32 flags)
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;
80  _prev_frame = NULL;
81 
82  /* Handle framebuffer stuff */
85  _trash_window_buffer = false;
86  _buffer_locker = new BLocker();
87  _bitmap = NULL;
88  _clips = NULL;
89  _num_clips = 0;
90 
91 #ifdef DRAWTHREAD
92  _draw_thread_id = spawn_thread(HAIKU_DrawThread, "drawing_thread",
93  B_NORMAL_PRIORITY, (void*) this);
94  resume_thread(_draw_thread_id);
95 #endif
96  }
97 
98  virtual ~ SDL_BWin()
99  {
100  Lock();
101  _connection_disabled = true;
102  int32 result;
103 
104 #if SDL_VIDEO_OPENGL
105  if (_SDL_GLView) {
106  _SDL_GLView->UnlockGL();
107  RemoveChild(_SDL_GLView); /* Why was this outside the if
108  statement before? */
109  }
110 
111 #endif
112  Unlock();
113 #if SDL_VIDEO_OPENGL
114  if (_SDL_GLView) {
115  delete _SDL_GLView;
116  }
117 #endif
118 
119  delete _prev_frame;
120 
121  /* Clean up framebuffer stuff */
122  _buffer_locker->Lock();
123 #ifdef DRAWTHREAD
124  wait_for_thread(_draw_thread_id, &result);
125 #endif
126  free(_clips);
127  delete _buffer_locker;
128  }
129 
130 
131  /* * * * * OpenGL functionality * * * * */
132 #if SDL_VIDEO_OPENGL
133  virtual BGLView *CreateGLView(Uint32 gl_flags) {
134  Lock();
135  if (_SDL_GLView == NULL) {
136  _SDL_GLView = new BGLView(Bounds(), "SDL GLView",
137  B_FOLLOW_ALL_SIDES,
138  (B_WILL_DRAW | B_FRAME_EVENTS),
139  gl_flags);
140  _gl_type = gl_flags;
141  }
142  AddChild(_SDL_GLView);
143  _SDL_GLView->SetEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, B_NO_POINTER_HISTORY);
144  _SDL_GLView->EnableDirectMode(true);
145  _SDL_GLView->LockGL(); /* "New" GLViews are created */
146  Unlock();
147  return (_SDL_GLView);
148  }
149 
150  virtual void RemoveGLView() {
151  Lock();
152  if(_SDL_GLView) {
153  _SDL_GLView->UnlockGL();
154  RemoveChild(_SDL_GLView);
155  }
156  Unlock();
157  }
158 
159  virtual void SwapBuffers(void) {
160  _SDL_GLView->UnlockGL();
161  _SDL_GLView->LockGL();
162  _SDL_GLView->SwapBuffers();
163  }
164 #endif
165 
166  /* * * * * Framebuffering* * * * */
167  virtual void DirectConnected(direct_buffer_info *info) {
169  return;
170  }
171 
172  /* Determine if the pixel buffer is usable after this update */
174  || ((info->buffer_state & B_BUFFER_RESIZED)
175  || (info->buffer_state & B_BUFFER_RESET)
176  || (info->driver_state == B_MODE_CHANGED));
177  LockBuffer();
178 
179  switch(info->buffer_state & B_DIRECT_MODE_MASK) {
180  case B_DIRECT_START:
181  _connected = true;
182 
183  case B_DIRECT_MODIFY:
184  if (info->clip_list_count > _num_clips)
185  {
186  if(_clips) {
187  free(_clips);
188  _clips = NULL;
189  }
190  }
191 
192  _num_clips = info->clip_list_count;
193  if (_clips == NULL)
194  _clips = (clipping_rect *)malloc(_num_clips*sizeof(clipping_rect));
195  if(_clips) {
196  memcpy(_clips, info->clip_list,
197  _num_clips*sizeof(clipping_rect));
198 
199  _bits = (uint8*) info->bits;
200  _row_bytes = info->bytes_per_row;
201  _bounds = info->window_bounds;
202  _bytes_per_px = info->bits_per_pixel / 8;
203  _buffer_dirty = true;
204  }
205  break;
206 
207  case B_DIRECT_STOP:
208  _connected = false;
209  break;
210  }
211 #if SDL_VIDEO_OPENGL
212  if(_SDL_GLView) {
213  _SDL_GLView->DirectConnected(info);
214  }
215 #endif
216 
217 
218  /* Call the base object directconnected */
219  BDirectWindow::DirectConnected(info);
220 
221  UnlockBuffer();
222 
223  }
224 
225 
226 
227 
228  /* * * * * Event sending * * * * */
229  /* Hook functions */
230  virtual void FrameMoved(BPoint origin) {
231  /* Post a message to the BApp so that it can handle the window event */
232  BMessage msg(BAPP_WINDOW_MOVED);
233  msg.AddInt32("window-x", (int)origin.x);
234  msg.AddInt32("window-y", (int)origin.y);
235  _PostWindowEvent(msg);
236 
237  /* Perform normal hook operations */
238  BDirectWindow::FrameMoved(origin);
239  }
240 
241  virtual void FrameResized(float width, float height) {
242  /* Post a message to the BApp so that it can handle the window event */
243  BMessage msg(BAPP_WINDOW_RESIZED);
244 
245  msg.AddInt32("window-w", (int)width + 1);
246  msg.AddInt32("window-h", (int)height + 1);
247  _PostWindowEvent(msg);
248 
249  /* Perform normal hook operations */
250  BDirectWindow::FrameResized(width, height);
251  }
252 
253  virtual bool QuitRequested() {
254  BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED);
255  _PostWindowEvent(msg);
256 
257  /* We won't allow a quit unless asked by DestroyWindow() */
258  return false;
259  }
260 
261  virtual void WindowActivated(bool active) {
262  BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */
263  msg.AddBool("focusGained", active);
264  _PostWindowEvent(msg);
265  }
266 
267  virtual void Zoom(BPoint origin,
268  float width,
269  float height) {
270  BMessage msg(BAPP_MAXIMIZE); /* Closest thing to maximization Haiku has */
271  _PostWindowEvent(msg);
272 
273  /* Before the window zooms, record its size */
274  if( !_prev_frame )
275  _prev_frame = new BRect(Frame());
276 
277  /* Perform normal hook operations */
278  BDirectWindow::Zoom(origin, width, height);
279  }
280 
281  /* Member functions */
282  virtual void Show() {
283  while(IsHidden()) {
284  BDirectWindow::Show();
285  }
286  _shown = true;
287 
288  BMessage msg(BAPP_SHOW);
289  _PostWindowEvent(msg);
290  }
291 
292  virtual void Hide() {
293  BDirectWindow::Hide();
294  _shown = false;
295 
296  BMessage msg(BAPP_HIDE);
297  _PostWindowEvent(msg);
298  }
299 
300  virtual void Minimize(bool minimize) {
301  BDirectWindow::Minimize(minimize);
302  int32 minState = (minimize ? BAPP_MINIMIZE : BAPP_RESTORE);
303 
304  BMessage msg(minState);
305  _PostWindowEvent(msg);
306  }
307 
308 
309  /* BView message interruption */
310  virtual void DispatchMessage(BMessage * msg, BHandler * target)
311  {
312  BPoint where; /* Used by mouse moved */
313  int32 buttons; /* Used for mouse button events */
314  int32 key; /* Used for key events */
315 
316  switch (msg->what) {
317  case B_MOUSE_MOVED:
318  int32 transit;
319  if (msg->FindPoint("where", &where) == B_OK
320  && msg->FindInt32("be:transit", &transit) == B_OK) {
321  _MouseMotionEvent(where, transit);
322  }
323  break;
324 
325  case B_MOUSE_DOWN:
326  if (msg->FindInt32("buttons", &buttons) == B_OK) {
327  _MouseButtonEvent(buttons, SDL_PRESSED);
328  }
329  break;
330 
331  case B_MOUSE_UP:
332  if (msg->FindInt32("buttons", &buttons) == B_OK) {
334  }
335  break;
336 
337  case B_MOUSE_WHEEL_CHANGED:
338  float x, y;
339  if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK
340  && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
341  _MouseWheelEvent((int)x, (int)y);
342  }
343  break;
344 
345  case B_KEY_DOWN:
346  {
347  int32 i = 0;
348  int8 byte;
349  int8 bytes[4] = { 0, 0, 0, 0 };
350  while (i < 4 && msg->FindInt8("byte", i, &byte) == B_OK) {
351  bytes[i] = byte;
352  i++;
353  }
354  if (msg->FindInt32("key", &key) == B_OK) {
355  _KeyEvent((SDL_Scancode)key, &bytes[0], i, SDL_PRESSED);
356  }
357  }
358  break;
359 
360  case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */
361  if (msg->FindInt32("key", &key) == B_OK) {
363  }
364  break;
365 
366  case B_KEY_UP:
367  case B_UNMAPPED_KEY_UP: /* modifier keys are unmapped */
368  if (msg->FindInt32("key", &key) == B_OK) {
370  }
371  break;
372 
373  default:
374  /* move it after switch{} so it's always handled
375  that way we keep Haiku features like:
376  - CTRL+Q to close window (and other shortcuts)
377  - PrintScreen to make screenshot into /boot/home
378  - etc.. */
379  /* BDirectWindow::DispatchMessage(msg, target); */
380  break;
381  }
382 
383  BDirectWindow::DispatchMessage(msg, target);
384  }
385 
386  /* Handle command messages */
387  virtual void MessageReceived(BMessage* message) {
388  switch (message->what) {
389  /* Handle commands from SDL */
390  case BWIN_SET_TITLE:
392  break;
393  case BWIN_MOVE_WINDOW:
394  _MoveTo(message);
395  break;
396  case BWIN_RESIZE_WINDOW:
398  break;
399  case BWIN_SET_BORDERED:
401  break;
402  case BWIN_SET_RESIZABLE:
404  break;
405  case BWIN_SHOW_WINDOW:
406  Show();
407  break;
408  case BWIN_HIDE_WINDOW:
409  Hide();
410  break;
412  BWindow::Zoom();
413  break;
415  Minimize(true);
416  break;
417  case BWIN_RESTORE_WINDOW:
418  _Restore();
419  break;
420  case BWIN_FULLSCREEN:
422  break;
423  default:
424  /* Perform normal message handling */
425  BDirectWindow::MessageReceived(message);
426  break;
427  }
428 
429  }
430 
431 
432 
433  /* Accessor methods */
434  bool IsShown() { return _shown; }
435  int32 GetID() { return _id; }
436  uint32 GetRowBytes() { return _row_bytes; }
437  int32 GetFbX() { return _bounds.left; }
438  int32 GetFbY() { return _bounds.top; }
440  bool Connected() { return _connected; }
441  clipping_rect *GetClips() { return _clips; }
442  int32 GetNumClips() { return _num_clips; }
443  uint8* GetBufferPx() { return _bits; }
444  int32 GetBytesPerPx() { return _bytes_per_px; }
446  bool BufferExists() { return _buffer_created; }
447  bool BufferIsDirty() { return _buffer_dirty; }
448  BBitmap *GetBitmap() { return _bitmap; }
449 #if SDL_VIDEO_OPENGL
450  BGLView *GetGLView() { return _SDL_GLView; }
451  Uint32 GetGLType() { return _gl_type; }
452 #endif
453 
454  /* Setter methods */
455  void SetID(int32 id) { _id = id; }
456  void SetBufferExists(bool bufferExists) { _buffer_created = bufferExists; }
457  void LockBuffer() { _buffer_locker->Lock(); }
458  void UnlockBuffer() { _buffer_locker->Unlock(); }
459  void SetBufferDirty(bool bufferDirty) { _buffer_dirty = bufferDirty; }
460  void SetTrashBuffer(bool trash) { _trash_window_buffer = trash; }
461  void SetBitmap(BBitmap *bitmap) { _bitmap = bitmap; }
462 
463 
464 private:
465  /* Event redirection */
466  void _MouseMotionEvent(BPoint &where, int32 transit) {
467  if(transit == B_EXITED_VIEW) {
468  /* Change mouse focus */
469  if(_mouse_focused) {
470  _MouseFocusEvent(false);
471  }
472  } else {
473  /* Change mouse focus */
474  if (!_mouse_focused) {
475  _MouseFocusEvent(true);
476  }
477  BMessage msg(BAPP_MOUSE_MOVED);
478  msg.AddInt32("x", (int)where.x);
479  msg.AddInt32("y", (int)where.y);
480 
481  _PostWindowEvent(msg);
482  }
483  }
484 
485  void _MouseFocusEvent(bool focusGained) {
486  _mouse_focused = focusGained;
487  BMessage msg(BAPP_MOUSE_FOCUS);
488  msg.AddBool("focusGained", focusGained);
489  _PostWindowEvent(msg);
490 
491 /* FIXME: Why were these here?
492  if false: be_app->SetCursor(B_HAND_CURSOR);
493  if true: SDL_SetCursor(NULL); */
494  }
495 
496  void _MouseButtonEvent(int32 buttons, Uint8 state) {
497  int32 buttonStateChange = buttons ^ _last_buttons;
498 
499  if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
501  }
502  if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
504  }
505  if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
507  }
508 
509  _last_buttons = buttons;
510  }
511 
512  void _SendMouseButton(int32 button, int32 state) {
513  BMessage msg(BAPP_MOUSE_BUTTON);
514  msg.AddInt32("button-id", button);
515  msg.AddInt32("button-state", state);
516  _PostWindowEvent(msg);
517  }
518 
519  void _MouseWheelEvent(int32 x, int32 y) {
520  /* Create a message to pass along to the BeApp thread */
521  BMessage msg(BAPP_MOUSE_WHEEL);
522  msg.AddInt32("xticks", x);
523  msg.AddInt32("yticks", y);
524  _PostWindowEvent(msg);
525  }
526 
527  void _KeyEvent(int32 keyCode, const int8 *keyUtf8, const ssize_t & len, int32 keyState) {
528  /* Create a message to pass along to the BeApp thread */
529  BMessage msg(BAPP_KEY);
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);
534  }
535  be_app->PostMessage(&msg);
536  }
537 
538  void _RepaintEvent() {
539  /* Force a repaint: Call the SDL exposed event */
540  BMessage msg(BAPP_REPAINT);
541  _PostWindowEvent(msg);
542  }
543  void _PostWindowEvent(BMessage &msg) {
544  msg.AddInt32("window-id", _id);
545  be_app->PostMessage(&msg);
546  }
547 
548  /* Command methods (functions called upon by SDL) */
549  void _SetTitle(BMessage *msg) {
550  const char *title;
551  if(
552  msg->FindString("window-title", &title) != B_OK
553  ) {
554  return;
555  }
556  SetTitle(title);
557  }
558 
559  void _MoveTo(BMessage *msg) {
560  int32 x, y;
561  if(
562  msg->FindInt32("window-x", &x) != B_OK ||
563  msg->FindInt32("window-y", &y) != B_OK
564  ) {
565  return;
566  }
567  MoveTo(x, y);
568  }
569 
570  void _ResizeTo(BMessage *msg) {
571  int32 w, h;
572  if(
573  msg->FindInt32("window-w", &w) != B_OK ||
574  msg->FindInt32("window-h", &h) != B_OK
575  ) {
576  return;
577  }
578  ResizeTo(w, h);
579  }
580 
581  void _SetBordered(BMessage *msg) {
582  bool bEnabled;
583  if(msg->FindBool("window-border", &bEnabled) != B_OK) {
584  return;
585  }
586  SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK);
587  }
588 
589  void _SetResizable(BMessage *msg) {
590  bool bEnabled;
591  if(msg->FindBool("window-resizable", &bEnabled) != B_OK) {
592  return;
593  }
594  if (bEnabled) {
595  SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
596  } else {
597  SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE));
598  }
599  }
600 
601  void _Restore() {
602  if(IsMinimized()) {
603  Minimize(false);
604  } else if(IsHidden()) {
605  Show();
606  } else if(_prev_frame != NULL) { /* Zoomed */
607  MoveTo(_prev_frame->left, _prev_frame->top);
608  ResizeTo(_prev_frame->Width(), _prev_frame->Height());
609  }
610  }
611 
612  void _SetFullScreen(BMessage *msg) {
613  bool fullscreen;
614  if(
615  msg->FindBool("fullscreen", &fullscreen) != B_OK
616  ) {
617  return;
618  }
619  SetFullScreen(fullscreen);
620  }
621 
622  /* Members */
623 #if SDL_VIDEO_OPENGL
624  BGLView * _SDL_GLView;
626 #endif
627 
629  int32 _id; /* Window id used by SDL_BApp */
630  bool _mouse_focused; /* Does this window have mouse focus? */
631  bool _shown;
633 
634  BRect *_prev_frame; /* Previous position and size of the window */
635 
636  /* Framebuffer members */
642  uint8 *_bits;
643  uint32 _row_bytes;
644  clipping_rect _bounds;
645  BLocker *_buffer_locker;
646  clipping_rect *_clips;
647  uint32 _num_clips;
649  thread_id _draw_thread_id;
650 
651  BBitmap *_bitmap;
652 };
653 
654 
655 /* FIXME:
656  * An explanation of framebuffer flags.
657  *
658  * _connected - Original variable used to let the drawing thread know
659  * when changes are being made to the other framebuffer
660  * members.
661  * _connection_disabled - Used to signal to the drawing thread that the window
662  * is closing, and the thread should exit.
663  * _buffer_created - True if the current buffer is valid
664  * _buffer_dirty - True if the window should be redrawn.
665  * _trash_window_buffer - True if the window buffer needs to be trashed partway
666  * through a draw cycle. Occurs when the previous
667  * buffer provided by DirectConnected() is invalidated.
668  */
669 #endif /* SDL_BWin_h_ */
670 
671 /* vi: set ts=4 sw=4 expandtab: */
SDL_BWin::_SetTitle
void _SetTitle(BMessage *msg)
Definition: SDL_BWin.h:549
SDL.h
malloc
#define malloc
Definition: SDL_qsort.c:47
SDL_bframebuffer.h
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_BWin::QuitRequested
virtual bool QuitRequested()
Definition: SDL_BWin.h:253
SDL_BWin::DirectConnected
virtual void DirectConnected(direct_buffer_info *info)
Definition: SDL_BWin.h:167
SDL_events.h
SDL_BWin::_SDL_GLView
BGLView * _SDL_GLView
Definition: SDL_BWin.h:624
SDL_BWin::~ SDL_BWin
virtual ~ SDL_BWin()
Definition: SDL_BWin.h:98
SDL_BWin::MessageReceived
virtual void MessageReceived(BMessage *message)
Definition: SDL_BWin.h:387
target
GLenum target
Definition: SDL_opengl_glext.h:1554
BWIN_RESIZE_WINDOW
@ BWIN_RESIZE_WINDOW
Definition: SDL_BWin.h:51
SDL_BWin::BufferExists
bool BufferExists()
Definition: SDL_BWin.h:446
SDL_BWin::_connection_disabled
bool _connection_disabled
Definition: SDL_BWin.h:638
SDL_BWin::GetBitmap
BBitmap * GetBitmap()
Definition: SDL_BWin.h:448
BAPP_RESTORE
@ BAPP_RESTORE
Definition: SDL_BApp.h:67
SDL_BWin::_MouseButtonEvent
void _MouseButtonEvent(int32 buttons, Uint8 state)
Definition: SDL_BWin.h:496
SDL_BWin::Minimize
virtual void Minimize(bool minimize)
Definition: SDL_BWin.h:300
BAPP_MOUSE_MOVED
@ BAPP_MOUSE_MOVED
Definition: SDL_BApp.h:59
NULL
#define NULL
Definition: begin_code.h:167
SDL_BWin::_clips
clipping_rect * _clips
Definition: SDL_BWin.h:646
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
message
GLuint GLsizei const GLchar * message
Definition: SDL_opengl_glext.h:2486
SDL_BUTTON_RIGHT
#define SDL_BUTTON_RIGHT
Definition: SDL_mouse.h:284
BAPP_KEY
@ BAPP_KEY
Definition: SDL_BApp.h:62
SDL_BWin
Definition: SDL_BWin.h:64
SDL_BWin::FrameResized
virtual void FrameResized(float width, float height)
Definition: SDL_BWin.h:241
SDL_BWin::_MouseMotionEvent
void _MouseMotionEvent(BPoint &where, int32 transit)
Definition: SDL_BWin.h:466
BAPP_HIDE
@ BAPP_HIDE
Definition: SDL_BApp.h:69
SDL_BWin::_SetBordered
void _SetBordered(BMessage *msg)
Definition: SDL_BWin.h:581
SDL_BWin::CanTrashWindowBuffer
bool CanTrashWindowBuffer()
Definition: SDL_BWin.h:445
BWIN_HIDE_WINDOW
@ BWIN_HIDE_WINDOW
Definition: SDL_BWin.h:53
SDL_BWin::FrameMoved
virtual void FrameMoved(BPoint origin)
Definition: SDL_BWin.h:230
SDL_BWin::_ResizeTo
void _ResizeTo(BMessage *msg)
Definition: SDL_BWin.h:570
BAPP_SHOW
@ BAPP_SHOW
Definition: SDL_BApp.h:68
BAPP_MINIMIZE
@ BAPP_MINIMIZE
Definition: SDL_BApp.h:66
BAPP_REPAINT
@ BAPP_REPAINT
Definition: SDL_BApp.h:63
SDL_Scancode
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:43
SDL_BWin::DispatchMessage
virtual void DispatchMessage(BMessage *msg, BHandler *target)
Definition: SDL_BWin.h:310
SDL_BWin::BufferIsDirty
bool BufferIsDirty()
Definition: SDL_BWin.h:447
BAPP_KEYBOARD_FOCUS
@ BAPP_KEYBOARD_FOCUS
Definition: SDL_BApp.h:71
BWIN_MINIMIZE_WINDOW
@ BWIN_MINIMIZE_WINDOW
Definition: SDL_BWin.h:55
SDL_BWin::GetFbX
int32 GetFbX()
Definition: SDL_BWin.h:437
SDL_BWin::SetID
void SetID(int32 id)
Definition: SDL_BWin.h:455
SDL_BWin::_SetResizable
void _SetResizable(BMessage *msg)
Definition: SDL_BWin.h:589
SDL_RELEASED
#define SDL_RELEASED
Definition: SDL_events.h:49
SDL_BWin::SDL_BWin
SDL_BWin(BRect bounds, window_look look, uint32 flags)
Definition: SDL_BWin.h:68
memcpy
#define memcpy
Definition: SDL_malloc.c:630
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
BWIN_SET_RESIZABLE
@ BWIN_SET_RESIZABLE
Definition: SDL_BWin.h:59
SDL_BWin::_last_buttons
int32 _last_buttons
Definition: SDL_BWin.h:628
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
SDL_BWin::CreateGLView
virtual BGLView * CreateGLView(Uint32 gl_flags)
Definition: SDL_BWin.h:133
BWIN_SET_BORDERED
@ BWIN_SET_BORDERED
Definition: SDL_BWin.h:58
SDL_BWin::_buffer_created
bool _buffer_created
Definition: SDL_BWin.h:639
SDL_BWin::Hide
virtual void Hide()
Definition: SDL_BWin.h:292
SDL_BWin::_MouseFocusEvent
void _MouseFocusEvent(bool focusGained)
Definition: SDL_BWin.h:485
SDL_BWin::GetNumClips
int32 GetNumClips()
Definition: SDL_BWin.h:442
SDL_BWin::IsShown
bool IsShown()
Definition: SDL_BWin.h:434
SDL_BWin::Zoom
virtual void Zoom(BPoint origin, float width, float height)
Definition: SDL_BWin.h:267
SDL_BWin::GetID
int32 GetID()
Definition: SDL_BWin.h:435
SDL_BWin::_connected
bool _connected
Definition: SDL_BWin.h:637
SDL_PRESSED
#define SDL_PRESSED
Definition: SDL_events.h:50
SDL_BWin::_shown
bool _shown
Definition: SDL_BWin.h:631
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2929
BWIN_SET_TITLE
@ BWIN_SET_TITLE
Definition: SDL_BWin.h:57
SDL_BWin::UnlockBuffer
void UnlockBuffer()
Definition: SDL_BWin.h:458
SDL_BWin::RemoveGLView
virtual void RemoveGLView()
Definition: SDL_BWin.h:150
SDL_BUTTON_LEFT
#define SDL_BUTTON_LEFT
Definition: SDL_mouse.h:282
BAPP_MOUSE_FOCUS
@ BAPP_MOUSE_FOCUS
Definition: SDL_BApp.h:70
SDL_BWin::_MouseWheelEvent
void _MouseWheelEvent(int32 x, int32 y)
Definition: SDL_BWin.h:519
SDL_BWin::_bitmap
BBitmap * _bitmap
Definition: SDL_BWin.h:651
SDL_BWin::GetRowBytes
uint32 GetRowBytes()
Definition: SDL_BWin.h:436
SDL_BWin::_prev_frame
BRect * _prev_frame
Definition: SDL_BWin.h:634
SDL_BWin::ConnectionEnabled
bool ConnectionEnabled()
Definition: SDL_BWin.h:439
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
BWIN_SHOW_WINDOW
@ BWIN_SHOW_WINDOW
Definition: SDL_BWin.h:52
SDL_BWin::_Restore
void _Restore()
Definition: SDL_BWin.h:601
SDL_BWin::_MoveTo
void _MoveTo(BMessage *msg)
Definition: SDL_BWin.h:559
SDL_BWin::SetBitmap
void SetBitmap(BBitmap *bitmap)
Definition: SDL_BWin.h:461
active
SDL_atomic_t active
Definition: SDL_events.c:84
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_BWin::LockBuffer
void LockBuffer()
Definition: SDL_BWin.h:457
SDL_BWin::_bytes_per_px
int32 _bytes_per_px
Definition: SDL_BWin.h:648
BWIN_MOVE_WINDOW
@ BWIN_MOVE_WINDOW
Definition: SDL_BWin.h:50
SDL_BUTTON_MIDDLE
#define SDL_BUTTON_MIDDLE
Definition: SDL_mouse.h:283
key
GLuint64 key
Definition: gl2ext.h:2192
SDL_BWin::Show
virtual void Show()
Definition: SDL_BWin.h:282
HAIKU_DrawThread
int32 HAIKU_DrawThread(void *data)
SDL_BWin::GetGLView
BGLView * GetGLView()
Definition: SDL_BWin.h:450
SDL_BWin::_PostWindowEvent
void _PostWindowEvent(BMessage &msg)
Definition: SDL_BWin.h:543
SDL_BWin::_buffer_dirty
bool _buffer_dirty
Definition: SDL_BWin.h:640
SDL_BWin::_KeyEvent
void _KeyEvent(int32 keyCode, const int8 *keyUtf8, const ssize_t &len, int32 keyState)
Definition: SDL_BWin.h:527
SDL_BWin::SetBufferExists
void SetBufferExists(bool bufferExists)
Definition: SDL_BWin.h:456
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
id
GLuint id
Definition: SDL_opengl_glext.h:531
bitmap
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
Definition: SDL_opengl_glext.h:4537
SDL_BWin::Connected
bool Connected()
Definition: SDL_BWin.h:440
SDL_BWin::_row_bytes
uint32 _row_bytes
Definition: SDL_BWin.h:643
SDL_BWin::SwapBuffers
virtual void SwapBuffers(void)
Definition: SDL_BWin.h:159
SDL_BWin::_RepaintEvent
void _RepaintEvent()
Definition: SDL_BWin.h:538
BWIN_FULLSCREEN
@ BWIN_FULLSCREEN
Definition: SDL_BWin.h:60
SDL_BWin::_draw_thread_id
thread_id _draw_thread_id
Definition: SDL_BWin.h:649
SDL_BWin::_trash_window_buffer
bool _trash_window_buffer
Definition: SDL_BWin.h:641
SDL_BWin::_mouse_focused
bool _mouse_focused
Definition: SDL_BWin.h:630
SDL_BWin::WindowActivated
virtual void WindowActivated(bool active)
Definition: SDL_BWin.h:261
BAPP_WINDOW_CLOSE_REQUESTED
@ BAPP_WINDOW_CLOSE_REQUESTED
Definition: SDL_BApp.h:72
SDL_BWin::_id
int32 _id
Definition: SDL_BWin.h:629
SDL_BWin::_SetFullScreen
void _SetFullScreen(BMessage *msg)
Definition: SDL_BWin.h:612
SDL_BWin::_buffer_locker
BLocker * _buffer_locker
Definition: SDL_BWin.h:645
SDL_BWin::SetBufferDirty
void SetBufferDirty(bool bufferDirty)
Definition: SDL_BWin.h:459
BAPP_WINDOW_MOVED
@ BAPP_WINDOW_MOVED
Definition: SDL_BApp.h:73
BWIN_RESTORE_WINDOW
@ BWIN_RESTORE_WINDOW
Definition: SDL_BWin.h:56
BAPP_WINDOW_RESIZED
@ BAPP_WINDOW_RESIZED
Definition: SDL_BApp.h:74
BAPP_MAXIMIZE
@ BAPP_MAXIMIZE
Definition: SDL_BApp.h:65
SDL_BWin::GetFbY
int32 GetFbY()
Definition: SDL_BWin.h:438
SDL_BWin::_num_clips
uint32 _num_clips
Definition: SDL_BWin.h:647
SDL_BWin::GetGLType
Uint32 GetGLType()
Definition: SDL_BWin.h:451
SDL_BWin::_bits
uint8 * _bits
Definition: SDL_BWin.h:642
SDL_BWin::_bounds
clipping_rect _bounds
Definition: SDL_BWin.h:644
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1483
BWIN_MAXIMIZE_WINDOW
@ BWIN_MAXIMIZE_WINDOW
Definition: SDL_BWin.h:54
SDL_BWin::_SendMouseButton
void _SendMouseButton(int32 button, int32 state)
Definition: SDL_BWin.h:512
SDL_BWin::GetBytesPerPx
int32 GetBytesPerPx()
Definition: SDL_BWin.h:444
SDL_BWin::_inhibit_resize
bool _inhibit_resize
Definition: SDL_BWin.h:632
SDL_BWin::SetTrashBuffer
void SetTrashBuffer(bool trash)
Definition: SDL_BWin.h:460
free
SDL_EventEntry * free
Definition: SDL_events.c:89
BAPP_MOUSE_BUTTON
@ BAPP_MOUSE_BUTTON
Definition: SDL_BApp.h:60
SDL_BWin::GetClips
clipping_rect * GetClips()
Definition: SDL_BWin.h:441
WinCommands
WinCommands
Definition: SDL_BWin.h:49
state
struct xkb_state * state
Definition: SDL_waylandsym.h:114
button
SDL_Texture * button
Definition: testgamecontroller.c:67
i
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
SDL_BWin::_gl_type
Uint32 _gl_type
Definition: SDL_BWin.h:625
BAPP_MOUSE_WHEEL
@ BAPP_MOUSE_WHEEL
Definition: SDL_BApp.h:61
SDL_syswm.h
SDL_BWin::GetBufferPx
uint8 * GetBufferPx()
Definition: SDL_BWin.h:443
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179