When unsetting bg image borders need to be redone to ensure blank rects are present

This commit is contained in:
Kovid Goyal 2020-02-02 20:51:31 +05:30
parent 01b11b8a53
commit b670973226
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 7 deletions

View File

@ -25,8 +25,8 @@ from .fast_data_types import (
change_os_window_state, create_os_window, current_os_window,
destroy_global_data, focus_os_window, get_clipboard_string,
global_font_size, mark_os_window_for_close, os_window_font_size,
patch_global_colors, safe_pipe, set_clipboard_string, set_in_sequence_mode,
thread_write, toggle_fullscreen, toggle_maximized
patch_global_colors, safe_pipe, set_background_image, set_clipboard_string,
set_in_sequence_mode, thread_write, toggle_fullscreen, toggle_maximized
)
from .keys import get_shortcut, shortcut_matches
from .layout import set_layout_options
@ -1294,3 +1294,11 @@ class Boss:
r'--regex=(?m)^:\s+.+$',
), input_data='\r\n'.join(lines).encode('utf-8'), custom_callback=done, action_on_removal=done2
)
def set_background_image(self, path, os_windows, configured, layout):
if layout:
set_background_image(path, os_windows, configured, layout)
else:
set_background_image(path, os_windows, configured)
for os_window_id in os_windows:
self.default_bg_changed_for(os_window_id)

View File

@ -12,7 +12,7 @@ from .cli import (
)
from .config import parse_config, parse_send_text_bytes
from .constants import appname
from .fast_data_types import focus_os_window, set_background_image as set_background_image_impl
from .fast_data_types import focus_os_window
from .launch import (
launch as do_launch, options_spec as launch_options_spec,
parse_launch_args
@ -1348,10 +1348,7 @@ def set_background_image(boss, window, payload):
f.flush()
try:
if layout:
set_background_image_impl(path, os_windows, pg(payload, 'configured'), layout)
else:
set_background_image_impl(path, os_windows, pg(payload, 'configured'))
boss.set_background_image(path, os_windows, pg(payload, 'configured'), layout)
except ValueError as err:
err.hide_traceback = True
raise