mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
Ladybird: Trigger browser to quit when the main window is closed
This patch adds an event handler to the main window which allows it to respond to a user closing the window. This event is then passed on to the LibCore event loop, which allows the application quit itself. Previously the application would hang, only running in the background, until killed by an external force.
This commit is contained in:
parent
95e3e06a1e
commit
7bf3010185
3 changed files with 19 additions and 3 deletions
|
@ -1,8 +1,10 @@
|
|||
#include "BrowserWindow.h"
|
||||
#include "WebView.h"
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <QStatusBar>
|
||||
|
||||
BrowserWindow::BrowserWindow()
|
||||
BrowserWindow::BrowserWindow(Core::EventLoop& event_loop)
|
||||
: m_event_loop(event_loop)
|
||||
{
|
||||
m_toolbar = new QToolBar;
|
||||
m_location_edit = new QLineEdit;
|
||||
|
@ -39,3 +41,13 @@ void BrowserWindow::page_favicon_changed(QIcon icon)
|
|||
{
|
||||
setWindowIcon(icon);
|
||||
}
|
||||
|
||||
void BrowserWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
QWidget::closeEvent(event);
|
||||
|
||||
// FIXME: Ladybird only supports one window at the moment. When we support
|
||||
// multiple windows, we'll only want to fire off the quit event when
|
||||
// all of the browser windows have closed.
|
||||
m_event_loop.quit(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue