Compare commits
3 Commits
31ae400852
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
7566f9af82
|
|||
|
7425355d01
|
|||
|
d8f785eae5
|
@@ -86,24 +86,30 @@ xdg_xsettings_update (struct xdg_xsettings *self, Display *dpy)
|
|||||||
// TODO: We're supposed to lock the server.
|
// TODO: We're supposed to lock the server.
|
||||||
// TODO: We're supposed to trap X errors.
|
// TODO: We're supposed to trap X errors.
|
||||||
char *selection = xstrdup_printf ("_XSETTINGS_S%d", DefaultScreen (dpy));
|
char *selection = xstrdup_printf ("_XSETTINGS_S%d", DefaultScreen (dpy));
|
||||||
Window owner
|
Atom selection_atom = XInternAtom (dpy, selection, True);
|
||||||
= XGetSelectionOwner (dpy, XInternAtom (dpy, selection, True));
|
|
||||||
free (selection);
|
free (selection);
|
||||||
|
if (!selection_atom)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Window owner = XGetSelectionOwner (dpy, selection_atom);
|
||||||
if (!owner)
|
if (!owner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Atom xsettings_atom = XInternAtom (dpy, "_XSETTINGS_SETTINGS", True);
|
||||||
|
if (!xsettings_atom)
|
||||||
|
return;
|
||||||
|
|
||||||
Atom actual_type = None;
|
Atom actual_type = None;
|
||||||
int actual_format = 0;
|
int actual_format = 0;
|
||||||
unsigned long nitems = 0, bytes_after = 0;
|
unsigned long nitems = 0, bytes_after = 0;
|
||||||
unsigned char *buffer = NULL;
|
unsigned char *buffer = NULL;
|
||||||
Atom xsettings = XInternAtom (dpy, "_XSETTINGS_SETTINGS", True);
|
|
||||||
int status = XGetWindowProperty (dpy,
|
int status = XGetWindowProperty (dpy,
|
||||||
owner,
|
owner,
|
||||||
xsettings,
|
xsettings_atom,
|
||||||
0L,
|
0L,
|
||||||
LONG_MAX,
|
LONG_MAX,
|
||||||
False,
|
False,
|
||||||
xsettings,
|
xsettings_atom,
|
||||||
&actual_type,
|
&actual_type,
|
||||||
&actual_format,
|
&actual_format,
|
||||||
&nitems,
|
&nitems,
|
||||||
@@ -112,7 +118,7 @@ xdg_xsettings_update (struct xdg_xsettings *self, Display *dpy)
|
|||||||
if (status != Success || !buffer)
|
if (status != Success || !buffer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (actual_type != xsettings
|
if (actual_type != xsettings_atom
|
||||||
|| actual_format != 8
|
|| actual_format != 8
|
||||||
|| nitems < 12)
|
|| nitems < 12)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|||||||
@@ -1884,6 +1884,8 @@ x11_init (struct poller *poller, struct attrs *app_attrs, size_t app_attrs_len)
|
|||||||
if (!(g_xui.dpy = XkbOpenDisplay
|
if (!(g_xui.dpy = XkbOpenDisplay
|
||||||
(NULL, &g_xui.xkb_base_event_code, NULL, NULL, NULL, NULL)))
|
(NULL, &g_xui.xkb_base_event_code, NULL, NULL, NULL, NULL)))
|
||||||
exit_fatal ("cannot open display");
|
exit_fatal ("cannot open display");
|
||||||
|
if (!XftInit (NULL))
|
||||||
|
print_warning ("Fontconfig initialization failed");
|
||||||
if (!XftDefaultHasRender (g_xui.dpy))
|
if (!XftDefaultHasRender (g_xui.dpy))
|
||||||
exit_fatal ("XRender is not supported");
|
exit_fatal ("XRender is not supported");
|
||||||
if (!(g_xui.x11_im = XOpenIM (g_xui.dpy, NULL, NULL, NULL)))
|
if (!(g_xui.x11_im = XOpenIM (g_xui.dpy, NULL, NULL, NULL)))
|
||||||
@@ -1912,8 +1914,6 @@ x11_init (struct poller *poller, struct attrs *app_attrs, size_t app_attrs_len)
|
|||||||
g_xui.x11_xsettings = xdg_xsettings_make ();
|
g_xui.x11_xsettings = xdg_xsettings_make ();
|
||||||
xdg_xsettings_update (&g_xui.x11_xsettings, g_xui.dpy);
|
xdg_xsettings_update (&g_xui.x11_xsettings, g_xui.dpy);
|
||||||
|
|
||||||
if (!FcInit ())
|
|
||||||
print_warning ("Fontconfig initialization failed");
|
|
||||||
if (!(g_xui.xft_fonts = x11_font_open (0)))
|
if (!(g_xui.xft_fonts = x11_font_open (0)))
|
||||||
exit_fatal ("cannot open a font");
|
exit_fatal ("cannot open a font");
|
||||||
|
|
||||||
|
|||||||
@@ -1209,7 +1209,10 @@ async_make (struct async_manager *manager)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Only allowed from the main thread once the job has been started but before
|
/// Only allowed from the main thread once the job has been started but before
|
||||||
/// the results have been dispatched
|
/// the results have been dispatched.
|
||||||
|
///
|
||||||
|
/// Note that it may in practice lead to memory leakage, although that's
|
||||||
|
/// an implementation issue: https://eissing.org/icing/posts/rip_pthread_cancel/
|
||||||
static void
|
static void
|
||||||
async_cancel (struct async *self)
|
async_cancel (struct async *self)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user