Converted tabs to spaces for SDL style

This commit is contained in:
Sam Lantinga 2015-10-06 21:40:50 -07:00
parent 9bd640e1a0
commit 5b1741132f
6 changed files with 99 additions and 99 deletions

View File

@ -607,19 +607,19 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
case WM_UNICHAR: case WM_UNICHAR:
if ( wParam == UNICODE_NOCHAR ) { if ( wParam == UNICODE_NOCHAR ) {
returnCode = 1; returnCode = 1;
break; break;
} }
/* otherwise fall through to below */ /* otherwise fall through to below */
case WM_CHAR: case WM_CHAR:
{ {
char text[5]; char text[5];
if ( WIN_ConvertUTF32toUTF8( (UINT32)wParam, text ) ) { if ( WIN_ConvertUTF32toUTF8( (UINT32)wParam, text ) ) {
SDL_SendKeyboardText( text ); SDL_SendKeyboardText( text );
} }
} }
returnCode = 0; returnCode = 0;
break; break;
#ifdef WM_INPUTLANGCHANGE #ifdef WM_INPUTLANGCHANGE
@ -813,9 +813,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
{ {
if ((wParam & 0xFFF0) == SC_KEYMENU) { if ((wParam & 0xFFF0) == SC_KEYMENU) {
return (0); return (0);
} }
#if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER) #if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER)
/* Don't start the screensaver or blank the monitor in fullscreen apps */ /* Don't start the screensaver or blank the monitor in fullscreen apps */

View File

@ -124,7 +124,7 @@ WIN_UpdateKeymap()
/* If this key is one of the non-mappable keys, ignore it */ /* If this key is one of the non-mappable keys, ignore it */
/* Not mapping numbers fixes the French layout, giving numeric keycodes for the number keys, which is the expected behavior */ /* Not mapping numbers fixes the French layout, giving numeric keycodes for the number keys, which is the expected behavior */
if ((keymap[scancode] & SDLK_SCANCODE_MASK) || if ((keymap[scancode] & SDLK_SCANCODE_MASK) ||
/* scancode == SDL_SCANCODE_GRAVE || */ /* Uncomment this line to re-enable the behavior of not mapping the "`"(grave) key to the users actual keyboard layout */ /* scancode == SDL_SCANCODE_GRAVE || */ /* Uncomment this line to re-enable the behavior of not mapping the "`"(grave) key to the users actual keyboard layout */
(scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0) ) { (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0) ) {
continue; continue;
} }
@ -402,7 +402,7 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd)
INT err = 0; INT err = 0;
BOOL vertical = FALSE; BOOL vertical = FALSE;
UINT maxuilen = 0; UINT maxuilen = 0;
static OSVERSIONINFOA osversion; static OSVERSIONINFOA osversion;
if (videodata->ime_uiless) if (videodata->ime_uiless)
return; return;

View File

@ -30,43 +30,43 @@
#endif #endif
typedef struct _WIN_GetMonitorDPIData { typedef struct _WIN_GetMonitorDPIData {
SDL_VideoData *vid_data; SDL_VideoData *vid_data;
SDL_DisplayMode *mode; SDL_DisplayMode *mode;
SDL_DisplayModeData *mode_data; SDL_DisplayModeData *mode_data;
} WIN_GetMonitorDPIData; } WIN_GetMonitorDPIData;
static BOOL CALLBACK static BOOL CALLBACK
WIN_GetMonitorDPI(HMONITOR hMonitor, WIN_GetMonitorDPI(HMONITOR hMonitor,
HDC hdcMonitor, HDC hdcMonitor,
LPRECT lprcMonitor, LPRECT lprcMonitor,
LPARAM dwData) LPARAM dwData)
{ {
WIN_GetMonitorDPIData *data = (WIN_GetMonitorDPIData*) dwData; WIN_GetMonitorDPIData *data = (WIN_GetMonitorDPIData*) dwData;
UINT hdpi, vdpi; UINT hdpi, vdpi;
if (data->vid_data->GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &hdpi, &vdpi) == S_OK && if (data->vid_data->GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &hdpi, &vdpi) == S_OK &&
hdpi > 0 && hdpi > 0 &&
vdpi > 0) { vdpi > 0) {
float hsize, vsize; float hsize, vsize;
data->mode_data->HorzDPI = (float)hdpi; data->mode_data->HorzDPI = (float)hdpi;
data->mode_data->VertDPI = (float)vdpi; data->mode_data->VertDPI = (float)vdpi;
// Figure out the monitor size and compute the diagonal DPI. // Figure out the monitor size and compute the diagonal DPI.
hsize = data->mode->w / data->mode_data->HorzDPI; hsize = data->mode->w / data->mode_data->HorzDPI;
vsize = data->mode->h / data->mode_data->VertDPI; vsize = data->mode->h / data->mode_data->VertDPI;
data->mode_data->DiagDPI = SDL_ComputeDiagonalDPI( data->mode->w, data->mode_data->DiagDPI = SDL_ComputeDiagonalDPI( data->mode->w,
data->mode->h, data->mode->h,
hsize, hsize,
vsize ); vsize );
// We can only handle one DPI per display mode so end the enumeration. // We can only handle one DPI per display mode so end the enumeration.
return FALSE; return FALSE;
} }
// We didn't get DPI information so keep going. // We didn't get DPI information so keep going.
return TRUE; return TRUE;
} }
static SDL_bool static SDL_bool
@ -91,11 +91,11 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod
data->DeviceMode.dmFields = data->DeviceMode.dmFields =
(DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY | (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY |
DM_DISPLAYFLAGS); DM_DISPLAYFLAGS);
data->ScaleX = 1.0f; data->ScaleX = 1.0f;
data->ScaleY = 1.0f; data->ScaleY = 1.0f;
data->DiagDPI = 0.0f; data->DiagDPI = 0.0f;
data->HorzDPI = 0.0f; data->HorzDPI = 0.0f;
data->VertDPI = 0.0f; data->VertDPI = 0.0f;
/* Fill in the mode information */ /* Fill in the mode information */
mode->format = SDL_PIXELFORMAT_UNKNOWN; mode->format = SDL_PIXELFORMAT_UNKNOWN;
@ -109,43 +109,43 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod
char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)]; char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
LPBITMAPINFO bmi; LPBITMAPINFO bmi;
HBITMAP hbm; HBITMAP hbm;
int logical_width = GetDeviceCaps( hdc, HORZRES ); int logical_width = GetDeviceCaps( hdc, HORZRES );
int logical_height = GetDeviceCaps( hdc, VERTRES ); int logical_height = GetDeviceCaps( hdc, VERTRES );
data->ScaleX = (float)logical_width / devmode.dmPelsWidth; data->ScaleX = (float)logical_width / devmode.dmPelsWidth;
data->ScaleY = (float)logical_height / devmode.dmPelsHeight; data->ScaleY = (float)logical_height / devmode.dmPelsHeight;
mode->w = logical_width; mode->w = logical_width;
mode->h = logical_height; mode->h = logical_height;
// WIN_GetMonitorDPI needs mode->w and mode->h // WIN_GetMonitorDPI needs mode->w and mode->h
// so only call after those are set. // so only call after those are set.
if (vid_data->GetDpiForMonitor) { if (vid_data->GetDpiForMonitor) {
WIN_GetMonitorDPIData dpi_data; WIN_GetMonitorDPIData dpi_data;
RECT monitor_rect; RECT monitor_rect;
dpi_data.vid_data = vid_data; dpi_data.vid_data = vid_data;
dpi_data.mode = mode; dpi_data.mode = mode;
dpi_data.mode_data = data; dpi_data.mode_data = data;
monitor_rect.left = devmode.dmPosition.x; monitor_rect.left = devmode.dmPosition.x;
monitor_rect.top = devmode.dmPosition.y; monitor_rect.top = devmode.dmPosition.y;
monitor_rect.right = monitor_rect.left + 1; monitor_rect.right = monitor_rect.left + 1;
monitor_rect.bottom = monitor_rect.top + 1; monitor_rect.bottom = monitor_rect.top + 1;
EnumDisplayMonitors(NULL, &monitor_rect, WIN_GetMonitorDPI, (LPARAM)&dpi_data); EnumDisplayMonitors(NULL, &monitor_rect, WIN_GetMonitorDPI, (LPARAM)&dpi_data);
} else { } else {
// We don't have the Windows 8.1 routine so just // We don't have the Windows 8.1 routine so just
// get system DPI. // get system DPI.
data->HorzDPI = (float)GetDeviceCaps( hdc, LOGPIXELSX ); data->HorzDPI = (float)GetDeviceCaps( hdc, LOGPIXELSX );
data->VertDPI = (float)GetDeviceCaps( hdc, LOGPIXELSY ); data->VertDPI = (float)GetDeviceCaps( hdc, LOGPIXELSY );
if (data->HorzDPI == data->VertDPI) { if (data->HorzDPI == data->VertDPI) {
data->DiagDPI = data->HorzDPI; data->DiagDPI = data->HorzDPI;
} else { } else {
data->DiagDPI = SDL_ComputeDiagonalDPI( mode->w, data->DiagDPI = SDL_ComputeDiagonalDPI( mode->w,
mode->h, mode->h,
(float)GetDeviceCaps( hdc, HORZSIZE ) / 25.4f, (float)GetDeviceCaps( hdc, HORZSIZE ) / 25.4f,
(float)GetDeviceCaps( hdc, VERTSIZE ) / 25.4f ); (float)GetDeviceCaps( hdc, VERTSIZE ) / 25.4f );
} }
} }
SDL_zero(bmi_data); SDL_zero(bmi_data);
bmi = (LPBITMAPINFO) bmi_data; bmi = (LPBITMAPINFO) bmi_data;
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@ -175,7 +175,7 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod
} else if (bmi->bmiHeader.biBitCount == 4) { } else if (bmi->bmiHeader.biBitCount == 4) {
mode->format = SDL_PIXELFORMAT_INDEX4LSB; mode->format = SDL_PIXELFORMAT_INDEX4LSB;
} }
} else { } else {
/* FIXME: Can we tell what this will be? */ /* FIXME: Can we tell what this will be? */
if ((devmode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) { if ((devmode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) {
switch (devmode.dmBitsPerPel) { switch (devmode.dmBitsPerPel) {
@ -319,17 +319,17 @@ WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi,
{ {
SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata;
if (ddpi) { if (ddpi) {
*ddpi = data->DiagDPI; *ddpi = data->DiagDPI;
} }
if (hdpi) { if (hdpi) {
*hdpi = data->HorzDPI; *hdpi = data->HorzDPI;
} }
if (vdpi) { if (vdpi) {
*vdpi = data->VertDPI; *vdpi = data->VertDPI;
} }
return data->DiagDPI != 0.0f ? 0 : -1; return data->DiagDPI != 0.0f ? 0 : -1;
} }
void void

View File

@ -31,11 +31,11 @@ typedef struct
typedef struct typedef struct
{ {
DEVMODE DeviceMode; DEVMODE DeviceMode;
float ScaleX; float ScaleX;
float ScaleY; float ScaleY;
float DiagDPI; float DiagDPI;
float HorzDPI; float HorzDPI;
float VertDPI; float VertDPI;
} SDL_DisplayModeData; } SDL_DisplayModeData;
extern int WIN_InitModes(_THIS); extern int WIN_InitModes(_THIS);

View File

@ -130,7 +130,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
data->created = created; data->created = created;
data->mouse_button_flags = 0; data->mouse_button_flags = 0;
data->videodata = videodata; data->videodata = videodata;
data->initializing = SDL_TRUE; data->initializing = SDL_TRUE;
window->driverdata = data; window->driverdata = data;
@ -256,7 +256,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
/* Enable dropping files */ /* Enable dropping files */
DragAcceptFiles(hwnd, TRUE); DragAcceptFiles(hwnd, TRUE);
data->initializing = SDL_FALSE; data->initializing = SDL_FALSE;
/* All done! */ /* All done! */
return 0; return 0;

View File

@ -37,11 +37,11 @@ typedef struct
WNDPROC wndproc; WNDPROC wndproc;
SDL_bool created; SDL_bool created;
WPARAM mouse_button_flags; WPARAM mouse_button_flags;
SDL_bool initializing; SDL_bool initializing;
SDL_bool expected_resize; SDL_bool expected_resize;
SDL_bool in_border_change; SDL_bool in_border_change;
SDL_bool in_title_click; SDL_bool in_title_click;
SDL_bool focus_click_pending; SDL_bool focus_click_pending;
struct SDL_VideoData *videodata; struct SDL_VideoData *videodata;
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL
EGLSurface egl_surface; EGLSurface egl_surface;