1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init

Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
This commit is contained in:
Rémi Verschelde
2022-05-02 16:28:25 +02:00
parent dd06cb90c5
commit c273ddc3ee
156 changed files with 749 additions and 951 deletions

View File

@@ -55,7 +55,7 @@
typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROC)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
struct vendor {
const char *glxvendor;
const char *glxvendor = nullptr;
int priority = 0;
};

View File

@@ -4531,24 +4531,11 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
r_error = OK;
current_cursor = CURSOR_ARROW;
mouse_mode = MOUSE_MODE_VISIBLE;
for (int i = 0; i < CURSOR_MAX; i++) {
cursors[i] = None;
img[i] = nullptr;
}
xmbstring = nullptr;
last_click_ms = 0;
last_click_button_index = MouseButton::NONE;
last_click_pos = Point2i(-100, -100);
last_timestamp = 0;
last_mouse_pos_valid = false;
last_keyrelease_time = 0;
XInitThreads(); //always use threads
/** XLIB INITIALIZATION **/
@@ -4583,8 +4570,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
const char *err;
xrr_get_monitors = nullptr;
xrr_free_monitors = nullptr;
int xrandr_major = 0;
int xrandr_minor = 0;
int event_base, error_base;
@@ -4660,11 +4645,10 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
XFree(imvalret);
}
/* Atorm internment */
/* Atom internment */
wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true);
//Set Xdnd (drag & drop) support
// Set Xdnd (drag & drop) support.
xdnd_aware = XInternAtom(x11_display, "XdndAware", False);
xdnd_version = 5;
xdnd_enter = XInternAtom(x11_display, "XdndEnter", False);
xdnd_position = XInternAtom(x11_display, "XdndPosition", False);
xdnd_status = XInternAtom(x11_display, "XdndStatus", False);
@@ -4751,11 +4735,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
driver_found = true;
// gl_manager->set_use_vsync(current_videomode.use_vsync);
if (true) {
// if (RasterizerGLES3::is_viable() == OK) {
// RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
} else {
memdelete(gl_manager);
@@ -4930,12 +4910,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
cursor_set_shape(CURSOR_BUSY);
requested = None;
/*if (p_desired.layered) {
set_window_per_pixel_transparency_enabled(true);
}*/
XEvent xevent;
while (XPending(x11_display) > 0) {
XNextEvent(x11_display, &xevent);

View File

@@ -100,8 +100,8 @@ class DisplayServerX11 : public DisplayServer {
Atom xdnd_finished;
Atom xdnd_selection;
Atom xdnd_aware;
Atom requested;
int xdnd_version;
Atom requested = None;
int xdnd_version = 5;
#if defined(GLES3_ENABLED)
GLManager_X11 *gl_manager = nullptr;
@@ -174,21 +174,21 @@ class DisplayServerX11 : public DisplayServer {
String internal_clipboard;
String internal_clipboard_primary;
Window xdnd_source_window;
Window xdnd_source_window = 0;
::Display *x11_display;
char *xmbstring = nullptr;
int xmblen;
unsigned long last_timestamp;
::Time last_keyrelease_time;
int xmblen = 0;
unsigned long last_timestamp = 0;
::Time last_keyrelease_time = 0;
::XIM xim;
::XIMStyle xim_style;
static void _xim_destroy_callback(::XIM im, ::XPointer client_data,
::XPointer call_data);
Point2i last_mouse_pos;
bool last_mouse_pos_valid;
Point2i last_click_pos;
uint64_t last_click_ms;
bool last_mouse_pos_valid = false;
Point2i last_click_pos = Point2i(-100, -100);
uint64_t last_click_ms = 0;
MouseButton last_click_button_index = MouseButton::NONE;
MouseButton last_button_state = MouseButton::NONE;
bool app_focused = false;
@@ -221,7 +221,7 @@ class DisplayServerX11 : public DisplayServer {
void _get_key_modifier_state(unsigned int p_x11_state, Ref<InputEventWithModifiers> state);
void _flush_mouse_motion();
MouseMode mouse_mode;
MouseMode mouse_mode = MOUSE_MODE_VISIBLE;
Point2i center;
void _handle_key_event(WindowID p_window, XKeyEvent *p_event, LocalVector<XEvent> &p_events, uint32_t &p_event_index, bool p_echo = false);
@@ -233,30 +233,26 @@ class DisplayServerX11 : public DisplayServer {
String _clipboard_get(Atom p_source, Window x11_window) const;
void _clipboard_transfer_ownership(Atom p_source, Window x11_window) const;
//bool minimized;
//bool window_has_focus;
bool do_mouse_warp;
bool do_mouse_warp = false;
const char *cursor_theme;
int cursor_size;
const char *cursor_theme = nullptr;
int cursor_size = 0;
XcursorImage *img[CURSOR_MAX];
Cursor cursors[CURSOR_MAX];
Cursor null_cursor;
CursorShape current_cursor;
CursorShape current_cursor = CURSOR_ARROW;
Map<CursorShape, Vector<Variant>> cursors_cache;
bool layered_window;
bool layered_window = false;
String rendering_driver;
//bool window_focused;
//void set_wm_border(bool p_enabled);
void set_wm_fullscreen(bool p_enabled);
void set_wm_above(bool p_enabled);
typedef xrr_monitor_info *(*xrr_get_monitors_t)(Display *dpy, Window window, Bool get_active, int *nmonitors);
typedef void (*xrr_free_monitors_t)(xrr_monitor_info *monitors);
xrr_get_monitors_t xrr_get_monitors;
xrr_free_monitors_t xrr_free_monitors;
xrr_get_monitors_t xrr_get_monitors = nullptr;
xrr_free_monitors_t xrr_free_monitors = nullptr;
void *xrandr_handle = nullptr;
Bool xrandr_ext_ok;