Move/rename EInternAtom -> ex_atom_get, AtomListIntern -> ex_atoms_get.

This commit is contained in:
Kim Woelders 2013-04-07 12:04:35 +02:00
parent 7678242b64
commit 9ca446396b
11 changed files with 132 additions and 130 deletions

View File

@ -155,7 +155,7 @@ ExtInitWinMain(void)
XGCValues gcv;
GC gc;
Pixmap pmap;
Atom a;
EX_Atom a;
EiwData eiwd;
EiwLoopFunc *eiwc_loop_func;
@ -193,7 +193,7 @@ ExtInitWinMain(void)
XFreePixmap(disp, pmap);
XFreeGC(disp, gc);
a = EInternAtom("ENLIGHTENMENT_RESTART_SCREEN");
a = ex_atom_get("ENLIGHTENMENT_RESTART_SCREEN");
ex_window_prop_window_set(WinGetXwin(VROOT), a, &win, 1);
XSelectInput(disp, win, StructureNotifyMask);
@ -260,12 +260,12 @@ ExtInitWinCreate(void)
{
EX_Window win_ex; /* Hmmm.. */
Window win;
Atom a;
EX_Atom a;
if (EDebug(EDBUG_TYPE_SESSION))
Eprintf("ExtInitWinCreate\n");
a = EInternAtom("ENLIGHTENMENT_RESTART_SCREEN");
a = ex_atom_get("ENLIGHTENMENT_RESTART_SCREEN");
ESync(0);
if (fork())

View File

@ -249,7 +249,7 @@
*
* xev.type = ClientMessage;
* xev.window = client_window;
* xev.message_type = EInternAtom(XA_WIN_LAYER);
* xev.message_type = ex_atom_get(XA_WIN_LAYER);
* xev.format = 32;
* xev.data.l[0] = new_layer;
* xev.data.l[1] = CurrentTime;
@ -263,7 +263,7 @@
*
* xev.type = ClientMessage;
* xev.window = client_window;
* xev.message_type = EInternAtom(XA_WIN_STATE);
* xev.message_type = ex_atom_get(XA_WIN_STATE);
* xev.format = 32;
* xev.data.l[0] = mask_of_members_to_change;
* xev.data.l[1] = new_members;
@ -278,7 +278,7 @@
*
* xev.type = ClientMessage;
* xev.window = client_window;
* xev.message_type = EInternAtom(XA_WIN_WORKSPACE);
* xev.message_type = ex_atom_get(XA_WIN_WORKSPACE);
* xev.format = 32;
* xev.data.l[0] = new_desktop_number;
* xev.data.l[2] = CurrentTimep;
@ -289,7 +289,7 @@
static void
GNOME_GetHintIcons(EWin * ewin, Atom atom_change)
{
static Atom atom_get = 0;
static EX_Atom atom_get = 0;
int num, i;
EX_ID *plst;
Pixmap pmap;
@ -299,7 +299,7 @@ GNOME_GetHintIcons(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = EInternAtom(XA_WIN_ICONS);
atom_get = ex_atom_get(XA_WIN_ICONS);
if ((atom_change) && (atom_change != atom_get))
return;
@ -320,7 +320,7 @@ GNOME_GetHintIcons(EWin * ewin, Atom atom_change)
static void
GNOME_GetHintLayer(EWin * ewin, Atom atom_change)
{
static Atom atom_get = 0;
static EX_Atom atom_get = 0;
int num;
unsigned int layer;
@ -328,7 +328,7 @@ GNOME_GetHintLayer(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = EInternAtom(XA_WIN_LAYER);
atom_get = ex_atom_get(XA_WIN_LAYER);
if ((atom_change) && (atom_change != atom_get))
return;
@ -344,7 +344,7 @@ GNOME_GetHintLayer(EWin * ewin, Atom atom_change)
static void
GNOME_GetHintState(EWin * ewin, Atom atom_change)
{
static Atom atom_get = 0;
static EX_Atom atom_get = 0;
int num;
unsigned int flags;
@ -352,7 +352,7 @@ GNOME_GetHintState(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = EInternAtom(XA_WIN_STATE);
atom_get = ex_atom_get(XA_WIN_STATE);
if ((atom_change) && (atom_change != atom_get))
return;
@ -375,7 +375,7 @@ GNOME_GetHintState(EWin * ewin, Atom atom_change)
static void
GNOME_GetHintAppState(EWin * ewin, Atom atom_change)
{
static Atom atom_get = 0;
static EX_Atom atom_get = 0;
int num;
unsigned int flags;
@ -385,7 +385,7 @@ GNOME_GetHintAppState(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = EInternAtom(XA_WIN_APP_STATE);
atom_get = ex_atom_get(XA_WIN_APP_STATE);
if ((atom_change) && (atom_change != atom_get))
return;
@ -399,7 +399,7 @@ GNOME_GetHintAppState(EWin * ewin, Atom atom_change)
static void
GNOME_GetHintDesktop(EWin * ewin, Atom atom_change)
{
static Atom atom_get = 0;
static EX_Atom atom_get = 0;
int num;
unsigned int desk;
@ -407,7 +407,7 @@ GNOME_GetHintDesktop(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = EInternAtom(XA_WIN_WORKSPACE);
atom_get = ex_atom_get(XA_WIN_WORKSPACE);
if ((atom_change) && (atom_change != atom_get))
return;
@ -422,7 +422,7 @@ GNOME_GetHintDesktop(EWin * ewin, Atom atom_change)
static void
GNOME_GetHint(EWin * ewin, Atom atom_change)
{
static Atom atom_get = 0;
static EX_Atom atom_get = 0;
int num;
unsigned int flags;
@ -430,7 +430,7 @@ GNOME_GetHint(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = EInternAtom(XA_WIN_HINTS);
atom_get = ex_atom_get(XA_WIN_HINTS);
if ((atom_change) && (atom_change != atom_get))
return;
@ -454,13 +454,13 @@ GNOME_GetHint(EWin * ewin, Atom atom_change)
void
GNOME_SetHint(const EWin * ewin)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
unsigned int val;
if ((ewin->type == EWIN_TYPE_MENU) || (ewin->type == EWIN_TYPE_PAGER))
return;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_STATE);
atom_set = ex_atom_get(XA_WIN_STATE);
val = 0;
if (EoIsSticky(ewin))
val |= WIN_STATE_STICKY;
@ -474,13 +474,13 @@ GNOME_SetHint(const EWin * ewin)
void
GNOME_SetEwinArea(const EWin * ewin)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
unsigned int val[2];
if ((ewin->type == EWIN_TYPE_MENU) || (ewin->type == EWIN_TYPE_PAGER))
return;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_AREA);
atom_set = ex_atom_get(XA_WIN_AREA);
val[0] = ewin->area_x;
val[1] = ewin->area_y;
ex_window_prop_card32_set(EwinGetClientXwin(ewin), atom_set, val, 2);
@ -489,13 +489,13 @@ GNOME_SetEwinArea(const EWin * ewin)
void
GNOME_SetEwinDesk(const EWin * ewin)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
unsigned int val;
if ((ewin->type == EWIN_TYPE_MENU) || (ewin->type == EWIN_TYPE_PAGER))
return;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_WORKSPACE);
atom_set = ex_atom_get(XA_WIN_WORKSPACE);
val = EoGetDeskNum(ewin);
ex_window_prop_card32_set(EwinGetClientXwin(ewin), atom_set, &val, 1);
}
@ -504,7 +504,7 @@ GNOME_SetEwinDesk(const EWin * ewin)
static void
GNOME_GetExpandedSize(EWin * ewin, Atom atom_change)
{
static Atom atom_get = 0;
static EX_Atom atom_get = 0;
int num;
unsigned int exp[4];
@ -512,7 +512,7 @@ GNOME_GetExpandedSize(EWin * ewin, Atom atom_change)
return;
if (!atom_get)
atom_get = EInternAtom(XA_WIN_EXPANDED_SIZE);
atom_get = ex_atom_get(XA_WIN_EXPANDED_SIZE);
if ((atom_change) && (atom_change != atom_get))
return;
@ -532,33 +532,33 @@ GNOME_GetExpandedSize(EWin * ewin, Atom atom_change)
static void
GNOME_SetUsedHints(void)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
EX_Atom list[10];
if (!atom_set)
atom_set = EInternAtom(XA_WIN_PROTOCOLS);
list[0] = EInternAtom(XA_WIN_LAYER);
list[1] = EInternAtom(XA_WIN_STATE);
list[2] = EInternAtom(XA_WIN_HINTS);
list[3] = EInternAtom(XA_WIN_APP_STATE);
list[4] = EInternAtom(XA_WIN_EXPANDED_SIZE);
list[5] = EInternAtom(XA_WIN_ICONS);
list[6] = EInternAtom(XA_WIN_WORKSPACE);
list[7] = EInternAtom(XA_WIN_WORKSPACE_COUNT);
list[8] = EInternAtom(XA_WIN_WORKSPACE_NAMES);
list[9] = EInternAtom(XA_WIN_CLIENT_LIST);
atom_set = ex_atom_get(XA_WIN_PROTOCOLS);
list[0] = ex_atom_get(XA_WIN_LAYER);
list[1] = ex_atom_get(XA_WIN_STATE);
list[2] = ex_atom_get(XA_WIN_HINTS);
list[3] = ex_atom_get(XA_WIN_APP_STATE);
list[4] = ex_atom_get(XA_WIN_EXPANDED_SIZE);
list[5] = ex_atom_get(XA_WIN_ICONS);
list[6] = ex_atom_get(XA_WIN_WORKSPACE);
list[7] = ex_atom_get(XA_WIN_WORKSPACE_COUNT);
list[8] = ex_atom_get(XA_WIN_WORKSPACE_NAMES);
list[9] = ex_atom_get(XA_WIN_CLIENT_LIST);
ex_window_prop_atom_set(WinGetXwin(VROOT), atom_set, list, 10);
}
void
GNOME_SetCurrentArea(void)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
unsigned int val[2];
int ax, ay;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_AREA);
atom_set = ex_atom_get(XA_WIN_AREA);
DeskCurrentGetArea(&ax, &ay);
val[0] = ax;
val[1] = ay;
@ -568,11 +568,11 @@ GNOME_SetCurrentArea(void)
void
GNOME_SetCurrentDesk(void)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
unsigned int val;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_WORKSPACE);
atom_set = ex_atom_get(XA_WIN_WORKSPACE);
val = DesksGetCurrentNum();
ex_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1);
}
@ -580,11 +580,11 @@ GNOME_SetCurrentDesk(void)
static void
GNOME_SetWMCheck(Window win_wm_check)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
unsigned int val;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_SUPPORTING_WM_CHECK);
atom_set = ex_atom_get(XA_WIN_SUPPORTING_WM_CHECK);
val = win_wm_check;
ex_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1);
ex_window_prop_card32_set(win_wm_check, atom_set, &val, 1);
@ -593,11 +593,11 @@ GNOME_SetWMCheck(Window win_wm_check)
void
GNOME_SetDeskCount(void)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
unsigned int val;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_WORKSPACE_COUNT);
atom_set = ex_atom_get(XA_WIN_WORKSPACE_COUNT);
val = DesksGetNumber();
ex_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1);
}
@ -605,12 +605,12 @@ GNOME_SetDeskCount(void)
void
GNOME_SetAreaCount(void)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
int ax, ay;
unsigned int val[2];
if (!atom_set)
atom_set = EInternAtom(XA_WIN_AREA_COUNT);
atom_set = ex_atom_get(XA_WIN_AREA_COUNT);
DesksGetAreaSize(&ax, &ay);
val[0] = ax;
val[1] = ay;
@ -620,12 +620,12 @@ GNOME_SetAreaCount(void)
void
GNOME_SetDeskNames(void)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
char s[1024], **names;
int i, n_desks;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_WORKSPACE_NAMES);
atom_set = ex_atom_get(XA_WIN_WORKSPACE_NAMES);
n_desks = DesksGetNumber();
names = EMALLOC(char *, n_desks);
@ -649,13 +649,13 @@ GNOME_SetDeskNames(void)
void
GNOME_SetClientList(void)
{
static Atom atom_set = 0;
static EX_Atom atom_set = 0;
unsigned int *wl;
int j, i, num;
EWin *const *lst;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_CLIENT_LIST);
atom_set = ex_atom_get(XA_WIN_CLIENT_LIST);
lst = EwinListOrderGet(&num);
wl = NULL;
@ -677,31 +677,31 @@ GNOME_SetClientList(void)
static void
GNOME_SetWMNameVer(void)
{
static Atom atom_set = 0, atom_set2 = 0;
static EX_Atom atom_set = 0, atom_set2 = 0;
if (!atom_set)
atom_set = EInternAtom(XA_WIN_WM_NAME);
atom_set = ex_atom_get(XA_WIN_WM_NAME);
ex_window_prop_string_set(WinGetXwin(VROOT), atom_set, e_wm_name);
if (!atom_set2)
atom_set2 = EInternAtom(XA_WIN_WM_VERSION);
atom_set2 = ex_atom_get(XA_WIN_WM_VERSION);
ex_window_prop_string_set(WinGetXwin(VROOT), atom_set2, e_wm_version);
}
void
GNOME_DelHints(const EWin * ewin)
{
static Atom atom_get[6] = { 0, 0, 0, 0, 0, 0 };
static EX_Atom atom_get[6] = { 0, 0, 0, 0, 0, 0 };
Window win;
if (!atom_get[0])
{
atom_get[0] = EInternAtom(XA_WIN_WORKSPACE);
atom_get[1] = EInternAtom(XA_WIN_LAYER);
atom_get[2] = EInternAtom(XA_WIN_STATE);
atom_get[3] = EInternAtom(XA_WIN_HINTS);
atom_get[4] = EInternAtom(XA_WIN_APP_STATE);
atom_get[5] = EInternAtom(XA_WIN_AREA);
atom_get[0] = ex_atom_get(XA_WIN_WORKSPACE);
atom_get[1] = ex_atom_get(XA_WIN_LAYER);
atom_get[2] = ex_atom_get(XA_WIN_STATE);
atom_get[3] = ex_atom_get(XA_WIN_HINTS);
atom_get[4] = ex_atom_get(XA_WIN_APP_STATE);
atom_get[5] = ex_atom_get(XA_WIN_AREA);
}
win = EwinGetClientXwin(ewin);
@ -734,10 +734,10 @@ GNOME_SetHints(Window win_wm_check)
GNOME_SetUsedHints();
GNOME_SetWMCheck(win_wm_check);
{
Atom atom_set;
EX_Atom atom_set;
unsigned int val;
atom_set = EInternAtom("_WIN_DESKTOP_BUTTON_PROXY");
atom_set = ex_atom_get("_WIN_DESKTOP_BUTTON_PROXY");
Mode.button_proxy_win =
XCreateSimpleWindow(disp, WinGetXwin(VROOT), -80, -80, 24, 24, 0,
0, 0);
@ -750,12 +750,12 @@ GNOME_SetHints(Window win_wm_check)
int
GNOME_ProcessClientClientMessage(EWin * ewin, XClientMessageEvent * event)
{
static Atom a4 = 0, a5 = 0;
static EX_Atom a4 = 0, a5 = 0;
if (!a4)
a4 = EInternAtom("_WIN_LAYER");
a4 = ex_atom_get("_WIN_LAYER");
if (!a5)
a5 = EInternAtom("_WIN_STATE");
a5 = ex_atom_get("_WIN_STATE");
if (event->message_type == a4)
{
@ -804,12 +804,12 @@ GNOME_ProcessClientClientMessage(EWin * ewin, XClientMessageEvent * event)
int
GNOME_ProcessRootClientMessage(XClientMessageEvent * event)
{
static Atom a2 = 0, a3 = 0;
static EX_Atom a2 = 0, a3 = 0;
if (!a2)
a2 = EInternAtom("_WIN_AREA");
a2 = ex_atom_get("_WIN_AREA");
if (!a3)
a3 = EInternAtom("_WIN_WORKSPACE");
a3 = ex_atom_get("_WIN_WORKSPACE");
if (event->message_type == a2)
{

View File

@ -58,37 +58,16 @@ static const char *const atoms_misc_names[] = {
"ENL_WIN_BORDER"
};
unsigned int atoms_misc[10];
EX_Atom atoms_misc[10];
static unsigned int desk_info = 0;
void
AtomListIntern(const char *const *names, unsigned int num, unsigned int *atoms)
{
#if SIZEOF_INT == SIZEOF_LONG
XInternAtoms(disp, (char **)names, num, False, (Atom *) atoms);
#else
unsigned int i;
Atom *_atoms;
_atoms = EMALLOC(Atom, num);
if (!_atoms)
return;
XInternAtoms(disp, (char **)names, num, False, _atoms);
for (i = 0; i < num; i++)
atoms[i] = _atoms[i];
Efree(_atoms);
#endif
}
void
HintsInit(void)
{
Window win;
AtomListIntern(atoms_misc_names, N_ITEMS(atoms_misc_names), atoms_misc);
ex_atoms_get(atoms_misc_names, N_ITEMS(atoms_misc_names), atoms_misc);
win = XCreateSimpleWindow(disp, WinGetXwin(VROOT), -200, -200, 5, 5,
0, 0, 0);
@ -596,7 +575,7 @@ EHintsSetInfoOnAll(void)
*/
struct _selection {
Atom atom;
EX_Atom atom;
Time time;
Win win;
EventCallbackFunc *func;
@ -615,7 +594,7 @@ SelectionAcquire(const char *name, EventCallbackFunc * func, void *data)
Esnprintf(buf, sizeof(buf), "%s%d", name, Dpy.screen);
sel->atom = EInternAtom(buf);
sel->atom = ex_atom_get(buf);
sel->time = EGetTimestamp();
sel->win = ECreateEventWindow(VROOT, -100, -100, 1, 1);

View File

@ -26,14 +26,12 @@
#include <X11/Xlib.h>
#include "etypes.h"
#include "xprop.h"
#include "xwin.h"
void AtomListIntern(const char *const *names, unsigned int num,
unsigned int *atoms);
/* Misc atoms */
extern unsigned int atoms_misc[];
extern EX_Atom atoms_misc[];
#define E_XA_MANAGER atoms_misc[0]

View File

@ -20,9 +20,10 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "config.h"
#include "ewins.h"
#include "hints.h"
#include "xprop.h"
/* Motif window hints */
#define MWM_HINTS_FUNCTIONS (1L << 0)
@ -56,7 +57,7 @@
#define PROP_MWM_HINTS_ELEMENTS 5
#define PROP_MWM_HINTS_ELEMENTS_MIN 4
static Atom _MOTIF_WM_HINTS = 0;
static EX_Atom _MOTIF_WM_HINTS = 0;
/* Motif window hints */
typedef struct {
@ -80,7 +81,7 @@ MWM_GetHints(EWin * ewin, Atom atom_change)
return;
if (!_MOTIF_WM_HINTS)
_MOTIF_WM_HINTS = EInternAtom("_MOTIF_WM_HINTS");
_MOTIF_WM_HINTS = ex_atom_get("_MOTIF_WM_HINTS");
if (atom_change && atom_change != _MOTIF_WM_HINTS)
return;
@ -176,13 +177,13 @@ MWM_GetHints(EWin * ewin, Atom atom_change)
void
MWM_SetInfo(void)
{
Atom a1;
EX_Atom a1;
struct {
long flags;
Window win;
} mwminfo;
a1 = EInternAtom("_MOTIF_WM_INFO");
a1 = ex_atom_get("_MOTIF_WM_INFO");
mwminfo.flags = 2;
mwminfo.win = WinGetXwin(VROOT);
XChangeProperty(disp, WinGetXwin(VROOT), a1, a1, 32, PropModeReplace,

View File

@ -31,7 +31,9 @@
#include "settings.h"
#include "snaps.h"
#include "user.h"
#if 0 /* Unused */
#include "xprop.h"
#endif
#include "xwin.h"
#ifdef USE_EXT_INIT_WIN
@ -292,7 +294,7 @@ callback_shutdown_cancelled(SmcConn smc_conn, SmPointer client_data __UNUSED__)
}
#if 0 /* Unused */
static Atom atom_sm_client_id;
static EX_Atom atom_sm_client_id;
#endif
static IceConn ice_conn;
@ -410,7 +412,7 @@ SessionInit(void)
return;
#if 0 /* Unused */
atom_sm_client_id = EInternAtom("SM_CLIENT_ID");
atom_sm_client_id = ex_atom_get("SM_CLIENT_ID");
#endif
#if USE_SM

View File

@ -40,12 +40,12 @@ typedef struct {
#define StObjIsMapped(o) (((SWin*)(o))->mapped)
/* XEmbed atoms */
static Atom E_XA__XEMBED = 0;
static Atom E_XA__XEMBED_INFO = 0;
static EX_Atom E_XA__XEMBED = 0;
static EX_Atom E_XA__XEMBED_INFO = 0;
/* Systray atoms */
static Atom _NET_SYSTEM_TRAY_OPCODE = 0;
static Atom _NET_SYSTEM_TRAY_MESSAGE_DATA = 0;
static EX_Atom _NET_SYSTEM_TRAY_OPCODE = 0;
static EX_Atom _NET_SYSTEM_TRAY_MESSAGE_DATA = 0;
/* Systray selection */
static ESelection *systray_sel = NULL;
@ -420,10 +420,10 @@ SystrayInit(Container * ct)
{
Win win;
E_XA__XEMBED = EInternAtom("_XEMBED");
E_XA__XEMBED_INFO = EInternAtom("_XEMBED_INFO");
_NET_SYSTEM_TRAY_OPCODE = EInternAtom("_NET_SYSTEM_TRAY_OPCODE");
_NET_SYSTEM_TRAY_MESSAGE_DATA = EInternAtom("_NET_SYSTEM_TRAY_MESSAGE_DATA");
E_XA__XEMBED = ex_atom_get("_XEMBED");
E_XA__XEMBED_INFO = ex_atom_get("_XEMBED_INFO");
_NET_SYSTEM_TRAY_OPCODE = ex_atom_get("_NET_SYSTEM_TRAY_OPCODE");
_NET_SYSTEM_TRAY_MESSAGE_DATA = ex_atom_get("_NET_SYSTEM_TRAY_MESSAGE_DATA");
/* Acquire selection */
if (systray_sel)

View File

@ -1237,12 +1237,6 @@ EKeynameToKeycode(const char *name)
return XKeysymToKeycode(disp, XStringToKeysym(name));
}
Atom
EInternAtom(const char *name)
{
return XInternAtom(disp, name, False);
}
#define DEBUG_SHAPE_OPS 0
#define DEBUG_SHAPE_PROPAGATE 0

View File

@ -38,7 +38,6 @@
#if DEBUG_CHECK
#include <assert.h>
#endif
#include "hints.h"
#include "xprop.h"
#include "xwin.h"
@ -50,6 +49,33 @@
* General stuff
*/
EX_Atom
ex_atom_get(const char *name)
{
return XInternAtom(_ex_disp, name, False);
}
void
ex_atoms_get(const char *const *names, unsigned int num, EX_Atom * atoms)
{
#if SIZEOF_INT == SIZEOF_LONG
XInternAtoms(_ex_disp, (char **)names, num, False, (Atom *) atoms);
#else
unsigned int i;
Atom *_atoms;
_atoms = EMALLOC(Atom, num);
if (!_atoms)
return;
XInternAtoms(_ex_disp, (char **)names, num, False, _atoms);
for (i = 0; i < num; i++)
atoms[i] = _atoms[i];
Efree(_atoms);
#endif
}
/*
* Send client message (format 32)
*/
@ -563,7 +589,7 @@ static const char *const atoms_icccm_names[] = {
/* *INDENT-ON* */
};
unsigned int atoms_icccm[CHECK_COUNT_ICCCM];
EX_Atom atoms_icccm[CHECK_COUNT_ICCCM];
void
ex_icccm_init(void)
@ -571,7 +597,7 @@ ex_icccm_init(void)
#if DEBUG_CHECK
assert(CHECK_COUNT_ICCCM == N_ITEMS(atoms_icccm));
#endif
AtomListIntern(atoms_icccm_names, N_ITEMS(atoms_icccm), atoms_icccm);
ex_atoms_get(atoms_icccm_names, N_ITEMS(atoms_icccm), atoms_icccm);
}
static void
@ -785,7 +811,7 @@ static const char *const atoms_netwm_names[] = {
/* *INDENT-ON* */
};
unsigned int atoms_netwm[CHECK_COUNT_NETWM];
EX_Atom atoms_netwm[CHECK_COUNT_NETWM];
void
ex_netwm_init(void)
@ -793,7 +819,7 @@ ex_netwm_init(void)
#if DEBUG_CHECK
assert(CHECK_COUNT_NETWM == N_ITEMS(atoms_netwm));
#endif
AtomListIntern(atoms_netwm_names, N_ITEMS(atoms_netwm), atoms_netwm);
ex_atoms_get(atoms_netwm_names, N_ITEMS(atoms_netwm), atoms_netwm);
}
/*

View File

@ -31,6 +31,10 @@
#define EX_Time EX_ID
#define EX_GC GC
EX_Atom ex_atom_get(const char *name);
void ex_atoms_get(const char *const *names,
unsigned int num, EX_Atom * atoms);
int ex_client_message32_send(EX_Window win,
EX_Atom type,
unsigned int mask,
@ -97,7 +101,7 @@ char *ex_window_prop_string_get(EX_Window win, EX_Atom atom);
/* Misc. */
#include "X11/Xatom.h"
extern unsigned int atoms_icccm[];
extern EX_Atom atoms_icccm[];
#define EX_ATOM_UTF8_STRING atoms_icccm[8]
@ -135,7 +139,7 @@ void ex_icccm_name_class_get(EX_Window win,
char **name, char **clss);
/* NETWM (EWMH) */
extern unsigned int atoms_netwm[];
extern EX_Atom atoms_netwm[];
/* Window manager info */
#define EX_ATOM_NET_SUPPORTED atoms_netwm[0]

View File

@ -278,8 +278,6 @@ void EXSendEvent(Window xwin,
KeyCode EKeysymToKeycode(KeySym keysym);
KeyCode EKeynameToKeycode(const char *name);
Atom EInternAtom(const char *name);
typedef struct {
char type;
char depth;