Modified: releases/WebKitGTK/webkit-2.16/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp (218828 => 218829)
--- releases/WebKitGTK/webkit-2.16/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp 2017-06-27 05:49:43 UTC (rev 218828)
+++ releases/WebKitGTK/webkit-2.16/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp 2017-06-27 06:01:27 UTC (rev 218829)
@@ -167,13 +167,8 @@
NativeWebMouseEvent* mouseEvent = m_page->currentlyProcessedMouseDownEvent();
const GdkEvent* event = mouseEvent ? mouseEvent->nativeEvent() : 0;
gtk_menu_attach_to_widget(m_menu, GTK_WIDGET(m_webView), nullptr);
-
-#if GTK_CHECK_VERSION(3, 22, 0)
- gtk_menu_popup_at_pointer(m_menu, event);
-#else
gtk_menu_popup(m_menu, nullptr, nullptr, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this,
event ? event->button.button : 3, event ? event->button.time : GDK_CURRENT_TIME);
-#endif
}
void WebContextMenuProxyGtk::showContextMenuWithItems(const Vector<WebContextMenuItemData>& items)
@@ -209,7 +204,6 @@
gtk_widget_destroy(GTK_WIDGET(m_menu));
}
-#if !GTK_CHECK_VERSION(3, 22, 0)
void WebContextMenuProxyGtk::menuPositionFunction(GtkMenu* menu, gint* x, gint* y, gboolean* pushIn, WebContextMenuProxyGtk* popupMenu)
{
GtkRequisition menuSize;
@@ -226,7 +220,6 @@
*pushIn = FALSE;
}
-#endif
} // namespace WebKit
#endif // ENABLE(CONTEXT_MENUS)
Modified: releases/WebKitGTK/webkit-2.16/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp (218828 => 218829)
--- releases/WebKitGTK/webkit-2.16/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp 2017-06-27 05:49:43 UTC (rev 218828)
+++ releases/WebKitGTK/webkit-2.16/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp 2017-06-27 06:01:27 UTC (rev 218829)
@@ -95,6 +95,9 @@
resetTypeAheadFindState();
+ IntPoint menuPosition = convertWidgetPointToScreenPoint(m_webView, rect.location());
+ menuPosition.move(0, rect.height());
+
// This approach follows the one in gtkcombobox.c.
GtkRequisition requisition;
gtk_widget_set_size_request(m_popup, -1, -1);
@@ -101,33 +104,13 @@
gtk_widget_get_preferred_size(m_popup, &requisition, nullptr);
gtk_widget_set_size_request(m_popup, std::max(rect.width(), requisition.width), -1);
- // Reposition the menu after giving it a new width.
- gtk_menu_reposition(GTK_MENU(m_popup));
-
-#if GTK_CHECK_VERSION(3, 22, 0)
- // With a recent GTK+ we calculate an offset from the position where the menu would
- // be normally popped up, and use it as value of the "rect-anchor-dy" property.
- // The code in gtkcombobox.c starts with the offset hardcoded as -2 as well.
- IntPoint menuPosition { 0, -2 };
-#else
- IntPoint menuPosition = convertWidgetPointToScreenPoint(m_webView, rect.location());
- menuPosition.move(0, rect.height());
-#endif
-
if (int itemCount = items.size()) {
GUniquePtr<GList> children(gtk_container_get_children(GTK_CONTAINER(m_popup)));
int i;
GList* child;
for (i = 0, child = children.get(); i < itemCount; i++, child = g_list_next(child)) {
-#if GTK_CHECK_VERSION(3, 22, 0)
- // Do not count the last one: we are using the top-left corner of the
- // item (GDK_GRAVITY_NORTH_WEST) as reference point of the popup.
- if (i >= selectedIndex)
- break;
-#else
if (i > selectedIndex)
break;
-#endif
GtkWidget* item = GTK_WIDGET(child->data);
GtkRequisition itemRequisition;
@@ -142,12 +125,6 @@
gtk_menu_attach_to_widget(GTK_MENU(m_popup), GTK_WIDGET(m_webView), nullptr);
const GdkEvent* event = m_client->currentlyProcessedMouseDownEvent() ? m_client->currentlyProcessedMouseDownEvent()->nativeEvent() : nullptr;
-#if GTK_CHECK_VERSION(3, 22, 0)
- // Set the same properties that GTK+ uses itself for combo box popups.
- g_object_set(m_popup, "menu-type-hint", GDK_WINDOW_TYPE_HINT_COMBO, "rect-anchor-dy", menuPosition.y(), "anchor-hints", GDK_ANCHOR_SLIDE | GDK_ANCHOR_RESIZE, nullptr);
- const GdkRectangle referenceRect = { rect.x(), rect.y(), rect.width(), rect.height() };
- gtk_menu_popup_at_rect(GTK_MENU(m_popup), gtk_widget_get_window(m_webView), &referenceRect, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, event);
-#else
gtk_menu_popup_for_device(GTK_MENU(m_popup), event ? gdk_event_get_device(event) : nullptr, nullptr, nullptr,
[](GtkMenu*, gint* x, gint* y, gboolean* pushIn, gpointer userData) {
// We can pass a pointer to the menuPosition local variable because the nested main loop ensures this is called in the function context.
@@ -157,7 +134,6 @@
*pushIn = menuPosition->y() < 0;
}, &menuPosition, nullptr, event && event->type == GDK_BUTTON_PRESS ? event->button.button : 1,
event ? gdk_event_get_time(event) : GDK_CURRENT_TIME);
-#endif
// Now that the menu has a position, schedule a resize to make sure it's resized to fit vertically in the work area.
gtk_widget_queue_resize(m_popup);
Modified: releases/WebKitGTK/webkit-2.16/Tools/MiniBrowser/gtk/BrowserSearchBar.c (218828 => 218829)
--- releases/WebKitGTK/webkit-2.16/Tools/MiniBrowser/gtk/BrowserSearchBar.c 2017-06-27 05:49:43 UTC (rev 218828)
+++ releases/WebKitGTK/webkit-2.16/Tools/MiniBrowser/gtk/BrowserSearchBar.c 2017-06-27 06:01:27 UTC (rev 218829)
@@ -93,12 +93,8 @@
static void searchEntryMenuIconPressedCallback(BrowserSearchBar *searchBar, GtkEntryIconPosition iconPosition, GdkEvent *event)
{
if (iconPosition == GTK_ENTRY_ICON_PRIMARY) {
-#if GTK_CHECK_VERSION(3, 22, 0)
- gtk_menu_popup_at_pointer(GTK_MENU(searchBar->optionsMenu), event);
-#else
GdkEventButton *eventButton = (GdkEventButton *)event;
gtk_menu_popup(GTK_MENU(searchBar->optionsMenu), NULL, NULL, NULL, NULL, eventButton->button, eventButton->time);
-#endif
}
}