tools: port perf ui from GTK 2 to GTK 3
PATCH 1/1 tools: port perf ui from GTK 2 to GTK 3
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions. gtk_tree_view_set_rules_hint is no longer required since theme's are now responsible to handle this, gtk_vbox_new is deprecated and replaced by passing the orientation to gtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly the GTK_STOCK_OK define is deprecated in GTK 3.
---
Originally sent in 2019. I've rebased it and given it a test.
One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”
Presumably we need to call g_markup_escape_text() somewhere, but I struggled to find the right place.
Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
tools/build/Makefile.feature | 5 +++--
tools/build/feature/Makefile | 12 +++++-----
tools/build/feature/test-all.c | 10 +++++++++
...est-gtk2-infobar.c => test-gtk3-infobar.c} | 0
.../feature/{test-gtk2.c => test-gtk3.c} | 0
tools/perf/Documentation/perf-report.txt | 2 +-
tools/perf/Makefile | 2 +-
tools/perf/Makefile.config | 22 +++++++++----------
tools/perf/Makefile.perf | 6 ++---
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-version.c | 1 +
tools/perf/tests/make | 12 +++++-----
tools/perf/ui/gtk/annotate.c | 2 +-
tools/perf/ui/gtk/browser.c | 16 ++++++++------
tools/perf/ui/gtk/hists.c | 6 +----
tools/perf/ui/gtk/progress.c | 2 +-
tools/perf/ui/setup.c | 2 +-
17 files changed, 56 insertions(+), 46 deletions(-)
rename tools/build/feature/{test-gtk2-infobar.c => test-gtk3-infobar.c} (100%)
rename tools/build/feature/{test-gtk2.c => test-gtk3.c} (100%)tools/build/Makefile.feature +3 -2
@@ -79,8 +79,8 @@ FEATURE_TESTS_EXTRA := \ compile-32 \ compile-x32 \ cplus-demangle \ - gtk2 \ - gtk2-infobar \ + gtk3 \ + gtk3-infobar \ hello \ libbabeltrace \ libbfd-liberty \
@@ -113,6 +113,7 @@ FEATURE_DISPLAY ?= \ dwarf \ dwarf_getlocations \ glibc \ + gtk3 \ libbfd \ libbfd-buildid \ libcap \
tools/build/feature/Makefile +6 -6
@@ -11,8 +11,8 @@ FILES= \ test-fortify-source.bin \ test-get_current_dir_name.bin \ test-glibc.bin \ - test-gtk2.bin \ - test-gtk2-infobar.bin \ + test-gtk3.bin \ + test-gtk3-infobar.bin \ test-hello.bin \ test-libaudit.bin \ test-libbfd.bin \
@@ -205,11 +205,11 @@ $(OUTPUT)test-libtracefs.bin: $(OUTPUT)test-libcrypto.bin: $(BUILD) -lcrypto -$(OUTPUT)test-gtk2.bin: - $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) -Wno-deprecated-declarations +$(OUTPUT)test-gtk3.bin: + $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) -$(OUTPUT)test-gtk2-infobar.bin: - $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) +$(OUTPUT)test-gtk3-infobar.bin: + $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) grep-libs = $(filter -l%,$(1)) strip-libs = $(filter-out -l%,$(1))
tools/build/feature/test-all.c +10 -0
@@ -70,6 +70,14 @@# include "test-libslang.c" #undef main +#define main main_test_gtk3 +# include "test-gtk3.c" +#undef main + +#define main main_test_gtk3_infobar +# include "test-gtk3-infobar.c" +#undef main +#define main main_test_libbfd# include "test-libbfd.c" #undef main
@@ -187,6 +195,8 @@ int main(int argc, char *argv[])main_test_libelf_getshdrstrndx ();main_test_libunwind ();main_test_libslang (); +main_test_gtk3 (argc, argv); +main_test_gtk3_infobar (argc, argv);main_test_libbfd ();main_test_libbfd_buildid ();main_test_backtrace ();
tools/build/feature/test-gtk3-infobar.c renamed from tools/build/feature/test-gtk2-infobar.c +0 -0
tools/build/feature/test-gtk3.c renamed from tools/build/feature/test-gtk2.c +0 -0
tools/perf/Documentation/perf-report.txt +1 -1
@@ -314,7 +314,7 @@ OPTIONS requires a tty, if one is not present, as when piping to other commands, the stdio interface is used. ---gtk:: Use the GTK2 interface. +--gtk:: Use the GTK3 interface. -k:: --vmlinux=<file>::
tools/perf/Makefile +1 -1
@@ -100,7 +100,7 @@ clean: # make -C tools/perf -f tests/make # build-test: - @$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg make_static make_with_gtk2 out + @$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg make_static make_with_gtk3 out build-test-tarball: @$(MAKE) -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory out
tools/perf/Makefile.config +11 -11
@@ -755,20 +755,20 @@ ifndef NO_SLANG endif endif -ifdef GTK2 - FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) - $(call feature_check,gtk2) - ifneq ($(feature-gtk2), 1) - msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); - NO_GTK2 := 1 +ifdef GTK3 + FLAGS_GTK3=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) + $(call feature_check,gtk3) + ifneq ($(feature-gtk3), 1) + msg := $(warning GTK3 not found, disables GTK3 support. Please install gtk3-devel or libgtk3.0-dev); + NO_GTK3 := 1 else - $(call feature_check,gtk2-infobar) - ifeq ($(feature-gtk2-infobar), 1) + $(call feature_check,gtk3-infobar) + ifeq ($(feature-gtk3-infobar), 1) GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT endif - CFLAGS += -DHAVE_GTK2_SUPPORT - GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null) - GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null) + CFLAGS += -DHAVE_GTK3_SUPPORT + GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-3.0 2>/dev/null) + GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-3.0 2>/dev/null) EXTLIBS += -ldl endif endif
tools/perf/Makefile.perf +3 -3
@@ -48,7 +48,7 @@ include ../scripts/utilities.mak # # Define NO_SLANG if you do not want TUI support. # -# Define GTK2 if you want GTK+ GUI support. +# Define GTK3 if you want GTK+ GUI support. # # Define NO_DEMANGLE if you do not want C++ symbol demangling. #
@@ -404,7 +404,7 @@ ifneq ($(OUTPUT),) CFLAGS += -I$(OUTPUT) endif -ifdef GTK2 +ifdef GTK3 ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so GTK_IN := $(OUTPUT)gtk-in.o endif
@@ -930,7 +930,7 @@ check: $(OUTPUT)common-cmds.h ### Installation rules -ifdef GTK2 +ifdef GTK3 install-gtk: $(OUTPUT)libperf-gtk.so $(call QUIET_INSTALL, 'GTK UI') \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
tools/perf/builtin-report.c +1 -1
@@ -1213,7 +1213,7 @@ int cmd_report(int argc, const char **argv)#ifdef HAVE_SLANG_SUPPORT OPT_BOOLEAN (0 ,"tui" , &report.use_tui,"Use the TUI interface" ), #endif -OPT_BOOLEAN (0 ,"gtk" , &report.use_gtk,"Use the GTK2 interface" ), +OPT_BOOLEAN (0 ,"gtk" , &report.use_gtk,"Use the GTK3 interface" ),OPT_BOOLEAN (0 ,"stdio" , &report.use_stdio,"Use the stdio interface" ), OPT_BOOLEAN(0, "header", &report.header, "Show data header."),
tools/perf/builtin-version.c +1 -0
@@ -60,6 +60,7 @@ static void library_status(void)STATUS (HAVE_DWARF_SUPPORT , dwarf);STATUS (HAVE_DWARF_GETLOCATIONS_SUPPORT , dwarf_getlocations);STATUS (HAVE_GLIBC_SUPPORT , glibc); +STATUS (HAVE_GTK3_SUPPORT , gtk3);#ifndef HAVE_SYSCALL_TABLE_SUPPORT STATUS (HAVE_LIBAUDIT_SUPPORT , libaudit);#endif
tools/perf/tests/make +6 -6
@@ -72,8 +72,8 @@ make_no_libpython := NO_LIBPYTHON=1 make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1 make_no_newt := NO_NEWT=1 make_no_slang := NO_SLANG=1 -make_no_gtk2 := NO_GTK2=1 -make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 +make_no_gtk3 := NO_GTK3=1 +make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK3=1 make_no_demangle := NO_DEMANGLE=1 make_no_libelf := NO_LIBELF=1 make_no_libunwind := NO_LIBUNWIND=1
@@ -93,7 +93,7 @@ make_no_sdt := NO_SDT=1 make_no_syscall_tbl := NO_SYSCALL_TABLE=1 make_with_clangllvm := LIBCLANGLLVM=1 make_with_libpfm4 := LIBPFM4=1 -make_with_gtk2 := GTK2=1 +make_with_gtk3 := GTK3=1 make_tags := tags make_cscope := cscope make_help := help
@@ -113,7 +113,7 @@ make_install_prefix_slash := install prefix=/tmp/krava/ make_static := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 # all the NO_* variable combined -make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 +make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK3=1 make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
@@ -138,7 +138,7 @@ run += make_no_libpython run += make_no_scripts run += make_no_newt run += make_no_slang -run += make_no_gtk2 +run += make_no_gtk3 run += make_no_ui run += make_no_demangle run += make_no_libelf
@@ -312,7 +312,7 @@ $(run): $(call test,$@) && \ rm -rf $@ $$TMP_DEST || (cat $@ ; false) -make_with_gtk2: +make_with_gtk3: $(call clean) @TMP_DEST=$$(mktemp -d); \ cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
tools/perf/ui/gtk/annotate.c +1 -1
@@ -208,7 +208,7 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,if (!pgctx)return -1 ; - vbox =gtk_vbox_new (FALSE,0 ); + vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 ); notebook =gtk_notebook_new (); pgctx->notebook = notebook;
tools/perf/ui/gtk/browser.c +9 -7
@@ -13,19 +13,21 @@ void perf_gtk__signal(int sig)psignal (sig,"perf" ); } -void perf_gtk__resize_window (GtkWidget *window) +void perf_gtk__resize_window (GtkWidget *widget) {GdkRectangle rect; -GdkScreen *screen; -int monitor; +GdkMonitor *monitor; +GdkDisplay *display; +GdkWindow *window;int height;int width; - screen =gtk_widget_get_screen (window); + display =gdk_display_get_default (); + window =gtk_widget_get_window (widget); - monitor =gdk_screen_get_monitor_at_window (screen, window->window); + monitor =gdk_display_get_monitor_at_window (display, window); -gdk_screen_get_monitor_geometry (screen, monitor, &rect); +gdk_monitor_get_geometry (monitor, &rect); width = rect.width *3 /4 ; height = rect.height *3 /4 ;
@@ -58,7 +60,7 @@ GtkWidget *perf_gtk__setup_info_bar(void) content_area =gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar));gtk_container_add (GTK_CONTAINER (content_area), label); -gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),GTK_STOCK_OK , +gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),"_OK" ,GTK_RESPONSE_OK );g_signal_connect (info_bar,"response" ,G_CALLBACK (gtk_widget_hide),NULL );
tools/perf/ui/gtk/hists.c +1 -5
@@ -395,8 +395,6 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists, } } -gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); -g_signal_connect (view,"row-activated" ,G_CALLBACK (on_row_activated),NULL );gtk_container_add (GTK_CONTAINER (window), view);
@@ -583,8 +581,6 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,perf_gtk__add_hierarchy_entries (hists, &hists->entries, store,NULL , &hpp, min_pcnt); -gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); -g_signal_connect (view,"row-activated" ,G_CALLBACK (on_row_activated),NULL );gtk_container_add (GTK_CONTAINER (window), view);
@@ -616,7 +612,7 @@ int evlist__gtk_browse_hists(struct evlist *evlist, const char *help,if (!pgctx)return -1 ; - vbox =gtk_vbox_new (FALSE,0 ); + vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 ); notebook =gtk_notebook_new ();
tools/perf/ui/gtk/progress.c +1 -1
@@ -13,7 +13,7 @@ static void gtk_ui_progress__update(struct ui_progress *p)char buf[1024 ];if (dialog ==NULL ) { -GtkWidget *vbox =gtk_vbox_new (TRUE,5 ); +GtkWidget *vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,5 );GtkWidget *label =gtk_label_new (p->title); dialog =gtk_window_new (GTK_WINDOW_TOPLEVEL );
tools/perf/ui/setup.c +1 -1
@@ -14,7 +14,7 @@ int use_browser = -1;#define PERF_GTK_DSO "libperf-gtk.so" -#ifdef HAVE_GTK2_SUPPORT +#ifdef HAVE_GTK3_SUPPORT static int setup_gtk_browser (void ) {
Signature · 1 line
2.35.1
Ian Rogers
reviewerQuoted 10 lines · Matt Turner
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions.
gtk_tree_view_set_rules_hintis no longer required since theme's are now responsible to handle this,gtk_vbox_newis deprecated and replaced by passing the orientation togtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly theGTK_STOCK_OKdefine is deprecated in GTK 3.
This is super super awesome, thanks for doing it! Does it make sense or do you know what it would take for GTK4 support? I'm trying to test this on Debian but see missing includes on gtk/gtk.h - good news that it applies cleanly to Arnaldo's tree. I'm suspecting something wrong on my end and so will try harder later.
Thanks,
Ian
Quoted 412 lines
Signed-off-by Jelle van der Waa <[email protected]>Signed-off-by Matt Turner <[email protected]>---
Originally sent in 2019. I've rebased it and given it a test.One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”Presumably we need to call
g_markup_escape_text()somewhere, but I struggled to find the right place.Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
tools/build/Makefile.feature | 5 +++-- tools/build/feature/Makefile | 12 +++++----- tools/build/feature/test-all.c | 10 +++++++++ ...est-gtk2-infobar.c => test-gtk3-infobar.c} | 0 .../feature/{test-gtk2.c => test-gtk3.c} | 0 tools/perf/Documentation/perf-report.txt | 2 +- tools/perf/Makefile | 2 +- tools/perf/Makefile.config | 22 +++++++++---------- tools/perf/Makefile.perf | 6 ++--- tools/perf/builtin-report.c | 2 +- tools/perf/builtin-version.c | 1 + tools/perf/tests/make | 12 +++++----- tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/ui/gtk/browser.c | 16 ++++++++------ tools/perf/ui/gtk/hists.c | 6 +---- tools/perf/ui/gtk/progress.c | 2 +- tools/perf/ui/setup.c | 2 +- 17 files changed, 56 insertions(+), 46 deletions(-) rename tools/build/feature/{test-gtk2-infobar.c => test-gtk3-infobar.c} (100%) rename tools/build/feature/{test-gtk2.c => test-gtk3.c} (100%)tools/build/Makefile.feature +3
-2@@ -79,8 +79,8 @@ FEATURE_TESTS_EXTRA := \ compile-32 \ compile-x32 \ cplus-demangle \ - gtk2 \ - gtk2-infobar \ + gtk3 \ + gtk3-infobar \ hello \ libbabeltrace \ libbfd-liberty \@@ -113,6 +113,7 @@ FEATURE_DISPLAY ?= \ dwarf \ dwarf_getlocations \ glibc \ + gtk3 \ libbfd \ libbfd-buildid \ libcap \tools/build/feature/Makefile +6
-6@@ -11,8 +11,8 @@ FILES= \ test-fortify-source.bin \ test-get_current_dir_name.bin \ test-glibc.bin \ - test-gtk2.bin \ - test-gtk2-infobar.bin \ + test-gtk3.bin \ + test-gtk3-infobar.bin \ test-hello.bin \ test-libaudit.bin \ test-libbfd.bin \@@ -205,11 +205,11 @@ $(OUTPUT)test-libtracefs.bin: $(OUTPUT)test-libcrypto.bin: $(BUILD) -lcrypto -$(OUTPUT)test-gtk2.bin: - $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) -Wno-deprecated-declarations +$(OUTPUT)test-gtk3.bin: + $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) -$(OUTPUT)test-gtk2-infobar.bin: - $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) +$(OUTPUT)test-gtk3-infobar.bin: + $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) grep-libs = $(filter -l%,$(1)) strip-libs = $(filter-out -l%,$(1))tools/build/feature/test-all.c +10
-0@@ -70,6 +70,14 @@# include "test-libslang.c" #undef main +#define main main_test_gtk3 +# include "test-gtk3.c" +#undef main + +#define main main_test_gtk3_infobar +# include "test-gtk3-infobar.c" +#undef main +#define main main_test_libbfd# include "test-libbfd.c" #undef main@@ -187,6 +195,8 @@ int main(int argc, char *argv[])main_test_libelf_getshdrstrndx ();main_test_libunwind ();main_test_libslang (); +main_test_gtk3 (argc, argv); +main_test_gtk3_infobar (argc, argv);main_test_libbfd ();main_test_libbfd_buildid ();main_test_backtrace ();tools/build/feature/test-gtk3-infobar.c renamed from tools/build/feature/test-gtk2-infobar.c +0
-0tools/build/feature/test-gtk3.c renamed from tools/build/feature/test-gtk2.c +0
-0tools/perf/Documentation/perf-report.txt +1
-1@@ -314,7 +314,7 @@ OPTIONS requires a tty, if one is not present, as when piping to other commands, the stdio interface is used. ---gtk:: Use the GTK2 interface. +--gtk:: Use the GTK3 interface. -k:: --vmlinux=<file>::tools/perf/Makefile +1
-1@@ -100,7 +100,7 @@ clean: # make -C tools/perf -f tests/make # build-test: - @$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg make_static make_with_gtk2 out + @$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg make_static make_with_gtk3 out build-test-tarball: @$(MAKE) -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory outtools/perf/Makefile.config +11
-11@@ -755,20 +755,20 @@ ifndef NO_SLANG endif endif -ifdef GTK2 - FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) - $(call feature_check,gtk2) - ifneq ($(feature-gtk2), 1) - msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); - NO_GTK2 := 1 +ifdef GTK3 + FLAGS_GTK3=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) + $(call feature_check,gtk3) + ifneq ($(feature-gtk3), 1) + msg := $(warning GTK3 not found, disables GTK3 support. Please install gtk3-devel or libgtk3.0-dev); + NO_GTK3 := 1 else - $(call feature_check,gtk2-infobar) - ifeq ($(feature-gtk2-infobar), 1) + $(call feature_check,gtk3-infobar) + ifeq ($(feature-gtk3-infobar), 1) GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT endif - CFLAGS += -DHAVE_GTK2_SUPPORT - GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null) - GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null) + CFLAGS += -DHAVE_GTK3_SUPPORT + GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-3.0 2>/dev/null) + GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-3.0 2>/dev/null) EXTLIBS += -ldl endif endiftools/perf/Makefile.perf +3
-3@@ -48,7 +48,7 @@ include ../scripts/utilities.mak # # Define NO_SLANG if you do not want TUI support. # -# Define GTK2 if you want GTK+ GUI support. +# Define GTK3 if you want GTK+ GUI support. # # Define NO_DEMANGLE if you do not want C++ symbol demangling. #@@ -404,7 +404,7 @@ ifneq ($(OUTPUT),) CFLAGS += -I$(OUTPUT) endif -ifdef GTK2 +ifdef GTK3 ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so GTK_IN := $(OUTPUT)gtk-in.o endif@@ -930,7 +930,7 @@ check: $(OUTPUT)common-cmds.h ### Installation rules -ifdef GTK2 +ifdef GTK3 install-gtk: $(OUTPUT)libperf-gtk.so $(call QUIET_INSTALL, 'GTK UI') \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \tools/perf/builtin-report.c +1
-1@@ -1213,7 +1213,7 @@ int cmd_report(int argc, const char **argv)#ifdef HAVE_SLANG_SUPPORT OPT_BOOLEAN (0 ,"tui" , &report.use_tui,"Use the TUI interface" ), #endif -OPT_BOOLEAN (0 ,"gtk" , &report.use_gtk,"Use the GTK2 interface" ), +OPT_BOOLEAN (0 ,"gtk" , &report.use_gtk,"Use the GTK3 interface" ),OPT_BOOLEAN (0 ,"stdio" , &report.use_stdio,"Use the stdio interface" ), OPT_BOOLEAN(0, "header", &report.header, "Show data header."),tools/perf/builtin-version.c +1
-0@@ -60,6 +60,7 @@ static void library_status(void)STATUS (HAVE_DWARF_SUPPORT , dwarf);STATUS (HAVE_DWARF_GETLOCATIONS_SUPPORT , dwarf_getlocations);STATUS (HAVE_GLIBC_SUPPORT , glibc); +STATUS (HAVE_GTK3_SUPPORT , gtk3);#ifndef HAVE_SYSCALL_TABLE_SUPPORT STATUS (HAVE_LIBAUDIT_SUPPORT , libaudit);#endif tools/perf/tests/make +6
-6@@ -72,8 +72,8 @@ make_no_libpython := NO_LIBPYTHON=1 make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1 make_no_newt := NO_NEWT=1 make_no_slang := NO_SLANG=1 -make_no_gtk2 := NO_GTK2=1 -make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 +make_no_gtk3 := NO_GTK3=1 +make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK3=1 make_no_demangle := NO_DEMANGLE=1 make_no_libelf := NO_LIBELF=1 make_no_libunwind := NO_LIBUNWIND=1@@ -93,7 +93,7 @@ make_no_sdt := NO_SDT=1 make_no_syscall_tbl := NO_SYSCALL_TABLE=1 make_with_clangllvm := LIBCLANGLLVM=1 make_with_libpfm4 := LIBPFM4=1 -make_with_gtk2 := GTK2=1 +make_with_gtk3 := GTK3=1 make_tags := tags make_cscope := cscope make_help := help@@ -113,7 +113,7 @@ make_install_prefix_slash := install prefix=/tmp/krava/ make_static := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 # all the NO_* variable combined -make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 +make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK3=1 make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1@@ -138,7 +138,7 @@ run += make_no_libpython run += make_no_scripts run += make_no_newt run += make_no_slang -run += make_no_gtk2 +run += make_no_gtk3 run += make_no_ui run += make_no_demangle run += make_no_libelf@@ -312,7 +312,7 @@ $(run): $(call test,$@) && \ rm -rf $@ $$TMP_DEST || (cat $@ ; false) -make_with_gtk2: +make_with_gtk3: $(call clean) @TMP_DEST=$$(mktemp -d); \ cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \tools/perf/ui/gtk/annotate.c +1
-1@@ -208,7 +208,7 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,if (!pgctx)return -1 ; - vbox =gtk_vbox_new (FALSE,0 ); + vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 ); notebook =gtk_notebook_new (); pgctx->notebook = notebook;tools/perf/ui/gtk/browser.c +9
-7@@ -13,19 +13,21 @@ void perf_gtk__signal(int sig)psignal (sig,"perf" ); } -void perf_gtk__resize_window (GtkWidget *window) +void perf_gtk__resize_window (GtkWidget *widget) {GdkRectangle rect; -GdkScreen *screen; -int monitor; +GdkMonitor *monitor; +GdkDisplay *display; +GdkWindow *window;int height;int width; - screen =gtk_widget_get_screen (window); + display =gdk_display_get_default (); + window =gtk_widget_get_window (widget); - monitor =gdk_screen_get_monitor_at_window (screen, window->window); + monitor =gdk_display_get_monitor_at_window (display, window); -gdk_screen_get_monitor_geometry (screen, monitor, &rect); +gdk_monitor_get_geometry (monitor, &rect); width = rect.width *3 /4 ; height = rect.height *3 /4 ;@@ -58,7 +60,7 @@ GtkWidget *perf_gtk__setup_info_bar(void) content_area =gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar));gtk_container_add (GTK_CONTAINER (content_area), label); -gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),GTK_STOCK_OK , +gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),"_OK" ,GTK_RESPONSE_OK );g_signal_connect (info_bar,"response" ,G_CALLBACK (gtk_widget_hide),NULL );tools/perf/ui/gtk/hists.c +1
-5@@ -395,8 +395,6 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists, } } -gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); -g_signal_connect (view,"row-activated" ,G_CALLBACK (on_row_activated),NULL );gtk_container_add (GTK_CONTAINER (window), view);@@ -583,8 +581,6 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,perf_gtk__add_hierarchy_entries (hists, &hists->entries, store,NULL , &hpp, min_pcnt); -gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); -g_signal_connect (view,"row-activated" ,G_CALLBACK (on_row_activated),NULL );gtk_container_add (GTK_CONTAINER (window), view);@@ -616,7 +612,7 @@ int evlist__gtk_browse_hists(struct evlist *evlist, const char *help,if (!pgctx)return -1 ; - vbox =gtk_vbox_new (FALSE,0 ); + vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 ); notebook =gtk_notebook_new ();tools/perf/ui/gtk/progress.c +1
-1@@ -13,7 +13,7 @@ static void gtk_ui_progress__update(struct ui_progress *p)char buf[1024 ];if (dialog ==NULL ) { -GtkWidget *vbox =gtk_vbox_new (TRUE,5 ); +GtkWidget *vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,5 );GtkWidget *label =gtk_label_new (p->title); dialog =gtk_window_new (GTK_WINDOW_TOPLEVEL );tools/perf/ui/setup.c +1
-2@@ -14,7 +14,7 @@ int use_browser = -1;#define PERF_GTK_DSO "libperf-gtk.so" -#ifdef HAVE_GTK2_SUPPORT +#ifdef HAVE_GTK3_SUPPORT static int setup_gtk_browser (void ) { --2.35.1
Arnaldo Carvalho de Melo
maintainerEm Thu, Apr 14, 2022 at 10:00:03PM -0700, Matt Turner escreveu:
Quoted 22 lines
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions.
gtk_tree_view_set_rules_hintis no longer required since theme's are now responsible to handle this,gtk_vbox_newis deprecated and replaced by passing the orientation togtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly theGTK_STOCK_OKdefine is deprecated in GTK 3.Signed-off-by Jelle van der Waa <[email protected]>Signed-off-by Matt Turner <[email protected]>---
Originally sent in 2019. I've rebased it and given it a test.One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”
Quoted 5 lines
Presumably we need to call
g_markup_escape_text()somewhere, but I struggled to find the right place.Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
I'm trying to test build this but failing:
1. uninstalled gtk2-devel, which removed several other packages
2. installed gtk3-devel, which installed several other packages
3.:
Auto-detecting system features:
... dwarf: [ on ] ... dwarf_getlocations: [ on ] ... glibc: [ on ]
... gtk3: [ OFF ]
... libbfd: [ on ]
... libbfd-buildid: [ on ]
Looking at how that OFF is deduced:
⬢[acme@toolbox perf]$ cat /tmp/build/perf/feature/test- Display all 150 possibilities? (y or n)
⬢[acme@toolbox perf]$ cat /tmp/build/perf/feature/test-all.make.output In file included from test-all.c:74:
test-gtk3.c:3:10: fatal error: gtk/gtk.h: No such file or directory
3 | #include <gtk/gtk.h>
| ^~~~~~~~~~~compilation terminated.
⬢[acme@toolbox perf]$
⬢[acme@toolbox perf]$ find /usr/include -name gtk.h /usr/include/gtk-3.0/gtk/gtk.h
⬢[acme@toolbox perf]$ rpm -qf /usr/include/gtk-3.0/gtk/gtk.h gtk3-devel-3.24.31-2.fc35.x86_64
⬢[acme@toolbox perf]$
And that pkg-config line produces:
⬢[acme@toolbox perf]$ pkg-config --libs --cflags gtk+-3.0
-I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/libxml2 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 ⬢[acme@toolbox perf]$
I'm testing this on fedora 35 silverblue, in a perf build container:
⬢[acme@toolbox perf]$ rpm -qa | grep gtk
gtk-update-icon-cache-3.24.31-2.fc35.x86_64
libcanberra-gtk3-0.30-27.fc35.x86_64
gtk3-3.24.31-2.fc35.x86_64
libcanberra-gtk2-0.30-27.fc35.x86_64
gtk2-2.24.33-7.fc35.x86_64
gtk3-devel-3.24.31-2.fc35.x86_64
⬢[acme@toolbox perf]$
Ideas?
- Arnaldo
Quoted 393 lines
tools/build/Makefile.feature | 5 +++-- tools/build/feature/Makefile | 12 +++++----- tools/build/feature/test-all.c | 10 +++++++++ ...est-gtk2-infobar.c => test-gtk3-infobar.c} | 0 .../feature/{test-gtk2.c => test-gtk3.c} | 0 tools/perf/Documentation/perf-report.txt | 2 +- tools/perf/Makefile | 2 +- tools/perf/Makefile.config | 22 +++++++++---------- tools/perf/Makefile.perf | 6 ++--- tools/perf/builtin-report.c | 2 +- tools/perf/builtin-version.c | 1 + tools/perf/tests/make | 12 +++++----- tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/ui/gtk/browser.c | 16 ++++++++------ tools/perf/ui/gtk/hists.c | 6 +---- tools/perf/ui/gtk/progress.c | 2 +- tools/perf/ui/setup.c | 2 +- 17 files changed, 56 insertions(+), 46 deletions(-) rename tools/build/feature/{test-gtk2-infobar.c => test-gtk3-infobar.c} (100%) rename tools/build/feature/{test-gtk2.c => test-gtk3.c} (100%)tools/build/Makefile.feature +3
-2@@ -79,8 +79,8 @@ FEATURE_TESTS_EXTRA := \ compile-32 \ compile-x32 \ cplus-demangle \ - gtk2 \ - gtk2-infobar \ + gtk3 \ + gtk3-infobar \ hello \ libbabeltrace \ libbfd-liberty \@@ -113,6 +113,7 @@ FEATURE_DISPLAY ?= \ dwarf \ dwarf_getlocations \ glibc \ + gtk3 \ libbfd \ libbfd-buildid \ libcap \tools/build/feature/Makefile +6
-6@@ -11,8 +11,8 @@ FILES= \ test-fortify-source.bin \ test-get_current_dir_name.bin \ test-glibc.bin \ - test-gtk2.bin \ - test-gtk2-infobar.bin \ + test-gtk3.bin \ + test-gtk3-infobar.bin \ test-hello.bin \ test-libaudit.bin \ test-libbfd.bin \@@ -205,11 +205,11 @@ $(OUTPUT)test-libtracefs.bin: $(OUTPUT)test-libcrypto.bin: $(BUILD) -lcrypto -$(OUTPUT)test-gtk2.bin: - $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) -Wno-deprecated-declarations +$(OUTPUT)test-gtk3.bin: + $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) -$(OUTPUT)test-gtk2-infobar.bin: - $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) +$(OUTPUT)test-gtk3-infobar.bin: + $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) grep-libs = $(filter -l%,$(1)) strip-libs = $(filter-out -l%,$(1))tools/build/feature/test-all.c +10
-0@@ -70,6 +70,14 @@# include "test-libslang.c" #undef main +#define main main_test_gtk3 +# include "test-gtk3.c" +#undef main + +#define main main_test_gtk3_infobar +# include "test-gtk3-infobar.c" +#undef main +#define main main_test_libbfd# include "test-libbfd.c" #undef main@@ -187,6 +195,8 @@ int main(int argc, char *argv[])main_test_libelf_getshdrstrndx ();main_test_libunwind ();main_test_libslang (); +main_test_gtk3 (argc, argv); +main_test_gtk3_infobar (argc, argv);main_test_libbfd ();main_test_libbfd_buildid ();main_test_backtrace ();tools/build/feature/test-gtk3-infobar.c renamed from tools/build/feature/test-gtk2-infobar.c +0
-0tools/build/feature/test-gtk3.c renamed from tools/build/feature/test-gtk2.c +0
-0tools/perf/Documentation/perf-report.txt +1
-1@@ -314,7 +314,7 @@ OPTIONS requires a tty, if one is not present, as when piping to other commands, the stdio interface is used. ---gtk:: Use the GTK2 interface. +--gtk:: Use the GTK3 interface. -k:: --vmlinux=<file>::tools/perf/Makefile +1
-1@@ -100,7 +100,7 @@ clean: # make -C tools/perf -f tests/make # build-test: - @$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg make_static make_with_gtk2 out + @$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg make_static make_with_gtk3 out build-test-tarball: @$(MAKE) -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory outtools/perf/Makefile.config +11
-11@@ -755,20 +755,20 @@ ifndef NO_SLANG endif endif -ifdef GTK2 - FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) - $(call feature_check,gtk2) - ifneq ($(feature-gtk2), 1) - msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); - NO_GTK2 := 1 +ifdef GTK3 + FLAGS_GTK3=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) + $(call feature_check,gtk3) + ifneq ($(feature-gtk3), 1) + msg := $(warning GTK3 not found, disables GTK3 support. Please install gtk3-devel or libgtk3.0-dev); + NO_GTK3 := 1 else - $(call feature_check,gtk2-infobar) - ifeq ($(feature-gtk2-infobar), 1) + $(call feature_check,gtk3-infobar) + ifeq ($(feature-gtk3-infobar), 1) GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT endif - CFLAGS += -DHAVE_GTK2_SUPPORT - GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null) - GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null) + CFLAGS += -DHAVE_GTK3_SUPPORT + GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-3.0 2>/dev/null) + GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-3.0 2>/dev/null) EXTLIBS += -ldl endif endiftools/perf/Makefile.perf +3
-3@@ -48,7 +48,7 @@ include ../scripts/utilities.mak # # Define NO_SLANG if you do not want TUI support. # -# Define GTK2 if you want GTK+ GUI support. +# Define GTK3 if you want GTK+ GUI support. # # Define NO_DEMANGLE if you do not want C++ symbol demangling. #@@ -404,7 +404,7 @@ ifneq ($(OUTPUT),) CFLAGS += -I$(OUTPUT) endif -ifdef GTK2 +ifdef GTK3 ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so GTK_IN := $(OUTPUT)gtk-in.o endif@@ -930,7 +930,7 @@ check: $(OUTPUT)common-cmds.h ### Installation rules -ifdef GTK2 +ifdef GTK3 install-gtk: $(OUTPUT)libperf-gtk.so $(call QUIET_INSTALL, 'GTK UI') \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \tools/perf/builtin-report.c +1
-1@@ -1213,7 +1213,7 @@ int cmd_report(int argc, const char **argv)#ifdef HAVE_SLANG_SUPPORT OPT_BOOLEAN (0 ,"tui" , &report.use_tui,"Use the TUI interface" ), #endif -OPT_BOOLEAN (0 ,"gtk" , &report.use_gtk,"Use the GTK2 interface" ), +OPT_BOOLEAN (0 ,"gtk" , &report.use_gtk,"Use the GTK3 interface" ),OPT_BOOLEAN (0 ,"stdio" , &report.use_stdio,"Use the stdio interface" ), OPT_BOOLEAN(0, "header", &report.header, "Show data header."),tools/perf/builtin-version.c +1
-0@@ -60,6 +60,7 @@ static void library_status(void)STATUS (HAVE_DWARF_SUPPORT , dwarf);STATUS (HAVE_DWARF_GETLOCATIONS_SUPPORT , dwarf_getlocations);STATUS (HAVE_GLIBC_SUPPORT , glibc); +STATUS (HAVE_GTK3_SUPPORT , gtk3);#ifndef HAVE_SYSCALL_TABLE_SUPPORT STATUS (HAVE_LIBAUDIT_SUPPORT , libaudit);#endif tools/perf/tests/make +6
-6@@ -72,8 +72,8 @@ make_no_libpython := NO_LIBPYTHON=1 make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1 make_no_newt := NO_NEWT=1 make_no_slang := NO_SLANG=1 -make_no_gtk2 := NO_GTK2=1 -make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 +make_no_gtk3 := NO_GTK3=1 +make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK3=1 make_no_demangle := NO_DEMANGLE=1 make_no_libelf := NO_LIBELF=1 make_no_libunwind := NO_LIBUNWIND=1@@ -93,7 +93,7 @@ make_no_sdt := NO_SDT=1 make_no_syscall_tbl := NO_SYSCALL_TABLE=1 make_with_clangllvm := LIBCLANGLLVM=1 make_with_libpfm4 := LIBPFM4=1 -make_with_gtk2 := GTK2=1 +make_with_gtk3 := GTK3=1 make_tags := tags make_cscope := cscope make_help := help@@ -113,7 +113,7 @@ make_install_prefix_slash := install prefix=/tmp/krava/ make_static := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 # all the NO_* variable combined -make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 +make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK3=1 make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1@@ -138,7 +138,7 @@ run += make_no_libpython run += make_no_scripts run += make_no_newt run += make_no_slang -run += make_no_gtk2 +run += make_no_gtk3 run += make_no_ui run += make_no_demangle run += make_no_libelf@@ -312,7 +312,7 @@ $(run): $(call test,$@) && \ rm -rf $@ $$TMP_DEST || (cat $@ ; false) -make_with_gtk2: +make_with_gtk3: $(call clean) @TMP_DEST=$$(mktemp -d); \ cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \tools/perf/ui/gtk/annotate.c +1
-1@@ -208,7 +208,7 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,if (!pgctx)return -1 ; - vbox =gtk_vbox_new (FALSE,0 ); + vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 ); notebook =gtk_notebook_new (); pgctx->notebook = notebook;tools/perf/ui/gtk/browser.c +9
-7@@ -13,19 +13,21 @@ void perf_gtk__signal(int sig)psignal (sig,"perf" ); } -void perf_gtk__resize_window (GtkWidget *window) +void perf_gtk__resize_window (GtkWidget *widget) {GdkRectangle rect; -GdkScreen *screen; -int monitor; +GdkMonitor *monitor; +GdkDisplay *display; +GdkWindow *window;int height;int width; - screen =gtk_widget_get_screen (window); + display =gdk_display_get_default (); + window =gtk_widget_get_window (widget); - monitor =gdk_screen_get_monitor_at_window (screen, window->window); + monitor =gdk_display_get_monitor_at_window (display, window); -gdk_screen_get_monitor_geometry (screen, monitor, &rect); +gdk_monitor_get_geometry (monitor, &rect); width = rect.width *3 /4 ; height = rect.height *3 /4 ;@@ -58,7 +60,7 @@ GtkWidget *perf_gtk__setup_info_bar(void) content_area =gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar));gtk_container_add (GTK_CONTAINER (content_area), label); -gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),GTK_STOCK_OK , +gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),"_OK" ,GTK_RESPONSE_OK );g_signal_connect (info_bar,"response" ,G_CALLBACK (gtk_widget_hide),NULL );tools/perf/ui/gtk/hists.c +1
-5@@ -395,8 +395,6 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists, } } -gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); -g_signal_connect (view,"row-activated" ,G_CALLBACK (on_row_activated),NULL );gtk_container_add (GTK_CONTAINER (window), view);@@ -583,8 +581,6 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,perf_gtk__add_hierarchy_entries (hists, &hists->entries, store,NULL , &hpp, min_pcnt); -gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); -g_signal_connect (view,"row-activated" ,G_CALLBACK (on_row_activated),NULL );gtk_container_add (GTK_CONTAINER (window), view);@@ -616,7 +612,7 @@ int evlist__gtk_browse_hists(struct evlist *evlist, const char *help,if (!pgctx)return -1 ; - vbox =gtk_vbox_new (FALSE,0 ); + vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 ); notebook =gtk_notebook_new ();tools/perf/ui/gtk/progress.c +1
-1@@ -13,7 +13,7 @@ static void gtk_ui_progress__update(struct ui_progress *p)char buf[1024 ];if (dialog ==NULL ) { -GtkWidget *vbox =gtk_vbox_new (TRUE,5 ); +GtkWidget *vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,5 );GtkWidget *label =gtk_label_new (p->title); dialog =gtk_window_new (GTK_WINDOW_TOPLEVEL );tools/perf/ui/setup.c +1
-1@@ -14,7 +14,7 @@ int use_browser = -1;#define PERF_GTK_DSO "libperf-gtk.so" -#ifdef HAVE_GTK2_SUPPORT +#ifdef HAVE_GTK3_SUPPORT static int setup_gtk_browser (void ) {Signature · 1 line
2.35.1
Signature · 1 line
- Arnaldo
Quoted 81 lines · Arnaldo Carvalho de Melo
Em Thu, Apr 14, 2022 at 10:00:03PM -0700, Matt Turner escreveu:
Quoted 22 lines
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions.
gtk_tree_view_set_rules_hintis no longer required since theme's are now responsible to handle this,gtk_vbox_newis deprecated and replaced by passing the orientation togtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly theGTK_STOCK_OKdefine is deprecated in GTK 3.Signed-off-by Jelle van der Waa <[email protected]>Signed-off-by Matt Turner <[email protected]>---
Originally sent in 2019. I've rebased it and given it a test.One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”Quoted 5 lines
Presumably we need to call
g_markup_escape_text()somewhere, but I struggled to find the right place.Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
I'm trying to test build this but failing:
1. uninstalled gtk2-devel, which removed several other packages
2. installed gtk3-devel, which installed several other packages
3.:
Auto-detecting system features:
... dwarf: [ on ] ... dwarf_getlocations: [ on ] ... glibc: [ on ]... gtk3: [ OFF ]
... libbfd: [ on ]
... libbfd-buildid: [ on ]Looking at how that OFF is deduced:
⬢[acme@toolbox perf]$ cat
/tmp/build/perf/feature/test-Display all 150 possibilities? (y or n)
⬢[acme@toolbox perf]$ cat/tmp/build/perf/feature/test-all.make.outputIn file included from test-all.c:74:
test-gtk3.c:3:10: fatal error:gtk/gtk.h: No such file or directory3 | #include <gtk/gtk.h> | ^~~~~~~~~~~compilation terminated.
⬢[acme@toolbox perf]$⬢[acme@toolbox perf]$ find
/usr/include-namegtk.h/usr/include/gtk-3.0/gtk/gtk.h
⬢[acme@toolbox perf]$ rpm -qf/usr/include/gtk-3.0/gtk/gtk.hgtk3-devel-3.24.31-2.fc35.x86_64
⬢[acme@toolbox perf]$And that pkg-config line produces:
⬢[acme@toolbox perf]$ pkg-config --libs --cflags gtk+-3.0
-I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/libxml2 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 ⬢[acme@toolbox perf]$I'm testing this on fedora 35 silverblue, in a perf build container:
⬢[acme@toolbox perf]$ rpm -qa | grep gtk
gtk-update-icon-cache-3.24.31-2.fc35.x86_64
libcanberra-gtk3-0.30-27.fc35.x86_64
gtk3-3.24.31-2.fc35.x86_64
libcanberra-gtk2-0.30-27.fc35.x86_64
gtk2-2.24.33-7.fc35.x86_64
gtk3-devel-3.24.31-2.fc35.x86_64
⬢[acme@toolbox perf]$
Quoted 1 line
Ideas?
Just to be clear, are you building with 'GTK3=1 make'? Since commit 4751bddd3f98 ("perf tools: Make GTK2 support opt-in") it's required to enable GTK support explicitly. (IMO, leaving it disabled by default makes sense to me, given some of the problems)
Arnaldo Carvalho de Melo
maintainerEm Thu, Apr 21, 2022 at 02:02:49PM -0700, Matt Turner escreveu:
Quoted 83 lines
Quoted 81 lines · Arnaldo Carvalho de Melo
Em Thu, Apr 14, 2022 at 10:00:03PM -0700, Matt Turner escreveu:
Quoted 22 lines
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions.
gtk_tree_view_set_rules_hintis no longer required since theme's are now responsible to handle this,gtk_vbox_newis deprecated and replaced by passing the orientation togtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly theGTK_STOCK_OKdefine is deprecated in GTK 3.Signed-off-by Jelle van der Waa <[email protected]>Signed-off-by Matt Turner <[email protected]>---
Originally sent in 2019. I've rebased it and given it a test.One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”Quoted 5 lines
Presumably we need to call
g_markup_escape_text()somewhere, but I struggled to find the right place.Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
I'm trying to test build this but failing:
1. uninstalled gtk2-devel, which removed several other packages
2. installed gtk3-devel, which installed several other packages
3.:
Auto-detecting system features:
... dwarf: [ on ] ... dwarf_getlocations: [ on ] ... glibc: [ on ]... gtk3: [ OFF ]
... libbfd: [ on ]
... libbfd-buildid: [ on ]Looking at how that OFF is deduced:
⬢[acme@toolbox perf]$ cat
/tmp/build/perf/feature/test-Display all 150 possibilities? (y or n)
⬢[acme@toolbox perf]$ cat/tmp/build/perf/feature/test-all.make.outputIn file included from test-all.c:74:
test-gtk3.c:3:10: fatal error:gtk/gtk.h: No such file or directory3 | #include <gtk/gtk.h> | ^~~~~~~~~~~compilation terminated.
⬢[acme@toolbox perf]$⬢[acme@toolbox perf]$ find
/usr/include-namegtk.h/usr/include/gtk-3.0/gtk/gtk.h
⬢[acme@toolbox perf]$ rpm -qf/usr/include/gtk-3.0/gtk/gtk.hgtk3-devel-3.24.31-2.fc35.x86_64
⬢[acme@toolbox perf]$And that pkg-config line produces:
⬢[acme@toolbox perf]$ pkg-config --libs --cflags gtk+-3.0
-I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/libxml2 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 ⬢[acme@toolbox perf]$I'm testing this on fedora 35 silverblue, in a perf build container:
⬢[acme@toolbox perf]$ rpm -qa | grep gtk
gtk-update-icon-cache-3.24.31-2.fc35.x86_64
libcanberra-gtk3-0.30-27.fc35.x86_64
gtk3-3.24.31-2.fc35.x86_64
libcanberra-gtk2-0.30-27.fc35.x86_64
gtk2-2.24.33-7.fc35.x86_64
gtk3-devel-3.24.31-2.fc35.x86_64
⬢[acme@toolbox perf]$
Quoted 3 lines
Quoted 1 line
Ideas?
Just to be clear, are you building with 'GTK3=1 make'? Since commit
No, I'm not, as I first test without enabling it, and in that case test-all.c is now failing, since these lines were added there:
tools/build/feature/test-all.c +10 -0
@@ -70,6 +70,14 @@# include "test-libslang.c" #undef main +#define main main_test_gtk3 +# include "test-gtk3.c" +#undef main + +#define main main_test_gtk3_infobar +# include "test-gtk3-infobar.c" +#undef main +#define main main_test_libbfd# include "test-libbfd.c" #undef main
@@ -187,6 +195,8 @@ int main(int argc, char *argv[])main_test_libelf_getshdrstrndx ();main_test_libunwind ();main_test_libslang (); +main_test_gtk3 (argc, argv); +main_test_gtk3_infobar (argc, argv);main_test_libbfd ();main_test_libbfd_buildid ();main_test_backtrace ();
tools/build/feature/test-gtk3-infobar.c renamed from tools/build/feature/test-gtk2-infobar.c +0 -0
------------
test-all.c is what we expect to be enabled in most places, i.e. that it will build successfully and we then don't have to test the features one by one, speeding up the process.
So please don't add those entries in tools/build/feature/test-all.c.
After the common case is tested and doesn't regress, we can move on to test with explicitely enabling the GTK code, ok?
- Arnaldo
Quoted 3 lines
4751bddd3f98("perf tools: Make GTK2 support opt-in") it's required to enable GTK support explicitly. (IMO, leaving it disabled by default makes sense to me, given some of the problems)
PATCH v2 1/1 tools: port perf ui from GTK 2 to GTK 3
In reply to Matt TurnerFrom: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions. gtk_tree_view_set_rules_hint is no longer required since theme's are now responsible to handle this, gtk_vbox_new is deprecated and replaced by passing the orientation to gtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly the GTK_STOCK_OK define is deprecated in GTK 3.
---
Originally sent in 2019. I've rebased it and given it a test.
One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”
Presumably we need to call g_markup_escape_text() somewhere, but I struggled to find the right place.
Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
v2: Dropped changes to test-all.c. I don't know how to build that
apparently.
tools/build/Makefile.feature | 5 +++--
tools/build/feature/Makefile | 12 +++++-----
...est-gtk2-infobar.c => test-gtk3-infobar.c} | 0
.../feature/{test-gtk2.c => test-gtk3.c} | 0
tools/perf/Documentation/perf-report.txt | 2 +-
tools/perf/Makefile | 2 +-
tools/perf/Makefile.config | 22 +++++++++----------
tools/perf/Makefile.perf | 6 ++---
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-version.c | 1 +
tools/perf/tests/make | 12 +++++-----
tools/perf/ui/gtk/annotate.c | 2 +-
tools/perf/ui/gtk/browser.c | 16 ++++++++------
tools/perf/ui/gtk/hists.c | 6 +----
tools/perf/ui/gtk/progress.c | 2 +-
tools/perf/ui/setup.c | 2 +-
16 files changed, 46 insertions(+), 46 deletions(-)
rename tools/build/feature/{test-gtk2-infobar.c => test-gtk3-infobar.c} (100%)
rename tools/build/feature/{test-gtk2.c => test-gtk3.c} (100%)tools/build/Makefile.feature +3 -2
@@ -80,8 +80,8 @@ FEATURE_TESTS_EXTRA := \ compile-32 \ compile-x32 \ cplus-demangle \ - gtk2 \ - gtk2-infobar \ + gtk3 \ + gtk3-infobar \ hello \ libbabeltrace \ libbfd-liberty \
@@ -119,6 +119,7 @@ FEATURE_DISPLAY ?= \ dwarf \ dwarf_getlocations \ glibc \ + gtk3 \ libbfd \ libbfd-buildid \ libcap \
tools/build/feature/Makefile +6 -6
@@ -11,8 +11,8 @@ FILES= \ test-fortify-source.bin \ test-get_current_dir_name.bin \ test-glibc.bin \ - test-gtk2.bin \ - test-gtk2-infobar.bin \ + test-gtk3.bin \ + test-gtk3-infobar.bin \ test-hello.bin \ test-libaudit.bin \ test-libbfd.bin \
@@ -214,11 +214,11 @@ $(OUTPUT)test-libtracefs.bin: $(OUTPUT)test-libcrypto.bin: $(BUILD) -lcrypto -$(OUTPUT)test-gtk2.bin: - $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) -Wno-deprecated-declarations +$(OUTPUT)test-gtk3.bin: + $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) -$(OUTPUT)test-gtk2-infobar.bin: - $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) +$(OUTPUT)test-gtk3-infobar.bin: + $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) grep-libs = $(filter -l%,$(1)) strip-libs = $(filter-out -l%,$(1))
tools/build/feature/test-gtk3-infobar.c renamed from tools/build/feature/test-gtk2-infobar.c +0 -0
tools/build/feature/test-gtk3.c renamed from tools/build/feature/test-gtk2.c +0 -0
tools/perf/Documentation/perf-report.txt +1 -1
@@ -315,7 +315,7 @@ OPTIONS requires a tty, if one is not present, as when piping to other commands, the stdio interface is used. ---gtk:: Use the GTK2 interface. +--gtk:: Use the GTK3 interface. -k:: --vmlinux=<file>::
tools/perf/Makefile +1 -1
@@ -100,7 +100,7 @@ clean: # make -C tools/perf -f tests/make # build-test: - @$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg make_static make_with_gtk2 out + @$(MAKE) SHUF=1 -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory tarpkg make_static make_with_gtk3 out build-test-tarball: @$(MAKE) -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory out
tools/perf/Makefile.config +11 -11
@@ -808,20 +808,20 @@ ifndef NO_SLANG endif endif -ifdef GTK2 - FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) - $(call feature_check,gtk2) - ifneq ($(feature-gtk2), 1) - msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); - NO_GTK2 := 1 +ifdef GTK3 + FLAGS_GTK3=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-3.0 2>/dev/null) + $(call feature_check,gtk3) + ifneq ($(feature-gtk3), 1) + msg := $(warning GTK3 not found, disables GTK3 support. Please install gtk3-devel or libgtk3.0-dev); + NO_GTK3 := 1 else - $(call feature_check,gtk2-infobar) - ifeq ($(feature-gtk2-infobar), 1) + $(call feature_check,gtk3-infobar) + ifeq ($(feature-gtk3-infobar), 1) GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT endif - CFLAGS += -DHAVE_GTK2_SUPPORT - GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null) - GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null) + CFLAGS += -DHAVE_GTK3_SUPPORT + GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-3.0 2>/dev/null) + GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-3.0 2>/dev/null) EXTLIBS += -ldl endif endif
tools/perf/Makefile.perf +3 -3
@@ -48,7 +48,7 @@ include ../scripts/utilities.mak # # Define NO_SLANG if you do not want TUI support. # -# Define GTK2 if you want GTK+ GUI support. +# Define GTK3 if you want GTK+ GUI support. # # Define NO_DEMANGLE if you do not want C++ symbol demangling. #
@@ -403,7 +403,7 @@ ifneq ($(OUTPUT),) CFLAGS += -I$(OUTPUT) endif -ifdef GTK2 +ifdef GTK3 ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so GTK_IN := $(OUTPUT)gtk-in.o endif
@@ -928,7 +928,7 @@ check: $(OUTPUT)common-cmds.h ### Installation rules -ifdef GTK2 +ifdef GTK3 install-gtk: $(OUTPUT)libperf-gtk.so $(call QUIET_INSTALL, 'GTK UI') \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
tools/perf/builtin-report.c +1 -1
@@ -1247,7 +1247,7 @@ int cmd_report(int argc, const char **argv) OPT_BOOLEAN(0, "tui", &report.use_tui, "Use the TUI interface"),#endif #ifdef HAVE_GTK2_SUPPORT -OPT_BOOLEAN (0 ,"gtk" , &report.use_gtk,"Use the GTK2 interface" ), +OPT_BOOLEAN (0 ,"gtk" , &report.use_gtk,"Use the GTK3 interface" ), #endifOPT_BOOLEAN (0 ,"stdio" , &report.use_stdio, "Use the stdio interface"),
tools/perf/builtin-version.c +1 -0
@@ -60,6 +60,7 @@ static void library_status(void)STATUS (HAVE_DWARF_SUPPORT , dwarf);STATUS (HAVE_DWARF_GETLOCATIONS_SUPPORT , dwarf_getlocations);STATUS (HAVE_GLIBC_SUPPORT , glibc); +STATUS (HAVE_GTK3_SUPPORT , gtk3);#ifndef HAVE_SYSCALL_TABLE_SUPPORT STATUS (HAVE_LIBAUDIT_SUPPORT , libaudit);#endif
tools/perf/tests/make +6 -6
@@ -72,8 +72,8 @@ make_no_libpython := NO_LIBPYTHON=1 make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1 make_no_newt := NO_NEWT=1 make_no_slang := NO_SLANG=1 -make_no_gtk2 := NO_GTK2=1 -make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 +make_no_gtk3 := NO_GTK3=1 +make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK3=1 make_no_demangle := NO_DEMANGLE=1 make_no_libelf := NO_LIBELF=1 make_no_libunwind := NO_LIBUNWIND=1
@@ -93,7 +93,7 @@ make_no_sdt := NO_SDT=1 make_no_syscall_tbl := NO_SYSCALL_TABLE=1 make_with_clangllvm := LIBCLANGLLVM=1 make_with_libpfm4 := LIBPFM4=1 -make_with_gtk2 := GTK2=1 +make_with_gtk3 := GTK3=1 make_tags := tags make_cscope := cscope make_help := help
@@ -113,7 +113,7 @@ make_install_prefix_slash := install prefix=/tmp/krava/ make_static := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 # all the NO_* variable combined -make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 +make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK3=1 make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
@@ -138,7 +138,7 @@ run += make_no_libpython run += make_no_scripts run += make_no_newt run += make_no_slang -run += make_no_gtk2 +run += make_no_gtk3 run += make_no_ui run += make_no_demangle run += make_no_libelf
@@ -312,7 +312,7 @@ $(run): $(call test,$@) && \ rm -rf $@ $$TMP_DEST || (cat $@ ; false) -make_with_gtk2: +make_with_gtk3: $(call clean) @TMP_DEST=$$(mktemp -d); \ cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
tools/perf/ui/gtk/annotate.c +1 -1
@@ -208,7 +208,7 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,if (!pgctx)return -1 ; - vbox =gtk_vbox_new (FALSE,0 ); + vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 ); notebook =gtk_notebook_new (); pgctx->notebook = notebook;
tools/perf/ui/gtk/browser.c +9 -7
@@ -13,19 +13,21 @@ void perf_gtk__signal(int sig)psignal (sig,"perf" ); } -void perf_gtk__resize_window (GtkWidget *window) +void perf_gtk__resize_window (GtkWidget *widget) {GdkRectangle rect; -GdkScreen *screen; -int monitor; +GdkMonitor *monitor; +GdkDisplay *display; +GdkWindow *window;int height;int width; - screen =gtk_widget_get_screen (window); + display =gdk_display_get_default (); + window =gtk_widget_get_window (widget); - monitor =gdk_screen_get_monitor_at_window (screen, window->window); + monitor =gdk_display_get_monitor_at_window (display, window); -gdk_screen_get_monitor_geometry (screen, monitor, &rect); +gdk_monitor_get_geometry (monitor, &rect); width = rect.width *3 /4 ; height = rect.height *3 /4 ;
@@ -58,7 +60,7 @@ GtkWidget *perf_gtk__setup_info_bar(void) content_area =gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar));gtk_container_add (GTK_CONTAINER (content_area), label); -gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),GTK_STOCK_OK , +gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),"_OK" ,GTK_RESPONSE_OK );g_signal_connect (info_bar,"response" ,G_CALLBACK (gtk_widget_hide),NULL );
tools/perf/ui/gtk/hists.c +1 -5
@@ -395,8 +395,6 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists, } } -gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); -g_signal_connect (view,"row-activated" ,G_CALLBACK (on_row_activated),NULL );gtk_container_add (GTK_CONTAINER (window), view);
@@ -583,8 +581,6 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,perf_gtk__add_hierarchy_entries (hists, &hists->entries, store,NULL , &hpp, min_pcnt); -gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); -g_signal_connect (view,"row-activated" ,G_CALLBACK (on_row_activated),NULL );gtk_container_add (GTK_CONTAINER (window), view);
@@ -616,7 +612,7 @@ int evlist__gtk_browse_hists(struct evlist *evlist, const char *help,if (!pgctx)return -1 ; - vbox =gtk_vbox_new (FALSE,0 ); + vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 ); notebook =gtk_notebook_new ();
tools/perf/ui/gtk/progress.c +1 -1
@@ -13,7 +13,7 @@ static void gtk_ui_progress__update(struct ui_progress *p)char buf[1024 ];if (dialog ==NULL ) { -GtkWidget *vbox =gtk_vbox_new (TRUE,5 ); +GtkWidget *vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,5 );GtkWidget *label =gtk_label_new (p->title); dialog =gtk_window_new (GTK_WINDOW_TOPLEVEL );
tools/perf/ui/setup.c +1 -1
@@ -13,7 +13,7 @@ int use_browser = -1;#define PERF_GTK_DSO "libperf-gtk.so" -#ifdef HAVE_GTK2_SUPPORT +#ifdef HAVE_GTK3_SUPPORT static int setup_gtk_browser (void ) {
Signature · 1 line
2.37.3
Quoted 23 lines · Matt Turner
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions.
gtk_tree_view_set_rules_hintis no longer required since theme's are now responsible to handle this,gtk_vbox_newis deprecated and replaced by passing the orientation togtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly theGTK_STOCK_OKdefine is deprecated in GTK 3.Signed-off-by Jelle van der Waa <[email protected]>Signed-off-by Matt Turner <[email protected]>---
Originally sent in 2019. I've rebased it and given it a test.One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”
Quoted 8 lines
Presumably we need to call
g_markup_escape_text()somewhere, but I struggled to find the right place.Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
v2: Dropped changes to
test-all.c. I don't know how to build that
apparently.
Arnaldo, does this work better for you?
Quoted 28 lines · Matt Turner
Quoted 26 lines · Matt Turner
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions.
gtk_tree_view_set_rules_hintis no longer required since theme's are now responsible to handle this,gtk_vbox_newis deprecated and replaced by passing the orientation togtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly theGTK_STOCK_OKdefine is deprecated in GTK 3.Signed-off-by Jelle van der Waa <[email protected]>Signed-off-by Matt Turner <[email protected]>---
Originally sent in 2019. I've rebased it and given it a test.One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”Presumably we need to call
g_markup_escape_text()somewhere, but I struggled to find the right place.
Quoted 8 lines
Quoted 5 lines
Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
v2: Dropped changes to
test-all.c. I don't know how to build that
apparently.Arnaldo, does this work better for you?
Ping²
Quoted 33 lines · Matt Turner
Quoted 31 lines · Matt Turner
Quoted 29 lines · Matt Turner
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions.
gtk_tree_view_set_rules_hintis no longer required since theme's are now responsible to handle this,gtk_vbox_newis deprecated and replaced by passing the orientation togtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly theGTK_STOCK_OKdefine is deprecated in GTK 3.Signed-off-by Jelle van der Waa <[email protected]>Signed-off-by Matt Turner <[email protected]>---
Originally sent in 2019. I've rebased it and given it a test.One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”Presumably we need to call
g_markup_escape_text()somewhere, but I struggled to find the right place.Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
v2: Dropped changes to
test-all.c. I don't know how to build that
apparently.Arnaldo, does this work better for you?
Ping²
Ping³
Ian Rogers
reviewerQuoted 39 lines · Matt Turner
Quoted 37 lines · Matt Turner
Quoted 35 lines · Matt Turner
Quoted 31 lines · Matt Turner
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions.
gtk_tree_view_set_rules_hintis no longer required since theme's are now responsible to handle this,gtk_vbox_newis deprecated and replaced by passing the orientation togtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly theGTK_STOCK_OKdefine is deprecated in GTK 3.Signed-off-by Jelle van der Waa <[email protected]>Signed-off-by Matt Turner <[email protected]>---
Originally sent in 2019. I've rebased it and given it a test.One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”Presumably we need to call
g_markup_escape_text()somewhere, but I struggled to find the right place.Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
v2: Dropped changes to
test-all.c. I don't know how to build that
apparently.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Arnaldo, does this work better for you?
Ping²
Ping³
Hi Matt,
did you see Namhyung's comment? It looks possible that we can drop the infobar feature check for GTK3, which would help simplify the builds. It seems to make sense to fold that into this change, or to have it as a patch on top of this. Wdyt?
Thanks,
Ian
Namhyung Kim
maintainerHello,
Quoted 23 lines · Matt Turner
From: Jelle van der Waa <[email protected]>
GTK 2 is a legacy API and the newer version is GTK 3 which changes a few API functions.
gtk_tree_view_set_rules_hintis no longer required since theme's are now responsible to handle this,gtk_vbox_newis deprecated and replaced by passing the orientation togtk_box_new. Apart from these changes the accessing of the screen changed in GTK which requires using new functions for getting geometry. Lastly theGTK_STOCK_OKdefine is deprecated in GTK 3.Signed-off-by Jelle van der Waa <[email protected]>Signed-off-by Matt Turner <[email protected]>---
Originally sent in 2019. I've rebased it and given it a test.One problem I've noticed is that C++ symbol names are often broken. E.g.:
(perf:3254940): Gtk-WARNING **: 21:47:46.663: Failed to set text from markup due to error parsing markup: Error on line 1 char 95:
“std::char_traits<char” is not a valid name: “<”
Quoted 5 lines
Presumably we need to call
g_markup_escape_text()somewhere, but I struggled to find the right place.Without the patch, the GTK-2 version repeatedly segfaults, so this is an improvement regardless.
Thanks for working on this.
Quoted 29 lines
v2: Dropped changes to
test-all.c. I don't know how to build that
apparently.tools/build/Makefile.feature | 5 +++-- tools/build/feature/Makefile | 12 +++++----- ...est-gtk2-infobar.c => test-gtk3-infobar.c} | 0 .../feature/{test-gtk2.c => test-gtk3.c} | 0 tools/perf/Documentation/perf-report.txt | 2 +- tools/perf/Makefile | 2 +- tools/perf/Makefile.config | 22 +++++++++---------- tools/perf/Makefile.perf | 6 ++--- tools/perf/builtin-report.c | 2 +- tools/perf/builtin-version.c | 1 + tools/perf/tests/make | 12 +++++----- tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/ui/gtk/browser.c | 16 ++++++++------ tools/perf/ui/gtk/hists.c | 6 +---- tools/perf/ui/gtk/progress.c | 2 +- tools/perf/ui/setup.c | 2 +- 16 files changed, 46 insertions(+), 46 deletions(-) rename tools/build/feature/{test-gtk2-infobar.c => test-gtk3-infobar.c} (100%) rename tools/build/feature/{test-gtk2.c => test-gtk3.c} (100%)tools/build/Makefile.feature +0
-0
tools/build/Makefile.feature FEATURE_TESTS_EXTRA := \ · line 84
Quoted 7 lines
tools/build/Makefile.feature +2
-2@@ -80,8 +80,8 @@ FEATURE_TESTS_EXTRA := \ compile-32 \ compile-x32 \ cplus-demangle \ - gtk2 \ - gtk2-infobar \ + gtk3 \ + gtk3-infobar \
I don't think gtk3-inforbar check is necessary anymore. IIRC the infobar was introduced in the middle of gtk2 so it needs to check if the current version supports it or not. But I guess gtk3 should support it by default.
Thanks,
Namhyung
Quoted 11 lines
tools/build/Makefile.feature +1
-0hello \ libbabeltrace \ libbfd-liberty \@@ -119,6 +119,7 @@ FEATURE_DISPLAY ?= \ dwarf \ dwarf_getlocations \ glibc \ + gtk3 \ libbfd \ libbfd-buildid \ libcap \