From c4ca131346e143af1d2395c9d7c0f4cab0f5ded7 Mon Sep 17 00:00:00 2001 From: Christiam Dywan Date: Fri, 16 Aug 2019 19:49:18 +0200 Subject: [PATCH] Consistent focus and color for speed dial - Set the color of the "tabs" stack - Set the webview's color to that of the speed dial - Set focus between webview/ urlbar w/o delay - Load tab without changing focus again --- core/browser.vala | 13 +++++++++---- core/tab.vala | 12 ++++-------- data/gtk3.css | 4 ++++ ui/browser.ui | 3 +++ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/core/browser.vala b/core/browser.vala index 3ce21e40e..2b1c25831 100644 --- a/core/browser.vala +++ b/core/browser.vala @@ -306,18 +306,23 @@ namespace Midori { bindings.append (tab.bind_property ("pinned", toggle_fullscreen, "visible", BindingFlags.INVERT_BOOLEAN)); bindings.append (tab.bind_property ("pinned", navigationbar, "visible", BindingFlags.INVERT_BOOLEAN)); bindings.append (tab.bind_property ("zoom-level", this, "zoom-level", BindingFlags.SYNC_CREATE)); + if (navigationbar.urlbar.blank) { + navigationbar.urlbar.grab_focus (); + } else { + tab.grab_focus (); + } if (focus_timeout > 0) { Source.remove (focus_timeout); focus_timeout = 0; } focus_timeout = Timeout.add (500, () => { focus_timeout = 0; - tab.grab_focus (); + // Delayed load on focus + if (tab.display_uri != tab.uri) { + tab.load_uri (tab.display_uri); + } search_entry.text = tab.get_find_controller ().get_search_text () ?? ""; search.search_mode_enabled = search_entry.text != ""; - if (navigationbar.urlbar.blank) { - navigationbar.urlbar.grab_focus (); - } return Source.REMOVE; }, Priority.LOW); } else { diff --git a/core/tab.vala b/core/tab.vala index c8b1437e3..ca5259c36 100644 --- a/core/tab.vala +++ b/core/tab.vala @@ -73,6 +73,10 @@ namespace Midori { Object (related_view: related, web_context: web_context, user_content_manager: content, visible: true); + var rgba = Gdk.RGBA (); + rgba.parse ("#dedede"); + set_background_color (rgba); + var settings = get_settings (); settings.user_agent += " %s".printf (Config.CORE_USER_AGENT_VERSION); bind_property ("pinned", settings, "enable-developer-extras", BindingFlags.SYNC_CREATE | BindingFlags.INVERT_BOOLEAN); @@ -122,14 +126,6 @@ namespace Midori { } } - public override bool focus_in_event (Gdk.EventFocus event) { - // Delayed load on focus - if (display_uri != uri) { - load_uri (display_uri); - } - return base.focus_in_event (event); - } - void update_progress (ParamSpec pspec) { // Update back/ forward state here since there's no signal can_go_back = base.can_go_back (); diff --git a/data/gtk3.css b/data/gtk3.css index 331aef4fe..bbaa0b795 100644 --- a/data/gtk3.css +++ b/data/gtk3.css @@ -107,3 +107,7 @@ statusbar button { margin: 0; padding: 0; } + +.tabs { + background-color: #dedede; +} diff --git a/ui/browser.ui b/ui/browser.ui index 7f3550f19..155aa6a41 100644 --- a/ui/browser.ui +++ b/ui/browser.ui @@ -183,6 +183,9 @@ yes yes yes +