PageRenderTime 55ms CodeModel.GetById 14ms app.highlight 36ms RepoModel.GetById 1ms app.codeStats 0ms

/thirdparty/libqnetwm/libqnetwm/netwm.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 188 lines | 136 code | 27 blank | 25 comment | 0 complexity | 5a3694656046cd2b922e5816751310d4 MD5 | raw file
  1/***************************************************************************
  2 *   Copyright (C) 2010 by Dmitry 'Krasu' Baryshev                         *
  3 *   ksquirrel.iv@gmail.com                                                *
  4 *                                                                         *
  5 *   This program is free software; you can redistribute it and/or modify  *
  6 *   it under the terms of the GNU General Public License as published by  *
  7 *   the Free Software Foundation; either version 3 of the License, or     *
  8 *   (at your option) any later version.                                   *
  9 *                                                                         *
 10 *   This program is distributed in the hope that it will be useful,       *
 11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 13 *   GNU General Public License for more details.                          *
 14 *                                                                         *
 15 *   You should have received a copy of the GNU General Public License     *
 16 *   along with this program; if not, write to the                         *
 17 *   Free Software Foundation, Inc.,                                       *
 18 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 19 ***************************************************************************/
 20
 21#ifndef NETWM_H
 22#define NETWM_H
 23
 24#include <X11/Xlib.h>
 25#include <X11/Xatom.h>
 26
 27#include "fixx11h.h"
 28
 29#include <QStringList>
 30#include <QString>
 31#include <QList>
 32
 33class NETWM
 34{
 35
 36public:
 37    struct net_wm_state
 38    {
 39        net_wm_state();
 40
 41        unsigned int modal             : 1;
 42        unsigned int sticky            : 1;
 43        unsigned int maximized_vert    : 1;
 44        unsigned int maximized_horz    : 1;
 45        unsigned int shaded            : 1;
 46        unsigned int skip_taskbar      : 1;
 47        unsigned int skip_pager        : 1;
 48        unsigned int hidden            : 1;
 49        unsigned int fullscreen        : 1;
 50        unsigned int above             : 1;
 51        unsigned int below             : 1;
 52        unsigned int stays_on_top      : 1;
 53        unsigned int stays_on_bottom   : 1;
 54        unsigned int demands_attention : 1;
 55        bool valid;
 56    };
 57
 58    struct net_wm_window_type
 59    {
 60        net_wm_window_type();
 61
 62        unsigned int desktop      : 1;
 63        unsigned int dock         : 1;
 64        unsigned int toolbar      : 1;
 65        unsigned int menu         : 1;
 66        unsigned int utility      : 1;
 67        unsigned int splash       : 1;
 68        unsigned int dialog       : 1;
 69        unsigned int dropdown     : 1;
 70        unsigned int popup        : 1;
 71        unsigned int tooltip      : 1;
 72        unsigned int notification : 1;
 73        unsigned int combo        : 1;
 74        unsigned int dnd          : 1;
 75        unsigned int normal       : 1;
 76        bool valid;
 77    };
 78
 79    /*************************************************************************/
 80
 81    static void init();
 82
 83    static void transset(Window, double);
 84
 85#if 0
 86    static bool isComposite();
 87#endif
 88
 89    static int setProperty(Window, Atom, long, uchar *, int);
 90
 91    static int setPropertySkipTaskbar(Window);
 92    static int setPropertyOnTop(Window);
 93
 94    static void* property(Window win, Atom prop, Atom type, int *nitems = 0, bool *ok = 0);
 95
 96    static bool climsg(Window win, long type, long l0, long l1 = 0, long l2 = 0, long l3 = 0, long l4 = 0);
 97    static bool climsgwm(Window win, Atom type, Atom arg);
 98
 99    // NETWM helper functions
100    static qint64 netwmPid(Window win);
101    static QList<Window> netwmWindowList();
102    static uint netwmDesktopsNumber();
103    static uint netwmCurrentDesktop();
104    static int netwmDesktop(Window win);
105    static net_wm_state netwmState(Window win);
106    static net_wm_window_type netwmWindowType(Window win);
107    static bool netwmActivateWindow(Window win);
108
109    // ICCCM helper functions
110    static QString icccmString(Window win, Atom atom);
111    static QString icccmUtf8String(Window win, Atom atom);
112    static QString icccmWindowRole(Window win);
113    static QStringList icccmClass(Window win);
114    static QString icccmName(Window win);
115    static QStringList icccmCommand(Window win);
116
117    /*************************************************************************/
118    /********************************* Atoms *********************************/
119    /*************************************************************************/
120
121    static Atom UTF8_STRING;
122    static Atom XROOTPMAP_ID;
123
124    static Atom WM_STATE;
125    static Atom WM_CLASS;
126    static Atom WM_NAME;
127    static Atom WM_DELETE_WINDOW;
128    static Atom WM_PROTOCOLS;
129    static Atom WM_CHANGE_STATE;
130    static Atom WM_WINDOW_ROLE;
131
132    static Atom NET_WORKAREA;
133    static Atom NET_CLIENT_LIST;
134    static Atom NET_CLIENT_LIST_STACKING;
135    static Atom NET_NUMBER_OF_DESKTOPS;
136    static Atom NET_CURRENT_DESKTOP;
137    static Atom NET_DESKTOP_NAMES;
138    static Atom NET_ACTIVE_WINDOW;
139    static Atom NET_CLOSE_WINDOW;
140    static Atom NET_SUPPORTED;
141    static Atom NET_WM_DESKTOP;
142    static Atom NET_SHOWING_DESKTOP;
143
144    static Atom NET_WM_STATE;
145    static Atom NET_WM_STATE_MODAL;
146    static Atom NET_WM_STATE_STICKY;
147    static Atom NET_WM_STATE_MAXIMIZED_VERT;
148    static Atom NET_WM_STATE_MAXIMIZED_HORZ;
149    static Atom NET_WM_STATE_SHADED;
150    static Atom NET_WM_STATE_SKIP_TASKBAR;
151    static Atom NET_WM_STATE_SKIP_PAGER;
152    static Atom NET_WM_STATE_HIDDEN;
153    static Atom NET_WM_STATE_FULLSCREEN;
154    static Atom NET_WM_STATE_ABOVE;
155    static Atom NET_WM_STATE_BELOW;
156    static Atom NET_WM_STATE_STAYS_ON_TOP;
157    static Atom NET_WM_STATE_STAYS_ON_BOTTOM;
158    static Atom NET_WM_STATE_DEMANDS_ATTENTION;
159
160    static Atom NET_WM_WINDOW_TYPE;
161    static Atom NET_WM_WINDOW_TYPE_DESKTOP;
162    static Atom NET_WM_WINDOW_TYPE_DOCK;
163    static Atom MODERRO_WINDOW_TYPE_DOCK;
164    static Atom NET_WM_WINDOW_TYPE_TOOLBAR;
165    static Atom NET_WM_WINDOW_TYPE_MENU;
166    static Atom NET_WM_WINDOW_TYPE_UTILITY;
167    static Atom NET_WM_WINDOW_TYPE_SPLASH;
168    static Atom NET_WM_WINDOW_TYPE_DIALOG;
169    static Atom NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
170    static Atom NET_WM_WINDOW_TYPE_POPUP_MENU;
171    static Atom NET_WM_WINDOW_TYPE_TOOLTIP;
172    static Atom NET_WM_WINDOW_TYPE_NOTIFICATION;
173    static Atom NET_WM_WINDOW_TYPE_COMBO;
174    static Atom NET_WM_WINDOW_TYPE_DND;
175    static Atom NET_WM_WINDOW_TYPE_NORMAL;
176    static Atom NET_WM_WINDOW_OPACITY;
177    static Atom NET_WM_NAME;
178    static Atom NET_WM_VISIBLE_NAME;
179    static Atom NET_WM_STRUT;
180    static Atom NET_WM_STRUT_PARTIAL;
181    static Atom NET_WM_ICON;
182    static Atom NET_WM_PID;
183
184private:
185    static void checkInit();
186};
187
188#endif