2001-05-08 10:21:00 -04:00
|
|
|
#include "xlib.h"
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
int Get_Mode (s48_value m){
|
|
|
|
return S48_EXTRACT_BOOLEAN(m) ? GrabModeSync :GrabModeAsync;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Grab_Pointer (s48_value dpy, s48_value win,
|
|
|
|
s48_value ownerp, s48_value events,
|
|
|
|
s48_value psyncp, s48_value ksyncp,
|
|
|
|
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),
|
2002-02-08 12:09:43 -05:00
|
|
|
s48_extract_integer(events),
|
2001-08-22 08:09:56 -04:00
|
|
|
Get_Mode(psyncp),
|
|
|
|
Get_Mode(ksyncp),
|
|
|
|
SCX_EXTRACT_WINDOW(confine_to),
|
|
|
|
SCX_EXTRACT_CURSOR(cursor),
|
|
|
|
SCX_EXTRACT_TIME(time));
|
2002-02-08 12:09:43 -05:00
|
|
|
return s48_enter_integer(res);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Ungrab_Pointer (s48_value dpy, s48_value time) {
|
|
|
|
XUngrabPointer (SCX_EXTRACT_DISPLAY(dpy), SCX_EXTRACT_TIME(time));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Grab_Button (s48_value dpy, s48_value win, s48_value button,
|
|
|
|
s48_value mods, s48_value ownerp, s48_value events,
|
|
|
|
s48_value psyncp, s48_value ksyncp,
|
|
|
|
s48_value confine_to, s48_value cursor){
|
|
|
|
XGrabButton(SCX_EXTRACT_DISPLAY(dpy),
|
2002-02-08 12:09:43 -05:00
|
|
|
s48_extract_integer(button),
|
|
|
|
s48_extract_integer(mods),
|
2001-08-22 08:09:56 -04:00
|
|
|
SCX_EXTRACT_WINDOW(win),
|
|
|
|
S48_EXTRACT_BOOLEAN(ownerp),
|
2002-02-08 12:09:43 -05:00
|
|
|
s48_extract_integer(events),
|
2001-08-22 08:09:56 -04:00
|
|
|
Get_Mode(psyncp), Get_Mode(ksyncp),
|
|
|
|
SCX_EXTRACT_WINDOW(confine_to),
|
|
|
|
SCX_EXTRACT_CURSOR(cursor));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Ungrab_Button (s48_value Xdpy, s48_value Xwin,
|
|
|
|
s48_value button, s48_value mods){
|
|
|
|
XUngrabButton(SCX_EXTRACT_DISPLAY(Xdpy),
|
2002-02-08 12:09:43 -05:00
|
|
|
s48_extract_integer(button),
|
|
|
|
s48_extract_integer(mods),
|
2001-08-22 08:09:56 -04:00
|
|
|
SCX_EXTRACT_WINDOW(Xwin));
|
2002-02-08 12:09:43 -05:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Change_Active_Pointer_Grab (s48_value Xdpy, s48_value events,
|
|
|
|
s48_value cursor, s48_value time){
|
|
|
|
XChangeActivePointerGrab (SCX_EXTRACT_DISPLAY(Xdpy),
|
2002-02-08 12:09:43 -05:00
|
|
|
s48_extract_integer(events),
|
2001-08-22 08:09:56 -04:00
|
|
|
SCX_EXTRACT_CURSOR(cursor),
|
|
|
|
SCX_EXTRACT_TIME(time));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Grab_Keyboard (s48_value Xdpy, s48_value Xwin, s48_value ownerp,
|
|
|
|
s48_value psyncp, s48_value ksyncp,
|
|
|
|
s48_value time){
|
2002-02-08 12:09:43 -05:00
|
|
|
int res = XGrabKeyboard( SCX_EXTRACT_DISPLAY(Xdpy),
|
2001-08-22 08:09:56 -04:00
|
|
|
SCX_EXTRACT_WINDOW(Xwin),
|
|
|
|
S48_EXTRACT_BOOLEAN(ownerp),
|
|
|
|
Get_Mode(psyncp),
|
|
|
|
Get_Mode (ksyncp),
|
2002-02-08 12:09:43 -05:00
|
|
|
SCX_EXTRACT_TIME(time));
|
|
|
|
return s48_enter_integer(res);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Ungrab_Keyboard (s48_value Xdpy, s48_value time){
|
|
|
|
XUngrabKeyboard (SCX_EXTRACT_DISPLAY(Xdpy),
|
|
|
|
SCX_EXTRACT_TIME(time));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Grab_Key (s48_value Xdpy, s48_value Xwin, s48_value key,
|
|
|
|
s48_value mods, s48_value ownerp, s48_value psyncp,
|
|
|
|
s48_value ksyncp, s48_value flag){
|
|
|
|
int keycode = AnyKey;
|
|
|
|
if (!S48_EXTRACT_BOOLEAN(flag))
|
|
|
|
keycode = (int)s48_extract_integer(key);
|
|
|
|
XGrabKey (SCX_EXTRACT_DISPLAY(Xdpy),
|
|
|
|
keycode,
|
2002-02-08 12:09:43 -05:00
|
|
|
s48_extract_integer(mods),
|
2001-08-22 08:09:56 -04:00
|
|
|
SCX_EXTRACT_WINDOW(Xwin),
|
|
|
|
S48_EXTRACT_BOOLEAN(ownerp),
|
|
|
|
Get_Mode(psyncp),
|
|
|
|
Get_Mode (ksyncp));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
s48_value scx_Ungrab_Key (s48_value Xdpy, s48_value Xwin, s48_value key,
|
|
|
|
s48_value mods, s48_value flag){
|
|
|
|
int keycode = AnyKey;
|
|
|
|
if (!S48_EXTRACT_BOOLEAN(flag))
|
|
|
|
keycode = (int)s48_extract_integer(key);
|
|
|
|
XUngrabKey (SCX_EXTRACT_DISPLAY(Xdpy),
|
|
|
|
keycode,
|
2002-02-08 12:09:43 -05:00
|
|
|
s48_extract_integer(mods),
|
2001-08-22 08:09:56 -04:00
|
|
|
SCX_EXTRACT_WINDOW(Xwin));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Allow_Events (s48_value Xdpy, s48_value mode, s48_value time){
|
|
|
|
XAllowEvents (SCX_EXTRACT_DISPLAY(Xdpy),
|
2002-02-08 12:09:43 -05:00
|
|
|
s48_extract_integer(mode),
|
2001-08-22 08:09:56 -04:00
|
|
|
SCX_EXTRACT_TIME(time));
|
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-08-22 08:09:56 -04:00
|
|
|
|
|
|
|
s48_value scx_Grab_Server (s48_value Xdpy){
|
2001-08-29 10:54:05 -04:00
|
|
|
XGrabServer(SCX_EXTRACT_DISPLAY(Xdpy));
|
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
|
|
|
|
|
|
|
s48_value scx_Ungrab_Server (s48_value Xdpy){
|
|
|
|
XUngrabServer (SCX_EXTRACT_DISPLAY(Xdpy));
|
|
|
|
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
|
|
|
|