2003-03-10 21:47:38 -05:00
|
|
|
/* Copyright 2001-2003 by Norbert Freudemann, David Frese */
|
|
|
|
|
2001-05-08 10:21:00 -04:00
|
|
|
#include "xlib.h"
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
#define scx_extract_grab_mode(x) S48_EXTRACT_ENUM(x, "scx-grab-mode")
|
|
|
|
#define scx_enter_grab_status(x) S48_ENTER_ENUM(x, "scx-grab-states")
|
|
|
|
|
|
|
|
s48_value scx_Grab_Pointer(s48_value dpy, s48_value win,
|
|
|
|
s48_value ownerp, s48_value events,
|
|
|
|
s48_value pmode, s48_value kmode,
|
|
|
|
s48_value confine_to, s48_value cursor,
|
|
|
|
s48_value time) {
|
|
|
|
int res = XGrabPointer(scx_extract_display(dpy),
|
|
|
|
scx_extract_window(win),
|
2001-08-22 08:09:56 -04:00
|
|
|
S48_EXTRACT_BOOLEAN(ownerp),
|
2003-03-10 21:47:38 -05:00
|
|
|
scx_extract_event_mask(events),
|
|
|
|
scx_extract_grab_mode(pmode),
|
|
|
|
scx_extract_grab_mode(kmode),
|
|
|
|
scx_extract_window(confine_to),
|
|
|
|
scx_extract_cursor(cursor),
|
|
|
|
scx_extract_time(time));
|
|
|
|
return scx_enter_grab_status(res);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Ungrab_Pointer(s48_value dpy, s48_value time) {
|
|
|
|
XUngrabPointer(scx_extract_display(dpy), scx_extract_time(time));
|
2001-08-22 08:09:56 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Change_Active_Pointer_Grab(s48_value dpy, s48_value events,
|
|
|
|
s48_value cursor, s48_value time){
|
|
|
|
XChangeActivePointerGrab(scx_extract_display(dpy),
|
|
|
|
scx_extract_event_mask(events),
|
|
|
|
scx_extract_cursor(cursor),
|
|
|
|
scx_extract_time(time));
|
2001-08-22 08:09:56 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Grab_Button(s48_value dpy, s48_value button, s48_value mods,
|
|
|
|
s48_value win, s48_value ownerp, s48_value events,
|
|
|
|
s48_value pmode, s48_value kmode,
|
|
|
|
s48_value confine_to, s48_value cursor) {
|
|
|
|
XGrabButton(scx_extract_display(dpy),
|
|
|
|
scx_extract_button(button),
|
|
|
|
scx_extract_state_set(mods),
|
|
|
|
scx_extract_window(win),
|
|
|
|
S48_EXTRACT_BOOLEAN(ownerp),
|
|
|
|
scx_extract_event_mask(events),
|
|
|
|
scx_extract_grab_mode(pmode),
|
|
|
|
scx_extract_grab_mode(kmode),
|
|
|
|
scx_extract_window(confine_to),
|
|
|
|
scx_extract_cursor(cursor));
|
2002-02-08 12:09:43 -05:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Ungrab_Button(s48_value dpy, s48_value button,
|
|
|
|
s48_value mods, s48_value win) {
|
|
|
|
XUngrabButton(scx_extract_display(dpy),
|
|
|
|
scx_extract_button(button),
|
|
|
|
scx_extract_state_set(mods),
|
|
|
|
scx_extract_window(win));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Grab_Keyboard(s48_value dpy, s48_value win, s48_value ownerp,
|
|
|
|
s48_value pmode, s48_value kmode,
|
|
|
|
s48_value time) {
|
|
|
|
int res = XGrabKeyboard( scx_extract_display(dpy),
|
|
|
|
scx_extract_window(win),
|
2001-08-22 08:09:56 -04:00
|
|
|
S48_EXTRACT_BOOLEAN(ownerp),
|
2003-03-10 21:47:38 -05:00
|
|
|
scx_extract_grab_mode(pmode),
|
|
|
|
scx_extract_grab_mode(kmode),
|
|
|
|
scx_extract_time(time));
|
|
|
|
return scx_enter_grab_status(res);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Ungrab_Keyboard(s48_value dpy, s48_value time){
|
|
|
|
XUngrabKeyboard(scx_extract_display(dpy),
|
|
|
|
scx_extract_time(time));
|
2001-08-22 08:09:56 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Grab_Key(s48_value dpy, s48_value key, s48_value mods,
|
|
|
|
s48_value win, s48_value ownerp, s48_value pmode,
|
|
|
|
s48_value kmode) {
|
|
|
|
XGrabKey(scx_extract_display(dpy),
|
|
|
|
s48_extract_integer(key),
|
|
|
|
scx_extract_state_set(mods),
|
|
|
|
scx_extract_window(win),
|
|
|
|
S48_EXTRACT_BOOLEAN(ownerp),
|
|
|
|
scx_extract_grab_mode(pmode),
|
|
|
|
scx_extract_grab_mode(kmode));
|
2001-08-22 08:09:56 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Ungrab_Key(s48_value dpy, s48_value key, s48_value mods,
|
|
|
|
s48_value win) {
|
|
|
|
XUngrabKey(scx_extract_display(dpy),
|
|
|
|
s48_extract_integer(key),
|
|
|
|
scx_extract_state_set(mods),
|
|
|
|
scx_extract_window(win));
|
2001-08-22 08:09:56 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
#define scx_extract_event_mode(x) S48_EXTRACT_ENUM(x, "scx-event-mode")
|
2001-08-22 08:09:56 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Allow_Events(s48_value dpy, s48_value event_mode,
|
|
|
|
s48_value time) {
|
|
|
|
XAllowEvents(scx_extract_display(dpy),
|
|
|
|
scx_extract_event_mode(event_mode),
|
|
|
|
scx_extract_time(time));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Grab_Server(s48_value dpy) {
|
|
|
|
XGrabServer(scx_extract_display(dpy));
|
2001-08-22 08:09:56 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
s48_value scx_Ungrab_Server(s48_value dpy){
|
|
|
|
XUngrabServer(scx_extract_display(dpy));
|
2001-08-22 08:09:56 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
void scx_init_grab(void) {
|
|
|
|
S48_EXPORT_FUNCTION(scx_Grab_Pointer);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Ungrab_Pointer);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Grab_Button);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Ungrab_Button);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Change_Active_Pointer_Grab);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Grab_Keyboard);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Ungrab_Keyboard);
|
2001-08-29 10:54:05 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Grab_Key);
|
2001-08-22 08:09:56 -04:00
|
|
|
S48_EXPORT_FUNCTION(scx_Ungrab_Key);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Allow_Events);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Grab_Server);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Ungrab_Server);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
2001-08-22 08:09:56 -04:00
|
|
|
|