Changeset 3371:dbd3f8c59d29 in roaraudio
- Timestamp:
- 02/08/10 23:10:43 (14 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/libroar.h
r3370 r3371 94 94 #endif 95 95 96 #ifdef ROAR_HAVE_LIBX11 97 #include <X11/Xlib.h> 98 #include <X11/Xatom.h> 99 #endif 100 96 101 #include "error.h" 97 102 #include "config.h" -
include/libroar/roarx11.h
r3370 r3371 38 38 #include "libroar.h" 39 39 40 struct roar_x11_connection { 41 #ifdef ROAR_HAVE_LIBX11 42 Display * display; 43 #else 44 char dummy[8]; 45 #endif 46 }; 47 48 struct roar_x11_connection * roar_x11_connect(char * display); 49 int roar_x11_disconnect(struct roar_x11_connection * con); 50 51 int roar_x11_set_prop(struct roar_x11_connection * con, const char * key, const char * val); 52 int roar_x11_delete_prop(struct roar_x11_connection * con, const char * key); 53 40 54 #endif 41 55 -
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.