Files
ladybird/UI/Gtk/CMakeLists.txt
Johan Dahlin 0a00a5d61a UI/Gtk: Add browser window, tabs, menus, and dialogs
Add the complete browser UI:
- BrowserWindow: AdwHeaderBar with navigation, tab management via
  AdwTabView/AdwTabBar, find-in-page, fullscreen, zoom, D-Bus
  single-instance with open/activate handlers
- Tab: WebContentView lifecycle, ViewImplementation callbacks for
  title, URL, favicon, cursor, tooltips, dialogs, window management
- LadybirdBrowserWindow: GtkBuilder template widget with toolbar,
  tab bar, find bar, devtools banner, and hamburger menu
- LadybirdLocationEntry: URL entry with autocomplete, domain
  highlighting, and security icon
- Menu: GAction-based context menus and application menu with
  keyboard accelerators
- Dialogs: JS alert/confirm/prompt (AdwAlertDialog), color picker,
  file picker, select dropdown, download save dialog, toast
- GtkBuilder .ui resources for browser window, location entry
  completions, and list popovers

Updates Application and main.cpp to create browser windows and
handle D-Bus activation from remote instances.
2026-04-17 11:17:56 -04:00

47 lines
1.5 KiB
CMake

find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK4 REQUIRED IMPORTED_TARGET gtk4)
pkg_check_modules(LIBADWAITA REQUIRED IMPORTED_TARGET libadwaita-1>=1.4)
add_executable(ladybird main.cpp)
find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources REQUIRED)
set(GTK_UI_RESOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/Resources/browser-window.ui"
"${CMAKE_CURRENT_SOURCE_DIR}/Resources/list-popover.ui"
"${CMAKE_CURRENT_SOURCE_DIR}/Resources/location-entry.ui"
)
set(GTK_GRESOURCE_XML "${CMAKE_CURRENT_SOURCE_DIR}/Resources/resources.gresource.xml")
set(GTK_GRESOURCE_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/gtk-ui-resources.cpp")
add_custom_command(
OUTPUT "${GTK_GRESOURCE_SOURCE}"
DEPENDS "${GTK_GRESOURCE_XML}" ${GTK_UI_RESOURCES}
COMMAND "${GLIB_COMPILE_RESOURCES}"
"${GTK_GRESOURCE_XML}"
--sourcedir "${CMAKE_CURRENT_SOURCE_DIR}/Resources"
--target "${GTK_GRESOURCE_SOURCE}"
--generate-source
VERBATIM
)
add_custom_target(gtk_ui_resources DEPENDS "${GTK_GRESOURCE_SOURCE}")
target_sources(ladybird PRIVATE
Application.cpp
BrowserWindow.cpp
Dialogs.cpp
Events.cpp
EventLoopImplementationGtk.cpp
Menu.cpp
Tab.cpp
WebContentView.cpp
Widgets/LadybirdBrowserWindow.cpp
Widgets/LadybirdLocationEntry.cpp
Widgets/LadybirdWebView.cpp
"${GTK_GRESOURCE_SOURCE}"
)
target_link_libraries(ladybird PRIVATE PkgConfig::GTK4 PkgConfig::LIBADWAITA)
add_dependencies(ladybird gtk_ui_resources)
create_ladybird_bundle(ladybird)