source: roaraudio/libroarpulse/x11.c @ 3496:474e67abcc4e

Last change on this file since 3496:474e67abcc4e was 3491:babffbc52d06, checked in by phi, 14 years ago

use void as Display on non X11 systems

File size: 2.6 KB
Line 
1//x11.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
5 *  The code (may) include prototypes and comments (and maybe
6 *  other code fragements) from libpulse*. They are mostly copyrighted by:
7 *  Lennart Poettering <poettering@users.sourceforge.net> and
8 *  Pierre Ossman <drzeus@drzeus.cx>
9 *
10 *  This file is part of libroarpulse a part of RoarAudio,
11 *  a cross-platform sound system for both, home and professional use.
12 *  See README for details.
13 *
14 *  This file is free software; you can redistribute it and/or modify
15 *  it under the terms of the GNU General Public License version 3
16 *  as published by the Free Software Foundation.
17 *
18 *  RoarAudio is distributed in the hope that it will be useful,
19 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 *  GNU General Public License for more details.
22 *
23 *  You should have received a copy of the GNU General Public License
24 *  along with this software; see the file COPYING.  If not, write to
25 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 *  NOTE for everyone want's to change something and send patches:
28 *  read README and HACKING! There a addition information on
29 *  the license of this document you need to read before you send
30 *  any patches.
31 *
32 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
33 *  or libpulse*:
34 *  The libs libroaresd, libroararts and libroarpulse link this libroar
35 *  and are therefore GPL. Because of this it may be illigal to use
36 *  them with any software that uses libesd, libartsc or libpulse*.
37 */
38
39#include <libroarpulse/libroarpulse.h>
40
41#ifndef ROAR_HAVE_LIBX11
42typedef void Display;
43#endif
44
45void pa_x11_set_prop(Display *d, const char *name, const char *data) {
46 struct roar_x11_connection * x11con = roar_x11_connect_display(d);
47
48 if ( x11con == NULL )
49  return;
50
51 roar_x11_set_prop(x11con, name, data);
52
53 roar_x11_disconnect(x11con);
54}
55
56void pa_x11_del_prop(Display *d, const char *name) {
57 struct roar_x11_connection * x11con = roar_x11_connect_display(d);
58
59 if ( x11con == NULL )
60  return;
61
62 roar_x11_delete_prop(x11con, name);
63
64 roar_x11_disconnect(x11con);
65}
66
67char* pa_x11_get_prop(Display *d, const char *name, char *p, size_t l) {
68 struct roar_x11_connection * x11con = roar_x11_connect_display(d);
69 char * val;
70 size_t len;
71
72 if ( x11con == NULL )
73  return NULL;
74
75 val = roar_x11_get_prop(x11con, name);
76
77 roar_x11_disconnect(x11con);
78
79 if ( val == NULL )
80  return NULL;
81
82 len = strlen(val);
83
84 if ( (l - 1) < len )
85  len = l - 1;
86
87 memcpy(p, val, len);
88 p[len] = 0;
89
90 return p;
91}
92
93//ll
Note: See TracBrowser for help on using the repository browser.