File indexing completed on 2024-04-28 05:30:17

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
0006     SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #pragma once
0012 
0013 #include "utils/common.h"
0014 #include <netwm.h>
0015 
0016 namespace KWin
0017 {
0018 
0019 class EffectWindowGroup;
0020 class X11Window;
0021 
0022 class Group
0023 {
0024 public:
0025     Group(xcb_window_t leader);
0026     ~Group();
0027     xcb_window_t leader() const;
0028     const X11Window *leaderClient() const;
0029     X11Window *leaderClient();
0030     const QList<X11Window *> &members() const;
0031     QIcon icon() const;
0032     void addMember(X11Window *member);
0033     void removeMember(X11Window *member);
0034     void gotLeader(X11Window *leader);
0035     void lostLeader();
0036     void updateUserTime(xcb_timestamp_t time);
0037     xcb_timestamp_t userTime() const;
0038     void ref();
0039     void deref();
0040     EffectWindowGroup *effectGroup();
0041 
0042 private:
0043     void startupIdChanged();
0044     QList<X11Window *> _members;
0045     X11Window *leader_client;
0046     xcb_window_t leader_wid;
0047     std::unique_ptr<NETWinInfo> leader_info;
0048     xcb_timestamp_t user_time;
0049     int refcount;
0050     std::unique_ptr<EffectWindowGroup> effect_group;
0051 };
0052 
0053 inline xcb_window_t Group::leader() const
0054 {
0055     return leader_wid;
0056 }
0057 
0058 inline const X11Window *Group::leaderClient() const
0059 {
0060     return leader_client;
0061 }
0062 
0063 inline X11Window *Group::leaderClient()
0064 {
0065     return leader_client;
0066 }
0067 
0068 inline const QList<X11Window *> &Group::members() const
0069 {
0070     return _members;
0071 }
0072 
0073 inline xcb_timestamp_t Group::userTime() const
0074 {
0075     return user_time;
0076 }
0077 
0078 inline EffectWindowGroup *Group::effectGroup()
0079 {
0080     return effect_group.get();
0081 }
0082 
0083 } // namespace