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

View File

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

View File

@ -58,37 +58,16 @@ static const char *const atoms_misc_names[] = {
"ENL_WIN_BORDER" "ENL_WIN_BORDER"
}; };
unsigned int atoms_misc[10]; EX_Atom atoms_misc[10];
static unsigned int desk_info = 0; 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 void
HintsInit(void) HintsInit(void)
{ {
Window win; 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, win = XCreateSimpleWindow(disp, WinGetXwin(VROOT), -200, -200, 5, 5,
0, 0, 0); 0, 0, 0);
@ -596,7 +575,7 @@ EHintsSetInfoOnAll(void)
*/ */
struct _selection { struct _selection {
Atom atom; EX_Atom atom;
Time time; Time time;
Win win; Win win;
EventCallbackFunc *func; EventCallbackFunc *func;
@ -615,7 +594,7 @@ SelectionAcquire(const char *name, EventCallbackFunc * func, void *data)
Esnprintf(buf, sizeof(buf), "%s%d", name, Dpy.screen); Esnprintf(buf, sizeof(buf), "%s%d", name, Dpy.screen);
sel->atom = EInternAtom(buf); sel->atom = ex_atom_get(buf);
sel->time = EGetTimestamp(); sel->time = EGetTimestamp();
sel->win = ECreateEventWindow(VROOT, -100, -100, 1, 1); sel->win = ECreateEventWindow(VROOT, -100, -100, 1, 1);

View File

@ -26,14 +26,12 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "etypes.h" #include "etypes.h"
#include "xprop.h"
#include "xwin.h" #include "xwin.h"
void AtomListIntern(const char *const *names, unsigned int num,
unsigned int *atoms);
/* Misc atoms */ /* Misc atoms */
extern unsigned int atoms_misc[]; extern EX_Atom atoms_misc[];
#define E_XA_MANAGER atoms_misc[0] #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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "E.h" #include "config.h"
#include "ewins.h" #include "ewins.h"
#include "hints.h" #include "hints.h"
#include "xprop.h"
/* Motif window hints */ /* Motif window hints */
#define MWM_HINTS_FUNCTIONS (1L << 0) #define MWM_HINTS_FUNCTIONS (1L << 0)
@ -56,7 +57,7 @@
#define PROP_MWM_HINTS_ELEMENTS 5 #define PROP_MWM_HINTS_ELEMENTS 5
#define PROP_MWM_HINTS_ELEMENTS_MIN 4 #define PROP_MWM_HINTS_ELEMENTS_MIN 4
static Atom _MOTIF_WM_HINTS = 0; static EX_Atom _MOTIF_WM_HINTS = 0;
/* Motif window hints */ /* Motif window hints */
typedef struct { typedef struct {
@ -80,7 +81,7 @@ MWM_GetHints(EWin * ewin, Atom atom_change)
return; return;
if (!_MOTIF_WM_HINTS) 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) if (atom_change && atom_change != _MOTIF_WM_HINTS)
return; return;
@ -176,13 +177,13 @@ MWM_GetHints(EWin * ewin, Atom atom_change)
void void
MWM_SetInfo(void) MWM_SetInfo(void)
{ {
Atom a1; EX_Atom a1;
struct { struct {
long flags; long flags;
Window win; Window win;
} mwminfo; } mwminfo;
a1 = EInternAtom("_MOTIF_WM_INFO"); a1 = ex_atom_get("_MOTIF_WM_INFO");
mwminfo.flags = 2; mwminfo.flags = 2;
mwminfo.win = WinGetXwin(VROOT); mwminfo.win = WinGetXwin(VROOT);
XChangeProperty(disp, WinGetXwin(VROOT), a1, a1, 32, PropModeReplace, XChangeProperty(disp, WinGetXwin(VROOT), a1, a1, 32, PropModeReplace,

View File

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

View File

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

View File

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

View File

@ -38,7 +38,6 @@
#if DEBUG_CHECK #if DEBUG_CHECK
#include <assert.h> #include <assert.h>
#endif #endif
#include "hints.h"
#include "xprop.h" #include "xprop.h"
#include "xwin.h" #include "xwin.h"
@ -50,6 +49,33 @@
* General stuff * 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) * Send client message (format 32)
*/ */
@ -563,7 +589,7 @@ static const char *const atoms_icccm_names[] = {
/* *INDENT-ON* */ /* *INDENT-ON* */
}; };
unsigned int atoms_icccm[CHECK_COUNT_ICCCM]; EX_Atom atoms_icccm[CHECK_COUNT_ICCCM];
void void
ex_icccm_init(void) ex_icccm_init(void)
@ -571,7 +597,7 @@ ex_icccm_init(void)
#if DEBUG_CHECK #if DEBUG_CHECK
assert(CHECK_COUNT_ICCCM == N_ITEMS(atoms_icccm)); assert(CHECK_COUNT_ICCCM == N_ITEMS(atoms_icccm));
#endif #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 static void
@ -785,7 +811,7 @@ static const char *const atoms_netwm_names[] = {
/* *INDENT-ON* */ /* *INDENT-ON* */
}; };
unsigned int atoms_netwm[CHECK_COUNT_NETWM]; EX_Atom atoms_netwm[CHECK_COUNT_NETWM];
void void
ex_netwm_init(void) ex_netwm_init(void)
@ -793,7 +819,7 @@ ex_netwm_init(void)
#if DEBUG_CHECK #if DEBUG_CHECK
assert(CHECK_COUNT_NETWM == N_ITEMS(atoms_netwm)); assert(CHECK_COUNT_NETWM == N_ITEMS(atoms_netwm));
#endif #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_Time EX_ID
#define EX_GC GC #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, int ex_client_message32_send(EX_Window win,
EX_Atom type, EX_Atom type,
unsigned int mask, unsigned int mask,
@ -97,7 +101,7 @@ char *ex_window_prop_string_get(EX_Window win, EX_Atom atom);
/* Misc. */ /* Misc. */
#include "X11/Xatom.h" #include "X11/Xatom.h"
extern unsigned int atoms_icccm[]; extern EX_Atom atoms_icccm[];
#define EX_ATOM_UTF8_STRING atoms_icccm[8] #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); char **name, char **clss);
/* NETWM (EWMH) */ /* NETWM (EWMH) */
extern unsigned int atoms_netwm[]; extern EX_Atom atoms_netwm[];
/* Window manager info */ /* Window manager info */
#define EX_ATOM_NET_SUPPORTED atoms_netwm[0] #define EX_ATOM_NET_SUPPORTED atoms_netwm[0]

View File

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