Mouse support by facekapow · Pull Request #131 · runtimejs/runtime · GitHub
Skip to content
This repository was archived by the owner on Jul 3, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions js/core/index.js
20 changes: 20 additions & 0 deletions js/core/mouse/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2016-present runtime.js project authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

const EventController = require('event-controller');
exports.onMousedown = new EventController();
exports.onMouseup = new EventController();
exports.onMousemove = new EventController();
10 changes: 10 additions & 0 deletions js/core/ps2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ exports.setKeyboardDriver = (driver) => {
ioPort: driverUtils.ioPort(0x60),
});
};

exports.setMouseDriver = (driver) => {
assert(typeutils.isFunction(driver.init));
assert(typeutils.isFunction(driver.reset));

driver.init({
irq: driverUtils.irq(12),
ioPorts: [driverUtils.ioPort(0x60), driverUtils.ioPort(0x64)],
});
};
1 change: 1 addition & 0 deletions js/driver/ps2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@

'use strict';
require('./keyboard');
require('./mouse');
188 changes: 188 additions & 0 deletions js/driver/ps2/mouse.js