123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #include <X11/Xlib.h>
- extern int _DtGetLock( Display *display, char *lock_name) ;
- extern void _DtReleaseLock( Display *display, char *lock_name) ;
- extern int _DtTestLock( Display *display, char *lock_name) ;
- int
- _DtGetLock(
- Display *display,
- char *lock_name )
- {
- Atom lock_atom;
- Window selection_owner;
- Window root_window;
-
-
- lock_atom = XInternAtom (display, lock_name, False);
- root_window = DefaultRootWindow (display);
-
- XGrabServer (display);
- if ((selection_owner = XGetSelectionOwner (display, lock_atom)) == None)
- XSetSelectionOwner (display, lock_atom, root_window, CurrentTime);
- XUngrabServer (display);
- XFlush (display);
-
-
- if (selection_owner == None)
- return (1);
- else
- return (0);
- }
- void
- _DtReleaseLock(
- Display *display,
- char *lock_name )
- {
- Atom lock_atom;
-
- lock_atom = XInternAtom (display, lock_name, False);
- XSetSelectionOwner (display, lock_atom, None, CurrentTime);
- XFlush (display);
- }
- int
- _DtTestLock(
- Display *display,
- char *lock_name )
- {
- Atom lock_atom;
-
- lock_atom = XInternAtom (display, lock_name, False);
-
- if (XGetSelectionOwner (display, lock_atom) == None)
- return (0);
- else
- return (1);
- }
-
|