mirror of
https://github.com/amiwm/amiwm.git
synced 2026-04-14 11:04:18 +00:00
implement a table of atoms defined only once
Previously, adding a new atom into the code required: 1. In <icc.h>, add the line `extern Atom my_new_atom;` declaring the new atom. 2. In <icc.c>, add the line `Atom my_new_atom;` defining the new atom. 3. In <icc.c>, add the line `my_new_atom = XInternAtom(dpy, "MY_NEW_ATOM", False);` interning this new atom, and assigning the interned value to the variable. Now, just add a line with the atom's name in the X-MACRO in <icc.h>, and a XInternAtoms(3) and a set of macros will do the rest. All new atoms will be referred to as an entry in the ATOMS[] array. For example: ATOMS[MY_NEW_ATOM] The exception are for those REALLY OLD atoms that have already a dedicated compile-time-known value defined at <X11/Xatom.h>. Those do not need to be interned; and are referred to with a constant beginning with the `XA_` prefix. For example: XA_WM_CLASS
This commit is contained in:
6
main.c
6
main.c
@@ -758,11 +758,10 @@ static void drag_icon(Scrn *s, Time time, int x_root, int y_root)
|
||||
|
||||
if (c != NULL) {
|
||||
if (c->module != NULL) {
|
||||
extern Atom amiwm_appwindowmsg;
|
||||
XTranslateCoordinates(dpy, s->back, c->window, -4, -4, &wx, &wy, &ch);
|
||||
for (int n = 0; n < nicons; n++) {
|
||||
dispatch_event_to_broker(mkcmessage(
|
||||
c->window, amiwm_appwindowmsg,dragging[n].icon->window,
|
||||
c->window, ATOMS[AMIWM_APPWINDOWMSG],dragging[n].icon->window,
|
||||
dragging[n].x + wx, dragging[n].y + wy
|
||||
), 0, c->module);
|
||||
}
|
||||
@@ -878,13 +877,12 @@ static void drag_resize(Client *c, Time time, int x_root, int y_root)
|
||||
|
||||
static void do_icon_double_click(Scrn *scr)
|
||||
{
|
||||
extern Atom amiwm_appiconmsg;
|
||||
Icon *i, *next;
|
||||
|
||||
for(i=scr->firstselected; i; i=next) {
|
||||
next=i->nextselected;
|
||||
if(i->module) {
|
||||
dispatch_event_to_broker(mkcmessage(i->window, amiwm_appiconmsg, 0),
|
||||
dispatch_event_to_broker(mkcmessage(i->window, ATOMS[AMIWM_APPICONMSG], 0),
|
||||
0, i->module);
|
||||
} else {
|
||||
deiconify(i);
|
||||
|
||||
Reference in New Issue
Block a user