Merge: Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:
@@ -140,7 +140,7 @@ static void GetVideoModes()
|
||||
set_gfx_mode(_fullscreen ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
|
||||
|
||||
GFX_MODE_LIST *mode_list = get_gfx_mode_list(gfx_driver->id);
|
||||
if (mode_list == NULL) {
|
||||
if (mode_list == nullptr) {
|
||||
memcpy(_resolutions, default_resolutions, sizeof(default_resolutions));
|
||||
_num_resolutions = lengthof(default_resolutions);
|
||||
return;
|
||||
@@ -243,7 +243,7 @@ static bool CreateMainSurface(uint w, uint h)
|
||||
bool VideoDriver_Allegro::ClaimMousePointer()
|
||||
{
|
||||
select_mouse_cursor(MOUSE_CURSOR_NONE);
|
||||
show_mouse(NULL);
|
||||
show_mouse(nullptr);
|
||||
disable_hardware_cursor();
|
||||
return true;
|
||||
}
|
||||
@@ -424,7 +424,7 @@ int _allegro_instance_count = 0;
|
||||
|
||||
const char *VideoDriver_Allegro::Start(const char * const *parm)
|
||||
{
|
||||
if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) {
|
||||
if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) {
|
||||
DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
|
||||
return "Failed to set up Allegro";
|
||||
}
|
||||
@@ -437,8 +437,8 @@ const char *VideoDriver_Allegro::Start(const char * const *parm)
|
||||
#if defined _DEBUG
|
||||
/* Allegro replaces SEGV/ABRT signals meaning that the debugger will never
|
||||
* be triggered, so rereplace the signals and make the debugger useful. */
|
||||
signal(SIGABRT, NULL);
|
||||
signal(SIGSEGV, NULL);
|
||||
signal(SIGABRT, nullptr);
|
||||
signal(SIGSEGV, nullptr);
|
||||
#endif
|
||||
|
||||
GetVideoModes();
|
||||
@@ -448,7 +448,7 @@ const char *VideoDriver_Allegro::Start(const char * const *parm)
|
||||
MarkWholeScreenDirty();
|
||||
set_close_button_callback(HandleExitGameRequest);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VideoDriver_Allegro::Stop()
|
||||
@@ -463,7 +463,7 @@ static uint32 GetTime()
|
||||
{
|
||||
struct timeval tim;
|
||||
|
||||
gettimeofday(&tim, NULL);
|
||||
gettimeofday(&tim, nullptr);
|
||||
return tim.tv_usec / 1000 + tim.tv_sec * 1000;
|
||||
}
|
||||
#else
|
||||
|
@@ -59,7 +59,7 @@ static OTTDMain *_ottd_main;
|
||||
static bool _cocoa_video_started = false;
|
||||
static bool _cocoa_video_dialog = false;
|
||||
|
||||
CocoaSubdriver *_cocoa_subdriver = NULL;
|
||||
CocoaSubdriver *_cocoa_subdriver = nullptr;
|
||||
|
||||
static NSString *OTTDMainLaunchGameEngine = @"ottdmain_launch_game_engine";
|
||||
|
||||
@@ -290,9 +290,9 @@ static void QZ_GetDisplayModeInfo(CFArrayRef modes, CFIndex i, int &bpp, uint16
|
||||
uint QZ_ListModes(OTTD_Point *modes, uint max_modes, CGDirectDisplayID display_id, int device_depth)
|
||||
{
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)
|
||||
CFArrayRef mode_list = MacOSVersionIsAtLeast(10, 6, 0) ? CGDisplayCopyAllDisplayModes(display_id, NULL) : CGDisplayAvailableModes(display_id);
|
||||
CFArrayRef mode_list = MacOSVersionIsAtLeast(10, 6, 0) ? CGDisplayCopyAllDisplayModes(display_id, nullptr) : CGDisplayAvailableModes(display_id);
|
||||
#elif (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
|
||||
CFArrayRef mode_list = CGDisplayCopyAllDisplayModes(display_id, NULL);
|
||||
CFArrayRef mode_list = CGDisplayCopyAllDisplayModes(display_id, nullptr);
|
||||
#else
|
||||
CFArrayRef mode_list = CGDisplayAvailableModes(display_id);
|
||||
#endif
|
||||
@@ -354,11 +354,11 @@ bool QZ_CanDisplay8bpp()
|
||||
/**
|
||||
* Update the video modus.
|
||||
*
|
||||
* @pre _cocoa_subdriver != NULL
|
||||
* @pre _cocoa_subdriver != nullptr
|
||||
*/
|
||||
static void QZ_UpdateVideoModes()
|
||||
{
|
||||
assert(_cocoa_subdriver != NULL);
|
||||
assert(_cocoa_subdriver != nullptr);
|
||||
|
||||
OTTD_Point modes[32];
|
||||
uint count = _cocoa_subdriver->ListModes(modes, lengthof(modes));
|
||||
@@ -376,7 +376,7 @@ static void QZ_UpdateVideoModes()
|
||||
*/
|
||||
void QZ_GameSizeChanged()
|
||||
{
|
||||
if (_cocoa_subdriver == NULL) return;
|
||||
if (_cocoa_subdriver == nullptr) return;
|
||||
|
||||
/* Tell the game that the resolution has changed */
|
||||
_screen.width = _cocoa_subdriver->GetWidth();
|
||||
@@ -408,13 +408,13 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
|
||||
/* The reason for the version mismatch is due to the fact that the 10.4 binary needs to work on 10.5 as well. */
|
||||
if (MacOSVersionIsAtLeast(10, 5, 0)) {
|
||||
ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp);
|
||||
if (ret != NULL) return ret;
|
||||
if (ret != nullptr) return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COCOA_QUICKDRAW
|
||||
ret = QZ_CreateWindowQuickdrawSubdriver(width, height, bpp);
|
||||
if (ret != NULL) return ret;
|
||||
if (ret != nullptr) return ret;
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_COCOA_QUARTZ) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
@@ -424,11 +424,11 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
|
||||
*/
|
||||
if (MacOSVersionIsAtLeast(10, 4, 0)) {
|
||||
ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp);
|
||||
if (ret != NULL) return ret;
|
||||
if (ret != nullptr) return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,11 +443,11 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
|
||||
*/
|
||||
static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool fullscreen, bool fallback)
|
||||
{
|
||||
CocoaSubdriver *ret = NULL;
|
||||
CocoaSubdriver *ret = nullptr;
|
||||
/* OSX 10.7 allows to toggle fullscreen mode differently */
|
||||
if (MacOSVersionIsAtLeast(10, 7, 0)) {
|
||||
ret = QZ_CreateWindowSubdriver(width, height, bpp);
|
||||
if (ret != NULL && fullscreen) ret->ToggleFullscreen();
|
||||
if (ret != nullptr && fullscreen) ret->ToggleFullscreen();
|
||||
}
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9)
|
||||
else {
|
||||
@@ -455,13 +455,13 @@ static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool f
|
||||
}
|
||||
#endif /* (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9) */
|
||||
|
||||
if (ret != NULL) return ret;
|
||||
if (!fallback) return NULL;
|
||||
if (ret != nullptr) return ret;
|
||||
if (!fallback) return nullptr;
|
||||
|
||||
/* Try again in 640x480 windowed */
|
||||
DEBUG(driver, 0, "Setting video mode failed, falling back to 640x480 windowed mode.");
|
||||
ret = QZ_CreateWindowSubdriver(640, 480, bpp);
|
||||
if (ret != NULL) return ret;
|
||||
if (ret != nullptr) return ret;
|
||||
|
||||
#if defined(_DEBUG) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9)
|
||||
/* This Fullscreen mode crashes on OSX 10.7 */
|
||||
@@ -469,11 +469,11 @@ static CocoaSubdriver *QZ_CreateSubdriver(int width, int height, int bpp, bool f
|
||||
/* Try fullscreen too when in debug mode */
|
||||
DEBUG(driver, 0, "Setting video mode failed, falling back to 640x480 fullscreen mode.");
|
||||
ret = QZ_CreateFullscreenSubdriver(640, 480, bpp);
|
||||
if (ret != NULL) return ret;
|
||||
if (ret != nullptr) return ret;
|
||||
}
|
||||
#endif /* defined(_DEBUG) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) */
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ void VideoDriver_Cocoa::Stop()
|
||||
[ _ottd_main unregisterObserver ];
|
||||
|
||||
delete _cocoa_subdriver;
|
||||
_cocoa_subdriver = NULL;
|
||||
_cocoa_subdriver = nullptr;
|
||||
|
||||
[ _ottd_main release ];
|
||||
|
||||
@@ -509,14 +509,14 @@ const char *VideoDriver_Cocoa::Start(const char * const *parm)
|
||||
setupApplication();
|
||||
|
||||
/* Don't create a window or enter fullscreen if we're just going to show a dialog. */
|
||||
if (_cocoa_video_dialog) return NULL;
|
||||
if (_cocoa_video_dialog) return nullptr;
|
||||
|
||||
int width = _cur_resolution.width;
|
||||
int height = _cur_resolution.height;
|
||||
int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
|
||||
|
||||
_cocoa_subdriver = QZ_CreateSubdriver(width, height, bpp, _fullscreen, true);
|
||||
if (_cocoa_subdriver == NULL) {
|
||||
if (_cocoa_subdriver == nullptr) {
|
||||
Stop();
|
||||
return "Could not create subdriver";
|
||||
}
|
||||
@@ -524,7 +524,7 @@ const char *VideoDriver_Cocoa::Start(const char * const *parm)
|
||||
QZ_GameSizeChanged();
|
||||
QZ_UpdateVideoModes();
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -537,7 +537,7 @@ const char *VideoDriver_Cocoa::Start(const char * const *parm)
|
||||
*/
|
||||
void VideoDriver_Cocoa::MakeDirty(int left, int top, int width, int height)
|
||||
{
|
||||
assert(_cocoa_subdriver != NULL);
|
||||
assert(_cocoa_subdriver != nullptr);
|
||||
|
||||
_cocoa_subdriver->MakeDirty(left, top, width, height);
|
||||
}
|
||||
@@ -564,7 +564,7 @@ void VideoDriver_Cocoa::MainLoop()
|
||||
*/
|
||||
bool VideoDriver_Cocoa::ChangeResolution(int w, int h)
|
||||
{
|
||||
assert(_cocoa_subdriver != NULL);
|
||||
assert(_cocoa_subdriver != nullptr);
|
||||
|
||||
bool ret = _cocoa_subdriver->ChangeResolution(w, h, BlitterFactory::GetCurrentBlitter()->GetScreenDepth());
|
||||
|
||||
@@ -582,7 +582,7 @@ bool VideoDriver_Cocoa::ChangeResolution(int w, int h)
|
||||
*/
|
||||
bool VideoDriver_Cocoa::ToggleFullscreen(bool full_screen)
|
||||
{
|
||||
assert(_cocoa_subdriver != NULL);
|
||||
assert(_cocoa_subdriver != nullptr);
|
||||
|
||||
/* For 10.7 and later, we try to toggle using the quartz subdriver. */
|
||||
if (_cocoa_subdriver->ToggleFullscreen()) return true;
|
||||
@@ -594,12 +594,12 @@ bool VideoDriver_Cocoa::ToggleFullscreen(bool full_screen)
|
||||
int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
|
||||
|
||||
delete _cocoa_subdriver;
|
||||
_cocoa_subdriver = NULL;
|
||||
_cocoa_subdriver = nullptr;
|
||||
|
||||
_cocoa_subdriver = QZ_CreateSubdriver(width, height, bpp, full_screen, false);
|
||||
if (_cocoa_subdriver == NULL) {
|
||||
if (_cocoa_subdriver == nullptr) {
|
||||
_cocoa_subdriver = QZ_CreateSubdriver(width, height, bpp, oldfs, true);
|
||||
if (_cocoa_subdriver == NULL) error("Cocoa: Failed to create subdriver");
|
||||
if (_cocoa_subdriver == nullptr) error("Cocoa: Failed to create subdriver");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ bool VideoDriver_Cocoa::AfterBlitterChange()
|
||||
*/
|
||||
void VideoDriver_Cocoa::EditBoxLostFocus()
|
||||
{
|
||||
if (_cocoa_subdriver != NULL) {
|
||||
if (_cocoa_subdriver != nullptr) {
|
||||
if ([ _cocoa_subdriver->cocoaview respondsToSelector:@selector(inputContext) ] && [ [ _cocoa_subdriver->cocoaview performSelector:@selector(inputContext) ] respondsToSelector:@selector(discardMarkedText) ]) {
|
||||
[ [ _cocoa_subdriver->cocoaview performSelector:@selector(inputContext) ] performSelector:@selector(discardMarkedText) ];
|
||||
}
|
||||
@@ -635,7 +635,7 @@ void VideoDriver_Cocoa::EditBoxLostFocus()
|
||||
#endif
|
||||
}
|
||||
/* Clear any marked string from the current edit box. */
|
||||
HandleTextInput(NULL, true);
|
||||
HandleTextInput(nullptr, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -652,9 +652,9 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||
_cocoa_video_dialog = true;
|
||||
|
||||
bool wasstarted = _cocoa_video_started;
|
||||
if (VideoDriver::GetInstance() == NULL) {
|
||||
if (VideoDriver::GetInstance() == nullptr) {
|
||||
setupApplication(); // Setup application before showing dialog
|
||||
} else if (!_cocoa_video_started && VideoDriver::GetInstance()->Start(NULL) != NULL) {
|
||||
} else if (!_cocoa_video_started && VideoDriver::GetInstance()->Start(nullptr) != nullptr) {
|
||||
fprintf(stderr, "%s: %s\n", title, message);
|
||||
return;
|
||||
}
|
||||
@@ -676,7 +676,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!wasstarted && VideoDriver::GetInstance() != NULL) VideoDriver::GetInstance()->Stop();
|
||||
if (!wasstarted && VideoDriver::GetInstance() != nullptr) VideoDriver::GetInstance()->Stop();
|
||||
|
||||
_cocoa_video_dialog = false;
|
||||
}
|
||||
@@ -694,7 +694,7 @@ void cocoaSetApplicationBundleDir()
|
||||
AppendPathSeparator(tmp, lastof(tmp));
|
||||
_searchpaths[SP_APPLICATION_BUNDLE_DIR] = stredup(tmp);
|
||||
} else {
|
||||
_searchpaths[SP_APPLICATION_BUNDLE_DIR] = NULL;
|
||||
_searchpaths[SP_APPLICATION_BUNDLE_DIR] = nullptr;
|
||||
}
|
||||
|
||||
CFRelease(url);
|
||||
@@ -967,7 +967,7 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
*/
|
||||
- (void)mouseExited:(NSEvent *)theEvent
|
||||
{
|
||||
if (_cocoa_subdriver != NULL) UndrawMouseCursor();
|
||||
if (_cocoa_subdriver != nullptr) UndrawMouseCursor();
|
||||
_cursor.in_window = false;
|
||||
}
|
||||
|
||||
@@ -979,16 +979,16 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
|
||||
NSString *s = [ aString isKindOfClass:[ NSAttributedString class ] ] ? [ aString string ] : (NSString *)aString;
|
||||
|
||||
const char *insert_point = NULL;
|
||||
const char *replace_range = NULL;
|
||||
const char *insert_point = nullptr;
|
||||
const char *replace_range = nullptr;
|
||||
if (replacementRange.location != NSNotFound) {
|
||||
/* Calculate the part to be replaced. */
|
||||
insert_point = Utf8AdvanceByUtf16Units(_focused_window->GetFocusedText(), replacementRange.location);
|
||||
replace_range = Utf8AdvanceByUtf16Units(insert_point, replacementRange.length);
|
||||
}
|
||||
|
||||
HandleTextInput(NULL, true);
|
||||
HandleTextInput([ s UTF8String ], false, NULL, insert_point, replace_range);
|
||||
HandleTextInput(nullptr, true);
|
||||
HandleTextInput([ s UTF8String ], false, nullptr, insert_point, replace_range);
|
||||
}
|
||||
|
||||
/** Insert the given text at the caret. */
|
||||
@@ -1005,9 +1005,9 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
NSString *s = [ aString isKindOfClass:[ NSAttributedString class ] ] ? [ aString string ] : (NSString *)aString;
|
||||
|
||||
const char *utf8 = [ s UTF8String ];
|
||||
if (utf8 != NULL) {
|
||||
const char *insert_point = NULL;
|
||||
const char *replace_range = NULL;
|
||||
if (utf8 != nullptr) {
|
||||
const char *insert_point = nullptr;
|
||||
const char *replace_range = nullptr;
|
||||
if (replacementRange.location != NSNotFound) {
|
||||
/* Calculate the part to be replaced. */
|
||||
NSRange marked = [ self markedRange ];
|
||||
@@ -1031,7 +1031,7 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
/** Unmark the current marked text. */
|
||||
- (void)unmarkText
|
||||
{
|
||||
HandleTextInput(NULL, true);
|
||||
HandleTextInput(nullptr, true);
|
||||
}
|
||||
|
||||
/** Get the caret position. */
|
||||
@@ -1050,7 +1050,7 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
|
||||
size_t mark_len;
|
||||
const char *mark = _focused_window->GetMarkedText(&mark_len);
|
||||
if (mark != NULL) {
|
||||
if (mark != nullptr) {
|
||||
NSUInteger start = CountUtf16Units(_focused_window->GetFocusedText(), mark);
|
||||
NSUInteger len = CountUtf16Units(mark, mark + mark_len);
|
||||
|
||||
@@ -1066,7 +1066,7 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
if (!EditBoxInGlobalFocus()) return NO;
|
||||
|
||||
size_t len;
|
||||
return _focused_window->GetMarkedText(&len) != NULL;
|
||||
return _focused_window->GetMarkedText(&len) != nullptr;
|
||||
}
|
||||
|
||||
/** Get a string corresponding to the given range. */
|
||||
@@ -1077,7 +1077,7 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
NSString *s = [ NSString stringWithUTF8String:_focused_window->GetFocusedText() ];
|
||||
NSRange valid_range = NSIntersectionRange(NSMakeRange(0, [ s length ]), theRange);
|
||||
|
||||
if (actualRange != NULL) *actualRange = valid_range;
|
||||
if (actualRange != nullptr) *actualRange = valid_range;
|
||||
if (valid_range.length == 0) return nil;
|
||||
|
||||
return [ [ [ NSAttributedString alloc ] initWithString:[ s substringWithRange:valid_range ] ] autorelease ];
|
||||
@@ -1086,7 +1086,7 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
/** Get a string corresponding to the given range. */
|
||||
- (NSAttributedString *)attributedSubstringFromRange:(NSRange)theRange
|
||||
{
|
||||
return [ self attributedSubstringForProposedRange:theRange actualRange:NULL ];
|
||||
return [ self attributedSubstringForProposedRange:theRange actualRange:nullptr ];
|
||||
}
|
||||
|
||||
/** Get the current edit box string. */
|
||||
@@ -1117,7 +1117,7 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
Point pt = { (int)view_pt.x, (int)[ self frame ].size.height - (int)view_pt.y };
|
||||
|
||||
const char *ch = _focused_window->GetTextCharacterAtPosition(pt);
|
||||
if (ch == NULL) return NSNotFound;
|
||||
if (ch == nullptr) return NSNotFound;
|
||||
|
||||
return CountUtf16Units(_focused_window->GetFocusedText(), ch);
|
||||
}
|
||||
|
@@ -87,13 +87,13 @@ static uint32 GetTick()
|
||||
{
|
||||
struct timeval tim;
|
||||
|
||||
gettimeofday(&tim, NULL);
|
||||
gettimeofday(&tim, nullptr);
|
||||
return tim.tv_usec / 1000 + tim.tv_sec * 1000;
|
||||
}
|
||||
|
||||
static void QZ_WarpCursor(int x, int y)
|
||||
{
|
||||
assert(_cocoa_subdriver != NULL);
|
||||
assert(_cocoa_subdriver != nullptr);
|
||||
|
||||
/* Only allow warping when in foreground */
|
||||
if (![ NSApp isActive ]) return;
|
||||
@@ -400,7 +400,7 @@ static void QZ_MouseButtonEvent(int button, BOOL down)
|
||||
|
||||
static bool QZ_PollEvent()
|
||||
{
|
||||
assert(_cocoa_subdriver != NULL);
|
||||
assert(_cocoa_subdriver != nullptr);
|
||||
|
||||
#ifdef _DEBUG
|
||||
uint32 et0 = GetTick();
|
||||
|
@@ -159,7 +159,7 @@ class FullscreenSubdriver : public CocoaSubdriver {
|
||||
/* The VBL delay is based on Ian Ollmann's RezLib <iano@cco.caltech.edu> */
|
||||
|
||||
CFNumberRef refreshRateCFNumber = (const __CFNumber*)CFDictionaryGetValue(this->cur_mode, kCGDisplayRefreshRate);
|
||||
if (refreshRateCFNumber == NULL) return;
|
||||
if (refreshRateCFNumber == nullptr) return;
|
||||
|
||||
double refreshRate;
|
||||
if (CFNumberGetValue(refreshRateCFNumber, kCFNumberDoubleType, &refreshRate) == 0) return;
|
||||
@@ -188,9 +188,9 @@ class FullscreenSubdriver : public CocoaSubdriver {
|
||||
NSPoint mouseLocation;
|
||||
|
||||
/* Destroy any previous mode */
|
||||
if (this->pixel_buffer != NULL) {
|
||||
if (this->pixel_buffer != nullptr) {
|
||||
free(this->pixel_buffer);
|
||||
this->pixel_buffer = NULL;
|
||||
this->pixel_buffer = nullptr;
|
||||
}
|
||||
|
||||
/* See if requested mode exists */
|
||||
@@ -241,7 +241,7 @@ class FullscreenSubdriver : public CocoaSubdriver {
|
||||
/* Since CGDisplayBaseAddress and CGDisplayBytesPerRow are no longer available on 10.7,
|
||||
* disable until a replacement can be found. */
|
||||
if (MacOSVersionIsAtLeast(10, 7, 0)) {
|
||||
this->window_buffer = NULL;
|
||||
this->window_buffer = nullptr;
|
||||
this->window_pitch = 0;
|
||||
} else {
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7)
|
||||
@@ -256,7 +256,7 @@ class FullscreenSubdriver : public CocoaSubdriver {
|
||||
|
||||
/* Setup double-buffer emulation */
|
||||
this->pixel_buffer = malloc(this->device_width * this->device_height * this->device_depth / 8);
|
||||
if (this->pixel_buffer == NULL) {
|
||||
if (this->pixel_buffer == nullptr) {
|
||||
DEBUG(driver, 0, "Failed to allocate memory for double buffering");
|
||||
goto ERR_DOUBLEBUF;
|
||||
}
|
||||
@@ -300,7 +300,7 @@ class FullscreenSubdriver : public CocoaSubdriver {
|
||||
/* Since the blanking window covers *all* windows (even force quit) correct recovery is crucial */
|
||||
ERR_NOT_INDEXED:
|
||||
free(this->pixel_buffer);
|
||||
this->pixel_buffer = NULL;
|
||||
this->pixel_buffer = nullptr;
|
||||
ERR_DOUBLEBUF:
|
||||
CGDisplaySwitchToMode(this->display_id, this->save_mode);
|
||||
ERR_NO_SWITCH:
|
||||
@@ -336,9 +336,9 @@ ERR_NO_MATCH:
|
||||
[ [ NSScreen mainScreen ] setFrame:screen_rect ];
|
||||
|
||||
/* Destroy the pixel buffer */
|
||||
if (this->pixel_buffer != NULL) {
|
||||
if (this->pixel_buffer != nullptr) {
|
||||
free(this->pixel_buffer);
|
||||
this->pixel_buffer = NULL;
|
||||
this->pixel_buffer = nullptr;
|
||||
}
|
||||
|
||||
if (!gamma_error) this->FadeGammaIn(&gamma_table);
|
||||
@@ -359,7 +359,7 @@ public:
|
||||
this->device_width = CGDisplayPixelsWide(this->display_id);
|
||||
this->device_height = CGDisplayPixelsHigh(this->display_id);
|
||||
this->device_depth = 0;
|
||||
this->pixel_buffer = NULL;
|
||||
this->pixel_buffer = nullptr;
|
||||
|
||||
this->num_dirty_rects = MAX_DIRTY_RECTS;
|
||||
}
|
||||
@@ -508,14 +508,14 @@ CocoaSubdriver *QZ_CreateFullscreenSubdriver(int width, int height, int bpp)
|
||||
* been removed from the API.
|
||||
*/
|
||||
if (MacOSVersionIsAtLeast(10, 7, 0)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FullscreenSubdriver *ret = new FullscreenSubdriver();
|
||||
|
||||
if (!ret->ChangeResolution(width, height, bpp)) {
|
||||
delete ret;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@@ -108,9 +108,9 @@ public:
|
||||
|
||||
static CGColorSpaceRef QZ_GetCorrectColorSpace()
|
||||
{
|
||||
static CGColorSpaceRef colorSpace = NULL;
|
||||
static CGColorSpaceRef colorSpace = nullptr;
|
||||
|
||||
if (colorSpace == NULL) {
|
||||
if (colorSpace == nullptr) {
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
if (MacOSVersionIsAtLeast(10, 5, 0)) {
|
||||
colorSpace = CGDisplayCopyColorSpace(CGMainDisplayID());
|
||||
@@ -126,9 +126,9 @@ static CGColorSpaceRef QZ_GetCorrectColorSpace()
|
||||
#endif
|
||||
}
|
||||
|
||||
if (colorSpace == NULL) colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
if (colorSpace == nullptr) colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
|
||||
if (colorSpace == NULL) error("Could not get system colour space. You might need to recalibrate your monitor.");
|
||||
if (colorSpace == nullptr) error("Could not get system colour space. You might need to recalibrate your monitor.");
|
||||
}
|
||||
|
||||
return colorSpace;
|
||||
@@ -143,7 +143,7 @@ static CGColorSpaceRef QZ_GetCorrectColorSpace()
|
||||
}
|
||||
- (void)drawRect:(NSRect)invalidRect
|
||||
{
|
||||
if (driver->cgcontext == NULL) return;
|
||||
if (driver->cgcontext == nullptr) return;
|
||||
|
||||
CGContextRef viewContext = (CGContextRef)[ [ NSGraphicsContext currentContext ] graphicsPort ];
|
||||
CGContextSetShouldAntialias(viewContext, FALSE);
|
||||
@@ -242,7 +242,7 @@ void WindowQuartzSubdriver::GetDeviceInfo()
|
||||
# else
|
||||
/* Use the new API when compiling for OSX 10.6 or later */
|
||||
CGDisplayModeRef cur_mode = CGDisplayCopyDisplayMode(kCGDirectMainDisplay);
|
||||
if (cur_mode == NULL) { return; }
|
||||
if (cur_mode == nullptr) { return; }
|
||||
|
||||
this->device_width = CGDisplayModeGetWidth(cur_mode);
|
||||
this->device_height = CGDisplayModeGetHeight(cur_mode);
|
||||
@@ -406,15 +406,15 @@ WindowQuartzSubdriver::WindowQuartzSubdriver()
|
||||
this->window_width = 0;
|
||||
this->window_height = 0;
|
||||
this->buffer_depth = 0;
|
||||
this->window_buffer = NULL;
|
||||
this->pixel_buffer = NULL;
|
||||
this->window_buffer = nullptr;
|
||||
this->pixel_buffer = nullptr;
|
||||
this->active = false;
|
||||
this->setup = false;
|
||||
|
||||
this->window = nil;
|
||||
this->cocoaview = nil;
|
||||
|
||||
this->cgcontext = NULL;
|
||||
this->cgcontext = nullptr;
|
||||
|
||||
this->num_dirty_rects = MAX_DIRTY_RECTS;
|
||||
}
|
||||
@@ -611,7 +611,7 @@ bool WindowQuartzSubdriver::WindowResized()
|
||||
kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host
|
||||
);
|
||||
|
||||
assert(this->cgcontext != NULL);
|
||||
assert(this->cgcontext != nullptr);
|
||||
CGContextSetShouldAntialias(this->cgcontext, FALSE);
|
||||
CGContextSetAllowsAntialiasing(this->cgcontext, FALSE);
|
||||
CGContextSetInterpolationQuality(this->cgcontext, kCGInterpolationNone);
|
||||
@@ -619,7 +619,7 @@ bool WindowQuartzSubdriver::WindowResized()
|
||||
if (this->buffer_depth == 8) {
|
||||
free(this->pixel_buffer);
|
||||
this->pixel_buffer = malloc(this->window_width * this->window_height);
|
||||
if (this->pixel_buffer == NULL) {
|
||||
if (this->pixel_buffer == nullptr) {
|
||||
DEBUG(driver, 0, "Failed to allocate pixel buffer");
|
||||
return false;
|
||||
}
|
||||
@@ -638,19 +638,19 @@ CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp)
|
||||
{
|
||||
if (!MacOSVersionIsAtLeast(10, 4, 0)) {
|
||||
DEBUG(driver, 0, "The cocoa quartz subdriver requires Mac OS X 10.4 or later.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (bpp != 8 && bpp != 32) {
|
||||
DEBUG(driver, 0, "The cocoa quartz subdriver only supports 8 and 32 bpp.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WindowQuartzSubdriver *ret = new WindowQuartzSubdriver();
|
||||
|
||||
if (!ret->ChangeResolution(width, height, bpp)) {
|
||||
delete ret;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@@ -342,7 +342,7 @@ WindowQuickdrawSubdriver::WindowQuickdrawSubdriver()
|
||||
this->window_width = 0;
|
||||
this->window_height = 0;
|
||||
this->buffer_depth = 0;
|
||||
this->pixel_buffer = NULL;
|
||||
this->pixel_buffer = nullptr;
|
||||
this->active = false;
|
||||
this->setup = false;
|
||||
|
||||
@@ -522,7 +522,7 @@ bool WindowQuickdrawSubdriver::WindowResized()
|
||||
|
||||
free(this->pixel_buffer);
|
||||
this->pixel_buffer = malloc(this->window_width * this->window_height * this->buffer_depth / 8);
|
||||
if (this->pixel_buffer == NULL) {
|
||||
if (this->pixel_buffer == nullptr) {
|
||||
DEBUG(driver, 0, "Failed to allocate pixel buffer");
|
||||
return false;
|
||||
}
|
||||
@@ -546,14 +546,14 @@ CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp
|
||||
|
||||
if (bpp != 8 && bpp != 32) {
|
||||
DEBUG(driver, 0, "The cocoa quickdraw subdriver only supports 8 and 32 bpp.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ret = new WindowQuickdrawSubdriver();
|
||||
|
||||
if (!ret->ChangeResolution(width, height, bpp)) {
|
||||
delete ret;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@@ -87,7 +87,7 @@ static void WINAPI CheckForConsoleInput()
|
||||
DWORD nb;
|
||||
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
|
||||
for (;;) {
|
||||
ReadFile(hStdin, _win_console_thread_buffer, lengthof(_win_console_thread_buffer), &nb, NULL);
|
||||
ReadFile(hStdin, _win_console_thread_buffer, lengthof(_win_console_thread_buffer), &nb, nullptr);
|
||||
if (nb >= lengthof(_win_console_thread_buffer)) nb = lengthof(_win_console_thread_buffer) - 1;
|
||||
_win_console_thread_buffer[nb] = '\0';
|
||||
|
||||
@@ -102,12 +102,12 @@ static void CreateWindowsConsoleThread()
|
||||
{
|
||||
DWORD dwThreadId;
|
||||
/* Create event to signal when console input is ready */
|
||||
_hInputReady = CreateEvent(NULL, false, false, NULL);
|
||||
_hWaitForInputHandling = CreateEvent(NULL, false, false, NULL);
|
||||
if (_hInputReady == NULL || _hWaitForInputHandling == NULL) usererror("Cannot create console event!");
|
||||
_hInputReady = CreateEvent(nullptr, false, false, nullptr);
|
||||
_hWaitForInputHandling = CreateEvent(nullptr, false, false, nullptr);
|
||||
if (_hInputReady == nullptr || _hWaitForInputHandling == nullptr) usererror("Cannot create console event!");
|
||||
|
||||
_hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CheckForConsoleInput, NULL, 0, &dwThreadId);
|
||||
if (_hThread == NULL) usererror("Cannot create console thread!");
|
||||
_hThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)CheckForConsoleInput, nullptr, 0, &dwThreadId);
|
||||
if (_hThread == nullptr) usererror("Cannot create console thread!");
|
||||
|
||||
DEBUG(driver, 2, "Windows console thread started");
|
||||
}
|
||||
@@ -130,7 +130,7 @@ static void *_dedicated_video_mem;
|
||||
/* Whether a fork has been done. */
|
||||
bool _dedicated_forks;
|
||||
|
||||
extern bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL);
|
||||
extern bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = nullptr);
|
||||
|
||||
static FVideoDriver_Dedicated iFVideoDriver_Dedicated;
|
||||
|
||||
@@ -138,7 +138,7 @@ static FVideoDriver_Dedicated iFVideoDriver_Dedicated;
|
||||
const char *VideoDriver_Dedicated::Start(const char * const *parm)
|
||||
{
|
||||
int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
|
||||
_dedicated_video_mem = (bpp == 0) ? NULL : MallocT<byte>(_cur_resolution.width * _cur_resolution.height * (bpp / 8));
|
||||
_dedicated_video_mem = (bpp == 0) ? nullptr : MallocT<byte>(_cur_resolution.width * _cur_resolution.height * (bpp / 8));
|
||||
|
||||
_screen.width = _screen.pitch = _cur_resolution.width;
|
||||
_screen.height = _cur_resolution.height;
|
||||
@@ -164,7 +164,7 @@ const char *VideoDriver_Dedicated::Start(const char * const *parm)
|
||||
#endif
|
||||
|
||||
DEBUG(driver, 1, "Loading dedicated server");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VideoDriver_Dedicated::Stop()
|
||||
@@ -192,14 +192,14 @@ static bool InputWaiting()
|
||||
FD_SET(STDIN, &readfds);
|
||||
|
||||
/* don't care about writefds and exceptfds: */
|
||||
return select(STDIN + 1, &readfds, NULL, NULL, &tv) > 0;
|
||||
return select(STDIN + 1, &readfds, nullptr, nullptr, &tv) > 0;
|
||||
}
|
||||
|
||||
static uint32 GetTime()
|
||||
{
|
||||
struct timeval tim;
|
||||
|
||||
gettimeofday(&tim, NULL);
|
||||
gettimeofday(&tim, nullptr);
|
||||
return tim.tv_usec / 1000 + tim.tv_sec * 1000;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ static void DedicatedHandleKeyInput()
|
||||
if (_exit_game) return;
|
||||
|
||||
#if defined(UNIX) || defined(__OS2__)
|
||||
if (fgets(input_line, lengthof(input_line), stdin) == NULL) return;
|
||||
if (fgets(input_line, lengthof(input_line), stdin) == nullptr) return;
|
||||
#else
|
||||
/* Handle console input, and signal console thread, it can accept input again */
|
||||
assert_compile(lengthof(_win_console_thread_buffer) <= lengthof(input_line));
|
||||
|
@@ -29,13 +29,13 @@ const char *VideoDriver_Null::Start(const char * const *parm)
|
||||
this->ticks = GetDriverParamInt(parm, "ticks", 1000);
|
||||
_screen.width = _screen.pitch = _cur_resolution.width;
|
||||
_screen.height = _cur_resolution.height;
|
||||
_screen.dst_ptr = NULL;
|
||||
_screen.dst_ptr = nullptr;
|
||||
ScreenSizeChanged();
|
||||
|
||||
/* Do not render, nor blit */
|
||||
DEBUG(misc, 1, "Forcing blitter 'null'...");
|
||||
BlitterFactory::SelectBlitter("null");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VideoDriver_Null::Stop() { }
|
||||
|
@@ -43,9 +43,9 @@ static bool _all_modes;
|
||||
/** Whether the drawing is/may be done in a separate thread. */
|
||||
static bool _draw_threaded;
|
||||
/** Mutex to keep the access to the shared memory controlled. */
|
||||
static std::recursive_mutex *_draw_mutex = NULL;
|
||||
static std::recursive_mutex *_draw_mutex = nullptr;
|
||||
/** Signal to draw the next frame. */
|
||||
static std::condition_variable_any *_draw_signal = NULL;
|
||||
static std::condition_variable_any *_draw_signal = nullptr;
|
||||
/** Should we keep continue drawing? */
|
||||
static volatile bool _draw_continue;
|
||||
static Palette _local_palette;
|
||||
@@ -115,7 +115,7 @@ static void UpdatePalette(bool init = false)
|
||||
* best mapping of shadow palette colors to real palette
|
||||
* colors from scratch.
|
||||
*/
|
||||
SDL_BlitSurface(_sdl_screen, NULL, _sdl_realscreen, NULL);
|
||||
SDL_BlitSurface(_sdl_screen, nullptr, _sdl_realscreen, nullptr);
|
||||
SDL_UpdateRect(_sdl_realscreen, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ static void DrawSurfaceToScreen()
|
||||
_num_dirty_rects = 0;
|
||||
if (n > MAX_DIRTY_RECTS) {
|
||||
if (_sdl_screen != _sdl_realscreen) {
|
||||
SDL_BlitSurface(_sdl_screen, NULL, _sdl_realscreen, NULL);
|
||||
SDL_BlitSurface(_sdl_screen, nullptr, _sdl_realscreen, nullptr);
|
||||
}
|
||||
SDL_UpdateRect(_sdl_realscreen, 0, 0, 0, 0);
|
||||
} else {
|
||||
@@ -208,10 +208,10 @@ static const Dimension _default_resolutions[] = {
|
||||
|
||||
static void GetVideoModes()
|
||||
{
|
||||
SDL_Rect **modes = SDL_ListModes(NULL, SDL_SWSURFACE | SDL_FULLSCREEN);
|
||||
if (modes == NULL) usererror("sdl: no modes available");
|
||||
SDL_Rect **modes = SDL_ListModes(nullptr, SDL_SWSURFACE | SDL_FULLSCREEN);
|
||||
if (modes == nullptr) usererror("sdl: no modes available");
|
||||
|
||||
_all_modes = (SDL_ListModes(NULL, SDL_SWSURFACE | (_fullscreen ? SDL_FULLSCREEN : 0)) == (void*)-1);
|
||||
_all_modes = (SDL_ListModes(nullptr, SDL_SWSURFACE | (_fullscreen ? SDL_FULLSCREEN : 0)) == (void*)-1);
|
||||
if (modes == (void*)-1) {
|
||||
int n = 0;
|
||||
for (uint i = 0; i < lengthof(_default_resolutions); i++) {
|
||||
@@ -282,15 +282,15 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h)
|
||||
if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
|
||||
|
||||
char icon_path[MAX_PATH];
|
||||
if (FioFindFullPath(icon_path, lastof(icon_path), BASESET_DIR, "openttd.32.bmp") != NULL) {
|
||||
if (FioFindFullPath(icon_path, lastof(icon_path), BASESET_DIR, "openttd.32.bmp") != nullptr) {
|
||||
/* Give the application an icon */
|
||||
icon = SDL_LoadBMP(icon_path);
|
||||
if (icon != NULL) {
|
||||
if (icon != nullptr) {
|
||||
/* Get the colourkey, which will be magenta */
|
||||
uint32 rgbmap = SDL_MapRGB(icon->format, 255, 0, 255);
|
||||
|
||||
SDL_SetColorKey(icon, SDL_SRCCOLORKEY, rgbmap);
|
||||
SDL_WM_SetIcon(icon, NULL);
|
||||
SDL_WM_SetIcon(icon, nullptr);
|
||||
SDL_FreeSurface(icon);
|
||||
}
|
||||
}
|
||||
@@ -326,9 +326,9 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h)
|
||||
if (want_hwpalette) DEBUG(driver, 1, "SDL: requesting hardware palette");
|
||||
|
||||
/* Free any previously allocated shadow surface */
|
||||
if (_sdl_screen != NULL && _sdl_screen != _sdl_realscreen) SDL_FreeSurface(_sdl_screen);
|
||||
if (_sdl_screen != nullptr && _sdl_screen != _sdl_realscreen) SDL_FreeSurface(_sdl_screen);
|
||||
|
||||
if (_sdl_realscreen != NULL) {
|
||||
if (_sdl_realscreen != nullptr) {
|
||||
if (_requested_hwpalette != want_hwpalette) {
|
||||
/* SDL (at least the X11 driver), reuses the
|
||||
* same window and palette settings when the bpp
|
||||
@@ -353,7 +353,7 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h)
|
||||
|
||||
/* DO NOT CHANGE TO HWSURFACE, IT DOES NOT WORK */
|
||||
newscreen = SDL_SetVideoMode(w, h, bpp, SDL_SWSURFACE | (want_hwpalette ? SDL_HWPALETTE : 0) | (_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE));
|
||||
if (newscreen == NULL) {
|
||||
if (newscreen == nullptr) {
|
||||
DEBUG(driver, 0, "SDL: Couldn't allocate a window to draw on");
|
||||
return false;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h)
|
||||
*/
|
||||
DEBUG(driver, 1, "SDL: using shadow surface");
|
||||
newscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, bpp, 0, 0, 0, 0);
|
||||
if (newscreen == NULL) {
|
||||
if (newscreen == nullptr) {
|
||||
DEBUG(driver, 0, "SDL: Couldn't allocate a shadow surface to draw on");
|
||||
return false;
|
||||
}
|
||||
@@ -641,9 +641,9 @@ const char *VideoDriver_SDL::Start(const char * const *parm)
|
||||
MarkWholeScreenDirty();
|
||||
SetupKeyboard();
|
||||
|
||||
_draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL;
|
||||
_draw_threaded = GetDriverParam(parm, "no_threads") == nullptr && GetDriverParam(parm, "no_thread") == nullptr;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VideoDriver_SDL::SetupKeyboard()
|
||||
@@ -677,7 +677,7 @@ void VideoDriver_SDL::MainLoop()
|
||||
/* Initialise the mutex first, because that's the thing we *need*
|
||||
* directly in the newly created thread. */
|
||||
_draw_mutex = new std::recursive_mutex();
|
||||
if (_draw_mutex == NULL) {
|
||||
if (_draw_mutex == nullptr) {
|
||||
_draw_threaded = false;
|
||||
} else {
|
||||
draw_lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
@@ -692,8 +692,8 @@ void VideoDriver_SDL::MainLoop()
|
||||
draw_lock.release();
|
||||
delete _draw_mutex;
|
||||
delete _draw_signal;
|
||||
_draw_mutex = NULL;
|
||||
_draw_signal = NULL;
|
||||
_draw_mutex = nullptr;
|
||||
_draw_signal = nullptr;
|
||||
} else {
|
||||
/* Wait till the draw mutex has started itself. */
|
||||
_draw_signal->wait(*_draw_mutex);
|
||||
@@ -761,26 +761,26 @@ void VideoDriver_SDL::MainLoop()
|
||||
|
||||
/* The gameloop is the part that can run asynchronously. The rest
|
||||
* except sleeping can't. */
|
||||
if (_draw_mutex != NULL) draw_lock.unlock();
|
||||
if (_draw_mutex != nullptr) draw_lock.unlock();
|
||||
|
||||
GameLoop();
|
||||
|
||||
if (_draw_mutex != NULL) draw_lock.lock();
|
||||
if (_draw_mutex != nullptr) draw_lock.lock();
|
||||
|
||||
UpdateWindows();
|
||||
_local_palette = _cur_palette;
|
||||
} else {
|
||||
/* Release the thread while sleeping */
|
||||
if (_draw_mutex != NULL) draw_lock.unlock();
|
||||
if (_draw_mutex != nullptr) draw_lock.unlock();
|
||||
CSleep(1);
|
||||
if (_draw_mutex != NULL) draw_lock.lock();
|
||||
if (_draw_mutex != nullptr) draw_lock.lock();
|
||||
|
||||
NetworkDrawChatMessage();
|
||||
DrawMouseCursor();
|
||||
}
|
||||
|
||||
/* End of the critical part. */
|
||||
if (_draw_mutex != NULL && !HasModalProgress()) {
|
||||
if (_draw_mutex != nullptr && !HasModalProgress()) {
|
||||
_draw_signal->notify_one();
|
||||
} else {
|
||||
/* Oh, we didn't have threads, then just draw unthreaded */
|
||||
@@ -789,7 +789,7 @@ void VideoDriver_SDL::MainLoop()
|
||||
}
|
||||
}
|
||||
|
||||
if (_draw_mutex != NULL) {
|
||||
if (_draw_mutex != nullptr) {
|
||||
_draw_continue = false;
|
||||
/* Sending signal if there is no thread blocked
|
||||
* is very valid and results in noop */
|
||||
@@ -801,15 +801,15 @@ void VideoDriver_SDL::MainLoop()
|
||||
delete _draw_mutex;
|
||||
delete _draw_signal;
|
||||
|
||||
_draw_mutex = NULL;
|
||||
_draw_signal = NULL;
|
||||
_draw_mutex = nullptr;
|
||||
_draw_signal = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool VideoDriver_SDL::ChangeResolution(int w, int h)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock;
|
||||
if (_draw_mutex != NULL) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
if (_draw_mutex != nullptr) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
|
||||
return CreateMainSurface(w, h);
|
||||
}
|
||||
@@ -817,7 +817,7 @@ bool VideoDriver_SDL::ChangeResolution(int w, int h)
|
||||
bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock;
|
||||
if (_draw_mutex != NULL) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
if (_draw_mutex != nullptr) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
|
||||
_fullscreen = fullscreen;
|
||||
GetVideoModes(); // get the list of available video modes
|
||||
@@ -838,12 +838,12 @@ bool VideoDriver_SDL::AfterBlitterChange()
|
||||
|
||||
void VideoDriver_SDL::AcquireBlitterLock()
|
||||
{
|
||||
if (_draw_mutex != NULL) _draw_mutex->lock();
|
||||
if (_draw_mutex != nullptr) _draw_mutex->lock();
|
||||
}
|
||||
|
||||
void VideoDriver_SDL::ReleaseBlitterLock()
|
||||
{
|
||||
if (_draw_mutex != NULL) _draw_mutex->unlock();
|
||||
if (_draw_mutex != nullptr) _draw_mutex->unlock();
|
||||
}
|
||||
|
||||
#endif /* WITH_SDL */
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#endif
|
||||
|
||||
typedef BOOL (WINAPI *PFNTRACKMOUSEEVENT)(LPTRACKMOUSEEVENT lpEventTrack);
|
||||
static PFNTRACKMOUSEEVENT _pTrackMouseEvent = NULL;
|
||||
static PFNTRACKMOUSEEVENT _pTrackMouseEvent = nullptr;
|
||||
|
||||
static struct {
|
||||
HWND main_wnd;
|
||||
@@ -72,9 +72,9 @@ DWORD _imm_props;
|
||||
/** Whether the drawing is/may be done in a separate thread. */
|
||||
static bool _draw_threaded;
|
||||
/** Mutex to keep the access to the shared memory controlled. */
|
||||
static std::recursive_mutex *_draw_mutex = NULL;
|
||||
static std::recursive_mutex *_draw_mutex = nullptr;
|
||||
/** Signal to draw the next frame. */
|
||||
static std::condition_variable_any *_draw_signal = NULL;
|
||||
static std::condition_variable_any *_draw_signal = nullptr;
|
||||
/** Should we keep continue drawing? */
|
||||
static volatile bool _draw_continue;
|
||||
/** Local copy of the palette for use in the drawing thread. */
|
||||
@@ -95,7 +95,7 @@ static void MakePalette()
|
||||
|
||||
}
|
||||
_wnd.gdi_palette = CreatePalette(pal);
|
||||
if (_wnd.gdi_palette == NULL) usererror("CreatePalette failed!\n");
|
||||
if (_wnd.gdi_palette == nullptr) usererror("CreatePalette failed!\n");
|
||||
|
||||
_cur_palette.first_dirty = 0;
|
||||
_cur_palette.count_dirty = 256;
|
||||
@@ -313,7 +313,7 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
|
||||
}
|
||||
} else if (_wnd.fullscreen) {
|
||||
/* restore display? */
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
ChangeDisplaySettings(nullptr, 0);
|
||||
/* restore the resolution */
|
||||
_wnd.width = _bck_resolution.width;
|
||||
_wnd.height = _bck_resolution.height;
|
||||
@@ -340,7 +340,7 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
|
||||
w = r.right - r.left;
|
||||
h = r.bottom - r.top;
|
||||
|
||||
if (_wnd.main_wnd != NULL) {
|
||||
if (_wnd.main_wnd != nullptr) {
|
||||
if (!_window_maximize) SetWindowPos(_wnd.main_wnd, 0, 0, 0, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE);
|
||||
} else {
|
||||
int x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
|
||||
@@ -349,8 +349,8 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
|
||||
char window_title[64];
|
||||
seprintf(window_title, lastof(window_title), "OpenTTD %s", _openttd_revision);
|
||||
|
||||
_wnd.main_wnd = CreateWindow(_T("OTTD"), MB_TO_WIDE(window_title), style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0);
|
||||
if (_wnd.main_wnd == NULL) usererror("CreateWindow failed");
|
||||
_wnd.main_wnd = CreateWindow(_T("OTTD"), MB_TO_WIDE(window_title), style, x, y, w, h, 0, 0, GetModuleHandle(nullptr), 0);
|
||||
if (_wnd.main_wnd == nullptr) usererror("CreateWindow failed");
|
||||
ShowWindow(_wnd.main_wnd, showstyle);
|
||||
}
|
||||
}
|
||||
@@ -503,7 +503,7 @@ static bool DrawIMECompositionString()
|
||||
static void SetCompositionPos(HWND hwnd)
|
||||
{
|
||||
HIMC hIMC = ImmGetContext(hwnd);
|
||||
if (hIMC != NULL) {
|
||||
if (hIMC != nullptr) {
|
||||
COMPOSITIONFORM cf;
|
||||
cf.dwStyle = CFS_POINT;
|
||||
|
||||
@@ -525,7 +525,7 @@ static void SetCompositionPos(HWND hwnd)
|
||||
static void SetCandidatePos(HWND hwnd)
|
||||
{
|
||||
HIMC hIMC = ImmGetContext(hwnd);
|
||||
if (hIMC != NULL) {
|
||||
if (hIMC != nullptr) {
|
||||
CANDIDATEFORM cf;
|
||||
cf.dwIndex = 0;
|
||||
cf.dwStyle = CFS_EXCLUDE;
|
||||
@@ -560,17 +560,17 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HIMC hIMC = ImmGetContext(hwnd);
|
||||
|
||||
if (hIMC != NULL) {
|
||||
if (hIMC != nullptr) {
|
||||
if (lParam & GCS_RESULTSTR) {
|
||||
/* Read result string from the IME. */
|
||||
LONG len = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0); // Length is always in bytes, even in UNICODE build.
|
||||
LONG len = ImmGetCompositionString(hIMC, GCS_RESULTSTR, nullptr, 0); // Length is always in bytes, even in UNICODE build.
|
||||
TCHAR *str = (TCHAR *)_alloca(len + sizeof(TCHAR));
|
||||
len = ImmGetCompositionString(hIMC, GCS_RESULTSTR, str, len);
|
||||
str[len / sizeof(TCHAR)] = '\0';
|
||||
|
||||
/* Transmit text to windowing system. */
|
||||
if (len > 0) {
|
||||
HandleTextInput(NULL, true); // Clear marked string.
|
||||
HandleTextInput(nullptr, true); // Clear marked string.
|
||||
HandleTextInput(FS2OTTD(str));
|
||||
}
|
||||
SetCompositionPos(hwnd);
|
||||
@@ -581,7 +581,7 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if ((lParam & GCS_COMPSTR) && DrawIMECompositionString()) {
|
||||
/* Read composition string from the IME. */
|
||||
LONG len = ImmGetCompositionString(hIMC, GCS_COMPSTR, NULL, 0); // Length is always in bytes, even in UNICODE build.
|
||||
LONG len = ImmGetCompositionString(hIMC, GCS_COMPSTR, nullptr, 0); // Length is always in bytes, even in UNICODE build.
|
||||
TCHAR *str = (TCHAR *)_alloca(len + sizeof(TCHAR));
|
||||
len = ImmGetCompositionString(hIMC, GCS_COMPSTR, str, len);
|
||||
str[len / sizeof(TCHAR)] = '\0';
|
||||
@@ -591,7 +591,7 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
convert_from_fs(str, utf8_buf, lengthof(utf8_buf));
|
||||
|
||||
/* Convert caret position from bytes in the input string to a position in the UTF-8 encoded string. */
|
||||
LONG caret_bytes = ImmGetCompositionString(hIMC, GCS_CURSORPOS, NULL, 0);
|
||||
LONG caret_bytes = ImmGetCompositionString(hIMC, GCS_CURSORPOS, nullptr, 0);
|
||||
const char *caret = utf8_buf;
|
||||
for (const TCHAR *c = str; *c != '\0' && *caret != '\0' && caret_bytes > 0; c++, caret_bytes--) {
|
||||
/* Skip DBCS lead bytes or leading surrogates. */
|
||||
@@ -608,7 +608,7 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
HandleTextInput(utf8_buf, true, caret);
|
||||
} else {
|
||||
HandleTextInput(NULL, true);
|
||||
HandleTextInput(nullptr, true);
|
||||
}
|
||||
|
||||
lParam &= ~(GCS_COMPSTR | GCS_COMPATTR | GCS_COMPCLAUSE | GCS_CURSORPOS | GCS_DELTASTART);
|
||||
@@ -623,10 +623,10 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
static void CancelIMEComposition(HWND hwnd)
|
||||
{
|
||||
HIMC hIMC = ImmGetContext(hwnd);
|
||||
if (hIMC != NULL) ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
|
||||
if (hIMC != nullptr) ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
|
||||
ImmReleaseContext(hwnd, hIMC);
|
||||
/* Clear any marked string from the current edit box. */
|
||||
HandleTextInput(NULL, true);
|
||||
HandleTextInput(nullptr, true);
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
@@ -651,14 +651,14 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
if (!in_sizemove && _draw_mutex != NULL && !HasModalProgress()) {
|
||||
if (!in_sizemove && _draw_mutex != nullptr && !HasModalProgress()) {
|
||||
/* Get the union of the old update rect and the new update rect. */
|
||||
RECT r;
|
||||
GetUpdateRect(hwnd, &r, FALSE);
|
||||
UnionRect(&_wnd.update_rect, &_wnd.update_rect, &r);
|
||||
|
||||
/* Mark the window as updated, otherwise Windows would send more WM_PAINT messages. */
|
||||
ValidateRect(hwnd, NULL);
|
||||
ValidateRect(hwnd, nullptr);
|
||||
_draw_signal->notify_one();
|
||||
} else {
|
||||
PAINTSTRUCT ps;
|
||||
@@ -680,7 +680,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
|
||||
SelectPalette(hDC, hOldPalette, TRUE);
|
||||
ReleaseDC(hwnd, hDC);
|
||||
if (nChanged != 0) InvalidateRect(hwnd, NULL, FALSE);
|
||||
if (nChanged != 0) InvalidateRect(hwnd, nullptr, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -734,7 +734,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
* tracking the mouse for exiting the window */
|
||||
if (!_cursor.in_window) {
|
||||
_cursor.in_window = true;
|
||||
if (_pTrackMouseEvent != NULL) {
|
||||
if (_pTrackMouseEvent != nullptr) {
|
||||
TRACKMOUSEEVENT tme;
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
@@ -787,7 +787,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
|
||||
case WM_IME_ENDCOMPOSITION:
|
||||
/* Clear any pending composition string. */
|
||||
HandleTextInput(NULL, true);
|
||||
HandleTextInput(nullptr, true);
|
||||
if (DrawIMECompositionString()) return 0;
|
||||
break;
|
||||
|
||||
@@ -835,7 +835,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
|
||||
/* Silently drop all messages handled by WM_CHAR. */
|
||||
MSG msg;
|
||||
if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
|
||||
if (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) {
|
||||
if ((msg.message == WM_CHAR || msg.message == WM_DEADCHAR) && GB(lParam, 16, 8) == GB(msg.lParam, 16, 8)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -997,7 +997,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
} else if (!active && !minimized) {
|
||||
/* Minimise the window and restore desktop */
|
||||
ShowWindow(hwnd, SW_MINIMIZE);
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
ChangeDisplaySettings(nullptr, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1012,7 +1012,7 @@ static void RegisterWndClass()
|
||||
static bool registered = false;
|
||||
|
||||
if (!registered) {
|
||||
HINSTANCE hinst = GetModuleHandle(NULL);
|
||||
HINSTANCE hinst = GetModuleHandle(nullptr);
|
||||
WNDCLASS wnd = {
|
||||
CS_OWNDC,
|
||||
WndProcGdi,
|
||||
@@ -1020,7 +1020,7 @@ static void RegisterWndClass()
|
||||
0,
|
||||
hinst,
|
||||
LoadIcon(hinst, MAKEINTRESOURCE(100)),
|
||||
LoadCursor(NULL, IDC_ARROW),
|
||||
LoadCursor(nullptr, IDC_ARROW),
|
||||
0,
|
||||
0,
|
||||
_T("OTTD")
|
||||
@@ -1061,8 +1061,8 @@ static bool AllocateDibSection(int w, int h, bool force)
|
||||
if (_wnd.dib_sect) DeleteObject(_wnd.dib_sect);
|
||||
|
||||
dc = GetDC(0);
|
||||
_wnd.dib_sect = CreateDIBSection(dc, bi, DIB_RGB_COLORS, (VOID**)&_wnd.buffer_bits, NULL, 0);
|
||||
if (_wnd.dib_sect == NULL) usererror("CreateDIBSection failed");
|
||||
_wnd.dib_sect = CreateDIBSection(dc, bi, DIB_RGB_COLORS, (VOID**)&_wnd.buffer_bits, nullptr, 0);
|
||||
if (_wnd.dib_sect == nullptr) usererror("CreateDIBSection failed");
|
||||
ReleaseDC(0, dc);
|
||||
|
||||
_screen.width = w;
|
||||
@@ -1099,7 +1099,7 @@ static void FindResolutions()
|
||||
/* XXX - EnumDisplaySettingsW crashes with unicows.dll on Windows95
|
||||
* Doesn't really matter since we don't pass a string anyways, but still
|
||||
* a letdown */
|
||||
for (i = 0; EnumDisplaySettingsA(NULL, i, &dm) != 0; i++) {
|
||||
for (i = 0; EnumDisplaySettingsA(nullptr, i, &dm) != 0; i++) {
|
||||
if (dm.dmBitsPerPel == bpp &&
|
||||
dm.dmPelsWidth >= 640 && dm.dmPelsHeight >= 480) {
|
||||
uint j;
|
||||
@@ -1153,9 +1153,9 @@ const char *VideoDriver_Win32::Start(const char * const *parm)
|
||||
|
||||
MarkWholeScreenDirty();
|
||||
|
||||
_draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL && std::thread::hardware_concurrency() > 1;
|
||||
_draw_threaded = GetDriverParam(parm, "no_threads") == nullptr && GetDriverParam(parm, "no_thread") == nullptr && std::thread::hardware_concurrency() > 1;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VideoDriver_Win32::Stop()
|
||||
@@ -1164,7 +1164,7 @@ void VideoDriver_Win32::Stop()
|
||||
DeleteObject(_wnd.dib_sect);
|
||||
DestroyWindow(_wnd.main_wnd);
|
||||
|
||||
if (_wnd.fullscreen) ChangeDisplaySettings(NULL, 0);
|
||||
if (_wnd.fullscreen) ChangeDisplaySettings(nullptr, 0);
|
||||
MyShowCursor(true);
|
||||
}
|
||||
|
||||
@@ -1180,7 +1180,7 @@ static void CheckPaletteAnim()
|
||||
if (_cur_palette.count_dirty == 0) return;
|
||||
|
||||
_local_palette = _cur_palette;
|
||||
InvalidateRect(_wnd.main_wnd, NULL, FALSE);
|
||||
InvalidateRect(_wnd.main_wnd, nullptr, FALSE);
|
||||
}
|
||||
|
||||
void VideoDriver_Win32::MainLoop()
|
||||
@@ -1215,8 +1215,8 @@ void VideoDriver_Win32::MainLoop()
|
||||
draw_lock.release();
|
||||
delete _draw_mutex;
|
||||
delete _draw_signal;
|
||||
_draw_mutex = NULL;
|
||||
_draw_signal = NULL;
|
||||
_draw_mutex = nullptr;
|
||||
_draw_signal = nullptr;
|
||||
} else {
|
||||
DEBUG(driver, 1, "Threaded drawing enabled");
|
||||
/* Wait till the draw thread has started itself. */
|
||||
@@ -1231,7 +1231,7 @@ void VideoDriver_Win32::MainLoop()
|
||||
for (;;) {
|
||||
uint32 prev_cur_ticks = cur_ticks; // to check for wrapping
|
||||
|
||||
while (PeekMessage(&mesg, NULL, 0, 0, PM_REMOVE)) {
|
||||
while (PeekMessage(&mesg, nullptr, 0, 0, PM_REMOVE)) {
|
||||
InteractiveRandom(); // randomness
|
||||
/* Convert key messages to char messages if we want text input. */
|
||||
if (EditBoxInGlobalFocus()) TranslateMessage(&mesg);
|
||||
@@ -1314,14 +1314,14 @@ void VideoDriver_Win32::MainLoop()
|
||||
delete _draw_mutex;
|
||||
delete _draw_signal;
|
||||
|
||||
_draw_mutex = NULL;
|
||||
_draw_mutex = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool VideoDriver_Win32::ChangeResolution(int w, int h)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock;
|
||||
if (_draw_mutex != NULL) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
if (_draw_mutex != nullptr) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
|
||||
if (_window_maximize) ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL);
|
||||
|
||||
@@ -1334,7 +1334,7 @@ bool VideoDriver_Win32::ChangeResolution(int w, int h)
|
||||
bool VideoDriver_Win32::ToggleFullscreen(bool full_screen)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock;
|
||||
if (_draw_mutex != NULL) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
if (_draw_mutex != nullptr) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
|
||||
return this->MakeWindow(full_screen);
|
||||
}
|
||||
@@ -1346,18 +1346,18 @@ bool VideoDriver_Win32::AfterBlitterChange()
|
||||
|
||||
void VideoDriver_Win32::AcquireBlitterLock()
|
||||
{
|
||||
if (_draw_mutex != NULL) _draw_mutex->lock();
|
||||
if (_draw_mutex != nullptr) _draw_mutex->lock();
|
||||
}
|
||||
|
||||
void VideoDriver_Win32::ReleaseBlitterLock()
|
||||
{
|
||||
if (_draw_mutex != NULL) _draw_mutex->unlock();
|
||||
if (_draw_mutex != nullptr) _draw_mutex->unlock();
|
||||
}
|
||||
|
||||
void VideoDriver_Win32::EditBoxLostFocus()
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lock;
|
||||
if (_draw_mutex != NULL) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
if (_draw_mutex != nullptr) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
|
||||
|
||||
CancelIMEComposition(_wnd.main_wnd);
|
||||
SetCompositionPos(_wnd.main_wnd);
|
||||
|
Reference in New Issue
Block a user