1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

changed sound server code

This commit is contained in:
kojima
2000-01-18 17:11:51 +00:00
parent 0d1935e3d8
commit ec5f3a294e

View File

@@ -8,16 +8,16 @@
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include "WindowMaker.h" #include "WindowMaker.h"
#include "funcs.h"
#include "wmsound.h" #include "wmsound.h"
#ifdef WMSOUND #ifdef WMSOUND
Window soundServer;
XEvent sound_event;
extern WPreferences wPreferences; extern WPreferences wPreferences;
extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
#if 0
void void
wSoundServerGrab(Window wm_win) wSoundServerGrab(Window wm_win)
{ {
@@ -60,28 +60,29 @@ wSoundServerGrab(Window wm_win)
} }
return; return;
} }
#endif
void void
wSoundPlay(long event_sound) wSoundPlay(long event_sound)
{ {
if (!soundServer) { static Atom atom = 0;
wSoundServerGrab(DefaultRootWindow(dpy)); XEvent sound_event;
if (!atom) {
atom = XInternAtom(dpy, "_WINDOWMAKER_EVENT", False);
} }
if(soundServer!=None && !wPreferences.no_sound) {
if(!wPreferences.no_sound) {
Window win = wScreenWithNumber(0)->info_window;
sound_event.xclient.type = ClientMessage; sound_event.xclient.type = ClientMessage;
sound_event.xclient.message_type = _XA_WINDOWMAKER_WM_FUNCTION; sound_event.xclient.message_type = atom;
sound_event.xclient.format = 32; sound_event.xclient.format = 32;
sound_event.xclient.display = dpy; sound_event.xclient.display = dpy;
sound_event.xclient.window = soundServer; sound_event.xclient.window = win;
sound_event.xclient.data.l[0] = event_sound; sound_event.xclient.data.l[0] = event_sound;
if (XSendEvent(dpy, soundServer, False, XSendEvent(dpy, win, False, StructureNotifyMask, &sound_event);
NoEventMask, &sound_event)==BadWindow) { XFlush(dpy);
soundServer = None;
return;
} else {
XFlush(dpy);
}
} }
} }