diff -urN gtk+-3.17.4-orig/gtk/gtkentrycompletion.c gtk+-3.17.4/gtk/gtkentrycompletion.c
--- gtk+-3.17.4-orig/gtk/gtkentrycompletion.c	2015-06-20 23:36:17.000000000 +0200
+++ gtk+-3.17.4/gtk/gtkentrycompletion.c	2015-07-23 22:20:00.000000000 +0200
@@ -83,6 +83,7 @@
 #include "gtkentry.h"
 #include "gtkmain.h"
 #include "gtkmarshalers.h"
+#include "gtkpopover.h"
 
 #include "gtkprivate.h"
 #include "gtkwindowprivate.h"
@@ -531,7 +532,6 @@
   GtkEntryCompletionPrivate *priv = completion->priv;
   GtkCellRenderer           *cell;
   GtkTreeSelection          *sel;
-  GtkWidget                 *popup_frame;
 
   G_OBJECT_CLASS (gtk_entry_completion_parent_class)->constructed (object);
 
@@ -572,7 +572,7 @@
                                   GTK_POLICY_NEVER,
                                   GTK_POLICY_AUTOMATIC);
   gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->scrolled_window),
-                                       GTK_SHADOW_NONE);
+                                       GTK_SHADOW_ETCHED_IN);
 
   /* a nasty hack to get the completions treeview to size nicely */
   gtk_widget_set_size_request (gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->scrolled_window)),
@@ -609,11 +609,9 @@
                                               NULL);
 
   /* pack it all */
-  priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
-  gtk_window_set_use_subsurface (GTK_WINDOW (priv->popup_window), TRUE);
-  gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE);
-  gtk_window_set_type_hint (GTK_WINDOW(priv->popup_window),
-                            GDK_WINDOW_TYPE_HINT_COMBO);
+  priv->popup_window = gtk_popover_new (NULL);
+  gtk_container_set_border_width(GTK_CONTAINER(priv->popup_window), 6);
+  gtk_popover_set_modal(GTK_POPOVER(priv->popup_window), FALSE);
 
   g_signal_connect (priv->popup_window, "key-press-event",
                     G_CALLBACK (gtk_entry_completion_popup_key_event),
@@ -625,14 +623,8 @@
                     G_CALLBACK (gtk_entry_completion_popup_button_press),
                     completion);
 
-  popup_frame = gtk_frame_new (NULL);
-  gtk_frame_set_shadow_type (GTK_FRAME (popup_frame),
-                             GTK_SHADOW_ETCHED_IN);
-  gtk_widget_show (popup_frame);
-  gtk_container_add (GTK_CONTAINER (priv->popup_window), popup_frame);
-
   priv->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (popup_frame), priv->vbox);
+  gtk_container_add (GTK_CONTAINER (priv->popup_window), priv->vbox);
 
   gtk_container_add (GTK_CONTAINER (priv->scrolled_window), priv->tree_view);
   gtk_box_pack_start (GTK_BOX (priv->vbox), priv->scrolled_window,
@@ -791,7 +783,7 @@
 {
   GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (object);
   GtkEntryCompletionPrivate *priv = completion->priv;
-
+ 
   if (priv->tree_view)
     {
       gtk_widget_destroy (priv->tree_view);
@@ -1603,8 +1595,6 @@
       gtk_tree_path_free (path);
     }
 
-  gtk_window_move (GTK_WINDOW (completion->priv->popup_window), x, y);
-
   return above;
 }
 
@@ -1622,9 +1612,6 @@
   if (!gtk_widget_has_focus (completion->priv->entry))
     return;
 
-  if (completion->priv->has_grab)
-    return;
-
   completion->priv->ignore_enter = TRUE;
 
   gtk_widget_show_all (completion->priv->vbox);
@@ -1635,34 +1622,11 @@
   _gtk_entry_completion_resize_popup (completion);
 
   toplevel = gtk_widget_get_toplevel (completion->priv->entry);
-  if (GTK_IS_WINDOW (toplevel))
-    {
-      gtk_window_set_transient_for (GTK_WINDOW (completion->priv->popup_window),
-                                    GTK_WINDOW (toplevel));
-      gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
-                                   GTK_WINDOW (completion->priv->popup_window));
-    }
-
-  /* prevent the first row being focused */
-  gtk_widget_grab_focus (completion->priv->tree_view);
 
   gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view)));
   gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->action_view)));
 
-  gtk_window_set_screen (GTK_WINDOW (completion->priv->popup_window),
-                         gtk_widget_get_screen (completion->priv->entry));
-
   gtk_widget_show (completion->priv->popup_window);
-
-  gtk_device_grab_add (completion->priv->popup_window, completion->priv->device, TRUE);
-  gdk_device_grab (completion->priv->device, gtk_widget_get_window (completion->priv->popup_window),
-                   GDK_OWNERSHIP_WINDOW, TRUE,
-                   GDK_BUTTON_PRESS_MASK |
-                   GDK_BUTTON_RELEASE_MASK |
-                   GDK_POINTER_MOTION_MASK,
-                   NULL, GDK_CURRENT_TIME);
-
-  completion->priv->has_grab = TRUE;
 }
 
 void
@@ -1673,14 +1637,6 @@
 
   completion->priv->ignore_enter = FALSE;
 
-  if (completion->priv->has_grab)
-    {
-      gdk_device_ungrab (completion->priv->device, GDK_CURRENT_TIME);
-      gtk_device_grab_remove (completion->priv->popup_window,
-                              completion->priv->device);
-      completion->priv->has_grab = FALSE;
-    }
-
   gtk_widget_hide (completion->priv->popup_window);
 }
 
@@ -2703,10 +2659,8 @@
 
   unset_accessible_relation (completion->priv->popup_window,
                              completion->priv->entry);
-  gtk_window_set_attached_to (GTK_WINDOW (completion->priv->popup_window),
-                              NULL);
 
-  gtk_window_set_transient_for (GTK_WINDOW (completion->priv->popup_window), NULL);
+  gtk_popover_set_relative_to(GTK_POPOVER(completion->priv->popup_window), NULL);
 
   completion->priv->entry = NULL;
 }
@@ -2719,8 +2673,8 @@
 
   set_accessible_relation (completion->priv->popup_window,
                            completion->priv->entry);
-  gtk_window_set_attached_to (GTK_WINDOW (completion->priv->popup_window),
-                              completion->priv->entry);
+
+  gtk_popover_set_relative_to(GTK_POPOVER(completion->priv->popup_window), completion->priv->entry);
 
   connect_completion_signals (completion);
 }
