1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:57:45 +00:00

Taskbar: Only include "Normal" windows in the taskbar window list.

This commit is contained in:
Andreas Kling 2019-04-04 16:23:23 +02:00
parent 82b02ed82b
commit 64a5abf8db
10 changed files with 70 additions and 16 deletions

View file

@ -6,6 +6,7 @@
#include <AK/Types.h>
#include <AK/WeakPtr.h>
#include <Kernel/KeyCode.h>
#include <LibGUI/GWindowType.h>
class GObject;
@ -74,22 +75,25 @@ private:
class GWMWindowAddedEvent : public GWMEvent {
public:
GWMWindowAddedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active)
GWMWindowAddedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, GWindowType window_type)
: GWMEvent(GEvent::Type::WM_WindowAdded, client_id, window_id)
, m_title(title)
, m_rect(rect)
, m_active(is_active)
, m_window_type(window_type)
{
}
String title() const { return m_title; }
Rect rect() const { return m_rect; }
bool is_active() const { return m_active; }
GWindowType window_type() const { return m_window_type; }
private:
String m_title;
Rect m_rect;
bool m_active;
GWindowType m_window_type;
};
class GWMWindowRemovedEvent : public GWMEvent {
@ -102,22 +106,25 @@ public:
class GWMWindowStateChangedEvent : public GWMEvent {
public:
GWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active)
GWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, GWindowType window_type)
: GWMEvent(GEvent::Type::WM_WindowStateChanged, client_id, window_id)
, m_title(title)
, m_rect(rect)
, m_active(is_active)
, m_window_type(window_type)
{
}
String title() const { return m_title; }
Rect rect() const { return m_rect; }
bool is_active() const { return m_active; }
GWindowType window_type() const { return m_window_type; }
private:
String m_title;
Rect m_rect;
bool m_active;
GWindowType m_window_type;
};
class QuitEvent final : public GEvent {

View file

@ -270,10 +270,13 @@ void GEventLoop::handle_menu_event(const WSAPI_ServerMessage& event)
void GEventLoop::handle_wm_event(const WSAPI_ServerMessage& event, GWindow& window)
{
#ifdef GEVENTLOOP_DEBUG
dbgprintf("GEventLoop: handle_wm_event: %d\n", (int)event.type);
#endif
if (event.type == WSAPI_ServerMessage::WM_WindowAdded)
return post_event(window, make<GWMWindowAddedEvent>(event.wm.client_id, event.wm.window_id, String(event.text, event.text_length), event.wm.rect, event.wm.is_active));
return post_event(window, make<GWMWindowAddedEvent>(event.wm.client_id, event.wm.window_id, String(event.text, event.text_length), event.wm.rect, event.wm.is_active, (GWindowType)event.wm.window_type));
if (event.type == WSAPI_ServerMessage::WM_WindowStateChanged)
return post_event(window, make<GWMWindowStateChangedEvent>(event.wm.client_id, event.wm.window_id, String(event.text, event.text_length), event.wm.rect, event.wm.is_active));
return post_event(window, make<GWMWindowStateChangedEvent>(event.wm.client_id, event.wm.window_id, String(event.text, event.text_length), event.wm.rect, event.wm.is_active, (GWindowType)event.wm.window_type));
if (event.type == WSAPI_ServerMessage::WM_WindowRemoved)
return post_event(window, make<GWMWindowRemovedEvent>(event.wm.client_id, event.wm.window_id));
ASSERT_NOT_REACHED();

View file

@ -1,6 +1,7 @@
#pragma once
#include "GObject.h"
#include <LibGUI/GObject.h>
#include <LibGUI/GWindowType.h>
#include <SharedGraphics/Rect.h>
#include <SharedGraphics/GraphicsBitmap.h>
#include <AK/AKString.h>
@ -17,12 +18,6 @@ enum class GStandardCursor {
ResizeVertical,
};
enum class GWindowType {
Invalid = 0,
Normal,
Taskbar,
};
class GWindow : public GObject {
public:
GWindow(GObject* parent = nullptr);

9
LibGUI/GWindowType.h Normal file
View file

@ -0,0 +1,9 @@
#pragma once
enum class GWindowType {
Invalid = 0,
Normal,
Menu,
WindowSwitcher,
Taskbar,
};