Changeset 3371:dbd3f8c59d29 in roaraudio for libroar/roarx11.c
- Timestamp:
- 02/08/10 23:10:43 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/roarx11.c
r3370 r3371 35 35 #include "libroar.h" 36 36 37 struct roar_x11_connection * roar_x11_connect(char * display) { 38 #ifdef ROAR_HAVE_LIBX11 39 struct roar_x11_connection * con; 40 41 if ( (con = roar_mm_malloc(sizeof(struct roar_x11_connection))) == NULL ) 42 return NULL; 43 44 if ( (con->display = XOpenDisplay(display)) == NULL ) { 45 roar_mm_free(con); 46 return NULL; 47 } 48 49 return con; 50 #else 51 return NULL; 52 #endif 53 } 54 55 int roar_x11_disconnect(struct roar_x11_connection * con) { 56 #ifdef ROAR_HAVE_LIBX11 57 int ret; 58 59 if ( con == NULL ) 60 return -1; 61 62 ret = XCloseDisplay(con->display); 63 64 roar_mm_free(con); 65 66 return ret; 67 #else 68 return -1; 69 #endif 70 } 71 72 int roar_x11_set_prop(struct roar_x11_connection * con, const char * key, const char * val) { 73 #ifdef ROAR_HAVE_LIBX11 74 Atom a; 75 76 if ( con == NULL ) 77 return -1; 78 79 a = XInternAtom(con->display, key, False); 80 81 XChangeProperty(con->display, RootWindow(con->display, 0), a, XA_STRING, 8, PropModeReplace, (const unsigned char*) val, strlen(val)+1); 82 83 return 0; 84 #else 85 return -1; 86 #endif 87 } 88 89 int roar_x11_delete_prop(struct roar_x11_connection * con, const char * key) { 90 #ifdef ROAR_HAVE_LIBX11 91 Atom a; 92 if ( con == NULL ) 93 return -1; 94 95 a = XInternAtom(con->display, key, False); 96 XDeleteProperty(con->display, RootWindow(con->display, 0), a); 97 98 return 0; 99 #else 100 return -1; 101 #endif 102 } 103 37 104 //ll
Note: See TracChangeset
for help on using the changeset viewer.