From 356d6b8db04bfc15a1d0a5fabbc79aad0e81d592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sun, 15 Oct 2017 19:58:55 +0100 Subject: [PATCH] GTK: Remove OSX integration library support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only Wireshark Qt is officially supported on macOS. Change-Id: Id0e3429891173d4b91e99061bcf11df2e38bc0bf Reviewed-on: https://code.wireshark.org/review/23931 Petri-Dish: João Valverde Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde --- configure.ac | 30 ----------- m4/ws_osx_integration_check.m4 | 81 ----------------------------- ui/commandline.c | 7 --- ui/gtk/drag_and_drop.c | 30 ----------- ui/gtk/main.c | 59 ++------------------- ui/gtk/main_menubar.c | 93 ---------------------------------- ui/gtk/prefs_gui.c | 22 -------- 7 files changed, 3 insertions(+), 319 deletions(-) delete mode 100644 m4/ws_osx_integration_check.m4 diff --git a/configure.ac b/configure.ac index fd0bb32bbd..16852cba05 100644 --- a/configure.ac +++ b/configure.ac @@ -1515,36 +1515,6 @@ if test "$ac_cv_glib_supports_printf_grouping" = yes ; then AC_DEFINE(HAVE_GLIB_PRINTF_GROUPING, 1, [Define if GLib's printf functions support thousands grouping.]) fi -if test "x$have_gtk" = "xyes" -then - # - # We have GTK+; do we want the macOS integration functions and, - # if so, do we have them and, if so, which versions do we have, - # the old Carbon-based ones or the new Cocoa-based ones? - # - AC_MSG_CHECKING(whether to use macOS integration functions) - - AC_ARG_WITH(osx-integration, - AC_HELP_STRING( [--with-osx-integration], - [use macOS integration functions @<:@default=yes, if available@:>@]), - [ - if test $withval = no - then - want_osx_integration=no - else - want_osx_integration=yes - fi - ],[ - want_osx_integration=yes - ]) - if test "x$want_osx_integration" = "xno"; then - AC_MSG_RESULT(no) - else - AC_MSG_RESULT(yes) - AC_WIRESHARK_OSX_INTEGRATION_CHECK - fi -fi - AC_SUBST(wireshark_bin) AC_SUBST(wireshark_man) AC_SUBST(wireshark_SUBDIRS) diff --git a/m4/ws_osx_integration_check.m4 b/m4/ws_osx_integration_check.m4 deleted file mode 100644 index 8c72538650..0000000000 --- a/m4/ws_osx_integration_check.m4 +++ /dev/null @@ -1,81 +0,0 @@ -# -# Autoconf script for Wireshark -# - -# -# AC_WIRESHARK_OSX_INTEGRATION_CHECK -# -# Checks for the presence of macOS integration functions in the GTK+ framework -# or as a separate library. -# -# GTK+ for macOS now lives on www.gtk.org at: -# -# http://www.gtk.org/download/macos.php -# -# Details on building with GTK-OSX are available at: -# -# http://live.gnome.org/GTK%2B/OSX/Building -# -# The GTK-OSX library has been renamed to gtkmacintegration. -# It was previously named igemacintegration. -# -# http://live.gnome.org/GTK%2B/OSX/Integration -# for the old Carbon-based integration functions -# -AC_DEFUN([AC_WIRESHARK_OSX_INTEGRATION_CHECK], -[dnl - AC_WIRESHARK_PUSH_FLAGS - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$GTK_LIBS $LIBS" - - # - # Check for the new integration functions in a -lgtkmacintegration - # library. - # - AC_CHECK_LIB(gtkmacintegration, gtkosx_application_set_menu_bar, - [ - AC_DEFINE(HAVE_GTKOSXAPPLICATION, 1, - [Define to 1 if -lgtkmacintegration includes the GtkOSXApplication Integration functions.]) - have_ige_mac=yes - # We don't want gtk stuff in LIBS (which is reset below) so - # manually set GTK_LIBS (which is more appropriate) - GTK_LIBS="$GTK_LIBS -lgtkmacintegration" - ]) - - if test x$have_ige_mac = x - then - # - # Not found - check for the old integration functions in - # the Gtk framework. - # - AC_CHECK_LIB(Gtk, gtk_mac_menu_set_menu_bar, - [ - AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1, - [Define to 1 if the the Gtk+ framework or a separate library includes the Imendio IGE macOS Integration functions.]) - have_ige_mac=yes - # We don't want gtk stuff in LIBS (which is reset below) so - # manually set GTK_LIBS (which is more appropriate) - GTK_LIBS="$GTK_LIBS -lGtk" - ]) - fi - - if test x$have_ige_mac = x - then - # - # Not found - check for the old integration functions in - # a -lgtkmacintegration library. - # - AC_CHECK_LIB(gtkmacintegration, gtk_mac_menu_set_menu_bar, - [ - AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1, - [Define to 1 if the the Gtk+ framework or a separate library includes the Imendio IGE macOS Integration functions.]) - have_ige_mac=yes - # We don't want gtk stuff in LIBS (which is reset below) so - # manually set GTK_LIBS (which is more appropriate) - GTK_LIBS="$GTK_LIBS -lgtkmacintegration" - ]) - fi - LIBS="$ac_save_LIBS" - AC_WIRESHARK_POP_FLAGS -]) diff --git a/ui/commandline.c b/ui/commandline.c index 2d77761c47..8d81c8d1a9 100644 --- a/ui/commandline.c +++ b/ui/commandline.c @@ -613,14 +613,7 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset) * file - yes, you could have "-r" as the last part of the command, * but that's a bit ugly. */ -#ifndef HAVE_GTKOSXAPPLICATION - /* - * For GTK+ Mac Integration, file name passed as free argument passed - * through grag-and-drop and opened twice sometimes causing crashes. - * Subject to report to GTK+ MAC. - */ global_commandline_info.cf_name = g_strdup(argv[0]); -#endif } argc--; argv++; diff --git a/ui/gtk/drag_and_drop.c b/ui/gtk/drag_and_drop.c index dcd5306b0a..8c4f30fbb4 100644 --- a/ui/gtk/drag_and_drop.c +++ b/ui/gtk/drag_and_drop.c @@ -45,9 +45,6 @@ #include "ui/gtk/old-gtk-compat.h" -#ifdef HAVE_GTKOSXAPPLICATION -#include -#endif enum { DND_TARGET_STRING, DND_TARGET_ROOTWIN, DND_TARGET_URL }; @@ -283,30 +280,6 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin } } -#ifdef HAVE_GTKOSXAPPLICATION -gboolean -gtk_osx_openFile (GtkosxApplication *app _U_, gchar *path, gpointer user_data _U_) -{ - GtkSelectionData selection_data; - gchar* selection_path; - size_t length = strlen(path); - - selection_path = (gchar *)g_malloc(length + 3); - memcpy(selection_path, path, length); - - selection_path[length] = '\r'; - selection_path[length + 1] = '\n'; - selection_path[length + 2] = '\0'; - - memset(&selection_data, 0, sizeof(selection_data)); - - gtk_selection_data_set(&selection_data, gdk_atom_intern_static_string ("text/uri-list"), 8, (guchar*) selection_path, (gint)(length + 2)); - dnd_data_received(NULL, NULL, 0, 0, &selection_data, DND_TARGET_URL, 0, 0); - - return TRUE; -} -#endif - /* init the drag and drop functionality */ void dnd_init(GtkWidget *w) @@ -326,9 +299,6 @@ dnd_init(GtkWidget *w) /* get notified, if some dnd coming in */ g_signal_connect(w, "drag_data_received", G_CALLBACK(dnd_data_received), NULL); -#ifdef HAVE_GTKOSXAPPLICATION - g_signal_connect(g_object_new(GTKOSX_TYPE_APPLICATION, NULL), "NSApplicationOpenFile", G_CALLBACK(gtk_osx_openFile), NULL); -#endif } /* diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 9777d4468f..e87816e384 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -204,10 +204,6 @@ #include -#ifdef HAVE_GTKOSXAPPLICATION -#include -#endif - #define INVALID_OPTION 1 #define INIT_FAILED 2 #define INVALID_CAPABILITY 2 @@ -247,7 +243,7 @@ static gboolean have_capture_file = FALSE; /* XXX - is there an equivalent in cf static guint tap_update_timer_id; -static void create_main_window(gint, gint, gint, e_prefs*); +static void create_main_window(gint, gint, gint); static void show_main_window(gboolean); static void main_save_window_geometry(GtkWidget *widget); @@ -1769,9 +1765,6 @@ main_cf_callback(gint event, gpointer data, gpointer user_data _U_) static void main_capture_callback(gint event, capture_session *cap_session, gpointer user_data _U_) { -#ifdef HAVE_GTKOSXAPPLICATION - GtkosxApplication *theApp; -#endif switch(event) { case(capture_cb_capture_prepared): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture prepared"); @@ -1780,14 +1773,6 @@ main_capture_callback(gint event, capture_session *cap_session, gpointer user_da case(capture_cb_capture_update_started): g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update started"); main_capture_cb_capture_update_started(cap_session); -#ifdef HAVE_GTKOSXAPPLICATION - theApp = (GtkosxApplication *)g_object_new(GTKOSX_TYPE_APPLICATION, NULL); -#ifdef HAVE_GDK_GRESOURCE - gtkosx_application_set_dock_icon_pixbuf(theApp, ws_gdk_pixbuf_new_from_resource("/org/wireshark/image/wsicon48.png")); -#else - gtkosx_application_set_dock_icon_pixbuf(theApp, gdk_pixbuf_new_from_inline(-1, wsicon_48_pb_data, FALSE, NULL)); -#endif -#endif break; case(capture_cb_capture_update_continue): /*g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update continue");*/ @@ -1811,14 +1796,6 @@ main_capture_callback(gint event, capture_session *cap_session, gpointer user_da g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture stopping"); /* Beware: this state won't be called, if the capture child * closes the capturing on its own! */ -#ifdef HAVE_GTKOSXAPPLICATION - theApp = (GtkosxApplication *)g_object_new(GTKOSX_TYPE_APPLICATION, NULL); -#ifdef HAVE_GDK_GRESOURCE - gtkosx_application_set_dock_icon_pixbuf(theApp, ws_gdk_pixbuf_new_from_resource("/org/wireshark/image/wsicon64.png")); -#else - gtkosx_application_set_dock_icon_pixbuf(theApp, gdk_pixbuf_new_from_inline(-1, wsicon_64_pb_data, FALSE, NULL)); -#endif -#endif main_capture_cb_capture_stopping(cap_session); break; case(capture_cb_capture_failed): @@ -2005,9 +1982,6 @@ main(int argc, char *argv[]) GtkWidget *splash_win = NULL; dfilter_t *jump_to_filter = NULL; unsigned int in_file_type = WTAP_TYPE_AUTO; -#ifdef HAVE_GTKOSXAPPLICATION - GtkosxApplication *theApp; -#endif GString *comp_info_str = NULL; GString *runtime_info_str = NULL; @@ -2433,7 +2407,7 @@ main(int argc, char *argv[]) /* Everything is prepared now, preferences and command line was read in */ /* Pop up the main window. */ - create_main_window(pl_size, tv_size, bv_size, global_commandline_info.prefs_p); + create_main_window(pl_size, tv_size, bv_size); /* Read the dynamic part of the recent file, as we have the gui now ready for it. */ if (!recent_read_dynamic(&rf_path, &rf_open_errno)) { @@ -2649,16 +2623,6 @@ main(int argc, char *argv[]) profile_store_persconffiles (FALSE); -#ifdef HAVE_GTKOSXAPPLICATION - theApp = (GtkosxApplication *)g_object_new(GTKOSX_TYPE_APPLICATION, NULL); -#ifdef HAVE_GDK_GRESOURCE - gtkosx_application_set_dock_icon_pixbuf(theApp, ws_gdk_pixbuf_new_from_resource("/org/wireshark/image/wsicon64.png")); -#else - gtkosx_application_set_dock_icon_pixbuf(theApp, gdk_pixbuf_new_from_inline(-1, wsicon_64_pb_data, FALSE, NULL)); -#endif - gtkosx_application_ready(theApp); -#endif - g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_INFO, "Wireshark is up and ready to go"); #ifdef HAVE_LIBPCAP @@ -2683,10 +2647,6 @@ main(int argc, char *argv[]) AirPDcapDestroyContext(&airpdcap_ctx); -#ifdef HAVE_GTKOSXAPPLICATION - g_object_unref(theApp); -#endif - #ifdef _WIN32 /* hide the (unresponsive) main window, while asking the user to close the console window */ if (G_IS_OBJECT(top_level)) @@ -3054,11 +3014,7 @@ top_level_key_pressed_cb(GtkWidget *w _U_, GdkEventKey *event, gpointer user_dat } static void -create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs_p -#if !defined(HAVE_IGE_MAC_INTEGRATION) && !defined (HAVE_GTKOSXAPPLICATION) - _U_ -#endif - ) +create_main_window (gint pl_size, gint tv_size, gint bv_size) { GtkAccelGroup *accel; @@ -3084,17 +3040,8 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs_p /* Menu bar */ menubar = main_menu_new(&accel); -#if defined(HAVE_IGE_MAC_INTEGRATION) || defined (HAVE_GTKOSXAPPLICATION) - /* macOS native menus are created and displayed by main_menu_new() */ - if(!prefs_p->gui_macosx_style) { -#endif gtk_window_add_accel_group(GTK_WINDOW(top_level), accel); gtk_widget_show(menubar); -#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION) - } else { - gtk_widget_hide(menubar); - } -#endif /* Main Toolbar */ main_tb = toolbar_new(); diff --git a/ui/gtk/main_menubar.c b/ui/gtk/main_menubar.c index 094530084f..2541604a4b 100644 --- a/ui/gtk/main_menubar.c +++ b/ui/gtk/main_menubar.c @@ -108,13 +108,6 @@ #include "capture_opts.h" #include "ui/capture_globals.h" #endif -#ifdef HAVE_IGE_MAC_INTEGRATION -#include -#endif - -#ifdef HAVE_GTKOSXAPPLICATION -#include -#endif static int initialize = TRUE; GtkActionGroup *main_menu_bar_action_group; @@ -2429,15 +2422,6 @@ GtkWidget * main_menu_new(GtkAccelGroup ** table) { GtkWidget *menubar; -#ifdef HAVE_IGE_MAC_INTEGRATION - GtkWidget *quit_item, *about_item, *preferences_item; - IgeMacMenuGroup *group; -#endif -#ifdef HAVE_GTKOSXAPPLICATION - GtkosxApplication *theApp; - GtkWidget * item; - GtkWidget * dock_menu; -#endif grp = gtk_accel_group_new(); @@ -2445,83 +2429,6 @@ main_menu_new(GtkAccelGroup ** table) menus_init(); menubar = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar"); -#ifdef HAVE_IGE_MAC_INTEGRATION - if(prefs.gui_macosx_style) { - ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar)); - ige_mac_menu_set_global_key_handler_enabled(TRUE); - - /* Create menu items to populate the application menu with. We have to - * do this because we are still using the old GtkItemFactory API for - * the main menu. */ - group = ige_mac_menu_add_app_menu_group(); - about_item = gtk_menu_item_new_with_label("About"); - g_signal_connect(about_item, "activate", G_CALLBACK(about_wireshark_cb), - NULL); - ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(about_item), NULL); - - group = ige_mac_menu_add_app_menu_group(); - preferences_item = gtk_menu_item_new_with_label("Preferences"); - g_signal_connect(preferences_item, "activate", G_CALLBACK(prefs_cb), - NULL); - ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(preferences_item), - NULL); - } - - /* The quit item in the application menu shows up whenever ige mac - * integration is enabled, even if the macOS UI style in Wireshark isn't - * turned on. */ - quit_item = gtk_menu_item_new_with_label("Quit"); - g_signal_connect(quit_item, "activate", G_CALLBACK(file_quit_cmd_cb), NULL); - ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM(quit_item)); -#endif - -#ifdef HAVE_GTKOSXAPPLICATION - theApp = (GtkosxApplication *)g_object_new(GTKOSX_TYPE_APPLICATION, NULL); - - if(prefs.gui_macosx_style) { - gtk_widget_hide(menubar); - - gtkosx_application_set_menu_bar(theApp, GTK_MENU_SHELL(menubar)); - gtkosx_application_set_use_quartz_accelerators(theApp, TRUE); - - /* Construct a conventional looking OSX App menu */ - - item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/HelpMenu/AboutWireshark"); - gtkosx_application_insert_app_menu_item(theApp, item, 0); - - gtkosx_application_insert_app_menu_item(theApp, gtk_separator_menu_item_new(), 1); - - item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/EditMenu/Preferences"); - gtkosx_application_insert_app_menu_item(theApp, item, 2); - - /* Set OSX help menu */ - - item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/HelpMenu"); - gtkosx_application_set_help_menu(theApp,GTK_MENU_ITEM(item)); - - /* Hide the File menu Quit item (a Quit item is automagically placed within the OSX App menu) */ - - item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/FileMenu/Quit"); - gtk_widget_hide(item); - } - - /* generate dock menu */ - dock_menu = gtk_menu_new(); - - item = gtk_menu_item_new_with_label("Start"); - g_signal_connect(item, "activate", G_CALLBACK (capture_start_cb), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item); - - item = gtk_menu_item_new_with_label("Stop"); - g_signal_connect(item, "activate", G_CALLBACK (capture_stop_cb), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item); - - item = gtk_menu_item_new_with_label("Restart"); - g_signal_connect(item, "activate", G_CALLBACK (capture_restart_cb), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item); - - gtkosx_application_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu)); -#endif if (table) *table = grp; diff --git a/ui/gtk/prefs_gui.c b/ui/gtk/prefs_gui.c index 176f55dbfd..072d177fa1 100644 --- a/ui/gtk/prefs_gui.c +++ b/ui/gtk/prefs_gui.c @@ -58,10 +58,6 @@ static gint scroll_percent_changed_cb(GtkWidget *recent_df_entry _U_, #define GEOMETRY_SIZE_KEY "geometry_size" #define GEOMETRY_MAXIMIZED_KEY "geometry_maximized" -#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION) -#define MACOSX_STYLE_KEY "macosx_style" -#endif - #ifdef _WIN32 #define GUI_CONSOLE_OPEN_KEY "console_open" #define ENABLE_UPDATE_KEY "enable_update" @@ -151,9 +147,6 @@ gui_prefs_show(void) GtkWidget *auto_scroll_cb, *scroll_percent_te; GtkWidget *webbrowser_te; GtkWidget *save_position_cb, *save_size_cb, *save_maximized_cb; -#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION) - GtkWidget *macosx_style_cb; -#endif GtkWidget *expert_info_eyecandy_cb; GtkWidget *packet_editor_cb; @@ -203,16 +196,6 @@ gui_prefs_show(void) g_object_set_data(G_OBJECT(main_vb), ENABLE_UPDATE_KEY, enable_update_cb); #endif -#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION) - macosx_style_cb = create_preference_check_button(main_grid, pos++, - "macOS style", - "Create a macOS look and feel. Checking this box will move the " - "menu bar to the top of the screen instead of the top of the Wireshark window. " - "Requires a restart of Wireshark to take effect.", - prefs.gui_macosx_style); - g_object_set_data(G_OBJECT(main_vb), MACOSX_STYLE_KEY, macosx_style_cb); -#endif - #ifdef _WIN32 /* How the console window should be opened */ console_open_om = create_preference_option_menu(main_grid, pos++, @@ -371,11 +354,6 @@ gui_prefs_fetch(GtkWidget *w) gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), ENABLE_UPDATE_KEY)); #endif -#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION) - prefs.gui_macosx_style = - gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), MACOSX_STYLE_KEY)); -#endif - #ifdef _WIN32 prefs.gui_console_open = fetch_enum_value( g_object_get_data(G_OBJECT(w), GUI_CONSOLE_OPEN_KEY), gui_console_open_vals);