ede/edewm/Atoms.cpp

244 lines
9.3 KiB
C++
Raw Normal View History

/*
* $Id: Atoms.cpp 1700 2006-07-22 18:51:10Z karijes $
*
* Edewm, window manager
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2006 EDE Authors.
*
* This program is licenced under terms of the
* GNU General Public Licence version 2 or newer.
* See COPYING for details.
*/
#include "Atoms.h"
#include <efltk/x.h>
// Icccm atoms
Atom _XA_WM_PROTOCOLS;
Atom _XA_WM_DELETE_WINDOW;
Atom _XA_WM_STATE;
Atom _XA_WM_CHANGE_STATE;
Atom _XA_WM_COLORMAP_WINDOWS;
Atom _XA_WM_TAKE_FOCUS;
Atom _XA_UTF8_STRING;
// Motif atoms
Atom _XA_MOTIF_HINTS;
// Netwm atoms
Atom _XA_NET_SUPPORTED;
Atom _XA_NET_SUPPORTING_WM_CHECK;
Atom _XA_NET_NUMBER_OF_DESKTOPS;
Atom _XA_NET_DESKTOP_GEOMETRY;
Atom _XA_NET_DESKTOP_VIEWPORT;
Atom _XA_NET_CURRENT_DESKTOP;
Atom _XA_NET_DESKTOP_NAMES;
Atom _XA_NET_ACTIVE_WINDOW;
Atom _XA_NET_WORKAREA;
Atom _XA_NET_SHOWING_DESKTOP;
// other root messages
Atom _XA_NET_CLOSE_WINDOW;
Atom _XA_NET_MOVERESIZE_WINDOW;
Atom _XA_NET_RESTACK_WINDOW;
Atom _XA_NET_REQUEST_FRAME_EXTENTS;
// application messages
Atom _XA_NET_WM_NAME;
Atom _XA_NET_WM_WINDOW_TYPE;
Atom _XA_NET_WM_WINDOW_TYPE_NORMAL;
Atom _XA_NET_WM_WINDOW_TYPE_DOCK;
Atom _XA_NET_WM_WINDOW_TYPE_TOOLBAR;
Atom _XA_NET_WM_WINDOW_TYPE_MENU;
Atom _XA_NET_WM_WINDOW_TYPE_UTIL;
Atom _XA_NET_WM_WINDOW_TYPE_DIALOG;
Atom _XA_NET_WM_WINDOW_TYPE_SPLASH;
Atom _XA_NET_WM_WINDOW_TYPE_DESKTOP;
// our messages
Atom _XA_EDE_WM_STARTUP_NOTIFY;
Atom _XA_EDE_WM_APP_STARTING;
// only for debugging
Atom _XA_NET_VIRTUAL_ROOTS;
Atom _XA_NET_DESKTOP_LAYOUT;
Atom _XA_NET_WM_MOVERESIZE;
Atom _XA_NET_WM_VISIBLE_NAME;
Atom _XA_NET_WM_ICON_NAME;
Atom _XA_NET_WM_ICON_VISIBLE_NAME;
Atom _XA_NET_WM_DESKTOP;
Atom _XA_NET_WM_STATE;
Atom _XA_NET_WM_STATE_MODAL; //Needs transient for (root for whole group)
Atom _XA_NET_WM_STATE_STICKY; //Pos fixed, even if virt. desk. scrolls
Atom _XA_NET_WM_STATE_MAXIMIZED_VERT;
Atom _XA_NET_WM_STATE_MAXIMIZED_HORZ;
Atom _XA_NET_WM_STATE_SHADED;
Atom _XA_NET_WM_STATE_SKIP_TASKBAR;
Atom _XA_NET_WM_STATE_SKIP_PAGER;
Atom _XA_NET_WM_STATE_HIDDEN;
Atom _XA_NET_WM_STATE_FULLSCREEN;
Atom _XA_NET_WM_STATE_ABOVE;
Atom _XA_NET_WM_STATE_BELOW;
Atom _XA_NET_WM_STATE_DEMANDS_ATTENTION;
Atom _XA_NET_WM_ALLOWED_ACTIONS;
Atom _XA_NET_WM_ACTION_MOVE;
Atom _XA_NET_WM_ACTION_RESIZE;
Atom _XA_NET_WM_ACTION_MINIMIZE;
Atom _XA_NET_WM_ACTION_SHADE;
Atom _XA_NET_WM_ACTION_STICK;
Atom _XA_NET_WM_ACTION_MAXIMIZE_HORZ;
Atom _XA_NET_WM_ACTION_MAXIMIZE_VERT;
Atom _XA_NET_WM_ACTION_FULLSCREEN;
Atom _XA_NET_WM_ACTION_CHANGE_DESKTOP;
Atom _XA_NET_WM_ACTION_CLOSE;
Atom _XA_NET_WM_STRUT;
Atom _XA_NET_WM_STRUT_PARTIAL;
Atom _XA_NET_WM_ICON_GEOMETRY;
Atom _XA_NET_WM_ICON;
Atom _XA_NET_WM_PID;
Atom _XA_NET_WM_HANDLED_ICONS;
Atom _XA_NET_WM_USER_TIME;
Atom _XA_NET_FRAME_EXTENTS;
Atom _XA_NET_WM_PING;
Atom _XA_NET_WM_SYNC_REQUEST;
Atom _XA_NET_WM_STATE_STAYS_ON_TOP;
Atom _XA_KWM_WIN_ICON;
#ifdef _DEBUG
#define REGISTER_ATOM(id, name) \
id = XInternAtom(fl_display, name, False);\
atoms_map[id] = name
#else
#define REGISTER_ATOM(id, name) \
id = XInternAtom(fl_display, name, False)
#endif
#define COUNT(x) (sizeof(x)/sizeof(x[0]))
#ifdef _DEBUG
void InitAtoms(Display* display, std::map<Atom, const char*>& atoms_map)
#else
void InitAtoms(Display* display)
#endif
{
// Icccm
REGISTER_ATOM(_XA_WM_PROTOCOLS, "WM_PROTOCOLS");
REGISTER_ATOM(_XA_WM_DELETE_WINDOW, "WM_DELETE_WINDOW");
REGISTER_ATOM(_XA_WM_STATE, "WM_STATE");
REGISTER_ATOM(_XA_WM_CHANGE_STATE, "WM_CHANGE_STATE");
REGISTER_ATOM(_XA_WM_COLORMAP_WINDOWS, "WM_COLORMAP_WINDOWS");
REGISTER_ATOM(_XA_WM_TAKE_FOCUS, "WM_TAKE_FOCUS");
REGISTER_ATOM(_XA_UTF8_STRING, "UTF8_STRING");
// Motif
REGISTER_ATOM(_XA_MOTIF_HINTS, "_MOTIF_WM_HINTS");
// Netwm
REGISTER_ATOM(_XA_NET_SUPPORTED, "_NET_SUPPORTED");
REGISTER_ATOM(_XA_NET_SUPPORTING_WM_CHECK, "_NET_SUPPORTING_WM_CHECK");
REGISTER_ATOM(_XA_NET_NUMBER_OF_DESKTOPS, "_NET_NUMBER_OF_DESKTOPS");
REGISTER_ATOM(_XA_NET_DESKTOP_GEOMETRY, "_NET_DESKTOP_GEOMETRY");
REGISTER_ATOM(_XA_NET_DESKTOP_VIEWPORT, "_NET_DESKTOP_VIEWPORT");
REGISTER_ATOM(_XA_NET_CURRENT_DESKTOP, "_NET_CURRENT_DESKTOP");
REGISTER_ATOM(_XA_NET_DESKTOP_NAMES, "_NET_DESKTOP_NAMES");
REGISTER_ATOM(_XA_NET_ACTIVE_WINDOW, "_NET_ACTIVE_WINDOW");
REGISTER_ATOM(_XA_NET_WORKAREA, "_NET_WORKAREA");
REGISTER_ATOM(_XA_NET_SHOWING_DESKTOP, "_NET_SHOWING_DESKTOP");
// other root messages
REGISTER_ATOM(_XA_NET_CLOSE_WINDOW, "_NET_CLOSE_WINDOW");
REGISTER_ATOM(_XA_NET_MOVERESIZE_WINDOW, "_NET_MOVERESIZE_WINDOW");
REGISTER_ATOM(_XA_NET_RESTACK_WINDOW, "_NET_RESTACK_WINDOW");
REGISTER_ATOM(_XA_NET_REQUEST_FRAME_EXTENTS, "_NET_REQUEST_FRAME_EXTENTS");
REGISTER_ATOM(_XA_NET_WM_NAME, "_NET_WM_NAME");
REGISTER_ATOM(_XA_NET_WM_WINDOW_TYPE, "_NET_WM_WINDOW_TYPE");
REGISTER_ATOM(_XA_NET_WM_WINDOW_TYPE_NORMAL, "_NET_WM_WINDOW_TYPE_NORMAL");
REGISTER_ATOM(_XA_NET_WM_WINDOW_TYPE_DOCK, "_NET_WM_WINDOW_TYPE_DOCK");
REGISTER_ATOM(_XA_NET_WM_WINDOW_TYPE_TOOLBAR, "_NET_WM_WINDOW_TYPE_TOOLBAR");
REGISTER_ATOM(_XA_NET_WM_WINDOW_TYPE_MENU, "_NET_WM_WINDOW_TYPE_MENU");
REGISTER_ATOM(_XA_NET_WM_WINDOW_TYPE_UTIL, "_NET_WM_WINDOW_TYPE_UTIL");
REGISTER_ATOM(_XA_NET_WM_WINDOW_TYPE_DIALOG, "_NET_WM_WINDOW_TYPE_DIALOG");
REGISTER_ATOM(_XA_NET_WM_WINDOW_TYPE_DIALOG, "_NET_WM_WINDOW_TYPE_SPLASH");
REGISTER_ATOM(_XA_NET_WM_WINDOW_TYPE_DESKTOP, "_NET_WM_WINDOW_TYPE_DESKTOP");
// window messages
REGISTER_ATOM(_XA_NET_WM_STATE, "_NET_WM_STATE");
REGISTER_ATOM(_XA_NET_WM_STATE_MAXIMIZED_VERT,"_NET_WM_STATE_MAXIMIZED_VERT");
REGISTER_ATOM(_XA_NET_WM_STATE_MAXIMIZED_HORZ,"_NET_WM_STATE_MAXIMIZED_HORZ");
REGISTER_ATOM(_XA_NET_WM_STATE_SHADED, "_NET_WM_STATE_SHADED");
REGISTER_ATOM(_XA_NET_WM_STATE_ABOVE, "_NET_WM_STATE_ABOVE");
REGISTER_ATOM(_XA_NET_WM_STATE_BELOW, "_NET_WM_STATE_BELOW");
// our messages
REGISTER_ATOM(_XA_EDE_WM_STARTUP_NOTIFY, "_EDE_WM_STARTUP_NOTIFY");
REGISTER_ATOM(_XA_EDE_WM_APP_STARTING, "_EDE_WM_APP_STARTING");
// debugging stuff (aka. not implemented)
REGISTER_ATOM(_XA_NET_VIRTUAL_ROOTS, "_NET_VIRTUAL_ROOTS");
REGISTER_ATOM(_XA_NET_DESKTOP_LAYOUT, "_NET_DESKTOP_LAYOUT");
REGISTER_ATOM(_XA_NET_WM_MOVERESIZE, "_NET_WM_MOVERESIZE");
REGISTER_ATOM(_XA_NET_WM_VISIBLE_NAME, "_NET_WM_VISIBLE_NAME");
REGISTER_ATOM(_XA_NET_WM_ICON_NAME, "_NET_WM_ICON_NAME");
REGISTER_ATOM(_XA_NET_WM_ICON_VISIBLE_NAME, "_NET_WM_ICON_VISIBLE_NAME");
REGISTER_ATOM(_XA_NET_WM_DESKTOP, "_NET_WM_DESKTOP");
REGISTER_ATOM(_XA_NET_WM_STATE_MODAL, "_NET_WM_STATE_MODAL");
REGISTER_ATOM(_XA_NET_WM_STATE_STICKY, "_NET_WM_STATE_STICKY");
REGISTER_ATOM(_XA_NET_WM_STATE_SKIP_TASKBAR, "_NET_WM_STATE_SKIP_TASKBAR");
REGISTER_ATOM(_XA_NET_WM_STATE_SKIP_PAGER, "_NET_WM_STATE_SKIP_PAGER");
REGISTER_ATOM(_XA_NET_WM_STATE_HIDDEN, "_NET_WM_STATE_HIDDEN");
REGISTER_ATOM(_XA_NET_WM_STATE_FULLSCREEN, "_NET_WM_STATE_FULLSCREEN");
REGISTER_ATOM(_XA_NET_WM_STATE_DEMANDS_ATTENTION, "_NET_WM_STATE_DEMANDS_ATTENTION");
REGISTER_ATOM(_XA_NET_WM_ALLOWED_ACTIONS, "_NET_WM_ALLOWED_ACTIONS");
REGISTER_ATOM(_XA_NET_WM_ACTION_MOVE, "_NET_WM_ACTION_MOVE");
REGISTER_ATOM(_XA_NET_WM_ACTION_RESIZE, "_NET_WM_ACTION_RESIZE");
REGISTER_ATOM(_XA_NET_WM_ACTION_MINIMIZE, "_NET_WM_ACTION_MINIMIZE");
REGISTER_ATOM(_XA_NET_WM_ACTION_SHADE, "_NET_WM_ACTION_SHADE");
REGISTER_ATOM(_XA_NET_WM_ACTION_STICK, "_NET_WM_ACTION_STICK");
REGISTER_ATOM(_XA_NET_WM_ACTION_MAXIMIZE_HORZ,"_NET_WM_ACTION_MAXIMIZE_HORZ");
REGISTER_ATOM(_XA_NET_WM_ACTION_MAXIMIZE_VERT,"_NET_WM_ACTION_MAXIMIZE_VERT");
REGISTER_ATOM(_XA_NET_WM_ACTION_FULLSCREEN, "_NET_WM_ACTION_FULLSCREEN");
REGISTER_ATOM(_XA_NET_WM_ACTION_CHANGE_DESKTOP,"_NET_WM_ACTION_CHANGE_DESKTOP");
REGISTER_ATOM(_XA_NET_WM_ACTION_CLOSE, "_NET_WM_ACTION_CLOSE");
REGISTER_ATOM(_XA_NET_WM_STRUT, "_NET_WM_STRUT");
REGISTER_ATOM(_XA_NET_WM_STRUT_PARTIAL, "_NET_WM_STRUT_PARTIAL");
REGISTER_ATOM(_XA_NET_WM_ICON_GEOMETRY, "_NET_WM_ICON_GEOMETRY");
REGISTER_ATOM(_XA_NET_WM_ICON, "_NET_WM_ICON");
REGISTER_ATOM(_XA_NET_WM_PID, "_NET_WM_PID");
REGISTER_ATOM(_XA_NET_WM_HANDLED_ICONS, "_NET_WM_HANDLED_ICONS");
REGISTER_ATOM(_XA_NET_WM_USER_TIME, "_NET_WM_USER_TIME");
REGISTER_ATOM(_XA_NET_FRAME_EXTENTS, "_NET_FRAME_EXTENTS");
REGISTER_ATOM(_XA_NET_WM_PING, "_NET_WM_PING");
REGISTER_ATOM(_XA_NET_WM_SYNC_REQUEST, "_NET_WM_SYNC_REQUEST");
REGISTER_ATOM(_XA_NET_WM_STATE_STAYS_ON_TOP, "_NET_WM_STATE_STAYS_ON_TOP");
REGISTER_ATOM(_XA_KWM_WIN_ICON, "_KWM_WIN_ICON");
}
// these are list of current implemented atoms
void SetSupported(Window root)
{
Atom atoms[] =
{
_XA_NET_SUPPORTED,
_XA_NET_SUPPORTING_WM_CHECK,
_XA_NET_WM_NAME,
_XA_NET_WM_WINDOW_TYPE,
_XA_NET_WM_WINDOW_TYPE_NORMAL,
_XA_NET_WM_WINDOW_TYPE_DOCK,
_XA_NET_WM_WINDOW_TYPE_TOOLBAR,
_XA_NET_WM_WINDOW_TYPE_MENU,
_XA_NET_WM_WINDOW_TYPE_UTIL,
_XA_NET_WM_WINDOW_TYPE_DIALOG,
_XA_NET_WM_WINDOW_TYPE_SPLASH,
_XA_NET_WM_WINDOW_TYPE_DESKTOP
};
XChangeProperty(fl_display, root, _XA_NET_SUPPORTED, XA_ATOM, 32, PropModeReplace,
(unsigned char*)atoms, COUNT(atoms));
}