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