From f70fcd09dd2e61b9c1fe035d1d998b3c41711dfe Mon Sep 17 00:00:00 2001 From: raster Date: Sat, 20 Sep 2008 02:19:38 +0000 Subject: [PATCH] illogict - patch for right lefty mouse... - ecore-x-pointer_mapping_support.patch: add support for modifying pointer button mapping git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@36113 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_x/Ecore_X.h | 4 ++++ src/lib/ecore_x/xcb/ecore_xcb.c | 50 +++++++++++++++++++++++++++++++++++++++++ src/lib/ecore_x/xlib/ecore_x.c | 13 ++++++++++- 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index 1cbd309..669666a 100644 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -1584,6 +1584,10 @@ EAPI int ecore_x_pointer_control_set(int accel_num, int accel_denom, int thresh EAPI void ecore_x_pointer_control_get_prefetch(void); EAPI void ecore_x_pointer_control_get_fetch(void); EAPI int ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold); +EAPI int ecore_x_pointer_mapping_set(unsigned char *map, int nmap); +EAPI void ecore_x_pointer_mapping_get_prefetch(void); +EAPI void ecore_x_pointer_mapping_get_fetch(void); +EAPI int ecore_x_pointer_mapping_get(unsigned char *map, int nmap); EAPI int ecore_x_pointer_grab(Ecore_X_Window win); EAPI int ecore_x_pointer_confine_grab(Ecore_X_Window win); EAPI void ecore_x_pointer_ungrab(void); diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c index 9ccf5f7..dd94a1a 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb.c +++ b/src/lib/ecore_x/xcb/ecore_xcb.c @@ -1267,6 +1267,56 @@ ecore_x_pointer_control_get(int *accel_num, } EAPI int +ecore_x_pointer_mapping_set(unsigned char *map, + int nmap) +{ + xcb_set_pointer_mapping(_ecore_xcb_conn, nmap, map); + return 1; +} + +EAPI void +ecore_x_pointer_mapping_get_prefetch(void) +{ + xcb_get_pointer_mapping_cookie_t cookie; + + cookie = xcb_get_pointer_mapping_unchecked(_ecore_xcb_conn); + _ecore_xcb_cookie_cache(cookie.sequence); +} + +EAPI void +ecore_x_pointer_mapping_get_fetch(void) +{ + xcb_get_pointer_mapping_cookie_t cookie; + xcb_get_pointer_mapping_reply_t *reply; + + cookie.sequence = _ecore_xcb_cookie_get(); + reply = xcb_get_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL); + _ecore_xcb_reply_cache(reply); +} + +EAPI int +ecore_x_pointer_mapping_get(unsigned char *map, + int nmap) +{ + xcb_get_pointer_mapping_reply_t *reply; + int i; + uint8_t tmp; + + reply = _ecore_xcb_reply_get(); + if (!reply) return 0; + + if (nmap > xcb_get_pointer_mapping_map_length(reply)) + return 0; + + tmp = xcb_get_pointer_mapping_map(reply); + + for (i = 0; i < nmap; i++) + map[i] = tmp[i]; + + return 1; +} + +EAPI int ecore_x_pointer_grab(Ecore_X_Window window) { xcb_grab_pointer_cookie_t cookie; diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c index 9be563f..6d96fa6 100644 --- a/src/lib/ecore_x/xlib/ecore_x.c +++ b/src/lib/ecore_x/xlib/ecore_x.c @@ -1013,7 +1013,6 @@ ecore_x_pointer_control_set(int accel_num, int accel_denom, int threshold) accel_num, accel_denom, threshold); } - EAPI int ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold) { @@ -1022,6 +1021,18 @@ ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold) } EAPI int +ecore_x_pointer_mapping_set(unsigned char *map, int nmap) +{ + return XSetPointerMapping(_ecore_x_disp, map, nmap); +} + +EAPI int +ecore_x_pointer_mapping_get(unsigned char *map, int nmap) +{ + return XGetPointerMapping(_ecore_x_disp, map, nmap); +} + +EAPI int ecore_x_pointer_grab(Ecore_X_Window win) { if (XGrabPointer(_ecore_x_disp, win, False, -- 2.7.4