Current Project: A set of X11 Window-Manager interface Atom definitions required by the library.
What Does This Code Do...
Defines and Interns a required set of X11 Window-Manager Atoms that the rest of the library depends on. A sole source for interface between the Window-Manager and the various classes implemented. Also useful for debugging.
//----------------------------------------------------------------------------- // xwinatom.c // // X11 window management standard Atom cache. // // Copyright (c) 2013 - No Fun Farms A.K.A. www.smegware.com // // All Smegware software is free; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // //----------------------------------------------------------------------------- // // History... // // $Source$ // $Author$ // $Revision$ // // $Log$ // //----------------------------------------------------------------------------- #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xatom.h> #include <stdio.h> #include <limits.h> #include <string.h> #include "report.h" //----------------------------------------------------------------------------- Atom WM_PROTOCOLS = None; Atom WM_DELETE_WINDOW = None; Atom WM_TRANSIENT_FOR = None; Atom _NET_WM_PING = None; Atom _NET_WM_SYNC_REQUEST = None; Atom _NET_SUPPORTED = None; Atom _NET_CLIENT_LIST = None; Atom _NET_NUMBER_OF_DESKTOPS = None; Atom _NET_DESKTOP_GEOMETRY = None; Atom _NET_DESKTOP_VIEWPORT = None; Atom _NET_CURRENT_DESKTOP = None; Atom _NET_DESKTOP_NAMES = None; Atom _NET_ACTIVE_WINDOW = None; Atom _NET_WORKAREA = None; Atom _NET_SUPPORTING_WM_CHECK = None; Atom _NET_VIRTUAL_ROOTS = None; Atom _NET_DESKTOP_LAYOUT = None; Atom _NET_SHOWING_DESKTOP = None; Atom _NET_CLOSE_WINDOW = None; Atom _NET_MOVERESIZE_WINDOW = None; Atom _NET_WM_MOVERESIZE = None; Atom _NET_RESTACK_WINDOW = None; Atom _NET_REQUEST_FRAME_EXTENTS = None; Atom _NET_WM_NAME = None; Atom _NET_WM_VISIBLE_NAME = None; Atom _NET_WM_ICON_NAME = None; Atom _NET_WM_VISIBLE_ICON_NAME = None; Atom _NET_WM_DESKTOP = None; Atom _NET_WM_WINDOW_TYPE = None; Atom _NET_WM_WINDOW_TYPE_DESKTOP = None; Atom _NET_WM_WINDOW_TYPE_DOCK = None; Atom _NET_WM_WINDOW_TYPE_TOOLBAR = None; Atom _NET_WM_WINDOW_TYPE_MENU = None; Atom _NET_WM_WINDOW_TYPE_UTILITY = None; Atom _NET_WM_WINDOW_TYPE_SPLASH = None; Atom _NET_WM_WINDOW_TYPE_DIALOG = None; Atom _NET_WM_WINDOW_TYPE_NORMAL = None; Atom _NET_WM_WINDOW_TYPE_HBUTTON = None; Atom _NET_WM_WINDOW_TYPE_PROGRESS = None; Atom _NET_WM_WINDOW_TYPE_CONTAINER = None; Atom _NET_WM_WINDOW_TYPE_SCROLLBAR = None; Atom _NET_WM_WINDOW_TYPE_STATIC = None; Atom _NET_WM_WINDOW_TYPE_EDIT = None; Atom _NET_WM_WINDOW_TYPE_LIST = None; Atom _NET_WM_WINDOW_TYPE_COMBO = None; Atom _NET_WM_WINDOW_TYPE_TREE = None; Atom _NET_WM_WINDOW_TYPE_TAB = None; Atom _NET_WM_STATE = None; Atom _NET_WM_STATE_REMOVE = None; Atom _NET_WM_STATE_ADD = None; Atom _NET_WM_STATE_TOGGLE = None; Atom _NET_WM_STATE_MODAL = None; Atom _NET_WM_STATE_STICKY = None; Atom _NET_WM_STATE_MAXIMIZED_VERT = None; Atom _NET_WM_STATE_MAXIMIZED_HORZ = None; Atom _NET_WM_STATE_SHADED = None; Atom _NET_WM_STATE_SKIP_TASKBAR = None; Atom _NET_WM_STATE_SKIP_PAGER = None; Atom _NET_WM_STATE_HIDDEN = None; Atom _NET_WM_STATE_FULLSCREEN = None; Atom _NET_WM_STATE_ABOVE = None; Atom _NET_WM_STATE_BELOW = None; Atom _NET_WM_STATE_DEMANDS_ATTENTION = None; Atom _NET_WM_ALLOWED_ACTIONS = None; Atom _NET_WM_ACTION_MOVE = None; Atom _NET_WM_ACTION_RESIZE = None; Atom _NET_WM_ACTION_MINIMIZE = None; Atom _NET_WM_ACTION_SHADE = None; Atom _NET_WM_ACTION_STICK = None; Atom _NET_WM_ACTION_MAXIMIZE_HORZ = None; Atom _NET_WM_ACTION_MAXIMIZE_VERT = None; Atom _NET_WM_ACTION_FULLSCREEN = None; Atom _NET_WM_ACTION_CHANGE_DESKTOP = None; Atom _NET_WM_ACTION_CLOSE = None; Atom _NET_WM_STRUT = None; Atom _NET_WM_STRUT_PARTIAL = None; Atom _NET_WM_ICON_GEOMETRY = None; Atom _NET_WM_ICON = None; Atom _NET_WM_PID = None; Atom _NET_WM_HANDLED_ICONS = None; Atom _NET_WM_USER_TIME = None; Atom _NET_FRAME_EXTENTS = None; Atom _NET_WM_WINDOW_OPACITY = None; Atom _NET_WINDOW_DECOR = None; Atom _NET_STARTUP_INFO_BEGIN = None; Atom _NET_STARTUP_INFO = None; //----------------------------------------------------------------------------- #define DEFNUMATOMS 86 void xwin_init_default_atoms(Display *display) { Atom atoms[DEFNUMATOMS]; char *_atoms[DEFNUMATOMS]; _atoms[0] = "WM_PROTOCOLS"; _atoms[1] = "WM_DELETE_WINDOW"; _atoms[2] = "WM_TRANSIENT_FOR"; _atoms[3] = "_NET_WM_PING"; _atoms[4] = "_NET_WM_SYNC_REQUEST"; _atoms[5] = "_NET_SUPPORTED"; _atoms[6] = "_NET_CLIENT_LIST"; _atoms[7] = "_NET_NUMBER_OF_DESKTOPS"; _atoms[8] = "_NET_DESKTOP_GEOMETRY"; _atoms[9] = "_NET_DESKTOP_VIEWPORT"; _atoms[10] = "_NET_CURRENT_DESKTOP"; _atoms[11] = "_NET_DESKTOP_NAMES"; _atoms[12] = "_NET_ACTIVE_WINDOW"; _atoms[13] = "_NET_WORKAREA"; _atoms[14] = "_NET_SUPPORTING_WM_CHECK"; _atoms[15] = "_NET_VIRTUAL_ROOTS"; _atoms[16] = "_NET_DESKTOP_LAYOUT"; _atoms[17] = "_NET_SHOWING_DESKTOP"; _atoms[18] = "_NET_CLOSE_WINDOW"; _atoms[19] = "_NET_MOVERESIZE_WINDOW"; _atoms[20] = "_NET_WM_MOVERESIZE"; _atoms[21] = "_NET_RESTACK_WINDOW"; _atoms[22] = "_NET_REQUEST_FRAME_EXTENTS"; _atoms[23] = "_NET_WM_NAME"; _atoms[24] = "_NET_WM_VISIBLE_NAME"; _atoms[25] = "_NET_WM_ICON_NAME"; _atoms[26] = "_NET_WM_VISIBLE_ICON_NAME"; _atoms[27] = "_NET_WM_DESKTOP"; _atoms[28] = "_NET_WM_WINDOW_TYPE"; _atoms[29] = "_NET_WM_WINDOW_TYPE_DESKTOP"; _atoms[30] = "_NET_WM_WINDOW_TYPE_DOCK"; _atoms[31] = "_NET_WM_WINDOW_TYPE_TOOLBAR"; _atoms[32] = "_NET_WM_WINDOW_TYPE_MENU"; _atoms[33] = "_NET_WM_WINDOW_TYPE_UTILITY"; _atoms[34] = "_NET_WM_WINDOW_TYPE_SPLASH"; _atoms[35] = "_NET_WM_WINDOW_TYPE_DIALOG"; _atoms[36] = "_NET_WM_WINDOW_TYPE_NORMAL"; _atoms[37] = "_NET_WM_WINDOW_TYPE_HBUTTON"; _atoms[38] = "_NET_WM_WINDOW_TYPE_PROGRESS"; _atoms[39] = "_NET_WM_WINDOW_TYPE_CONTAINER"; _atoms[40] = "_NET_WM_WINDOW_TYPE_SCROLLBAR"; _atoms[41] = "_NET_WM_WINDOW_TYPE_STATIC"; _atoms[42] = "_NET_WM_WINDOW_TYPE_EDIT"; _atoms[43] = "_NET_WM_WINDOW_TYPE_LIST"; _atoms[44] = "_NET_WM_WINDOW_TYPE_COMBO"; _atoms[45] = "_NET_WM_WINDOW_TYPE_TREE"; _atoms[46] = "_NET_WM_STATE"; _atoms[47] = "_NET_WM_STATE_REMOVE"; _atoms[48] = "_NET_WM_STATE_ADD"; _atoms[49] = "_NET_WM_STATE_TOGGLE"; _atoms[50] = "_NET_WM_STATE_MODAL"; _atoms[51] = "_NET_WM_STATE_STICKY"; _atoms[52] = "_NET_WM_STATE_MAXIMIZED_VERT"; _atoms[53] = "_NET_WM_STATE_MAXIMIZED_HORZ"; _atoms[54] = "_NET_WM_STATE_SHADED"; _atoms[55] = "_NET_WM_STATE_SKIP_TASKBAR"; _atoms[56] = "_NET_WM_STATE_SKIP_PAGER"; _atoms[57] = "_NET_WM_STATE_HIDDEN"; _atoms[58] = "_NET_WM_STATE_FULLSCREEN"; _atoms[59] = "_NET_WM_STATE_ABOVE"; _atoms[60] = "_NET_WM_STATE_BELOW"; _atoms[61] = "_NET_WM_STATE_DEMANDS_ATTENTION"; _atoms[62] = "_NET_WM_ALLOWED_ACTIONS"; _atoms[63] = "_NET_WM_ACTION_MOVE"; _atoms[64] = "_NET_WM_ACTION_RESIZE"; _atoms[65] = "_NET_WM_ACTION_MINIMIZE"; _atoms[66] = "_NET_WM_ACTION_SHADE"; _atoms[67] = "_NET_WM_ACTION_STICK"; _atoms[68] = "_NET_WM_ACTION_MAXIMIZE_HORZ"; _atoms[69] = "_NET_WM_ACTION_MAXIMIZE_VERT"; _atoms[70] = "_NET_WM_ACTION_FULLSCREEN"; _atoms[71] = "_NET_WM_ACTION_CHANGE_DESKTOP"; _atoms[72] = "_NET_WM_ACTION_CLOSE"; _atoms[73] = "_NET_WM_STRUT"; _atoms[74] = "_NET_WM_STRUT_PARTIAL"; _atoms[75] = "_NET_WM_ICON_GEOMETRY"; _atoms[76] = "_NET_WM_ICON"; _atoms[77] = "_NET_WM_PID"; _atoms[78] = "_NET_WM_HANDLED_ICONS"; _atoms[79] = "_NET_WM_USER_TIME"; _atoms[80] = "_NET_FRAME_EXTENTS"; _atoms[81] = "_NET_WM_WINDOW_OPACITY"; _atoms[82] = "_NET_WINDOW_DECOR"; _atoms[83] = "_NET_STARTUP_INFO_BEGIN"; _atoms[84] = "_NET_STARTUP_INFO"; _atoms[85] = "_NET_WM_WINDOW_TYPE_TAB"; XInternAtoms(display, _atoms, DEFNUMATOMS, False, atoms); WM_PROTOCOLS = atoms[0]; WM_DELETE_WINDOW = atoms[1]; WM_TRANSIENT_FOR = atoms[2]; _NET_WM_PING = atoms[3]; _NET_WM_SYNC_REQUEST = atoms[4]; _NET_SUPPORTED = atoms[5]; _NET_CLIENT_LIST = atoms[6]; _NET_NUMBER_OF_DESKTOPS = atoms[7]; _NET_DESKTOP_GEOMETRY = atoms[8]; _NET_DESKTOP_VIEWPORT = atoms[9]; _NET_CURRENT_DESKTOP = atoms[10]; _NET_DESKTOP_NAMES = atoms[11]; _NET_ACTIVE_WINDOW = atoms[12]; _NET_WORKAREA = atoms[13]; _NET_SUPPORTING_WM_CHECK = atoms[14]; _NET_VIRTUAL_ROOTS = atoms[15]; _NET_DESKTOP_LAYOUT = atoms[16]; _NET_SHOWING_DESKTOP = atoms[17]; _NET_CLOSE_WINDOW = atoms[18]; _NET_MOVERESIZE_WINDOW = atoms[19]; _NET_WM_MOVERESIZE = atoms[20]; _NET_RESTACK_WINDOW = atoms[21]; _NET_REQUEST_FRAME_EXTENTS = atoms[22]; _NET_WM_NAME = atoms[23]; _NET_WM_VISIBLE_NAME = atoms[24]; _NET_WM_ICON_NAME = atoms[25]; _NET_WM_VISIBLE_ICON_NAME = atoms[26]; _NET_WM_DESKTOP = atoms[27]; _NET_WM_WINDOW_TYPE = atoms[28]; _NET_WM_WINDOW_TYPE_DESKTOP = atoms[29]; _NET_WM_WINDOW_TYPE_DOCK = atoms[30]; _NET_WM_WINDOW_TYPE_TOOLBAR = atoms[31]; _NET_WM_WINDOW_TYPE_MENU = atoms[32]; _NET_WM_WINDOW_TYPE_UTILITY = atoms[33]; _NET_WM_WINDOW_TYPE_SPLASH = atoms[34]; _NET_WM_WINDOW_TYPE_DIALOG = atoms[35]; _NET_WM_WINDOW_TYPE_NORMAL = atoms[36]; _NET_WM_WINDOW_TYPE_HBUTTON = atoms[37]; _NET_WM_WINDOW_TYPE_PROGRESS = atoms[38]; _NET_WM_WINDOW_TYPE_CONTAINER = atoms[39]; _NET_WM_WINDOW_TYPE_SCROLLBAR = atoms[40]; _NET_WM_WINDOW_TYPE_STATIC = atoms[41]; _NET_WM_WINDOW_TYPE_EDIT = atoms[42]; _NET_WM_WINDOW_TYPE_LIST = atoms[43]; _NET_WM_WINDOW_TYPE_COMBO = atoms[44]; _NET_WM_WINDOW_TYPE_TREE = atoms[45]; _NET_WM_STATE = atoms[46]; _NET_WM_STATE_REMOVE = atoms[47]; _NET_WM_STATE_ADD = atoms[48]; _NET_WM_STATE_TOGGLE = atoms[49]; _NET_WM_STATE_MODAL = atoms[50]; _NET_WM_STATE_STICKY = atoms[51]; _NET_WM_STATE_MAXIMIZED_VERT = atoms[52]; _NET_WM_STATE_MAXIMIZED_HORZ = atoms[53]; _NET_WM_STATE_SHADED = atoms[54]; _NET_WM_STATE_SKIP_TASKBAR = atoms[55]; _NET_WM_STATE_SKIP_PAGER = atoms[56]; _NET_WM_STATE_HIDDEN = atoms[57]; _NET_WM_STATE_FULLSCREEN = atoms[58]; _NET_WM_STATE_ABOVE = atoms[59]; _NET_WM_STATE_BELOW = atoms[60]; _NET_WM_STATE_DEMANDS_ATTENTION = atoms[61]; _NET_WM_ALLOWED_ACTIONS = atoms[62]; _NET_WM_ACTION_MOVE = atoms[63]; _NET_WM_ACTION_RESIZE = atoms[64]; _NET_WM_ACTION_MINIMIZE = atoms[65]; _NET_WM_ACTION_SHADE = atoms[66]; _NET_WM_ACTION_STICK = atoms[67]; _NET_WM_ACTION_MAXIMIZE_HORZ = atoms[68]; _NET_WM_ACTION_MAXIMIZE_VERT = atoms[69]; _NET_WM_ACTION_FULLSCREEN = atoms[70]; _NET_WM_ACTION_CHANGE_DESKTOP = atoms[71]; _NET_WM_ACTION_CLOSE = atoms[72]; _NET_WM_STRUT = atoms[73]; _NET_WM_STRUT_PARTIAL = atoms[74]; _NET_WM_ICON_GEOMETRY = atoms[75]; _NET_WM_ICON = atoms[76]; _NET_WM_PID = atoms[77]; _NET_WM_HANDLED_ICONS = atoms[78]; _NET_WM_USER_TIME = atoms[79]; _NET_FRAME_EXTENTS = atoms[80]; _NET_WM_WINDOW_OPACITY = atoms[81]; _NET_WINDOW_DECOR = atoms[82]; _NET_STARTUP_INFO_BEGIN = atoms[83]; _NET_STARTUP_INFO = atoms[84]; _NET_STARTUP_INFO = atoms[84]; _NET_WM_WINDOW_TYPE_TAB = atoms[85]; } //----------------------------------------------------------------------------- // end: xwinatom.c //
And The Companion Header...
//----------------------------------------------------------------------------- // xwinatom.h // // X11 window management standard Atom cache definition. // // Copyright (c) 2013 - No Fun Farms A.K.A. www.smegware.com // // All Smegware software is free; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // //----------------------------------------------------------------------------- // // History... // // $Source$ // $Author$ // $Revision$ // // $Log$ // //----------------------------------------------------------------------------- extern Atom WM_PROTOCOLS; extern Atom WM_DELETE_WINDOW; extern Atom WM_TRANSIENT_FOR; extern Atom _NET_WM_PING; extern Atom _NET_WM_SYNC_REQUEST; extern Atom _NET_SUPPORTED; extern Atom _NET_CLIENT_LIST; extern Atom _NET_NUMBER_OF_DESKTOPS; extern Atom _NET_DESKTOP_GEOMETRY; extern Atom _NET_DESKTOP_VIEWPORT; extern Atom _NET_CURRENT_DESKTOP; extern Atom _NET_DESKTOP_NAMES; extern Atom _NET_ACTIVE_WINDOW; extern Atom _NET_WORKAREA; extern Atom _NET_SUPPORTING_WM_CHECK; extern Atom _NET_VIRTUAL_ROOTS; extern Atom _NET_DESKTOP_LAYOUT; extern Atom _NET_SHOWING_DESKTOP; extern Atom _NET_CLOSE_WINDOW; extern Atom _NET_MOVERESIZE_WINDOW; extern Atom _NET_WM_MOVERESIZE; extern Atom _NET_RESTACK_WINDOW; extern Atom _NET_REQUEST_FRAME_EXTENTS; extern Atom _NET_WM_NAME; extern Atom _NET_WM_VISIBLE_NAME; extern Atom _NET_WM_ICON_NAME; extern Atom _NET_WM_VISIBLE_ICON_NAME; extern Atom _NET_WM_DESKTOP; extern Atom _NET_WM_WINDOW_TYPE; extern Atom _NET_WM_WINDOW_TYPE_DESKTOP; extern Atom _NET_WM_WINDOW_TYPE_DOCK; extern Atom _NET_WM_WINDOW_TYPE_TOOLBAR; extern Atom _NET_WM_WINDOW_TYPE_MENU; extern Atom _NET_WM_WINDOW_TYPE_UTILITY; extern Atom _NET_WM_WINDOW_TYPE_SPLASH; extern Atom _NET_WM_WINDOW_TYPE_DIALOG; extern Atom _NET_WM_WINDOW_TYPE_NORMAL; extern Atom _NET_WM_WINDOW_TYPE_HBUTTON; extern Atom _NET_WM_WINDOW_TYPE_PROGRESS; extern Atom _NET_WM_WINDOW_TYPE_CONTAINER; extern Atom _NET_WM_WINDOW_TYPE_SCROLLBAR; extern Atom _NET_WM_WINDOW_TYPE_STATIC; extern Atom _NET_WM_WINDOW_TYPE_EDIT; extern Atom _NET_WM_WINDOW_TYPE_LIST; extern Atom _NET_WM_WINDOW_TYPE_COMBO; extern Atom _NET_WM_WINDOW_TYPE_TREE; extern Atom _NET_WM_WINDOW_TYPE_TAB; extern Atom _NET_WM_STATE; extern Atom _NET_WM_STATE_REMOVE; extern Atom _NET_WM_STATE_ADD; extern Atom _NET_WM_STATE_TOGGLE; extern Atom _NET_WM_STATE_MODAL; extern Atom _NET_WM_STATE_STICKY; extern Atom _NET_WM_STATE_MAXIMIZED_VERT; extern Atom _NET_WM_STATE_MAXIMIZED_HORZ; extern Atom _NET_WM_STATE_SHADED; extern Atom _NET_WM_STATE_SKIP_TASKBAR; extern Atom _NET_WM_STATE_SKIP_PAGER; extern Atom _NET_WM_STATE_HIDDEN; extern Atom _NET_WM_STATE_FULLSCREEN; extern Atom _NET_WM_STATE_ABOVE; extern Atom _NET_WM_STATE_BELOW; extern Atom _NET_WM_STATE_DEMANDS_ATTENTION; extern Atom _NET_WM_ALLOWED_ACTIONS; extern Atom _NET_WM_ACTION_MOVE; extern Atom _NET_WM_ACTION_RESIZE; extern Atom _NET_WM_ACTION_MINIMIZE; extern Atom _NET_WM_ACTION_SHADE; extern Atom _NET_WM_ACTION_STICK; extern Atom _NET_WM_ACTION_MAXIMIZE_HORZ; extern Atom _NET_WM_ACTION_MAXIMIZE_VERT; extern Atom _NET_WM_ACTION_FULLSCREEN; extern Atom _NET_WM_ACTION_CHANGE_DESKTOP; extern Atom _NET_WM_ACTION_CLOSE; extern Atom _NET_WM_STRUT; extern Atom _NET_WM_STRUT_PARTIAL; extern Atom _NET_WM_ICON_GEOMETRY; extern Atom _NET_WM_ICON; extern Atom _NET_WM_PID; extern Atom _NET_WM_HANDLED_ICONS; extern Atom _NET_WM_USER_TIME; extern Atom _NET_FRAME_EXTENTS; extern Atom _NET_WM_WINDOW_OPACITY; extern Atom _NET_WINDOW_DECOR; extern Atom _NET_STARTUP_INFO_BEGIN; extern Atom _NET_STARTUP_INFO; //----------------------------------------------------------------------------- extern void xwin_init_default_atoms(Display*); //----------------------------------------------------------------------------- // end: xwinatom.h //
The Code Demonstrates The Following Programming Techniques...
Conclusion...
It is known that this code has many 'Freshman' mistakes in it. It is not claimed to be good code. Hopefully though; it demonstrates some of the less obvious interface mechanisms when communicating with both a Window-Manager and a Client program. A definition of how to use the code is also missing. Not purposely, an interface spec just can't be fit into my schedule. For now. Besides... This code is not really meant to be used. Although I use this code it is presented here purely for educational purposes.
6987