summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gtk2_in_qt5.cpp22
-rw-r--r--src/qt5_in_gtk.cpp19
-rw-r--r--src/x11_in_qt5.cpp24
3 files changed, 34 insertions, 31 deletions
diff --git a/src/gtk2_in_qt5.cpp b/src/gtk2_in_qt5.cpp
index 69b4dce..a5c98f1 100644
--- a/src/gtk2_in_qt5.cpp
+++ b/src/gtk2_in_qt5.cpp
@@ -54,21 +54,21 @@ struct SuilGtk2InQt5Wrapper {
static void
on_size_request(GtkWidget*, GtkRequisition* requisition, gpointer user_data)
{
- auto* const wrap = (QWidget*)user_data;
+ auto* const wrap = static_cast<QWidget*>(user_data);
wrap->setMinimumSize(requisition->width, requisition->height);
}
static void
on_size_allocate(GtkWidget*, GdkRectangle* allocation, gpointer user_data)
{
- auto* const wrap = (QWidget*)user_data;
+ auto* const wrap = static_cast<QWidget*>(user_data);
wrap->resize(allocation->width, allocation->height);
}
static void
wrapper_free(SuilWrapper* wrapper)
{
- auto* impl = (SuilGtk2InQt5Wrapper*)wrapper->impl;
+ auto* impl = static_cast<SuilGtk2InQt5Wrapper*>(wrapper->impl);
if (impl->window) {
impl->window->setParent(nullptr);
@@ -87,17 +87,19 @@ wrapper_free(SuilWrapper* wrapper)
static int
wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
{
- auto* const impl = (SuilGtk2InQt5Wrapper*)wrapper->impl;
+ auto* const impl = static_cast<SuilGtk2InQt5Wrapper*>(wrapper->impl);
auto* const wrap = new QWidget(nullptr, Qt::Window);
GtkWidget* const plug = gtk_plug_new(0);
- auto* const widget = (GtkWidget*)instance->ui_widget;
+ auto* const widget = static_cast<GtkWidget*>(instance->ui_widget);
gtk_container_add(GTK_CONTAINER(plug), widget);
gtk_widget_show_all(plug);
- const WId wid = (WId)gtk_plug_get_id((GtkPlug*)plug);
- QWindow* window = QWindow::fromWinId(wid);
- QWidget* container =
+ const WId wid =
+ static_cast<WId>(gtk_plug_get_id(reinterpret_cast<GtkPlug*>(plug)));
+
+ QWindow* window = QWindow::fromWinId(wid);
+ QWidget* container =
QWidget::createWindowContainer(window, wrap, Qt::WindowFlags());
auto* layout = new QVBoxLayout();
@@ -155,9 +157,9 @@ suil_wrapper_new(SuilHost* host,
/* Create wrapper implementation. */
auto* const impl =
- (SuilGtk2InQt5Wrapper*)calloc(1, sizeof(SuilGtk2InQt5Wrapper));
+ static_cast<SuilGtk2InQt5Wrapper*>(calloc(1, sizeof(SuilGtk2InQt5Wrapper)));
- auto* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
+ auto* wrapper = static_cast<SuilWrapper*>(calloc(1, sizeof(SuilWrapper)));
wrapper->wrap = wrapper_wrap;
wrapper->free = wrapper_free;
wrapper->impl = impl;
diff --git a/src/qt5_in_gtk.cpp b/src/qt5_in_gtk.cpp
index 3699ae8..6277daa 100644
--- a/src/qt5_in_gtk.cpp
+++ b/src/qt5_in_gtk.cpp
@@ -125,7 +125,7 @@ suil_qt_wrapper_realize(GtkWidget* w, gpointer)
{
SuilQtWrapper* const wrap = SUIL_QT_WRAPPER(w);
GtkSocket* const s = GTK_SOCKET(w);
- const WId id = (WId)gtk_socket_get_id(s);
+ const WId id = static_cast<WId>(gtk_socket_get_id(s));
wrap->qembed->winId();
wrap->qembed->windowHandle()->setParent(QWindow::fromWinId(id));
@@ -162,7 +162,7 @@ wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
wrap->wrapper = wrapper;
wrap->instance = instance;
- auto* qwidget = (QWidget*)instance->ui_widget;
+ auto* qwidget = static_cast<QWidget*>(instance->ui_widget);
auto* layout = new QVBoxLayout();
layout->setMargin(0);
layout->setSpacing(0);
@@ -177,9 +177,8 @@ wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
const LV2UI_Idle_Interface* idle_iface = nullptr;
if (instance->descriptor->extension_data) {
- idle_iface =
- (const LV2UI_Idle_Interface*)instance->descriptor->extension_data(
- LV2_UI__idleInterface);
+ idle_iface = static_cast<const LV2UI_Idle_Interface*>(
+ instance->descriptor->extension_data(LV2_UI__idleInterface));
}
if (idle_iface) {
@@ -207,7 +206,7 @@ suil_wrapper_new(SuilHost*,
LV2_Feature*** features,
unsigned n_features)
{
- auto* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
+ auto* wrapper = static_cast<SuilWrapper*>(calloc(1, sizeof(SuilWrapper)));
wrapper->wrap = wrapper_wrap;
wrapper->free = wrapper_free;
@@ -228,9 +227,9 @@ suil_wrapper_new(SuilHost*,
LV2_Options_Option* options = nullptr;
for (LV2_Feature** f = *features; *f && (!map || !options); ++f) {
if (!strcmp((*f)->URI, LV2_OPTIONS__options)) {
- options = (LV2_Options_Option*)(*f)->data;
+ options = static_cast<LV2_Options_Option*>((*f)->data);
} else if (!strcmp((*f)->URI, LV2_URID__map)) {
- map = (LV2_URID_Map*)(*f)->data;
+ map = static_cast<LV2_URID_Map*>((*f)->data);
}
}
@@ -239,7 +238,9 @@ suil_wrapper_new(SuilHost*,
LV2_URID ui_updateRate = map->map(map->handle, LV2_UI__updateRate);
for (LV2_Options_Option* o = options; o->key; ++o) {
if (o->key == ui_updateRate) {
- wrap->idle_ms = (guint)(1000.0f / *(const float*)o->value);
+ wrap->idle_ms =
+ static_cast<guint>(1000.0f / *static_cast<const float*>(o->value));
+
break;
}
}
diff --git a/src/x11_in_qt5.cpp b/src/x11_in_qt5.cpp
index ba7f036..a288319 100644
--- a/src/x11_in_qt5.cpp
+++ b/src/x11_in_qt5.cpp
@@ -105,8 +105,8 @@ protected:
if (_window) {
XResizeWindow(QX11Info::display(),
_window,
- (unsigned)event->size().width(),
- (unsigned)event->size().height());
+ static_cast<unsigned>(event->size().width()),
+ static_cast<unsigned>(event->size().height()));
}
}
@@ -146,7 +146,7 @@ struct SuilX11InQt5Wrapper {
static void
wrapper_free(SuilWrapper* wrapper)
{
- auto* impl = (SuilX11InQt5Wrapper*)wrapper->impl;
+ auto* impl = static_cast<SuilX11InQt5Wrapper*>(wrapper->impl);
delete impl->host_widget;
@@ -156,10 +156,11 @@ wrapper_free(SuilWrapper* wrapper)
static int
wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
{
- auto* const impl = (SuilX11InQt5Wrapper*)wrapper->impl;
+ auto* const impl = static_cast<SuilX11InQt5Wrapper*>(wrapper->impl);
+
SuilQX11Widget* const ew = impl->parent;
Display* const display = QX11Info::display();
- const auto window = (Window)instance->ui_widget;
+ const auto window = reinterpret_cast<Window>(instance->ui_widget);
XWindowAttributes attrs{};
XSizeHints hints{};
@@ -183,9 +184,8 @@ wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
}
if (instance->descriptor->extension_data) {
- const auto* idle_iface =
- (const LV2UI_Idle_Interface*)instance->descriptor->extension_data(
- LV2_UI__idleInterface);
+ const auto* idle_iface = static_cast<const LV2UI_Idle_Interface*>(
+ instance->descriptor->extension_data(LV2_UI__idleInterface));
ew->start_idle(instance, idle_iface);
}
@@ -199,7 +199,7 @@ wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance)
static int
wrapper_resize(LV2UI_Feature_Handle handle, int width, int height)
{
- auto* const ew = (QWidget*)handle;
+ auto* const ew = static_cast<QWidget*>(handle);
ew->resize(width, height);
return 0;
}
@@ -213,9 +213,9 @@ suil_wrapper_new(SuilHost*,
unsigned n_features)
{
auto* const impl =
- (SuilX11InQt5Wrapper*)calloc(1, sizeof(SuilX11InQt5Wrapper));
+ static_cast<SuilX11InQt5Wrapper*>(calloc(1, sizeof(SuilX11InQt5Wrapper)));
- auto* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper));
+ auto* wrapper = static_cast<SuilWrapper*>(malloc(sizeof(SuilWrapper)));
wrapper->wrap = wrapper_wrap;
wrapper->free = wrapper_free;
@@ -227,7 +227,7 @@ suil_wrapper_new(SuilHost*,
wrapper->resize.handle = ew;
wrapper->resize.ui_resize = wrapper_resize;
- void* parent_id = (void*)(intptr_t)ew->winId();
+ void* parent_id = reinterpret_cast<void*>(ew->winId());
suil_add_feature(features, &n_features, LV2_UI__parent, parent_id);
suil_add_feature(features, &n_features, LV2_UI__resize, &wrapper->resize);
suil_add_feature(features, &n_features, LV2_UI__idleInterface, nullptr);