diff options
author | David Robillard <d@drobilla.net> | 2020-12-22 15:52:51 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-22 16:18:39 +0100 |
commit | 2769f3eadd6de75a2571b9c857509a76f7652205 (patch) | |
tree | 861f18539958c41e89426507e1819154ded5d5d7 /src | |
parent | ff49394a00f79d939b45c93a8d8e8a2d9194bfad (diff) | |
download | suil-2769f3eadd6de75a2571b9c857509a76f7652205.tar.gz suil-2769f3eadd6de75a2571b9c857509a76f7652205.tar.bz2 suil-2769f3eadd6de75a2571b9c857509a76f7652205.zip |
Use "auto" to avoid redundancy
Diffstat (limited to 'src')
-rw-r--r-- | src/gtk2_in_qt5.cpp | 22 | ||||
-rw-r--r-- | src/qt5_in_gtk.cpp | 6 | ||||
-rw-r--r-- | src/x11_in_qt5.cpp | 27 |
3 files changed, 28 insertions, 27 deletions
diff --git a/src/gtk2_in_qt5.cpp b/src/gtk2_in_qt5.cpp index 1832132..e8967b5 100644 --- a/src/gtk2_in_qt5.cpp +++ b/src/gtk2_in_qt5.cpp @@ -49,21 +49,21 @@ typedef struct { static void on_size_request(GtkWidget*, GtkRequisition* requisition, gpointer user_data) { - QWidget* const wrap = (QWidget*)user_data; + auto* const wrap = (QWidget*)user_data; wrap->setMinimumSize(requisition->width, requisition->height); } static void on_size_allocate(GtkWidget*, GdkRectangle* allocation, gpointer user_data) { - QWidget* const wrap = (QWidget*)user_data; + auto* const wrap = (QWidget*)user_data; wrap->resize(allocation->width, allocation->height); } static void wrapper_free(SuilWrapper* wrapper) { - SuilGtk2InQt5Wrapper* impl = (SuilGtk2InQt5Wrapper*)wrapper->impl; + auto* impl = (SuilGtk2InQt5Wrapper*)wrapper->impl; if (impl->window) { impl->window->setParent(nullptr); @@ -83,10 +83,10 @@ static int wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance) { - SuilGtk2InQt5Wrapper* const impl = (SuilGtk2InQt5Wrapper*)wrapper->impl; - QWidget* const wrap = new QWidget(nullptr, Qt::Window); - GtkWidget* const plug = gtk_plug_new(0); - GtkWidget* const widget = (GtkWidget*)instance->ui_widget; + auto* const impl = (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; gtk_container_add(GTK_CONTAINER(plug), widget); gtk_widget_show_all(plug); @@ -96,7 +96,7 @@ wrapper_wrap(SuilWrapper* wrapper, QWidget* container = QWidget::createWindowContainer(window, wrap, Qt::WindowFlags()); - QVBoxLayout* layout = new QVBoxLayout(); + auto* layout = new QVBoxLayout(); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(container, 0, Qt::Alignment()); @@ -149,10 +149,10 @@ suil_wrapper_new(SuilHost* host, } /* Create wrapper implementation. */ - SuilGtk2InQt5Wrapper* const impl = (SuilGtk2InQt5Wrapper*) - calloc(1, sizeof(SuilGtk2InQt5Wrapper)); + auto* const impl = + (SuilGtk2InQt5Wrapper*)calloc(1, sizeof(SuilGtk2InQt5Wrapper)); - SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper)); + auto* wrapper = (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 6ef50f6..ae33436 100644 --- a/src/qt5_in_gtk.cpp +++ b/src/qt5_in_gtk.cpp @@ -154,8 +154,8 @@ wrapper_wrap(SuilWrapper* wrapper, wrap->wrapper = wrapper; wrap->instance = instance; - QWidget* qwidget = (QWidget*)instance->ui_widget; - QVBoxLayout* layout = new QVBoxLayout(); + auto* qwidget = (QWidget*)instance->ui_widget; + auto* layout = new QVBoxLayout(); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(qwidget, 0, Qt::Alignment()); @@ -199,7 +199,7 @@ suil_wrapper_new(SuilHost*, LV2_Feature*** features, unsigned n_features) { - SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper)); + auto* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper)); wrapper->wrap = wrapper_wrap; wrapper->free = wrapper_free; diff --git a/src/x11_in_qt5.cpp b/src/x11_in_qt5.cpp index 5dd8c9d..642996c 100644 --- a/src/x11_in_qt5.cpp +++ b/src/x11_in_qt5.cpp @@ -144,7 +144,7 @@ typedef struct { static void wrapper_free(SuilWrapper* wrapper) { - SuilX11InQt5Wrapper* impl = (SuilX11InQt5Wrapper*)wrapper->impl; + auto* impl = (SuilX11InQt5Wrapper*)wrapper->impl; delete impl->host_widget; @@ -155,10 +155,10 @@ static int wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance) { - SuilX11InQt5Wrapper* const impl = (SuilX11InQt5Wrapper*)wrapper->impl; - SuilQX11Widget* const ew = impl->parent; - Display* const display = QX11Info::display(); - const Window window = (Window)instance->ui_widget; + auto* const impl = (SuilX11InQt5Wrapper*)wrapper->impl; + SuilQX11Widget* const ew = impl->parent; + Display* const display = QX11Info::display(); + const auto window = (Window)instance->ui_widget; XWindowAttributes attrs{}; XSizeHints hints{}; @@ -182,9 +182,10 @@ wrapper_wrap(SuilWrapper* wrapper, } if (instance->descriptor->extension_data) { - const LV2UI_Idle_Interface* idle_iface - = (const LV2UI_Idle_Interface*) - instance->descriptor->extension_data(LV2_UI__idleInterface); + const auto* idle_iface = + (const LV2UI_Idle_Interface*)instance->descriptor->extension_data( + LV2_UI__idleInterface); + ew->start_idle(instance, idle_iface); } @@ -198,7 +199,7 @@ wrapper_wrap(SuilWrapper* wrapper, static int wrapper_resize(LV2UI_Feature_Handle handle, int width, int height) { - QWidget* const ew = (QWidget*)handle; + auto* const ew = (QWidget*)handle; ew->resize(width, height); return 0; } @@ -211,14 +212,14 @@ suil_wrapper_new(SuilHost*, LV2_Feature*** features, unsigned n_features) { - SuilX11InQt5Wrapper* const impl = (SuilX11InQt5Wrapper*) - calloc(1, sizeof(SuilX11InQt5Wrapper)); + auto* const impl = + (SuilX11InQt5Wrapper*)calloc(1, sizeof(SuilX11InQt5Wrapper)); - SuilWrapper* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper)); + auto* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper)); wrapper->wrap = wrapper_wrap; wrapper->free = wrapper_free; - SuilQX11Widget* const ew = new SuilQX11Widget(nullptr, Qt::Window); + auto* const ew = new SuilQX11Widget(nullptr, Qt::Window); impl->parent = ew; |