]> spindle.queued.net Git - midori/commitdiff
Relate completion height to browser window height
authorChristian Dywan <christian@twotoasts.de>
Thu, 4 Mar 2010 22:47:05 +0000 (23:47 +0100)
committerChristian Dywan <christian@twotoasts.de>
Thu, 4 Mar 2010 23:02:07 +0000 (00:02 +0100)
To prevent the completion from obscuring other windows, it will
relate to 2/3 of the browser window and screen height respectively.

midori/midori-locationaction.c

index f86260cb3fbcac0924952045dc09cda2e2aada9f..d053b7f13aca15f161da226175906cbd229881a2 100644 (file)
@@ -342,7 +342,8 @@ midori_location_action_popup_timeout_cb (gpointer data)
     gint result;
     static sqlite3_stmt* stmt;
     const gchar* sqlcmd;
-    gint matches, searches, height, screen_height, sep;
+    gint matches, searches, height, screen_height, browser_height, sep;
+    MidoriBrowser* browser = midori_browser_get_for_widget (action->entry);
     GtkStyle* style;
 
     if (!gtk_widget_has_focus (action->entry) || !action->history)
@@ -497,10 +498,12 @@ midori_location_action_popup_timeout_cb (gpointer data)
     column = gtk_tree_view_get_column (GTK_TREE_VIEW (action->treeview), 0);
     gtk_tree_view_column_cell_get_size (column, NULL, NULL, NULL, NULL, &height);
     screen_height = gdk_screen_get_height (gtk_widget_get_screen (action->popup));
+    gtk_window_get_size (GTK_WINDOW (browser), NULL, &browser_height);
+    screen_height = MIN (MIN (browser_height, screen_height / 1.5), screen_height / 1.5);
     gtk_widget_style_get (action->treeview, "vertical-separator", &sep, NULL);
     /* FIXME: Instead of 1.5 we should relate to the height of one line */
     height = MIN (matches * height + (matches + searches) * sep
-                                   + searches * height / 1.5, screen_height / 1.5);
+                                   + searches * height / 1.5, screen_height);
     gtk_widget_set_size_request (action->treeview, -1, height);
     midori_location_action_popup_position (action->popup, action->entry);
     gtk_widget_show_all (action->popup);