mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 21:38:00 +01:00
*** empty log message ***
This commit is contained in:
@@ -19,29 +19,54 @@ extern WPreferences wPreferences;
|
||||
extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
|
||||
|
||||
void
|
||||
wSoundServerGrab(char *name, Window window)
|
||||
wSoundServerGrab(Window wm_win)
|
||||
{
|
||||
if(soundServer==None && name!=NULL && strcmp(name,"WMSoundServer")==0) {
|
||||
soundServer = window;
|
||||
Window *lstChildren;
|
||||
Window retRoot;
|
||||
Window retParent;
|
||||
int indexCount;
|
||||
u_int numChildren;
|
||||
XClassHint *retHint;
|
||||
|
||||
if (XQueryTree(dpy, wm_win, &retRoot, &retParent, &lstChildren, &numChildren)) {
|
||||
for (indexCount = 1; indexCount < numChildren; indexCount++) {
|
||||
retHint = XAllocClassHint();
|
||||
if (!retHint) {
|
||||
XFree(lstChildren);
|
||||
return;
|
||||
}
|
||||
|
||||
XGetClassHint (dpy, lstChildren[indexCount], retHint);
|
||||
if (retHint->res_class) {
|
||||
if (strcmp("WMSoundServer", retHint->res_class) == 0) {
|
||||
soundServer = lstChildren[indexCount];
|
||||
XFree(lstChildren);
|
||||
if(retHint) {
|
||||
XFree(retHint);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
XFree(retHint);
|
||||
retHint = 0;
|
||||
}
|
||||
XFree(lstChildren);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wSoundInit(Display *dpy)
|
||||
{
|
||||
soundServer = 0;
|
||||
sound_event.xclient.type = ClientMessage;
|
||||
sound_event.xclient.message_type = _XA_WINDOWMAKER_WM_FUNCTION;
|
||||
sound_event.xclient.format = 32;
|
||||
sound_event.xclient.display = dpy;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
wSoundPlay(long event_sound)
|
||||
{
|
||||
if (!soundServer) {
|
||||
wSoundServerGrab(DefaultRootWindow(dpy));
|
||||
}
|
||||
if(soundServer!=None && !wPreferences.no_sound) {
|
||||
sound_event.xclient.type = ClientMessage;
|
||||
sound_event.xclient.message_type = _XA_WINDOWMAKER_WM_FUNCTION;
|
||||
sound_event.xclient.format = 32;
|
||||
sound_event.xclient.display = dpy;
|
||||
sound_event.xclient.window = soundServer;
|
||||
sound_event.xclient.data.l[0] = event_sound;
|
||||
if (XSendEvent(dpy, soundServer, False,
|
||||
@@ -54,5 +79,4 @@ wSoundPlay(long event_sound)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* WMSOUND */
|
||||
|
||||
Reference in New Issue
Block a user