mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 22:35:59 +00:00
Use C++ style comments consistently in SDL source code
Implemented using this script: find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \; git checkout \ core/linux/SDL_evdev_kbd_default_keymap.h \ events/imKStoUCS.* \ hidapi \ joystick/controller_type.c \ joystick/controller_type.h \ joystick/hidapi/steam/controller_constants.h \ joystick/hidapi/steam/controller_structs.h \ joystick/SDL_gamepad_db.h \ libm \ render/*/*Shader*.h \ render/vitagxm/SDL_render_vita_gxm_shaders.h \ render/metal/SDL_shaders_metal_*.h \ stdlib/SDL_malloc.c \ stdlib/SDL_qsort.c \ stdlib/SDL_strtokr.c \ test/ \ video/directx/SDL_d3d12_xbox_cmacros.h \ video/directx/d3d12.h \ video/directx/d3d12sdklayers.h \ video/khronos \ video/x11/edid-parse.c \ video/x11/xsettings-client.* \ video/yuv2rgb sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
This commit is contained in:
@@ -36,7 +36,7 @@ extern "C" {
|
||||
|
||||
#include "SDL_internal.h"
|
||||
|
||||
/* Local includes */
|
||||
// Local includes
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#include "../../video/haiku/SDL_bframebuffer.h"
|
||||
|
||||
@@ -47,27 +47,27 @@ extern "C" {
|
||||
#include <vector>
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
// Forward declarations
|
||||
class SDL_BLooper;
|
||||
class SDL_BWin;
|
||||
|
||||
/* Message constants */
|
||||
// Message constants
|
||||
enum ToSDL
|
||||
{
|
||||
/* Intercepted by BWindow on its way to BView */
|
||||
// Intercepted by BWindow on its way to BView
|
||||
BAPP_MOUSE_MOVED,
|
||||
BAPP_MOUSE_BUTTON,
|
||||
BAPP_MOUSE_WHEEL,
|
||||
BAPP_KEY,
|
||||
BAPP_REPAINT, /* from _UPDATE_ */
|
||||
/* From BWindow */
|
||||
BAPP_MAXIMIZE, /* from B_ZOOM */
|
||||
BAPP_REPAINT, // from _UPDATE_
|
||||
// From BWindow
|
||||
BAPP_MAXIMIZE, // from B_ZOOM
|
||||
BAPP_MINIMIZE,
|
||||
BAPP_RESTORE, /* TODO: IMPLEMENT! */
|
||||
BAPP_RESTORE, // TODO: IMPLEMENT!
|
||||
BAPP_SHOW,
|
||||
BAPP_HIDE,
|
||||
BAPP_MOUSE_FOCUS, /* caused by MOUSE_MOVE */
|
||||
BAPP_KEYBOARD_FOCUS, /* from WINDOW_ACTIVATED */
|
||||
BAPP_MOUSE_FOCUS, // caused by MOUSE_MOVE
|
||||
BAPP_KEYBOARD_FOCUS, // from WINDOW_ACTIVATED
|
||||
BAPP_WINDOW_CLOSE_REQUESTED,
|
||||
BAPP_WINDOW_MOVED,
|
||||
BAPP_WINDOW_RESIZED,
|
||||
@@ -78,7 +78,7 @@ enum ToSDL
|
||||
extern "C" SDL_BLooper *SDL_Looper;
|
||||
|
||||
|
||||
/* Create a descendant of BLooper */
|
||||
// Create a descendant of BLooper
|
||||
class SDL_BLooper : public BLooper
|
||||
{
|
||||
public:
|
||||
@@ -93,10 +93,10 @@ class SDL_BLooper : public BLooper
|
||||
{
|
||||
}
|
||||
|
||||
/* Event-handling functions */
|
||||
// Event-handling functions
|
||||
virtual void MessageReceived(BMessage *message)
|
||||
{
|
||||
/* Sort out SDL-related messages */
|
||||
// Sort out SDL-related messages
|
||||
switch (message->what) {
|
||||
case BAPP_MOUSE_MOVED:
|
||||
_HandleMouseMove(message);
|
||||
@@ -159,7 +159,7 @@ class SDL_BLooper : public BLooper
|
||||
break;
|
||||
|
||||
case BAPP_SCREEN_CHANGED:
|
||||
/* TODO: Handle screen resize or workspace change */
|
||||
// TODO: Handle screen resize or workspace change
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -168,7 +168,7 @@ class SDL_BLooper : public BLooper
|
||||
}
|
||||
}
|
||||
|
||||
/* Window creation/destruction methods */
|
||||
// Window creation/destruction methods
|
||||
int32 GetID(SDL_Window *win)
|
||||
{
|
||||
int32 i;
|
||||
@@ -179,19 +179,19 @@ class SDL_BLooper : public BLooper
|
||||
}
|
||||
}
|
||||
|
||||
/* Expand the vector if all slots are full */
|
||||
// Expand the vector if all slots are full
|
||||
if (i == _GetNumWindowSlots()) {
|
||||
_PushBackWindow(win);
|
||||
return i;
|
||||
}
|
||||
|
||||
/* TODO: error handling */
|
||||
// TODO: error handling
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: Bad coding practice, but I can't include SDL_BWin.h here. Is
|
||||
there another way to do this? */
|
||||
void ClearID(SDL_BWin *bwin); /* Defined in SDL_BeApp.cc */
|
||||
void ClearID(SDL_BWin *bwin); // Defined in SDL_BeApp.cc
|
||||
|
||||
SDL_Window *GetSDLWindow(int32 winID)
|
||||
{
|
||||
@@ -215,7 +215,7 @@ class SDL_BLooper : public BLooper
|
||||
#endif
|
||||
|
||||
private:
|
||||
/* Event management */
|
||||
// Event management
|
||||
void _HandleBasicWindowEvent(BMessage *msg, SDL_EventType sdlEventType)
|
||||
{
|
||||
SDL_Window *win;
|
||||
@@ -235,8 +235,8 @@ class SDL_BLooper : public BLooper
|
||||
int32 x = 0, y = 0;
|
||||
if (
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("x", &x) != B_OK || /* x movement */
|
||||
msg->FindInt32("y", &y) != B_OK /* y movement */
|
||||
msg->FindInt32("x", &x) != B_OK || // x movement
|
||||
msg->FindInt32("y", &y) != B_OK // y movement
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ class SDL_BLooper : public BLooper
|
||||
{
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 button, state; /* left/middle/right, pressed/released */
|
||||
int32 button, state; // left/middle/right, pressed/released
|
||||
if (
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("button-id", &button) != B_OK ||
|
||||
@@ -294,7 +294,7 @@ class SDL_BLooper : public BLooper
|
||||
{
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 scancode, state; /* scancode, pressed/released */
|
||||
int32 scancode, state; // scancode, pressed/released
|
||||
if (
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("key-state", &state) != B_OK ||
|
||||
@@ -321,7 +321,7 @@ class SDL_BLooper : public BLooper
|
||||
{
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
bool bSetFocus; /* If false, lose focus */
|
||||
bool bSetFocus; // If false, lose focus
|
||||
if (
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindBool("focusGained", &bSetFocus) != B_OK) {
|
||||
@@ -331,7 +331,7 @@ class SDL_BLooper : public BLooper
|
||||
if (bSetFocus) {
|
||||
SDL_SetMouseFocus(win);
|
||||
} else if (SDL_GetMouseFocus() == win) {
|
||||
/* Only lose all focus if this window was the current focus */
|
||||
// Only lose all focus if this window was the current focus
|
||||
SDL_SetMouseFocus(NULL);
|
||||
}
|
||||
}
|
||||
@@ -340,7 +340,7 @@ class SDL_BLooper : public BLooper
|
||||
{
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
bool bSetFocus; /* If false, lose focus */
|
||||
bool bSetFocus; // If false, lose focus
|
||||
if (
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindBool("focusGained", &bSetFocus) != B_OK) {
|
||||
@@ -350,7 +350,7 @@ class SDL_BLooper : public BLooper
|
||||
if (bSetFocus) {
|
||||
SDL_SetKeyboardFocus(win);
|
||||
} else if (SDL_GetKeyboardFocus() == win) {
|
||||
/* Only lose all focus if this window was the current focus */
|
||||
// Only lose all focus if this window was the current focus
|
||||
SDL_SetKeyboardFocus(NULL);
|
||||
}
|
||||
}
|
||||
@@ -360,7 +360,7 @@ class SDL_BLooper : public BLooper
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 xPos, yPos;
|
||||
/* Get the window id and new x/y position of the window */
|
||||
// Get the window id and new x/y position of the window
|
||||
if (
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("window-x", &xPos) != B_OK ||
|
||||
@@ -376,7 +376,7 @@ class SDL_BLooper : public BLooper
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 w, h;
|
||||
/* Get the window id ]and new x/y position of the window */
|
||||
// Get the window id ]and new x/y position of the window
|
||||
if (
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("window-w", &w) != B_OK ||
|
||||
@@ -414,8 +414,8 @@ class SDL_BLooper : public BLooper
|
||||
_window_map.push_back(win);
|
||||
}
|
||||
|
||||
/* Members */
|
||||
std::vector<SDL_Window *> _window_map; /* Keeps track of SDL_Windows by index-id */
|
||||
// Members
|
||||
std::vector<SDL_Window *> _window_map; // Keeps track of SDL_Windows by index-id
|
||||
|
||||
#ifdef SDL_VIDEO_OPENGL
|
||||
BGLView *_current_context;
|
||||
|
Reference in New Issue
Block a user