aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html1
-rw-r--r--gtk/PlatGTK.cxx14
2 files changed, 12 insertions, 3 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 6f97a07ff..fcca31931 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -530,6 +530,7 @@
</li>
<li>
Fix display of autocompletion lists and calltips on GTK+ 3.22 on Wayland.
+ Newer APIs used on GTK+ 3.22 as older APIs were deprecated.
</li>
</ul>
<h3>
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index d35a379ba..fe207cece 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -1914,17 +1914,24 @@ void Menu::Destroy() {
mid = 0;
}
+#if !GTK_CHECK_VERSION(3,22,0)
static void MenuPositionFunc(GtkMenu *, gint *x, gint *y, gboolean *, gpointer userData) {
sptr_t intFromPointer = GPOINTER_TO_INT(userData);
*x = intFromPointer & 0xffff;
*y = intFromPointer >> 16;
}
+#endif
-void Menu::Show(Point pt, Window &) {
- int screenHeight = gdk_screen_height();
- int screenWidth = gdk_screen_width();
+void Menu::Show(Point pt, Window &wnd) {
GtkMenu *widget = static_cast<GtkMenu *>(mid);
gtk_widget_show_all(GTK_WIDGET(widget));
+#if GTK_CHECK_VERSION(3,22,0)
+ // Rely on GTK+ to do the right thing with positioning
+ gtk_menu_popup_at_pointer(widget, NULL);
+#else
+ GdkRectangle rcScreen = MonitorRectangleForWidget(PWidget(wnd.GetID()));
+ const int screenWidth = rcScreen.width;
+ const int screenHeight = rcScreen.height;
GtkRequisition requisition;
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(GTK_WIDGET(widget), NULL, &requisition);
@@ -1940,6 +1947,7 @@ void Menu::Show(Point pt, Window &) {
gtk_menu_popup(widget, NULL, NULL, MenuPositionFunc,
GINT_TO_POINTER((static_cast<int>(pt.y) << 16) | static_cast<int>(pt.x)), 0,
gtk_get_current_event_time());
+#endif
}
ElapsedTime::ElapsedTime() {