bare-pointer 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/linux.js +29 -0
  2. package/package.json +2 -2
package/lib/linux.js CHANGED
@@ -10,6 +10,21 @@ module.exports = class LinuxPointer {
10
10
  return [view.width, view.height]
11
11
  }
12
12
 
13
+ covered(view, x, y) {
14
+ const point = this._point(view, x, y)
15
+ const root = this._display.defaultRootWindow
16
+ const window = this._toplevel(view.native.surface.xid)
17
+
18
+ const { child } = this._display.translateCoordinates(root, root, point.x, point.y)
19
+
20
+ if (child === window) return false
21
+
22
+ this._display.raiseWindow(window)
23
+ this._display.sync()
24
+
25
+ return true
26
+ }
27
+
13
28
  watch(view, onhidden) {
14
29
  const window = view.native
15
30
 
@@ -48,6 +63,20 @@ module.exports = class LinuxPointer {
48
63
  this._display.close()
49
64
  }
50
65
 
66
+ // A window manager can put the window in a frame of its own, which is what is
67
+ // stacked among the other windows.
68
+ _toplevel(window) {
69
+ const root = this._display.defaultRootWindow
70
+
71
+ while (true) {
72
+ const { parent } = this._display.queryTree(window)
73
+
74
+ if (parent === root) return window
75
+
76
+ window = parent
77
+ }
78
+ }
79
+
51
80
  _move(view, x, y) {
52
81
  const point = this._point(view, x, y)
53
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-pointer",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Simulated pointer input for testing Bare apps",
5
5
  "exports": {
6
6
  "./package": "./package.json",
@@ -54,7 +54,7 @@
54
54
  "bare-ui-kit-touch": "^0.1.0",
55
55
  "bare-user32": "^0.1.1",
56
56
  "bare-win-ui": "^0.3.7",
57
- "bare-x11": "^0.1.0",
57
+ "bare-x11": "^0.1.1",
58
58
  "bare-x11-xtest": "^0.1.0"
59
59
  },
60
60
  "devDependencies": {