140 lines
4.3 KiB
C
140 lines
4.3 KiB
C
/* Copyright 2001-2003 by Norbert Freudemann, David Frese */
|
|
|
|
#include "xlib.h"
|
|
|
|
#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),
|
|
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),
|
|
scx_extract_time(time));
|
|
return scx_enter_grab_status(res);
|
|
}
|
|
|
|
s48_value scx_Ungrab_Pointer(s48_value dpy, s48_value time) {
|
|
XUngrabPointer(scx_extract_display(dpy), scx_extract_time(time));
|
|
return S48_UNSPECIFIC;
|
|
}
|
|
|
|
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));
|
|
return S48_UNSPECIFIC;
|
|
}
|
|
|
|
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));
|
|
return S48_UNSPECIFIC;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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),
|
|
S48_EXTRACT_BOOLEAN(ownerp),
|
|
scx_extract_grab_mode(pmode),
|
|
scx_extract_grab_mode(kmode),
|
|
scx_extract_time(time));
|
|
return scx_enter_grab_status(res);
|
|
}
|
|
|
|
s48_value scx_Ungrab_Keyboard(s48_value dpy, s48_value time){
|
|
XUngrabKeyboard(scx_extract_display(dpy),
|
|
scx_extract_time(time));
|
|
return S48_UNSPECIFIC;
|
|
}
|
|
|
|
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));
|
|
return S48_UNSPECIFIC;
|
|
}
|
|
|
|
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));
|
|
return S48_UNSPECIFIC;
|
|
}
|
|
|
|
#define scx_extract_event_mode(x) S48_EXTRACT_ENUM(x, "scx-event-mode")
|
|
|
|
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;
|
|
}
|
|
|
|
s48_value scx_Grab_Server(s48_value dpy) {
|
|
XGrabServer(scx_extract_display(dpy));
|
|
return S48_UNSPECIFIC;
|
|
}
|
|
|
|
s48_value scx_Ungrab_Server(s48_value dpy){
|
|
XUngrabServer(scx_extract_display(dpy));
|
|
return S48_UNSPECIFIC;
|
|
}
|
|
|
|
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);
|
|
S48_EXPORT_FUNCTION(scx_Grab_Key);
|
|
S48_EXPORT_FUNCTION(scx_Ungrab_Key);
|
|
S48_EXPORT_FUNCTION(scx_Allow_Events);
|
|
S48_EXPORT_FUNCTION(scx_Grab_Server);
|
|
S48_EXPORT_FUNCTION(scx_Ungrab_Server);
|
|
}
|
|
|