forked from flingone/b2g-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0003-gecko.patch
111 lines (107 loc) · 3.74 KB
/
0003-gecko.patch
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
diff --git a/gecko/widget/gonk/nsAppShell.cpp b/gecko/widget/gonk/nsAppShell.cpp
index 09b65b0..9a7bc3d 100644
--- a/gecko/widget/gonk/nsAppShell.cpp
+++ b/gecko/widget/gonk/nsAppShell.cpp
@@ -20,6 +20,7 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
+#include <linux/fb.h>
#include <signal.h>
#include <sys/epoll.h>
#include <sys/ioctl.h>
@@ -70,6 +71,11 @@
// Defines kKeyMapping and GetKeyNameIndex()
#include "GonkKeyMapping.h"
+#define FBIOPUT_SET_CURSOR_EN 0x4609
+#define FBIOPUT_SET_CURSOR_IMG 0x460a
+#define FBIOPUT_SET_CURSOR_POS 0x460b
+#define FBIOPUT_SET_CURSOR_CMAP 0x460c
+
#define LOG(args...) \
__android_log_print(ANDROID_LOG_INFO, "Gonk" , ## args)
#ifdef VERBOSE_LOG_ENABLED
@@ -297,13 +303,72 @@ class GeckoPointerController : public PointerControllerInterface {
float mY;
int32_t mButtonState;
InputReaderConfiguration* mConfig;
+ int32_t mFbHandler;
public:
GeckoPointerController(InputReaderConfiguration* config)
: mX(0)
, mY(0)
, mButtonState(0)
, mConfig(config)
- {}
+ {
+ mFbHandler = open("/dev/graphics/fb0", O_RDWR, 0);
+ if (mFbHandler < 0)
+ LOG("%s: open fb fail", __func__);
+ else {
+ char cursorImg[128] = {
+ //big mouse with tail
+ 0x80, 0x00, 0x00, 0x00,
+ 0xE0, 0x00, 0x00, 0x00,
+ 0x78, 0x00, 0x00, 0x00,
+ 0x7E, 0x00, 0x00, 0x00,
+ 0x3F, 0x80, 0x00, 0x00,
+ 0x3F, 0xE0, 0x00, 0x00,
+ 0x1F, 0xF8, 0x00, 0x00,
+ 0x1F, 0xFE, 0x00, 0x00,
+ 0x0F, 0xFF, 0x80, 0x00,
+ 0x0F, 0xFF, 0xE0, 0x00,
+ 0x07, 0xFF, 0xF8, 0x00,
+ 0x07, 0xFF, 0xFE, 0x00,
+ 0x03, 0xFF, 0xFF, 0x80,
+ 0x03, 0xFF, 0xFF, 0xE0,
+ 0x01, 0xFF, 0xFF, 0xF8,
+ 0x01, 0xFF, 0xFF, 0xFC,
+ 0x00, 0xFF, 0xFF, 0xF8,
+ 0x00, 0xFF, 0xFF, 0xF0,
+ 0x00, 0x7F, 0xFF, 0xE0,
+ 0x00, 0x7F, 0xFF, 0xC0,
+ 0x00, 0x3F, 0xFF, 0x80,
+ 0x00, 0x3F, 0xFF, 0x80,
+ 0x00, 0x1F, 0xFF, 0xC0,
+ 0x00, 0x1F, 0xFF, 0xE0,
+ 0x00, 0x0F, 0xFF, 0xF0,
+ 0x00, 0x0F, 0xF3, 0xF8,
+ 0x00, 0x07, 0xE1, 0xFC,
+ 0x00, 0x07, 0xC0, 0xFE,
+ 0x00, 0x03, 0x80, 0x7F,
+ 0x00, 0x03, 0x00, 0x3F,
+ 0x00, 0x00, 0x00, 0x1E,
+ 0x00, 0x00, 0x00, 0x0C,
+ };
+ struct fb_image img;
+ int cursor_en = 1;
+ int red, green, blue;
+ char propVal[PROPERTY_VALUE_MAX];
+ property_get("cursor.hw.colour.red", propVal, "255");
+ red = atoi(propVal);
+ property_get("cursor.hw.colour.green", propVal, "0");
+ green = atoi(propVal);
+ property_get("cursor.hw.colour.blue", propVal, "0");
+ blue = atoi(propVal);
+
+ img.bg_color = 0xff;
+ img.fg_color = ((red<<16) + (green<<8) + blue);
+
+ ioctl(mFbHandler, FBIOPUT_SET_CURSOR_CMAP, &img);
+ ioctl(mFbHandler, FBIOPUT_SET_CURSOR_IMG, cursorImg);
+ ioctl(mFbHandler, FBIOPUT_SET_CURSOR_EN, &cursor_en);
+ }
+ }
virtual bool getBounds(float* outMinX, float* outMinY,
float* outMaxX, float* outMaxY) const;
@@ -344,6 +409,12 @@ GeckoPointerController::move(float deltaX, float deltaY)
mX = clamped(mX + deltaX, minX, maxX);
mY = clamped(mY + deltaY, minY, maxY);
+ if (mFbHandler >= 0) {
+ struct fbcurpos cursor_pos;
+ cursor_pos.x = mX;
+ cursor_pos.y = mY;
+ ioctl(mFbHandler, FBIOPUT_SET_CURSOR_POS, &cursor_pos);
+ }
}
void