[orca] Add debugging
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add debugging
- Date: Thu, 27 Jun 2019 20:23:18 +0000 (UTC)
commit 2b86cfd944ee1e91c357889f7512b5b189d4ea69
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Jun 27 16:22:58 2019 -0400
Add debugging
src/orca/eventsynthesizer.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/src/orca/eventsynthesizer.py b/src/orca/eventsynthesizer.py
index cb75caae6..9f2f7721e 100644
--- a/src/orca/eventsynthesizer.py
+++ b/src/orca/eventsynthesizer.py
@@ -27,7 +27,12 @@ __copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc." \
"Copyright (c) 2018 Igalia, S.L."
__license__ = "LGPL"
+import gi
import pyatspi
+
+gi.require_version("Gtk", "3.0")
+from gi.repository import Gtk
+
from . import debug
try:
@@ -35,13 +40,29 @@ try:
except:
_canScrollTo = False
+def _getMouseCoordinates():
+ """Returns the current mouse coordinates."""
+
+ rootWindow = Gtk.Window().get_screen().get_root_window()
+ window, x, y, modifiers = rootWindow.get_pointer()
+ msg = "EVENT SYNTHESIZER: Mouse coordinates: %d,%d" % (x, y)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return x, y
+
def _generateMouseEvent(x, y, event):
"""Synthesize a mouse event at a specific screen coordinate."""
+ oldX, oldY = _getMouseCoordinates()
+
msg = "EVENT SYNTHESIZER: Generating %s mouse event at %d,%d" % (event, x, y)
debug.println(debug.LEVEL_INFO, msg, True)
pyatspi.Registry.generateMouseEvent(x, y, event)
+ newX, newY = _getMouseCoordinates()
+ if oldX == newX and oldY == newY and (oldX, oldY) != (x, y):
+ msg = "EVENT SYNTHESIZER: Mouse event possible failure. Pointer didn't move"
+ debug.println(debug.LEVEL_INFO, msg, True)
+
def _mouseEventOnCharacter(obj, event):
"""Performs the specified mouse event on the current character in obj."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]