Files
wmaker/src/wmsound.c
T

90 lines
2.1 KiB
C
Raw Normal View History

1998-09-29 22:36:29 +00:00
#include "wconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xproto.h>
#include "WindowMaker.h"
2000-01-18 17:11:51 +00:00
#include "funcs.h"
1998-09-29 22:36:29 +00:00
#include "wmsound.h"
#ifdef WMSOUND
2000-01-18 17:11:51 +00:00
1998-09-29 22:36:29 +00:00
extern WPreferences wPreferences;
2000-01-18 17:11:51 +00:00
#if 0
1998-09-29 22:36:29 +00:00
void
1999-04-10 19:32:34 +00:00
wSoundServerGrab(Window wm_win)
1998-09-29 22:36:29 +00:00
{
1999-04-10 19:32:34 +00:00
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);
2000-01-17 03:07:18 +00:00
if (retHint->res_class) {
if (strcmp("WMSoundServer", retHint->res_class)==0 ||
/*strcmp("WSoundServer", retHint->res_class)==0 ||*/
(retHint->res_name &&
strcmp("wsoundserver", retHint->res_name)==0 &&
strcmp("DockApp", retHint->res_class)==0)) {
soundServer = lstChildren[indexCount];
XFree(lstChildren);
if(retHint) {
XFree(retHint);
}
return;
}
1999-04-10 19:32:34 +00:00
}
XFree(retHint);
retHint = 0;
}
XFree(lstChildren);
1998-09-29 22:36:29 +00:00
}
1999-04-10 19:32:34 +00:00
return;
1998-09-29 22:36:29 +00:00
}
2000-01-18 17:11:51 +00:00
#endif
1998-09-29 22:36:29 +00:00
void
wSoundPlay(long event_sound)
{
2000-01-18 17:11:51 +00:00
static Atom atom = 0;
XEvent sound_event;
if (!atom) {
atom = XInternAtom(dpy, "_WINDOWMAKER_EVENT", False);
1999-04-10 19:32:34 +00:00
}
2000-01-18 17:11:51 +00:00
if(!wPreferences.no_sound) {
Window win = wScreenWithNumber(0)->info_window;
1999-04-10 19:32:34 +00:00
sound_event.xclient.type = ClientMessage;
2000-01-18 17:11:51 +00:00
sound_event.xclient.message_type = atom;
1999-04-10 19:32:34 +00:00
sound_event.xclient.format = 32;
sound_event.xclient.display = dpy;
2000-01-18 17:11:51 +00:00
sound_event.xclient.window = win;
1998-09-29 22:36:29 +00:00
sound_event.xclient.data.l[0] = event_sound;
2000-01-18 17:11:51 +00:00
XSendEvent(dpy, win, False, StructureNotifyMask, &sound_event);
XFlush(dpy);
1998-09-29 22:36:29 +00:00
}
}
#endif /* WMSOUND */