src/video/haiku/SDL_bwindow.cc
changeset 12082 09999a0e8f9a
parent 11811 5d94cb6b24d3
child 12201 8bdc4d340419
equal deleted inserted replaced
12081:277e57c09ff4 12082:09999a0e8f9a
    73     bwin->SetID(winID);
    73     bwin->SetID(winID);
    74 
    74 
    75     return 0;
    75     return 0;
    76 }
    76 }
    77 
    77 
    78 int BE_CreateWindow(_THIS, SDL_Window *window) {
    78 int HAIKU_CreateWindow(_THIS, SDL_Window *window) {
    79     if (_InitWindow(_this, window) < 0) {
    79     if (_InitWindow(_this, window) < 0) {
    80         return -1;
    80         return -1;
    81     }
    81     }
    82 	
    82 	
    83 	/* Start window loop */
    83 	/* Start window loop */
    84     _ToBeWin(window)->Show();
    84     _ToBeWin(window)->Show();
    85     return 0;
    85     return 0;
    86 }
    86 }
    87 
    87 
    88 int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
    88 int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
    89 
    89 
    90 	SDL_BWin *otherBWin = (SDL_BWin*)data;
    90 	SDL_BWin *otherBWin = (SDL_BWin*)data;
    91 	if(!otherBWin->LockLooper())
    91 	if(!otherBWin->LockLooper())
    92 		return -1;
    92 		return -1;
    93 	
    93 	
   115     
   115     
   116     otherBWin->UnlockLooper();
   116     otherBWin->UnlockLooper();
   117     return 0;
   117     return 0;
   118 }
   118 }
   119 
   119 
   120 void BE_SetWindowTitle(_THIS, SDL_Window * window) {
   120 void HAIKU_SetWindowTitle(_THIS, SDL_Window * window) {
   121 	BMessage msg(BWIN_SET_TITLE);
   121 	BMessage msg(BWIN_SET_TITLE);
   122 	msg.AddString("window-title", window->title);
   122 	msg.AddString("window-title", window->title);
   123 	_ToBeWin(window)->PostMessage(&msg);
   123 	_ToBeWin(window)->PostMessage(&msg);
   124 }
   124 }
   125 
   125 
   126 void BE_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) {
   126 void HAIKU_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) {
   127 	/* FIXME: Icons not supported by Haiku */
   127 	/* FIXME: Icons not supported by Haiku */
   128 }
   128 }
   129 
   129 
   130 void BE_SetWindowPosition(_THIS, SDL_Window * window) {
   130 void HAIKU_SetWindowPosition(_THIS, SDL_Window * window) {
   131 	BMessage msg(BWIN_MOVE_WINDOW);
   131 	BMessage msg(BWIN_MOVE_WINDOW);
   132 	msg.AddInt32("window-x", window->x);
   132 	msg.AddInt32("window-x", window->x);
   133 	msg.AddInt32("window-y", window->y);
   133 	msg.AddInt32("window-y", window->y);
   134 	_ToBeWin(window)->PostMessage(&msg);
   134 	_ToBeWin(window)->PostMessage(&msg);
   135 }
   135 }
   136 
   136 
   137 void BE_SetWindowSize(_THIS, SDL_Window * window) {
   137 void HAIKU_SetWindowSize(_THIS, SDL_Window * window) {
   138 	BMessage msg(BWIN_RESIZE_WINDOW);
   138 	BMessage msg(BWIN_RESIZE_WINDOW);
   139 	msg.AddInt32("window-w", window->w - 1);
   139 	msg.AddInt32("window-w", window->w - 1);
   140 	msg.AddInt32("window-h", window->h - 1);
   140 	msg.AddInt32("window-h", window->h - 1);
   141 	_ToBeWin(window)->PostMessage(&msg);
   141 	_ToBeWin(window)->PostMessage(&msg);
   142 }
   142 }
   143 
   143 
   144 void BE_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
   144 void HAIKU_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
   145 	BMessage msg(BWIN_SET_BORDERED);
   145 	BMessage msg(BWIN_SET_BORDERED);
   146 	msg.AddBool("window-border", bordered != SDL_FALSE);
   146 	msg.AddBool("window-border", bordered != SDL_FALSE);
   147 	_ToBeWin(window)->PostMessage(&msg);
   147 	_ToBeWin(window)->PostMessage(&msg);
   148 }
   148 }
   149 
   149 
   150 void BE_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
   150 void HAIKU_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
   151 	BMessage msg(BWIN_SET_RESIZABLE);
   151 	BMessage msg(BWIN_SET_RESIZABLE);
   152 	msg.AddBool("window-resizable", resizable != SDL_FALSE);
   152 	msg.AddBool("window-resizable", resizable != SDL_FALSE);
   153 	_ToBeWin(window)->PostMessage(&msg);
   153 	_ToBeWin(window)->PostMessage(&msg);
   154 }
   154 }
   155 
   155 
   156 void BE_ShowWindow(_THIS, SDL_Window * window) {
   156 void HAIKU_ShowWindow(_THIS, SDL_Window * window) {
   157 	BMessage msg(BWIN_SHOW_WINDOW);
   157 	BMessage msg(BWIN_SHOW_WINDOW);
   158 	_ToBeWin(window)->PostMessage(&msg);
   158 	_ToBeWin(window)->PostMessage(&msg);
   159 }
   159 }
   160 
   160 
   161 void BE_HideWindow(_THIS, SDL_Window * window) {
   161 void HAIKU_HideWindow(_THIS, SDL_Window * window) {
   162 	BMessage msg(BWIN_HIDE_WINDOW);
   162 	BMessage msg(BWIN_HIDE_WINDOW);
   163 	_ToBeWin(window)->PostMessage(&msg);
   163 	_ToBeWin(window)->PostMessage(&msg);
   164 }
   164 }
   165 
   165 
   166 void BE_RaiseWindow(_THIS, SDL_Window * window) {
   166 void HAIKU_RaiseWindow(_THIS, SDL_Window * window) {
   167 	BMessage msg(BWIN_SHOW_WINDOW);	/* Activate this window and move to front */
   167 	BMessage msg(BWIN_SHOW_WINDOW);	/* Activate this window and move to front */
   168 	_ToBeWin(window)->PostMessage(&msg);
   168 	_ToBeWin(window)->PostMessage(&msg);
   169 }
   169 }
   170 
   170 
   171 void BE_MaximizeWindow(_THIS, SDL_Window * window) {
   171 void HAIKU_MaximizeWindow(_THIS, SDL_Window * window) {
   172 	BMessage msg(BWIN_MAXIMIZE_WINDOW);
   172 	BMessage msg(BWIN_MAXIMIZE_WINDOW);
   173 	_ToBeWin(window)->PostMessage(&msg);
   173 	_ToBeWin(window)->PostMessage(&msg);
   174 }
   174 }
   175 
   175 
   176 void BE_MinimizeWindow(_THIS, SDL_Window * window) {
   176 void HAIKU_MinimizeWindow(_THIS, SDL_Window * window) {
   177 	BMessage msg(BWIN_MINIMIZE_WINDOW);
   177 	BMessage msg(BWIN_MINIMIZE_WINDOW);
   178 	_ToBeWin(window)->PostMessage(&msg);
   178 	_ToBeWin(window)->PostMessage(&msg);
   179 }
   179 }
   180 
   180 
   181 void BE_RestoreWindow(_THIS, SDL_Window * window) {
   181 void HAIKU_RestoreWindow(_THIS, SDL_Window * window) {
   182 	BMessage msg(BWIN_RESTORE_WINDOW);
   182 	BMessage msg(BWIN_RESTORE_WINDOW);
   183 	_ToBeWin(window)->PostMessage(&msg);
   183 	_ToBeWin(window)->PostMessage(&msg);
   184 }
   184 }
   185 
   185 
   186 void BE_SetWindowFullscreen(_THIS, SDL_Window * window,
   186 void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window,
   187 		SDL_VideoDisplay * display, SDL_bool fullscreen) {
   187 		SDL_VideoDisplay * display, SDL_bool fullscreen) {
   188 	/* Haiku tracks all video display information */
   188 	/* Haiku tracks all video display information */
   189 	BMessage msg(BWIN_FULLSCREEN);
   189 	BMessage msg(BWIN_FULLSCREEN);
   190 	msg.AddBool("fullscreen", fullscreen);
   190 	msg.AddBool("fullscreen", fullscreen);
   191 	_ToBeWin(window)->PostMessage(&msg);
   191 	_ToBeWin(window)->PostMessage(&msg);
   192 	
   192 	
   193 }
   193 }
   194 
   194 
   195 int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
   195 int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
   196 	/* FIXME: Not Haiku supported */
   196 	/* FIXME: Not Haiku supported */
   197 	return -1;
   197 	return -1;
   198 }
   198 }
   199 
   199 
   200 int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
   200 int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
   201 	/* FIXME: Not Haiku supported */
   201 	/* FIXME: Not Haiku supported */
   202 	return -1;
   202 	return -1;
   203 }
   203 }
   204 
   204 
   205 
   205 
   206 void BE_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
   206 void HAIKU_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
   207 	/* TODO: Implement this! */
   207 	/* TODO: Implement this! */
   208 }
   208 }
   209 
   209 
   210 void BE_DestroyWindow(_THIS, SDL_Window * window) {
   210 void HAIKU_DestroyWindow(_THIS, SDL_Window * window) {
   211 	_ToBeWin(window)->LockLooper();	/* This MUST be locked */
   211 	_ToBeWin(window)->LockLooper();	/* This MUST be locked */
   212 	_GetBeApp()->ClearID(_ToBeWin(window));
   212 	_GetBeApp()->ClearID(_ToBeWin(window));
   213 	_ToBeWin(window)->Quit();
   213 	_ToBeWin(window)->Quit();
   214 	window->driverdata = NULL;
   214 	window->driverdata = NULL;
   215 }
   215 }
   216 
   216 
   217 SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window,
   217 SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window,
   218                                     struct SDL_SysWMinfo *info) {
   218                                     struct SDL_SysWMinfo *info) {
   219 	/* FIXME: What is the point of this? What information should be included? */
   219 	/* FIXME: What is the point of this? What information should be included? */
   220 	return SDL_FALSE;
   220 	return SDL_FALSE;
   221 }
   221 }
   222 
   222