From c1286c80008f1a538f959167f4935b40105b9d96 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 16 Dec 2017 08:56:50 +0100 Subject: Clean up feature code in wrappers --- src/cocoa_in_gtk2.mm | 9 +++------ src/win_in_gtk2.cpp | 9 +++------ src/x11_in_gtk2.c | 9 +++------ src/x11_in_gtk3.c | 9 +++------ src/x11_in_qt4.cpp | 9 +++------ src/x11_in_qt5.cpp | 9 +++------ 6 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/cocoa_in_gtk2.mm b/src/cocoa_in_gtk2.mm index be732bd..0d796fb 100644 --- a/src/cocoa_in_gtk2.mm +++ b/src/cocoa_in_gtk2.mm @@ -387,12 +387,9 @@ suil_wrapper_new(SuilHost* host, wrap->flt_win = gtk_widget_get_window(parent); gdk_window_add_filter(wrap->flt_win, event_filter, wrap); - suil_add_feature(features, &n_features, LV2_UI__parent, - gdk_quartz_window_get_nsview(window)); - - suil_add_feature(features, &n_features, LV2_UI__resize, - &wrapper->resize); - + NSView* parent_view = gdk_quartz_window_get_nsview(window); + suil_add_feature(features, &n_features, LV2_UI__parent, parent_view); + suil_add_feature(features, &n_features, LV2_UI__resize, &wrapper->resize); suil_add_feature(features, &n_features, LV2_UI__idleInterface, NULL); // Scan for URID map and options diff --git a/src/win_in_gtk2.cpp b/src/win_in_gtk2.cpp index ebab5ff..ca8bf2a 100644 --- a/src/win_in_gtk2.cpp +++ b/src/win_in_gtk2.cpp @@ -225,12 +225,9 @@ suil_wrapper_new(SuilHost* host, wrap->flt_win = gtk_widget_get_window(parent); gdk_window_add_filter(wrap->flt_win, event_filter, wrap); - suil_add_feature(features, &n_features, LV2_UI__parent, - GDK_WINDOW_HWND(window)); - - suil_add_feature(features, &n_features, LV2_UI__resize, - &wrapper->resize); - + HWND parent_window = GDK_WINDOW_HWND; + suil_add_feature(features, &n_features, LV2_UI__parent, parent_window); + suil_add_feature(features, &n_features, LV2_UI__resize, &wrapper->resize); suil_add_feature(features, &n_features, LV2_UI__idleInterface, NULL); // Scan for URID map and options diff --git a/src/x11_in_gtk2.c b/src/x11_in_gtk2.c index 21390cd..7ec9592 100644 --- a/src/x11_in_gtk2.c +++ b/src/x11_in_gtk2.c @@ -367,12 +367,9 @@ suil_wrapper_new(SuilHost* host, gtk_widget_set_sensitive(GTK_WIDGET(wrap), TRUE); gtk_widget_set_can_focus(GTK_WIDGET(wrap), TRUE); - suil_add_feature(features, &n_features, LV2_UI__parent, - (void*)(intptr_t)gtk_plug_get_id(wrap->plug)); - - suil_add_feature(features, &n_features, LV2_UI__resize, - &wrapper->resize); - + const intptr_t parent_id = (intptr_t)gtk_plug_get_id(wrap->plug); + suil_add_feature(features, &n_features, LV2_UI__parent, (void*)parent_id); + suil_add_feature(features, &n_features, LV2_UI__resize, &wrapper->resize); suil_add_feature(features, &n_features, LV2_UI__idleInterface, NULL); // Scan for URID map and options diff --git a/src/x11_in_gtk3.c b/src/x11_in_gtk3.c index 6dd00f6..0c016c9 100644 --- a/src/x11_in_gtk3.c +++ b/src/x11_in_gtk3.c @@ -371,12 +371,9 @@ suil_wrapper_new(SuilHost* host, gtk_widget_set_sensitive(GTK_WIDGET(wrap), TRUE); gtk_widget_set_can_focus(GTK_WIDGET(wrap), TRUE); - suil_add_feature(features, &n_features, LV2_UI__parent, - (void*)(intptr_t)gtk_plug_get_id(wrap->plug)); - - suil_add_feature(features, &n_features, LV2_UI__resize, - &wrapper->resize); - + const intptr_t parent_id = (intptr_t)gtk_plug_get_id(wrap->plug); + suil_add_feature(features, &n_features, LV2_UI__parent, (void*)parent_id); + suil_add_feature(features, &n_features, LV2_UI__resize, &wrapper->resize); suil_add_feature(features, &n_features, LV2_UI__idleInterface, NULL); // Scan for URID map and options diff --git a/src/x11_in_qt4.cpp b/src/x11_in_qt4.cpp index 8d12526..c21357d 100644 --- a/src/x11_in_qt4.cpp +++ b/src/x11_in_qt4.cpp @@ -140,12 +140,9 @@ suil_wrapper_new(SuilHost* host, wrapper->resize.handle = ew; wrapper->resize.ui_resize = wrapper_resize; - suil_add_feature(features, &n_features, LV2_UI__parent, - (void*)(intptr_t)ew->winId()); - - suil_add_feature(features, &n_features, LV2_UI__resize, - &wrapper->resize); - + const intptr_t parent_id = (intptr_t)ew->winId(); + suil_add_feature(features, &n_features, LV2_UI__parent, (void*)parent_id); + suil_add_feature(features, &n_features, LV2_UI__resize, &wrapper->resize); suil_add_feature(features, &n_features, LV2_UI__idleInterface, NULL); return wrapper; diff --git a/src/x11_in_qt5.cpp b/src/x11_in_qt5.cpp index 6a8cd8a..be90323 100644 --- a/src/x11_in_qt5.cpp +++ b/src/x11_in_qt5.cpp @@ -137,12 +137,9 @@ suil_wrapper_new(SuilHost* host, wrapper->resize.handle = ew; wrapper->resize.ui_resize = wrapper_resize; - suil_add_feature(features, &n_features, LV2_UI__parent, - (void*)(intptr_t)ew->winId()); - - suil_add_feature(features, &n_features, LV2_UI__resize, - &wrapper->resize); - + void* parent_id = (void*)(intptr_t)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, NULL); return wrapper; -- cgit v1.2.1