api: Eliminate redundant dd

This commit is contained in:
Kim Woelders 2023-12-09 21:52:02 +01:00
parent 1ee805ce65
commit 3a0345032f
1 changed files with 15 additions and 16 deletions

View File

@ -44,7 +44,6 @@ static Epplet_window mainwin; /* Always the main epplet window */
static Atom wmDeleteWindow;
static Display *dd = NULL;
static Window comms_win = 0;
static Window my_win = 0;
static Window root = 0;
@ -437,8 +436,7 @@ Epplet_Init(const char *name, const char *version, const char *info,
#endif
#endif
dd = disp;
root = DefaultRootWindow(dd);
root = DefaultRootWindow(disp);
imlib_context_set_display(disp);
imlib_context_set_visual(DefaultVisual(disp, DefaultScreen(disp)));
@ -1682,10 +1680,11 @@ CommsSetup(void)
if (!my_win)
{
my_win = XCreateWindow(dd, root, -10, -10, 1, 1, 0,
my_win = XCreateWindow(disp, root, -10, -10, 1, 1, 0,
CopyFromParent, InputOnly, CopyFromParent,
0, NULL);
XSelectInput(dd, my_win, StructureNotifyMask | SubstructureNotifyMask);
XSelectInput(disp, my_win,
StructureNotifyMask | SubstructureNotifyMask);
}
}
@ -1704,7 +1703,7 @@ CommsHandlePropertyNotify(XEvent *ev)
if (comms_win)
return 0;
if (!a)
a = XInternAtom(dd, "ENLIGHTENMENT_COMMS", True);
a = XInternAtom(disp, "ENLIGHTENMENT_COMMS", True);
if (a == ev->xproperty.atom)
CommsSetup();
if (comms_win)
@ -1723,11 +1722,11 @@ CommsFindCommsWindow(void)
int dint;
unsigned int duint;
a = XInternAtom(dd, "ENLIGHTENMENT_COMMS", True);
a = XInternAtom(disp, "ENLIGHTENMENT_COMMS", True);
if (a != None)
{
s = NULL;
XGetWindowProperty(dd, root, a, 0, 14, False, AnyPropertyType, &ar,
XGetWindowProperty(disp, root, a, 0, 14, False, AnyPropertyType, &ar,
&format, &num, &after, &s);
if (s)
{
@ -1739,13 +1738,13 @@ CommsFindCommsWindow(void)
if (comms_win)
{
if (!XGetGeometry(dd, comms_win, &rt, &dint, &dint,
if (!XGetGeometry(disp, comms_win, &rt, &dint, &dint,
&duint, &duint, &duint, &duint))
comms_win = 0;
s = NULL;
if (comms_win)
{
XGetWindowProperty(dd, comms_win, a, 0, 14, False,
XGetWindowProperty(disp, comms_win, a, 0, 14, False,
AnyPropertyType, &ar, &format, &num,
&after, &s);
if (s)
@ -1756,7 +1755,7 @@ CommsFindCommsWindow(void)
}
}
if (comms_win)
XSelectInput(dd, comms_win,
XSelectInput(disp, comms_win,
StructureNotifyMask | SubstructureNotifyMask);
}
@ -1770,11 +1769,11 @@ Epplet_send_ipc(const char *fmt, ...)
int i, j, k, len;
XEvent ev;
if (!fmt || !dd)
if (!fmt || !disp)
return;
if (!a)
a = XInternAtom(dd, "ENL_MSG", False);
a = XInternAtom(disp, "ENL_MSG", False);
va_start(args, fmt);
len = vsnprintf(buf, sizeof(buf), fmt, args);
@ -1801,7 +1800,7 @@ Epplet_send_ipc(const char *fmt, ...)
ss[20] = 0;
for (k = 0; k < 20; k++)
ev.xclient.data.b[k] = ss[k];
XSendEvent(dd, comms_win, False, 0, (XEvent *) & ev);
XSendEvent(disp, comms_win, False, 0, (XEvent *) & ev);
}
}
@ -1823,7 +1822,7 @@ ECommsWaitForMessage(void)
while ((!msg) && (comms_win))
{
XIfEvent(dd, &ev, ev_check, NULL);
XIfEvent(disp, &ev, ev_check, NULL);
if (ev.type == DestroyNotify)
comms_win = 0;
else
@ -5368,7 +5367,7 @@ Epplet_dialog_ok(const char *fmt, ...)
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
if (!dd)
if (!disp)
{
printf("*** %s\n", buf);
return;