[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/6] xsettings: prefetch atoms
From: |
Julien Danjou |
Subject: |
[PATCH 6/6] xsettings: prefetch atoms |
Date: |
Wed, 10 Nov 2010 14:49:56 +0100 |
Signed-off-by: Julien Danjou <address@hidden>
---
src/ChangeLog | 4 ++++
src/xsettings.c | 8 --------
src/xterm.c | 25 ++++++++++++++++++++-----
3 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 3975d8b..2b7acb5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
2010-11-10 Julien Danjou <address@hidden>
+ * xterm.c (x_term_init): Fetch XSETTINGS atoms.
+
+ * xsettings.c (init_xsettings): Use already fetch atoms.
+
* xterm.h (x_display_info): Add SM_CLIENT_ID atom.
* xsmfns.c (create_client_leader_window): Use SM_CLIENT_ID atom
diff --git a/src/xsettings.c b/src/xsettings.c
index 0d9c9ca..b3f3cb6 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -656,18 +656,10 @@ init_gconf (void)
static void
init_xsettings (struct x_display_info *dpyinfo)
{
- char sel[64];
Display *dpy = dpyinfo->display;
BLOCK_INPUT;
- sprintf (sel, "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen));
- dpyinfo->Xatom_xsettings_sel = XInternAtom (dpy, sel, False);
- dpyinfo->Xatom_xsettings_prop = XInternAtom (dpy,
- "_XSETTINGS_SETTINGS",
- False);
- dpyinfo->Xatom_xsettings_mgr = XInternAtom (dpy, "MANAGER", False);
-
/* Select events so we can detect client messages sent when selection
owner changes. */
XSelectInput (dpy, dpyinfo->root_window, StructureNotifyMask);
diff --git a/src/xterm.c b/src/xterm.c
index e8a7d07..1900881 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10249,22 +10249,37 @@ x_term_init (Lisp_Object display_name, char
*xrm_option, char *resource_name)
"_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supported,
"_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity,
"_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window,
- "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID
+ "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID,
+ "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop,
+ "MANAGER", &dpyinfo->Xatom_xsettings_mgr
};
int i;
- const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]);
- Atom *atoms_return = xmalloc (sizeof (Atom) * atom_count);
- char **atom_names = xmalloc (sizeof (char *) * atom_count);
+ const int atom_count = (sizeof (atom_refs) / sizeof (atom_refs[0]));
+ /* 1 for _XSETTINGS_SN */
+ const int total_atom_count = 1 + atom_count;
+ Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count);
+ char **atom_names = xmalloc (sizeof (char *) * total_atom_count);
+ char xsettings_atom_name[64];
for (i = 0; i < atom_count; i++)
atom_names[i] = (char *) atom_refs[i].name;
- XInternAtoms (dpyinfo->display, atom_names, atom_count, False,
atoms_return);
+ /* Build _XSETTINGS_SN atom name */
+ snprintf (xsettings_atom_name, sizeof (xsettings_atom_name),
+ "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen));
+ atom_names[i] = xsettings_atom_name;
+ /* Fetch atoms */
+ XInternAtoms (dpyinfo->display, atom_names, total_atom_count, False,
atoms_return);
+
+ /* Copy atoms back */
for (i = 0; i < atom_count; i++)
*atom_refs[i].atom = atoms_return[i];
+ /* Manual copy of last atoms */
+ dpyinfo->Xatom_xsettings_sel = atoms_return[i];
+
xfree (atom_names);
xfree (atoms_return);
}
--
1.7.2.3
- X atoms rework, Julien Danjou, 2010/11/10
- [PATCH 5/6] xsmfns: use pre-fetch SM_CLIENT_ID, Julien Danjou, 2010/11/10
- [PATCH 3/6] xterm: use atoms in set_wm_state, Julien Danjou, 2010/11/10
- [PATCH 6/6] xsettings: prefetch atoms,
Julien Danjou <=
- [PATCH 4/6] xterm: get all atoms in one round-trip, Julien Danjou, 2010/11/10
- [PATCH 2/6] xselect: split x_send_client_event to use Atom directly, Julien Danjou, 2010/11/10
- [PATCH 1/6] xterm: store atoms in dpyinfo, Julien Danjou, 2010/11/10
- Re: X atoms rework, Jan Djärv, 2010/11/10
- Re: X atoms rework, Jan D., 2010/11/11
- Re: X atoms rework, Jan Djärv, 2010/11/12