From 3725c23fddd8e936a91296f74e3fd6342270d6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Wed, 6 Feb 2013 19:28:33 +0100 Subject: make TEXT atoms global variables * (events.c) extract xa_compound_text from selection_request(), make it a global * introduce xa_string (same as XA_STRING) and rename utf8_string to xa_utf8_string, for consistency --- src/globals.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/globals.c') diff --git a/src/globals.c b/src/globals.c index 3029aef..8824484 100644 --- a/src/globals.c +++ b/src/globals.c @@ -47,13 +47,17 @@ Atom rp_command_request; Atom rp_command_result; Atom rp_selection; +/* TEXT atoms */ +Atom xa_string; +Atom xa_compound_text; +Atom xa_utf8_string; + /* netwm atoms */ Atom _net_wm_pid; Atom _net_supported; Atom _net_wm_window_type; Atom _net_wm_window_type_dialog; Atom _net_wm_name; -Atom utf8_string; int rp_current_screen; rp_screen *screens; @@ -94,7 +98,7 @@ x_export_selection (void) XSetSelectionOwner(dpy, XA_PRIMARY, screens[0].key_window, CurrentTime); if (XGetSelectionOwner(dpy, XA_PRIMARY) != screens[0].key_window) PRINT_ERROR(("can't get primary selection")); - XChangeProperty(dpy, screens[0].root, XA_CUT_BUFFER0, XA_STRING, 8, + XChangeProperty(dpy, screens[0].root, XA_CUT_BUFFER0, xa_string, 8, PropModeReplace, (unsigned char*)selection.text, selection.len); } @@ -196,7 +200,7 @@ get_selection (void) /* be a good icccm citizen */ XDeleteProperty (dpy, s->input_window, rp_selection); /* TODO: we shouldn't use CurrentTime here, use the time of the XKeyEvent, should we fake it? */ - XConvertSelection (dpy, XA_PRIMARY, XA_STRING, rp_selection, s->input_window, CurrentTime); + XConvertSelection (dpy, XA_PRIMARY, xa_string, rp_selection, s->input_window, CurrentTime); /* This seems like a hack. */ while (!XCheckTypedWindowEvent (dpy, s->input_window, SelectionNotify, &ev)) -- cgit v1.2.3