mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:07:45 +00:00
WindowServer+TaskBar: Add a taskbar window button popup menu.
This patch only hooks up the minimize and unminimize actions.
This commit is contained in:
parent
c5c4e54a67
commit
956bd23aae
17 changed files with 158 additions and 56 deletions
|
@ -2,37 +2,9 @@
|
|||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <LibGUI/GButton.h>
|
||||
|
||||
class WindowIdentifier {
|
||||
public:
|
||||
WindowIdentifier(int client_id, int window_id)
|
||||
: m_client_id(client_id)
|
||||
, m_window_id(window_id)
|
||||
{
|
||||
}
|
||||
|
||||
int client_id() const { return m_client_id; }
|
||||
int window_id() const { return m_window_id; }
|
||||
|
||||
bool operator==(const WindowIdentifier& other) const
|
||||
{
|
||||
return m_client_id == other.m_client_id && m_window_id == other.m_window_id;
|
||||
}
|
||||
private:
|
||||
int m_client_id { -1 };
|
||||
int m_window_id { -1 };
|
||||
};
|
||||
|
||||
namespace AK {
|
||||
template<>
|
||||
struct Traits<WindowIdentifier> {
|
||||
static unsigned hash(const WindowIdentifier& w) { return pair_int_hash(w.client_id(), w.window_id()); }
|
||||
static void dump(const WindowIdentifier& w) { kprintf("WindowIdentifier(%d, %d)", w.client_id(), w.window_id()); }
|
||||
};
|
||||
}
|
||||
#include "WindowIdentifier.h"
|
||||
|
||||
class Window {
|
||||
public:
|
||||
|
@ -90,6 +62,8 @@ private:
|
|||
|
||||
class WindowList {
|
||||
public:
|
||||
static WindowList& the();
|
||||
|
||||
template<typename Callback> void for_each_window(Callback callback)
|
||||
{
|
||||
for (auto& it : m_windows)
|
||||
|
@ -100,7 +74,7 @@ public:
|
|||
Window& ensure_window(const WindowIdentifier&);
|
||||
void remove_window(const WindowIdentifier&);
|
||||
|
||||
Function<GButton*()> aid_create_button;
|
||||
Function<GButton*(const WindowIdentifier&)> aid_create_button;
|
||||
|
||||
private:
|
||||
HashMap<WindowIdentifier, OwnPtr<Window>> m_windows;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue