diff options
author | Christian Dywan <christian@twotoasts.de> | 2019-07-09 23:23:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-09 23:23:18 +0200 |
commit | b411a64be82d70d26531e8023f791519b960c60d (patch) | |
tree | d4657ee4aee47b48ab9d2e4c00f75e7f855ed537 | |
parent | c933252913bc49bde4a3f2dbadd161565d9e6fcd (diff) | |
download | midori-git-b411a64be82d70d26531e8023f791519b960c60d.tar.gz |
Explicitly allow script windows and dialogs (#331)
- Allow scripts to "automatically" open windows and modal dialogs
- Open windows with no urlbar like apps (locked and pinned)
- Don't save size of locked windows
- Override size of popups as per request or with a default
- Ensure other windows which open as tabs open in the foreground
The "dialogs" are skipped by session management since the browser
is locked in this case. Transiency ensures the window is placed
approprietely.
Fixes: #318
-rw-r--r-- | core/browser.vala | 15 | ||||
-rw-r--r-- | core/tab.vala | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/core/browser.vala b/core/browser.vala index 9c149440..c9b76d8b 100644 --- a/core/browser.vala +++ b/core/browser.vala @@ -404,7 +404,7 @@ namespace Midori { get_size (out width, null); is_small = width < 500; - if (!(get_style_context ().has_class ("tiled") || is_maximized || is_fullscreen)) { + if (!(get_style_context ().has_class ("tiled") || is_maximized || is_fullscreen || is_locked)) { int height; get_size (null, out height); var settings = CoreSettings.get_default (); @@ -727,8 +727,21 @@ namespace Midori { new_tab.hide (); new_tab.ready_to_show.connect (() => { new_tab.show (); + if (!new_tab.get_window_properties ().locationbar_visible) { + new_tab.pinned = true; + var browser = new Browser ((App)application, true); + var geometry = new_tab.get_window_properties ().geometry; + browser.default_width = geometry.width > 1 ? geometry.width : 640; + browser.default_height = geometry.height > 1 ? geometry.height : 480; + browser.transient_for = this; + browser.add (new_tab); + browser.show (); + return; + } + new_tab.set_data<bool> ("foreground", true); add (new_tab); }); + new_tab.load_request (action.get_request ()); return new_tab; }); tab.enter_fullscreen.connect (() => { diff --git a/core/tab.vala b/core/tab.vala index ac06bebe..c8b1437e 100644 --- a/core/tab.vala +++ b/core/tab.vala @@ -77,6 +77,8 @@ namespace Midori { settings.user_agent += " %s".printf (Config.CORE_USER_AGENT_VERSION); bind_property ("pinned", settings, "enable-developer-extras", BindingFlags.SYNC_CREATE | BindingFlags.INVERT_BOOLEAN); var core_settings = CoreSettings.get_default (); + settings.javascript_can_open_windows_automatically = true; + settings.allow_modal_dialogs = true; settings.enable_javascript = core_settings.enable_javascript; core_settings.notify["enable-javascript"].connect ((pspec) => { settings.enable_javascript = core_settings.enable_javascript; |