Changeset 3372:92c4d8a5d8b7 in roaraudio
- Timestamp:
- 02/09/10 19:11:30 (14 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/roarx11.h
r3371 r3372 47 47 48 48 struct roar_x11_connection * roar_x11_connect(char * display); 49 int roar_x11_disconnect(struct roar_x11_connection * con);49 int roar_x11_disconnect(struct roar_x11_connection * con); 50 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); 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 char * roar_x11_get_prop(struct roar_x11_connection * con, const char * key); 53 54 54 55 #endif -
libroar/basic.c
r3077 r3372 2 2 3 3 /* 4 * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008 4 * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2010 5 5 * 6 6 * This file is part of libroar a part of RoarAudio, … … 49 49 struct stat decnet_stat; 50 50 #endif 51 #ifdef ROAR_HAVE_LIBX11 52 struct roar_x11_connection * x11con; 53 #endif 51 54 52 55 roar_errno = ROAR_ERROR_UNKNOWN; … … 60 63 if ( server == NULL && (roar_server = getenv("ROAR_SERVER")) != NULL ) 61 64 server = roar_server; 65 66 #ifdef ROAR_HAVE_LIBX11 67 if ( server == NULL ) { 68 if ( (x11con = roar_x11_connect(NULL)) != NULL ) { 69 server = roar_x11_get_prop(x11con, "ROAR_SERVER"); 70 roar_x11_disconnect(x11con); 71 } 72 } 73 #endif 62 74 63 75 #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER) -
libroar/roarx11.c
r3371 r3372 102 102 } 103 103 104 char * roar_x11_get_prop(struct roar_x11_connection * con, const char * key) { 105 unsigned long nitems; 106 unsigned long nbytes_after; 107 unsigned char * prop = NULL; 108 char * ret = NULL; 109 int actual_format; 110 Atom actual_type; 111 Atom a; 112 113 a = XInternAtom(con->display, key, False); 114 115 if ( XGetWindowProperty(con->display, RootWindow(con->display, 0), a, 116 0, 256, False, XA_STRING, &actual_type, 117 &actual_format, &nitems, &nbytes_after, &prop) != Success ) { 118 if ( prop != NULL ) 119 XFree(prop); 120 121 return NULL; 122 } 123 124 if ( prop == NULL ) 125 return NULL; 126 127 if (actual_type != XA_STRING) { 128 XFree(prop); 129 130 return NULL; 131 } 132 133 ret = roar_mm_malloc(nitems+1); 134 135 memcpy(ret, prop, nitems); 136 ret[nitems] = 0; 137 138 XFree(prop); 139 140 return ret; 141 } 142 104 143 //ll
Note: See TracChangeset
for help on using the changeset viewer.