5c96c38e39
Instead of killing the window without asking, show the kill prompt like it's done for X11 windows. The window in question is exported through XDG foreign so the kill helper can parent itself to it, and an activation token is also provided. Also, the more contemporary desktop file name is now used for identification rather than window class. A no-display desktop file is installed for the kill helper so that it can get a proper window icon and suppress startup notification.
45 lines
841 B
C++
45 lines
841 B
C++
/*
|
|
* SPDX-FileCopyrightText: 2023 Kai Uwe Broulik <kde@broulik.de>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QProcess>
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
class Window;
|
|
|
|
class KillPrompt
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Creates a kill helper process.
|
|
* @param window The window to kill, must be an X11Window or XdgToplevelWindow.
|
|
*/
|
|
explicit KillPrompt(Window *window);
|
|
|
|
/**
|
|
* @brief Whether the kill helper process is currently running.
|
|
*/
|
|
bool isRunning() const;
|
|
|
|
/**
|
|
* @brief Starts the kill helper process.
|
|
* @param timestamp The X activation timestamp.
|
|
*/
|
|
void start(quint32 timestamp = 0);
|
|
/**
|
|
* @brief Terminate the kill helper process.
|
|
*/
|
|
void quit();
|
|
|
|
private:
|
|
Window *m_window = nullptr;
|
|
QProcess m_process;
|
|
};
|
|
|
|
} // namespace KWin
|