summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-29 23:24:52 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-29 23:24:52 +0000
commit5d000c47dda53af105cb8098c9fef5288008757b (patch)
treecbfba940c62992a4ce68b844dac29e91776c7921
parented634bf615561459266438450a8300026ce0224c (diff)
downloadchromium_src-5d000c47dda53af105cb8098c9fef5288008757b.zip
chromium_src-5d000c47dda53af105cb8098c9fef5288008757b.tar.gz
chromium_src-5d000c47dda53af105cb8098c9fef5288008757b.tar.bz2
linux: delete code that worked around gtk <2.18
We now depend on GTK 2.18, and in fact we've been infobaring users who don't have it informing them that Chrome will stop working. Review URL: http://codereview.chromium.org/7791004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98732 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_main.cc5
-rw-r--r--chrome/browser/printing/print_dialog_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/global_bookmark_menu.cc49
-rw-r--r--chrome/browser/ui/gtk/gtk_util.cc23
-rw-r--r--chrome/browser/ui/gtk/menu_gtk.cc4
-rw-r--r--content/browser/renderer_host/gtk_key_bindings_handler.cc37
-rw-r--r--views/controls/combobox/native_combobox_gtk.cc4
-rw-r--r--views/controls/menu/native_menu_gtk.cc13
-rw-r--r--webkit/glue/webcursor_gtk.cc27
9 files changed, 6 insertions, 160 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 0ec5e3b..0c8f5bd 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -554,11 +554,6 @@ static void GLibLogHandler(const gchar* log_domain,
LOG(ERROR) << "Bug 9643: " << log_domain << ": " << message;
alerted = true;
}
- } else if (strstr(message, "gtk_widget_size_allocate(): attempt to "
- "allocate widget with width") &&
- !GTK_CHECK_VERSION(2, 16, 1)) {
- // This warning only occurs in obsolete versions of GTK and is harmless.
- // http://crbug.com/11133
} else if (strstr(message, "Theme file for default has no") ||
strstr(message, "Theme directory") ||
strstr(message, "theme pixmap")) {
diff --git a/chrome/browser/printing/print_dialog_gtk.cc b/chrome/browser/printing/print_dialog_gtk.cc
index 6457ce0..3e803ed 100644
--- a/chrome/browser/printing/print_dialog_gtk.cc
+++ b/chrome/browser/printing/print_dialog_gtk.cc
@@ -143,9 +143,7 @@ void PrintDialogGtk::UseDefaultSettings() {
g_object_ref(printer_);
gtk_print_settings_set_printer(gtk_settings_,
gtk_printer_get_name(printer_));
-#if GTK_CHECK_VERSION(2, 14, 0)
page_setup_ = gtk_printer_get_default_page_size(printer_);
-#endif
}
if (!page_setup_)
@@ -236,10 +234,8 @@ void PrintDialogGtk::ShowDialog(
GTK_PRINT_CAPABILITY_REVERSE);
gtk_print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(dialog_),
cap);
-#if GTK_CHECK_VERSION(2, 18, 0)
gtk_print_unix_dialog_set_embed_page_setup(GTK_PRINT_UNIX_DIALOG(dialog_),
TRUE);
-#endif
g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
gtk_widget_show(dialog_);
}
diff --git a/chrome/browser/ui/gtk/global_bookmark_menu.cc b/chrome/browser/ui/gtk/global_bookmark_menu.cc
index 7cd4f47..801cf60 100644
--- a/chrome/browser/ui/gtk/global_bookmark_menu.cc
+++ b/chrome/browser/ui/gtk/global_bookmark_menu.cc
@@ -24,34 +24,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/gtk_util.h"
-namespace {
-
-// We need to know whether we're using a newer GTK at run time because we need
-// to prevent.
-//
-// TODO(erg): Once we've dropped Hardy support, remove this hack.
-typedef void (*gtk_menu_item_set_label_func)(GtkMenuItem*, const gchar*);
-gtk_menu_item_set_label_func gtk_menu_item_set_label_sym =
-#if GTK_CHECK_VERSION(2, 16, 1)
- gtk_menu_item_set_label;
-#else
- NULL;
-#endif
-
-void EnsureMenuItemFunctions() {
-#if !GTK_CHECK_VERSION(2, 16, 1)
- static bool methods_looked_up = false;
- if (!methods_looked_up) {
- methods_looked_up = true;
- gtk_menu_item_set_label_sym =
- reinterpret_cast<gtk_menu_item_set_label_func>(
- dlsym(NULL, "gtk_menu_item_set_label"));
- }
-#endif
-}
-
-} // namespace
-
GlobalBookmarkMenu::GlobalBookmarkMenu(Browser* browser)
: browser_(browser),
profile_(browser->profile()),
@@ -74,13 +46,10 @@ void GlobalBookmarkMenu::Init(GtkWidget* bookmark_menu,
GtkWidget* bookmark_menu_item) {
bookmark_menu_.Own(bookmark_menu);
- EnsureMenuItemFunctions();
- if (gtk_menu_item_set_label_sym) {
- BookmarkModel* model = profile_->GetBookmarkModel();
- model->AddObserver(this);
- if (model->IsLoaded())
- Loaded(model, false);
- }
+ BookmarkModel* model = profile_->GetBookmarkModel();
+ model->AddObserver(this);
+ if (model->IsLoaded())
+ Loaded(model, false);
}
void GlobalBookmarkMenu::RebuildMenuInFuture() {
@@ -167,14 +136,8 @@ void GlobalBookmarkMenu::ConfigureMenuItem(const BookmarkNode* node,
CHECK(node);
CHECK(menu_item);
- // This check is only to make things compile on Hardy; this code won't
- // display any visible widgets in older systems that don't have a global menu
- // bar.
- if (gtk_menu_item_set_label_sym) {
- gtk_menu_item_set_label_sym(
- GTK_MENU_ITEM(menu_item),
- bookmark_utils::BuildMenuLabelFor(node).c_str());
- }
+ gtk_menu_item_set_label(GTK_MENU_ITEM(menu_item),
+ bookmark_utils::BuildMenuLabelFor(node).c_str());
if (node->is_url()) {
gtk_widget_set_tooltip_markup(
diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc
index ecfbe15..c116bef 100644
--- a/chrome/browser/ui/gtk/gtk_util.cc
+++ b/chrome/browser/ui/gtk/gtk_util.cc
@@ -380,7 +380,6 @@ void CenterOverWindow(GtkWindow* window, GtkWindow* parent) {
}
void MakeAppModalWindowGroup() {
-#if GTK_CHECK_VERSION(2, 14, 0)
// Older versions of GTK+ don't give us gtk_window_group_list() which is what
// we need to add current non-browser modal dialogs to the list. If
// we have 2.14+ we can do things the correct way.
@@ -398,20 +397,9 @@ void MakeAppModalWindowGroup() {
g_list_free(all_windows);
}
g_object_unref(window_group);
-#else
- // Otherwise just grab all browser windows and be slightly broken.
- GtkWindowGroup* window_group = gtk_window_group_new();
- for (BrowserList::const_iterator it = BrowserList::begin();
- it != BrowserList::end(); ++it) {
- gtk_window_group_add_window(window_group,
- (*it)->window()->GetNativeHandle());
- }
- g_object_unref(window_group);
-#endif
}
void AppModalDismissedUngroupWindows() {
-#if GTK_CHECK_VERSION(2, 14, 0)
if (BrowserList::begin() != BrowserList::end()) {
std::vector<GtkWindow*> transient_windows;
@@ -440,17 +428,6 @@ void AppModalDismissedUngroupWindows() {
gtk_window_group_add_window(group, *it);
}
}
-#else
- // This is slightly broken in the case where a different window had a dialog,
- // but its the best we can do since we don't have newer gtk stuff.
- for (BrowserList::const_iterator it = BrowserList::begin();
- it != BrowserList::end(); ++it) {
- GtkWindowGroup* window_group = gtk_window_group_new();
- gtk_window_group_add_window(window_group,
- (*it)->window()->GetNativeHandle());
- g_object_unref(window_group);
- }
-#endif
}
void RemoveAllChildren(GtkWidget* container) {
diff --git a/chrome/browser/ui/gtk/menu_gtk.cc b/chrome/browser/ui/gtk/menu_gtk.cc
index 9d76219..3918ee6 100644
--- a/chrome/browser/ui/gtk/menu_gtk.cc
+++ b/chrome/browser/ui/gtk/menu_gtk.cc
@@ -801,11 +801,7 @@ void MenuGtk::SetMenuItemInfo(GtkWidget* widget, gpointer userdata) {
gfx::ConvertAcceleratorsFromWindowsStyle(
UTF16ToUTF8(model->GetLabelAt(id)));
-#if GTK_CHECK_VERSION(2, 16, 0)
gtk_menu_item_set_label(GTK_MENU_ITEM(widget), label.c_str());
-#else
- gtk_label_set_label(GTK_LABEL(GTK_BIN(widget)->child), label.c_str());
-#endif
if (GTK_IS_IMAGE_MENU_ITEM(widget)) {
SkBitmap icon;
if (model->GetIconAt(id, &icon)) {
diff --git a/content/browser/renderer_host/gtk_key_bindings_handler.cc b/content/browser/renderer_host/gtk_key_bindings_handler.cc
index 94e3234..890046e 100644
--- a/content/browser/renderer_host/gtk_key_bindings_handler.cc
+++ b/content/browser/renderer_host/gtk_key_bindings_handler.cc
@@ -56,17 +56,6 @@ GtkWidget* GtkKeyBindingsHandler::CreateNewHandler() {
gtk_widget_set_events(GTK_WIDGET(handler), 0);
gtk_widget_set_can_focus(GTK_WIDGET(handler), TRUE);
-#if !GTK_CHECK_VERSION(2, 14, 0)
- // "move-focus", "move-viewport", "select-all" and "toggle-cursor-visible"
- // have no corresponding virtual methods. Prior to glib 2.18 (gtk 2.14),
- // there is no way to override the default class handler of a signal.
- // So we need hook these signal explicitly.
- g_signal_connect(handler, "move-focus", G_CALLBACK(MoveFocus), NULL);
- g_signal_connect(handler, "move-viewport", G_CALLBACK(MoveViewport), NULL);
- g_signal_connect(handler, "select-all", G_CALLBACK(SelectAll), NULL);
- g_signal_connect(handler, "toggle-cursor-visible",
- G_CALLBACK(ToggleCursorVisible), NULL);
-#endif
return GTK_WIDGET(handler);
}
@@ -95,7 +84,6 @@ void GtkKeyBindingsHandler::HandlerClassInit(HandlerClass *klass) {
text_view_class->toggle_overwrite = ToggleOverwrite;
widget_class->show_help = ShowHelp;
-#if GTK_CHECK_VERSION(2, 14, 0)
// "move-focus", "move-viewport", "select-all" and "toggle-cursor-visible"
// have no corresponding virtual methods. Since glib 2.18 (gtk 2.14),
// g_signal_override_class_handler() is introduced to override a signal
@@ -115,7 +103,6 @@ void GtkKeyBindingsHandler::HandlerClassInit(HandlerClass *klass) {
g_signal_override_class_handler("toggle-cursor-visible",
G_TYPE_FROM_CLASS(klass),
G_CALLBACK(ToggleCursorVisible));
-#endif
}
GType GtkKeyBindingsHandler::HandlerGetType() {
@@ -264,12 +251,6 @@ void GtkKeyBindingsHandler::MoveCursor(
void GtkKeyBindingsHandler::MoveViewport(
GtkTextView* text_view, GtkScrollStep step, gint count) {
// Not supported by webkit.
-#if !GTK_CHECK_VERSION(2, 14, 0)
- // Before gtk 2.14.0, there is no way to override a non-virtual default signal
- // handler, so we need stop the signal emission explicitly to prevent the
- // default handler from being executed.
- g_signal_stop_emission_by_name(text_view, "move-viewport");
-#endif
}
void GtkKeyBindingsHandler::PasteClipboard(GtkTextView* text_view) {
@@ -281,12 +262,6 @@ void GtkKeyBindingsHandler::SelectAll(GtkTextView* text_view, gboolean select) {
GetHandlerOwner(text_view)->EditCommandMatched("SelectAll", "");
else
GetHandlerOwner(text_view)->EditCommandMatched("Unselect", "");
-#if !GTK_CHECK_VERSION(2, 14, 0)
- // Before gtk 2.14.0, there is no way to override a non-virtual default signal
- // handler, so we need stop the signal emission explicitly to prevent the
- // default handler from being executed.
- g_signal_stop_emission_by_name(text_view, "select-all");
-#endif
}
void GtkKeyBindingsHandler::SetAnchor(GtkTextView* text_view) {
@@ -295,12 +270,6 @@ void GtkKeyBindingsHandler::SetAnchor(GtkTextView* text_view) {
void GtkKeyBindingsHandler::ToggleCursorVisible(GtkTextView* text_view) {
// Not supported by webkit.
-#if !GTK_CHECK_VERSION(2, 14, 0)
- // Before gtk 2.14.0, there is no way to override a non-virtual default signal
- // handler, so we need stop the signal emission explicitly to prevent the
- // default handler from being executed.
- g_signal_stop_emission_by_name(text_view, "toggle-cursor-visible");
-#endif
}
void GtkKeyBindingsHandler::ToggleOverwrite(GtkTextView* text_view) {
@@ -316,10 +285,4 @@ gboolean GtkKeyBindingsHandler::ShowHelp(GtkWidget* widget,
void GtkKeyBindingsHandler::MoveFocus(GtkWidget* widget,
GtkDirectionType arg1) {
// Just for disabling the default handler.
-#if !GTK_CHECK_VERSION(2, 14, 0)
- // Before gtk 2.14.0, there is no way to override a non-virtual default signal
- // handler, so we need stop the signal emission explicitly to prevent the
- // default handler from being executed.
- g_signal_stop_emission_by_name(widget, "move-focus");
-#endif
}
diff --git a/views/controls/combobox/native_combobox_gtk.cc b/views/controls/combobox/native_combobox_gtk.cc
index 76e550d..3efdb75 100644
--- a/views/controls/combobox/native_combobox_gtk.cc
+++ b/views/controls/combobox/native_combobox_gtk.cc
@@ -180,11 +180,7 @@ void NativeComboboxGtk::FocusedMenuItemChanged() {
GtkCellView* cell_view = GTK_CELL_VIEW(child);
GtkTreePath* path = gtk_cell_view_get_displayed_row(cell_view);
GtkTreeModel* model = NULL;
-#if GTK_CHECK_VERSION(2, 16, 0)
model = gtk_cell_view_get_model(cell_view);
-#else
- g_object_get(cell_view, "model", &model, NULL);
-#endif
GtkTreeIter iter;
if (model && gtk_tree_model_get_iter(model, &iter, path)) {
GValue value = { 0 };
diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc
index 8a87830..50810bb 100644
--- a/views/controls/menu/native_menu_gtk.cc
+++ b/views/controls/menu/native_menu_gtk.cc
@@ -393,11 +393,9 @@ GtkWidget* NativeMenuGtk::AddMenuItemAt(int index,
gtk_image_new_from_pixbuf(pixbuf));
g_object_unref(pixbuf);
-#if GTK_CHECK_VERSION(2,16,0)
// Show the image even if the "gtk-menu-images" setting is turned off.
gtk_image_menu_item_set_always_show_image(
GTK_IMAGE_MENU_ITEM(menu_item), TRUE);
-#endif
} else {
menu_item = gtk_menu_item_new_with_mnemonic(label.c_str());
}
@@ -606,18 +604,7 @@ void NativeMenuGtk::SendAccessibilityEvent() {
// Get the menu item's label.
std::string name;
-#if GTK_CHECK_VERSION(2, 16, 0)
name = gtk_menu_item_get_label(GTK_MENU_ITEM(menu_item));
-#else
- GList* children = gtk_container_get_children(GTK_CONTAINER(menu_item));
- for (GList* l = g_list_first(children); l != NULL; l = g_list_next(l)) {
- GtkWidget* child = static_cast<GtkWidget*>(l->data);
- if (GTK_IS_LABEL(child)) {
- name = gtk_label_get_label(GTK_LABEL(child));
- break;
- }
- }
-#endif
if (ViewsDelegate::views_delegate) {
ViewsDelegate::views_delegate->NotifyMenuItemFocused(
diff --git a/webkit/glue/webcursor_gtk.cc b/webkit/glue/webcursor_gtk.cc
index c315b2a..209e761 100644
--- a/webkit/glue/webcursor_gtk.cc
+++ b/webkit/glue/webcursor_gtk.cc
@@ -44,23 +44,6 @@ GdkCursor* GetInlineCustomCursor(CustomCursorType type) {
return cursor;
}
-// For GTK 2.16 and beyond, GDK_BLANK_CURSOR is available. Before, we have to
-// use a custom cursor.
-#if !GTK_CHECK_VERSION(2, 16, 0)
-// Get/create a custom cursor which is invisible.
-GdkCursor* GetInvisibleCustomCursor() {
- static GdkCursor* cursor = NULL;
- if (cursor)
- return cursor;
- const char bits[] = { 0 };
- const GdkColor color = { 0, 0, 0, 0 };
- GdkPixmap* bitmap = gdk_bitmap_create_from_data(NULL, bits, 1, 1);
- cursor = gdk_cursor_new_from_pixmap(bitmap, bitmap, &color, &color, 0, 0);
- g_object_unref(bitmap);
- return cursor;
-}
-#endif
-
} // end anonymous namespace
int WebCursor::GetCursorType() const {
@@ -143,12 +126,7 @@ int WebCursor::GetCursorType() const {
case WebCursorInfo::TypeCopy:
NOTIMPLEMENTED(); return GDK_LAST_CURSOR;
case WebCursorInfo::TypeNone:
-// See comment above |GetInvisibleCustomCursor()|.
-#if !GTK_CHECK_VERSION(2, 16, 0)
- return GDK_CURSOR_IS_PIXMAP;
-#else
return GDK_BLANK_CURSOR;
-#endif
case WebCursorInfo::TypeNotAllowed:
NOTIMPLEMENTED(); return GDK_LAST_CURSOR;
case WebCursorInfo::TypeZoomIn:
@@ -171,11 +149,6 @@ gfx::NativeCursor WebCursor::GetNativeCursor() {
GdkCursor* WebCursor::GetCustomCursor() {
switch (type_) {
-// See comment above |GetInvisibleCustomCursor()|.
-#if !GTK_CHECK_VERSION(2, 16, 0)
- case WebCursorInfo::TypeNone:
- return GetInvisibleCustomCursor();
-#endif
case WebCursorInfo::TypeZoomIn:
return GetInlineCustomCursor(CustomCursorZoomIn);
case WebCursorInfo::TypeZoomOut: