8 #include <X11/Xproto.h>
10 #include "WindowMaker.h"
18 extern WPreferences wPreferences
;
19 extern Atom _XA_WINDOWMAKER_WM_FUNCTION
;
22 wSoundServerGrab(Window wm_win
)
31 if (XQueryTree(dpy
, wm_win
, &retRoot
, &retParent
, &lstChildren
, &numChildren
)) {
32 for (indexCount
= 1; indexCount
< numChildren
; indexCount
++) {
33 retHint
= XAllocClassHint();
39 XGetClassHint (dpy
, lstChildren
[indexCount
], retHint
);
40 if (retHint
->res_class
) {
41 if (strcmp("WMSoundServer", retHint
->res_class
) == 0) {
42 soundServer
= lstChildren
[indexCount
];
60 wSoundPlay(long event_sound
)
63 wSoundServerGrab(DefaultRootWindow(dpy
));
65 if(soundServer
!=None
&& !wPreferences
.no_sound
) {
66 sound_event
.xclient
.type
= ClientMessage
;
67 sound_event
.xclient
.message_type
= _XA_WINDOWMAKER_WM_FUNCTION
;
68 sound_event
.xclient
.format
= 32;
69 sound_event
.xclient
.display
= dpy
;
70 sound_event
.xclient
.window
= soundServer
;
71 sound_event
.xclient
.data
.l
[0] = event_sound
;
72 if (XSendEvent(dpy
, soundServer
, False
,
73 NoEventMask
, &sound_event
)==BadWindow
) {