diff options
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r-- | platform/linuxbsd/context_gl_x11.cpp | 12 | ||||
-rw-r--r-- | platform/linuxbsd/crash_handler_linuxbsd.cpp | 12 | ||||
-rw-r--r-- | platform/linuxbsd/detect_prime_x11.cpp | 8 | ||||
-rw-r--r-- | platform/linuxbsd/display_server_x11.cpp | 84 | ||||
-rw-r--r-- | platform/linuxbsd/joypad_linux.cpp | 10 | ||||
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 10 | ||||
-rw-r--r-- | platform/linuxbsd/vulkan_context_x11.cpp | 4 |
7 files changed, 70 insertions, 70 deletions
diff --git a/platform/linuxbsd/context_gl_x11.cpp b/platform/linuxbsd/context_gl_x11.cpp index 5442af3bef..308d68521a 100644 --- a/platform/linuxbsd/context_gl_x11.cpp +++ b/platform/linuxbsd/context_gl_x11.cpp @@ -52,7 +52,7 @@ struct ContextGL_X11_Private { void ContextGL_X11::release_current() { - glXMakeCurrent(x11_display, None, NULL); + glXMakeCurrent(x11_display, None, nullptr); } void ContextGL_X11::make_current() { @@ -117,7 +117,7 @@ Error ContextGL_X11::initialize() { int fbcount; GLXFBConfig fbconfig = 0; - XVisualInfo *vi = NULL; + XVisualInfo *vi = nullptr; XSetWindowAttributes swa; swa.event_mask = StructureNotifyMask; @@ -136,7 +136,7 @@ Error ContextGL_X11::initialize() { XRenderPictFormat *pict_format = XRenderFindVisualFormat(x11_display, vi->visual); if (!pict_format) { XFree(vi); - vi = NULL; + vi = nullptr; continue; } @@ -208,9 +208,9 @@ int ContextGL_X11::get_window_height() { void ContextGL_X11::set_use_vsync(bool p_use) { static bool setup = false; - static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL; - static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalMESA = NULL; - static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL; + static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = nullptr; + static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalMESA = nullptr; + static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = nullptr; if (!setup) { setup = true; diff --git a/platform/linuxbsd/crash_handler_linuxbsd.cpp b/platform/linuxbsd/crash_handler_linuxbsd.cpp index 1b3804e3ed..dbdb15918e 100644 --- a/platform/linuxbsd/crash_handler_linuxbsd.cpp +++ b/platform/linuxbsd/crash_handler_linuxbsd.cpp @@ -46,7 +46,7 @@ #include <stdlib.h> static void handle_crash(int sig) { - if (OS::get_singleton() == NULL) { + if (OS::get_singleton() == nullptr) { abort(); } @@ -79,7 +79,7 @@ static void handle_crash(int sig) { if (dladdr(bt_buffer[i], &info) && info.dli_sname) { if (info.dli_sname[0] == '_') { int status; - char *demangled = abi::__cxa_demangle(info.dli_sname, NULL, 0, &status); + char *demangled = abi::__cxa_demangle(info.dli_sname, nullptr, nullptr, &status); if (status == 0 && demangled) { snprintf(fname, 1024, "%s", demangled); @@ -102,7 +102,7 @@ static void handle_crash(int sig) { // Try to get the file/line number using addr2line int ret; - Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret); + Error err = OS::get_singleton()->execute(String("addr2line"), args, true, nullptr, &output, &ret); if (err == OK) { output.erase(output.length() - 1, 1); } @@ -132,9 +132,9 @@ void CrashHandler::disable() { return; #ifdef CRASH_HANDLER_ENABLED - signal(SIGSEGV, NULL); - signal(SIGFPE, NULL); - signal(SIGILL, NULL); + signal(SIGSEGV, nullptr); + signal(SIGFPE, nullptr); + signal(SIGILL, nullptr); #endif disabled = true; diff --git a/platform/linuxbsd/detect_prime_x11.cpp b/platform/linuxbsd/detect_prime_x11.cpp index 69b0837e6c..1bec65ff04 100644 --- a/platform/linuxbsd/detect_prime_x11.cpp +++ b/platform/linuxbsd/detect_prime_x11.cpp @@ -67,12 +67,12 @@ vendor vendormap[] = { { "Intel", 20 }, { "nouveau", 10 }, { "Mesa Project", 0 }, - { NULL, 0 } + { nullptr, 0 } }; // Runs inside a child. Exiting will not quit the engine. void create_context() { - Display *x11_display = XOpenDisplay(NULL); + Display *x11_display = XOpenDisplay(nullptr); Window x11_window; GLXContext glx_context; @@ -91,7 +91,7 @@ void create_context() { int fbcount; GLXFBConfig fbconfig = 0; - XVisualInfo *vi = NULL; + XVisualInfo *vi = nullptr; XSetWindowAttributes swa; swa.event_mask = StructureNotifyMask; @@ -114,7 +114,7 @@ void create_context() { None }; - glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, NULL, true, context_attribs); + glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, nullptr, true, context_attribs); swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone); x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, 10, 10, 0, vi->depth, InputOutput, vi->visual, valuemask, &swa); diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index 786bc37bad..47497eb95f 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -902,7 +902,7 @@ void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p int format; unsigned long len; unsigned long remaining; - unsigned char *data = NULL; + unsigned char *data = nullptr; if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) { if (format == 32 && len == 4 && data) { long *extents = (long *)data; @@ -1091,7 +1091,7 @@ Size2i DisplayServerX11::window_get_real_size(WindowID p_window) const { int format; unsigned long len; unsigned long remaining; - unsigned char *data = NULL; + unsigned char *data = nullptr; if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) { if (format == 32 && len == 4 && data) { long *extents = (long *)data; @@ -1116,7 +1116,7 @@ bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const { int format; unsigned long len; unsigned long remaining; - unsigned char *data = NULL; + unsigned char *data = nullptr; int result = XGetWindowProperty( x11_display, @@ -1402,7 +1402,7 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c int format; unsigned long len; unsigned long remaining; - unsigned char *data = NULL; + unsigned char *data = nullptr; bool retval = false; int result = XGetWindowProperty( @@ -1453,7 +1453,7 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c int format; unsigned long len; unsigned long remaining; - unsigned char *data = NULL; + unsigned char *data = nullptr; int result = XGetWindowProperty( x11_display, @@ -1592,7 +1592,7 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co int format; unsigned long len; unsigned long remaining; - unsigned char *data = NULL; + unsigned char *data = nullptr; if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, sizeof(Hints), False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) { if (data && (format == 32) && (len >= 5)) { borderless = !((Hints *)data)->decorations; @@ -1719,8 +1719,8 @@ void DisplayServerX11::window_set_ime_position(const Point2i &p_pos, WindowID p_ ::XPoint spot; spot.x = short(p_pos.x); spot.y = short(p_pos.y); - XVaNestedList preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); - XSetICValues(wd.xic, XNPreeditAttributes, preedit_attr, NULL); + XVaNestedList preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, nullptr); + XSetICValues(wd.xic, XNPreeditAttributes, preedit_attr, nullptr); XFree(preedit_attr); } @@ -1827,7 +1827,7 @@ void DisplayServerX11::cursor_set_custom_image(const RES &p_cursor, CursorShape *(cursor_image->pixels + index) = image->get_pixel(column_index, row_index).to_argb32(); } - ERR_FAIL_COND(cursor_image->pixels == NULL); + ERR_FAIL_COND(cursor_image->pixels == nullptr); // Save it for a further usage cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_image); @@ -1900,14 +1900,14 @@ DisplayServerX11::Property DisplayServerX11::_read_property(Display *p_display, int actual_format; unsigned long nitems; unsigned long bytes_after; - unsigned char *ret = 0; + unsigned char *ret = nullptr; int read_bytes = 1024; //Keep trying to read the property until there are no //bytes unread. do { - if (ret != 0) + if (ret != nullptr) XFree(ret); XGetWindowProperty(p_display, p_window, p_property, 0, read_bytes, False, AnyPropertyType, @@ -2006,8 +2006,8 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, XKeyEvent xkeyevent_no_mod = *xkeyevent; xkeyevent_no_mod.state &= ~ShiftMask; xkeyevent_no_mod.state &= ~ControlMask; - XLookupString(xkeyevent, str, 256, &keysym_unicode, NULL); - XLookupString(&xkeyevent_no_mod, NULL, 0, &keysym_keycode, NULL); + XLookupString(xkeyevent, str, 256, &keysym_unicode, nullptr); + XLookupString(&xkeyevent_no_mod, nullptr, 0, &keysym_keycode, nullptr); // Meanwhile, XLookupString returns keysyms useful for unicode. @@ -2170,7 +2170,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, #undef ABSDIFF if (peek_event.type == KeyPress && threshold < 5) { KeySym rk; - XLookupString((XKeyEvent *)&peek_event, str, 256, &rk, NULL); + XLookupString((XKeyEvent *)&peek_event, str, 256, &rk, nullptr); if (rk == keysym_keycode) { XEvent event; XNextEvent(x11_display, &event); //erase next event @@ -2232,10 +2232,10 @@ void DisplayServerX11::_xim_destroy_callback(::XIM im, ::XPointer client_data, WARN_PRINT("Input method stopped"); DisplayServerX11 *ds = reinterpret_cast<DisplayServerX11 *>(client_data); - ds->xim = NULL; + ds->xim = nullptr; for (Map<WindowID, WindowData>::Element *E = ds->windows.front(); E; E = E->next()) { - E->get().xic = NULL; + E->get().xic = nullptr; } } @@ -3222,11 +3222,11 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u if (xim && xim_style) { - wd.xic = XCreateIC(xim, XNInputStyle, xim_style, XNClientWindow, wd.x11_window, XNFocusWindow, wd.x11_window, (char *)NULL); - if (XGetICValues(wd.xic, XNFilterEvents, &im_event_mask, NULL) != NULL) { + wd.xic = XCreateIC(xim, XNInputStyle, xim_style, XNClientWindow, wd.x11_window, XNFocusWindow, wd.x11_window, (char *)nullptr); + if (XGetICValues(wd.xic, XNFilterEvents, &im_event_mask, nullptr) != nullptr) { WARN_PRINT("XGetICValues couldn't obtain XNFilterEvents value"); XDestroyIC(wd.xic); - wd.xic = NULL; + wd.xic = nullptr; } if (wd.xic) { XUnsetICFocus(wd.xic); @@ -3235,7 +3235,7 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u } } else { - wd.xic = NULL; + wd.xic = nullptr; WARN_PRINT("XCreateIC couldn't create wd.xic"); } @@ -3380,12 +3380,12 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode for (int i = 0; i < CURSOR_MAX; i++) { cursors[i] = None; - img[i] = NULL; + img[i] = nullptr; } last_button_state = 0; - xmbstring = NULL; + xmbstring = nullptr; last_click_ms = 0; last_click_button_index = -1; @@ -3398,7 +3398,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode XInitThreads(); //always use threads /** XLIB INITIALIZATION **/ - x11_display = XOpenDisplay(NULL); + x11_display = XOpenDisplay(nullptr); if (!x11_display) { ERR_PRINT("X11 Display is not available"); @@ -3406,10 +3406,10 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode return; } - char *modifiers = NULL; + char *modifiers = nullptr; Bool xkb_dar = False; XAutoRepeatOn(x11_display); - xkb_dar = XkbSetDetectableAutoRepeat(x11_display, True, NULL); + xkb_dar = XkbSetDetectableAutoRepeat(x11_display, True, nullptr); // Try to support IME if detectable auto-repeat is supported if (xkb_dar == True) { @@ -3421,7 +3421,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode #endif } - if (modifiers == NULL) { + if (modifiers == nullptr) { if (OS::get_singleton()->is_stdout_verbose()) { WARN_PRINT("IME is disabled"); } @@ -3430,8 +3430,8 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode } const char *err; - xrr_get_monitors = NULL; - xrr_free_monitors = NULL; + xrr_get_monitors = nullptr; + xrr_free_monitors = nullptr; int xrandr_major = 0; int xrandr_minor = 0; int event_base, error_base; @@ -3452,7 +3452,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode if (!xrr_free_monitors) { err = dlerror(); fprintf(stderr, "could not find XRRFreeMonitors\nError: %s\n", err); - xrr_get_monitors = NULL; + xrr_get_monitors = nullptr; } } } @@ -3466,9 +3466,9 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode return; } - xim = XOpenIM(x11_display, NULL, NULL, NULL); + xim = XOpenIM(x11_display, nullptr, nullptr, nullptr); - if (xim == NULL) { + if (xim == nullptr) { WARN_PRINT("XOpenIM failed"); xim_style = 0L; } else { @@ -3476,14 +3476,14 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode im_destroy_callback.client_data = (::XPointer)(this); im_destroy_callback.callback = (::XIMProc)(_xim_destroy_callback); if (XSetIMValues(xim, XNDestroyCallback, &im_destroy_callback, - NULL) != NULL) { + nullptr) != nullptr) { WARN_PRINT("Error setting XIM destroy callback"); } - ::XIMStyles *xim_styles = NULL; + ::XIMStyles *xim_styles = nullptr; xim_style = 0L; - char *imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); - if (imvalret != NULL || xim_styles == NULL) { + char *imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, nullptr); + if (imvalret != nullptr || xim_styles == nullptr) { fprintf(stderr, "Input method doesn't support any styles\n"); } @@ -3532,7 +3532,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode context_vulkan = memnew(VulkanContextX11); if (context_vulkan->initialize() != OK) { memdelete(context_vulkan); - context_vulkan = NULL; + context_vulkan = nullptr; r_error = ERR_CANT_CREATE; ERR_FAIL_MSG("Could not initialize Vulkan"); } @@ -3541,7 +3541,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode // Init context and rendering device #if defined(OPENGL_ENABLED) if (rendering_driver == "opengl_es") { - if (getenv("DRI_PRIME") == NULL) { + if (getenv("DRI_PRIME") == nullptr) { int use_prime = -1; if (getenv("PRIMUS_DISPLAY") || @@ -3587,7 +3587,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode if (context_gles2->initialize() != OK) { memdelete(context_gles2); - context_gles2 = NULL; + context_gles2 = nullptr; ERR_FAIL_V(ERR_UNAVAILABLE); } @@ -3598,7 +3598,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode RasterizerGLES2::make_current(); } else { memdelete(context_gles2); - context_gles2 = NULL; + context_gles2 = nullptr; ERR_FAIL_V(ERR_UNAVAILABLE); } } @@ -3683,7 +3683,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size); if (!img[i]) { - const char *fallback = NULL; + const char *fallback = nullptr; switch (i) { case CURSOR_POINTING_HAND: @@ -3732,7 +3732,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode fallback = "help"; break; } - if (fallback != NULL) { + if (fallback != nullptr) { img[i] = XcursorLibraryLoadImage(fallback, cursor_theme, cursor_size); } } @@ -3832,7 +3832,7 @@ DisplayServerX11::~DisplayServerX11() { for (int i = 0; i < CURSOR_MAX; i++) { if (cursors[i] != None) XFreeCursor(x11_display, cursors[i]); - if (img[i] != NULL) + if (img[i] != nullptr) XcursorImageDestroy(img[i]); }; diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index c4c793093d..381eb909ba 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -54,7 +54,7 @@ JoypadLinux::Joypad::Joypad() { dpad = 0; devpath = ""; for (int i = 0; i < MAX_ABS; i++) { - abs_info[i] = NULL; + abs_info[i] = nullptr; } } @@ -146,9 +146,9 @@ void JoypadLinux::enumerate_joypads(udev *p_udev) { void JoypadLinux::monitor_joypads(udev *p_udev) { - udev_device *dev = NULL; + udev_device *dev = nullptr; udev_monitor *mon = udev_monitor_new_from_netlink(p_udev, "udev"); - udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL); + udev_monitor_filter_add_match_subsystem_devtype(mon, "input", nullptr); udev_monitor_enable_receiving(mon); int fd = udev_monitor_get_fd(mon); @@ -163,7 +163,7 @@ void JoypadLinux::monitor_joypads(udev *p_udev) { tv.tv_sec = 0; tv.tv_usec = 0; - ret = select(fd + 1, &fds, NULL, NULL, &tv); + ret = select(fd + 1, &fds, nullptr, nullptr, &tv); /* Check if our file descriptor has received data. */ if (ret > 0 && FD_ISSET(fd, &fds)) { @@ -299,7 +299,7 @@ void JoypadLinux::setup_joypad_properties(int p_id) { joy->abs_info[i] = memnew(input_absinfo); if (ioctl(joy->fd, EVIOCGABS(i), joy->abs_info[i]) < 0) { memdelete(joy->abs_info[i]); - joy->abs_info[i] = NULL; + joy->abs_info[i] = nullptr; } } } diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 084453bdc6..5b9a25bd8b 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -87,7 +87,7 @@ void OS_LinuxBSD::finalize() { if (main_loop) memdelete(main_loop); - main_loop = NULL; + main_loop = nullptr; #ifdef ALSAMIDI_ENABLED driver_alsamidi.close(); @@ -107,7 +107,7 @@ void OS_LinuxBSD::delete_main_loop() { if (main_loop) memdelete(main_loop); - main_loop = NULL; + main_loop = nullptr; } void OS_LinuxBSD::set_main_loop(MainLoop *p_main_loop) { @@ -230,7 +230,7 @@ String OS_LinuxBSD::get_system_dir(SystemDir p_dir) const { String pipe; List<String> arg; arg.push_back(xdgparam); - Error err = const_cast<OS_LinuxBSD *>(this)->execute("xdg-user-dir", arg, true, NULL, &pipe); + Error err = const_cast<OS_LinuxBSD *>(this)->execute("xdg-user-dir", arg, true, nullptr, &pipe); if (err != OK) return "."; return pipe.strip_edges(); @@ -351,7 +351,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { mv_args.push_back(p_path); mv_args.push_back(trash_can); int retval; - err = execute("mv", mv_args, true, NULL, NULL, &retval); + err = execute("mv", mv_args, true, nullptr, nullptr, &retval); // Issue an error if "mv" failed to move the given resource to the trash can. if (err != OK || retval != 0) { @@ -364,7 +364,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { OS_LinuxBSD::OS_LinuxBSD() { - main_loop = NULL; + main_loop = nullptr; force_quit = false; #ifdef PULSEAUDIO_ENABLED diff --git a/platform/linuxbsd/vulkan_context_x11.cpp b/platform/linuxbsd/vulkan_context_x11.cpp index d0e1b1678c..1798a7026e 100644 --- a/platform/linuxbsd/vulkan_context_x11.cpp +++ b/platform/linuxbsd/vulkan_context_x11.cpp @@ -39,13 +39,13 @@ Error VulkanContextX11::window_create(DisplayServer::WindowID p_window_id, ::Win VkXlibSurfaceCreateInfoKHR createInfo; createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; - createInfo.pNext = NULL; + createInfo.pNext = nullptr; createInfo.flags = 0; createInfo.dpy = p_display; createInfo.window = p_window; VkSurfaceKHR surface; - VkResult err = vkCreateXlibSurfaceKHR(_get_instance(), &createInfo, NULL, &surface); + VkResult err = vkCreateXlibSurfaceKHR(_get_instance(), &createInfo, nullptr, &surface); ERR_FAIL_COND_V(err, ERR_CANT_CREATE); return _window_create(p_window_id, surface, p_width, p_height); } |