home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Shareware 1999 March
/
PCShareware-3-99.iso
/
IMPLE
/
DJGPP.RAR
/
DJGPP2
/
XLIB-SR0.ZIP
/
SRC
/
XLIBEMU
/
GRABKEYB.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-14
|
1KB
|
55 lines
/* $Id: grabkeyb.c 1.2 1994/01/15 02:19:34 ulrich Exp $ */
/*
* grabkeyb.c
*
* X library functions for keyboard grabbing.
*/
#include "Xlibemu.h"
int XGrabKeyboard(
Display* display,
Window grab_window,
Bool owner_events,
int pointer_mode,
int keyboard_mode,
Time time)
{
if (_KeyboardGrab.active &&
_KeyboardGrab.display != display)
return AlreadyGrabbed;
if (grab_window->viewable == 0)
return GrabNotViewable;
if (time != CurrentTime &&
(time < _KeyboardGrab.time || time > _WCurrentTime()))
return GrabInvalidTime;
_KeyboardGrab.active = 1;
_KeyboardGrab.display = display;
_KeyboardGrab.grab_window = grab_window;
_KeyboardGrab.owner_events = owner_events;
_KeyboardGrab.pointer_mode = pointer_mode;
_KeyboardGrab.keyboard_mode = keyboard_mode;
_KeyboardGrab.time = (time != CurrentTime) ? time : _WCurrentTime();
return GrabSuccess;
}
int XUngrabKeyboard(
Display* display,
Time time)
{
if (_KeyboardGrab.active &&
_KeyboardGrab.display == display)
{
if (time != CurrentTime &&
(time < _KeyboardGrab.time || time > _WCurrentTime()))
return 0;
_KeyboardGrab.active = 0;
return 1;
}
return 0;
}