Relate completion height to browser window height
To prevent the completion from obscuring other windows, it will relate to 2/3 of the browser window and screen height respectively.
This commit is contained in:
parent
6ae3633dce
commit
cf6cffe2bc
1 changed files with 5 additions and 2 deletions
|
@ -342,7 +342,8 @@ midori_location_action_popup_timeout_cb (gpointer data)
|
||||||
gint result;
|
gint result;
|
||||||
static sqlite3_stmt* stmt;
|
static sqlite3_stmt* stmt;
|
||||||
const gchar* sqlcmd;
|
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;
|
GtkStyle* style;
|
||||||
|
|
||||||
if (!gtk_widget_has_focus (action->entry) || !action->history)
|
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);
|
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);
|
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));
|
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);
|
gtk_widget_style_get (action->treeview, "vertical-separator", &sep, NULL);
|
||||||
/* FIXME: Instead of 1.5 we should relate to the height of one line */
|
/* FIXME: Instead of 1.5 we should relate to the height of one line */
|
||||||
height = MIN (matches * height + (matches + searches) * sep
|
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);
|
gtk_widget_set_size_request (action->treeview, -1, height);
|
||||||
midori_location_action_popup_position (action->popup, action->entry);
|
midori_location_action_popup_position (action->popup, action->entry);
|
||||||
gtk_widget_show_all (action->popup);
|
gtk_widget_show_all (action->popup);
|
||||||
|
|
Loading…
Reference in a new issue