xorg: add recipes for X11R7.5 release
[openembedded.git] / recipes / xorg-xserver / xserver-xorg / randr-support-1.7.0.patch
1 diff -Nur xorg-server-1.7.0.orig/hw/xfree86/common/xf86Xinput.c xorg-server-1.7.0/hw/xfree86/common/xf86Xinput.c
2 --- xorg-server-1.7.0.orig/hw/xfree86/common/xf86Xinput.c       2009-09-24 07:12:00.000000000 +0200
3 +++ xorg-server-1.7.0/hw/xfree86/common/xf86Xinput.c    2009-10-08 11:45:50.000000000 +0200
4 @@ -95,6 +95,8 @@
5  
6  #include "os.h"
7  
8 +#define RR_Rotate_All    (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
9 +
10  EventListPtr xf86Events = NULL;
11  
12  /**
13 @@ -1086,4 +1088,67 @@
14      EnableDevice(dev, TRUE);
15  }
16  
17 +/* Taken from evdev-properties.h. */
18 +#define EVDEV_PROP_SWAP_AXES "Evdev Axes Swap"
19 +#define EVDEV_PROP_INVERT_AXES "Evdev Axis Inversion"
20 +
21 +/* This is a hack until we get device -> CRTC association. */
22 +void
23 +xf86InputRotationNotify(Rotation rotation)
24 +{
25 +    DeviceIntPtr dev;
26 +    LocalDevicePtr local;
27 +    int ret;
28 +    int swap_axes = 0;
29 +    CARD8 invert[2] = { 0, 0 };
30 +    static Atom prop_swap = 0, prop_invert = 0;
31 +    static int atom_generation = -1;
32 +    
33 +    if (atom_generation != serverGeneration) {
34 +        prop_swap = 0;
35 +        prop_invert = 0;
36 +    }
37 +
38 +    switch (rotation & RR_Rotate_All) {
39 +    case RR_Rotate_0:
40 +        break;
41 +    case RR_Rotate_90:
42 +        swap_axes = 1;
43 +        invert[0] = 1;
44 +        break;
45 +    case RR_Rotate_180:
46 +        invert[0] = 1;
47 +        invert[1] = 1;
48 +        break;
49 +    case RR_Rotate_270:
50 +        swap_axes = 1;
51 +        invert[1] = 1;
52 +        break;
53 +    }
54 +
55 +    if (!prop_swap)
56 +        prop_swap = MakeAtom(EVDEV_PROP_SWAP_AXES,
57 +                             strlen(EVDEV_PROP_SWAP_AXES), TRUE);
58 +    if (!prop_invert)
59 +        prop_invert = MakeAtom(EVDEV_PROP_INVERT_AXES,
60 +                               strlen(EVDEV_PROP_INVERT_AXES), TRUE);
61 +
62 +    for (dev = inputInfo.devices; dev; dev = dev->next) {
63 +        local = dev->public.devicePrivate;
64 +        ret = XIChangeDeviceProperty(dev, prop_swap, XA_INTEGER, 8,
65 +                                     PropModeReplace, 1, &swap_axes, FALSE);
66 +        if (ret != Success) {
67 +            xf86Msg(X_ERROR, "Changing swap_xy property failed!\n");
68 +            continue;
69 +        }
70 +        ret = XIChangeDeviceProperty(dev, prop_invert, XA_INTEGER, 8,
71 +                                     PropModeReplace, 2, invert, FALSE);
72 +        if (ret != Success) {
73 +            xf86Msg(X_ERROR, "Changing invert property failed!\n");
74 +            continue;
75 +        }
76 +    }
77 +}
78 +
79 +
80  /* end of xf86Xinput.c */
81 diff -Nur xorg-server-1.7.0.orig/hw/xfree86/modes/xf86Crtc.c xorg-server-1.7.0/hw/xfree86/modes/xf86Crtc.c
82 --- xorg-server-1.7.0.orig/hw/xfree86/modes/xf86Crtc.c  2009-10-01 08:27:36.000000000 +0200
83 +++ xorg-server-1.7.0/hw/xfree86/modes/xf86Crtc.c       2009-10-08 11:28:42.000000000 +0200
84 @@ -391,6 +391,12 @@
85      if (didLock)
86         crtc->funcs->unlock (crtc);
87  
88 +    /*
89 +     * Rotate Touchscreen
90 +     */
91 +    xf86InputRotationNotify(crtc->rotation);
92 +
93 +    
94      return ret;
95  }
96