Files
ladybird/UI/AppKit/Interface/TabController.h
Andreas Kling 71d92c7298 UI/AppKit: Restore focus when activating a tab
Tabs opened from links on AppKit can be created before their URL is
loaded. That left background open-url tabs with the location field as
their stored responder, so switching to them later restored address-bar
focus instead of web content focus.

Track each tab's preferred responder, restore it when AppKit makes
the tab key, and mark page-backed open-url tabs to prefer the web view.
Blank new-tab pages still keep the location field focused.
2026-04-17 08:06:24 +02:00

36 lines
707 B
Objective-C

/*
* Copyright (c) 2023-2026, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
#include <LibURL/URL.h>
#import <Cocoa/Cocoa.h>
@class Tab;
@interface TabController : NSWindowController <NSWindowDelegate>
- (instancetype)init;
- (instancetype)initAsChild:(Tab*)parent
pageIndex:(u64)page_index;
- (void)loadURL:(URL::URL const&)url;
- (void)onLoadStart:(URL::URL const&)url isRedirect:(BOOL)isRedirect;
- (void)onURLChange:(URL::URL const&)url;
- (void)onEnterFullscreenWindow;
- (void)onExitFullscreenWindow;
- (void)focusWebViewWhenActivated;
- (void)focusWebView;
- (void)focusLocationToolbarItem;
@end