Made it possible to switch the text format in one place
authorSam Lantinga <slouken@libsdl.org>
Mon, 12 Jul 2010 00:49:26 -0700
changeset 45098e91c3947210
parent 4508 15d2c6f40c48
child 4510 6f8175ad0335
Made it possible to switch the text format in one place
src/video/x11/SDL_x11clipboard.c
     1.1 --- a/src/video/x11/SDL_x11clipboard.c	Mon Jul 12 00:36:55 2010 -0700
     1.2 +++ b/src/video/x11/SDL_x11clipboard.c	Mon Jul 12 00:49:26 2010 -0700
     1.3 @@ -27,6 +27,13 @@
     1.4  #include "SDL_x11video.h"
     1.5  
     1.6  
     1.7 +/* If you don't support UTF-8, you might use XA_STRING here */
     1.8 +#if 1
     1.9 +#define TEXT_FORMAT XInternAtom(display, "UTF8_STRING", False)
    1.10 +#else
    1.11 +#define TEXT_FORMAT XA_STRING
    1.12 +#endif
    1.13 +
    1.14  /* Get any application owned window handle for clipboard association */
    1.15  static Window
    1.16  GetWindow(_THIS)
    1.17 @@ -58,8 +65,8 @@
    1.18          return -1;
    1.19      }
    1.20  
    1.21 -    /* If you don't support UTF-8, you might use XA_STRING here */
    1.22 -    format = XInternAtom(display, "UTF8_STRING", False);
    1.23 +    /* Save the selection on the root window */
    1.24 +    format = TEXT_FORMAT;
    1.25      XChangeProperty(display, DefaultRootWindow(display),
    1.26          XA_CUT_BUFFER0, format, 8, PropModeReplace,
    1.27          (const unsigned char *)text, SDL_strlen(text));
    1.28 @@ -88,12 +95,9 @@
    1.29  
    1.30      text = NULL;
    1.31  
    1.32 -    /* Get the SDL window that will own the selection */
    1.33 +    /* Get the window that holds the selection */
    1.34      window = GetWindow(_this);
    1.35 -
    1.36 -    /* If you don't support UTF-8, you might use XA_STRING here */
    1.37 -    format = XInternAtom(display, "UTF8_STRING", False);
    1.38 -
    1.39 +    format = TEXT_FORMAT;
    1.40      owner = XGetSelectionOwner(display, XA_PRIMARY);
    1.41      if ((owner == None) || (owner == window)) {
    1.42          owner = DefaultRootWindow(display);