summaryrefslogtreecommitdiff
path: root/src/bin/e_mouse.c
blob: 42f0fa35fa8b9d724d8793af8475fd9afca42e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
#include "e.h"
 
EAPI int
e_mouse_init(void)
{
   unsigned char map[256];
   int n;

   if (!ecore_x_pointer_control_set(e_config->mouse_accel_numerator,
				    e_config->mouse_accel_denominator,
				    e_config->mouse_accel_threshold))
     return 0;

   if (!(n = ecore_x_pointer_mapping_get(map, 256))) return 0;

   if (((e_config->mouse_hand == E_MOUSE_HAND_LEFT) && (map[2] != 1)) ||
       ((e_config->mouse_hand == E_MOUSE_HAND_RIGHT) && (map[0] != 1)))
     {
	const unsigned char tmp = map[0];
	map[0] = map[2]; map[2] = tmp;
	if (ecore_x_pointer_mapping_set(map, n)) return 0;
     }

   return 1;
}