Changeset 3488:c1b4ef74afda in roaraudio for libroarpulse


Ignore:
Timestamp:
02/14/10 17:55:18 (10 years ago)
Author:
phi
Branch:
default
Message:

x11 prop functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarpulse/x11.c

    r3486 r3488  
    3939#include <libroarpulse/libroarpulse.h> 
    4040 
    41 void pa_x11_set_prop(Display *d, const char *name, const char *data); 
    42 void pa_x11_del_prop(Display *d, const char *name); 
    43 char* pa_x11_get_prop(Display *d, const char *name, char *p, size_t l); 
     41void pa_x11_set_prop(Display *d, const char *name, const char *data) { 
     42 struct roar_x11_connection * x11con = roar_x11_connect_display(d); 
     43 
     44 if ( x11con == NULL ) 
     45  return; 
     46 
     47 roar_x11_set_prop(x11con, name, data); 
     48 
     49 roar_x11_disconnect(x11con); 
     50} 
     51 
     52void pa_x11_del_prop(Display *d, const char *name) { 
     53 struct roar_x11_connection * x11con = roar_x11_connect_display(d); 
     54 
     55 if ( x11con == NULL ) 
     56  return; 
     57 
     58 roar_x11_delete_prop(x11con, name); 
     59 
     60 roar_x11_disconnect(x11con); 
     61} 
     62 
     63char* pa_x11_get_prop(Display *d, const char *name, char *p, size_t l) { 
     64 struct roar_x11_connection * x11con = roar_x11_connect_display(d); 
     65 char * val; 
     66 size_t len; 
     67 
     68 if ( x11con == NULL ) 
     69  return NULL; 
     70 
     71 val = roar_x11_get_prop(x11con, name); 
     72 
     73 roar_x11_disconnect(x11con); 
     74 
     75 if ( val == NULL ) 
     76  return NULL; 
     77 
     78 len = strlen(val); 
     79 
     80 if ( (l - 1) < len ) 
     81  len = l - 1; 
     82 
     83 memcpy(p, val, len); 
     84 p[len] = 0; 
     85 
     86 return p; 
     87} 
    4488 
    4589//ll 
Note: See TracChangeset for help on using the changeset viewer.