Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6674 - Function Graph - Fixed cursor not updating when a node is selected

dragonmacher663c21df19b4
diff --git a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/event/mouse/VertexMouseInfo.java b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/event/mouse/VertexMouseInfo.java
index 1f2af0da30..8749f222b2 100644
--- a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/event/mouse/VertexMouseInfo.java
+++ b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/event/mouse/VertexMouseInfo.java
@@ -83,13 +83,38 @@ public class VertexMouseInfo<V extends VisualVertex, E extends VisualEdge<V>> {
return HAND_CURSOR;
}
- if (mousedDestinationComponent != null) {
- return mousedDestinationComponent.getCursor();
+ Cursor c = getDestinationCursor();
+ if (c != null) {
+ return c;
}
return DEFAULT_CURSOR;
}
+ private Cursor getDestinationCursor() {
+
+ if (mousedDestinationComponent == null) {
+ return null;
+ }
+
+ /*
+ Unusual Code
+
+ We'd like to let the component define the cursor to use. The component's default
+ getCursor() methods will walk the hierarchy to find a cursor if one is not set. We only
+ want the cursor if the component has one, not the parent's. If we use the graph
+ viewer's' cursor, then the cursor doesn't change when hovering over a node. Thus, if
+ the cursor is different than the viewer's, assume it is a valid cursor for that node.
+ */
+ Cursor componentCursor = mousedDestinationComponent.getCursor();
+ Cursor viewerCursor = viewer.getCursor();
+ if (componentCursor != viewerCursor) {
+ return componentCursor;
+ }
+
+ return null;
+ }
+
public boolean isGrabArea() {
// subclasses can override to specify areas of the vertex that they can click in order
// to edit and perform keyboard operations
@@ -240,13 +265,13 @@ public class VertexMouseInfo<V extends VisualVertex, E extends VisualEdge<V>> {
int scrollAmount = wheelEvent.getScrollAmount();
int wheelRotation = wheelEvent.getWheelRotation();
return new MouseWheelEvent(source, ev.getID(), ev.getWhen(),
- ev.getModifiers() | ev.getModifiersEx(), (int) clickPoint.getX(),
+ ev.getModifiersEx(), (int) clickPoint.getX(),
(int) clickPoint.getY(), ev.getClickCount(), ev.isPopupTrigger(),
scrollType, scrollAmount, wheelRotation);
}
return new MouseEvent(source, ev.getID(), ev.getWhen(),
- ev.getModifiers() | ev.getModifiersEx(), (int) clickPoint.getX(),
+ ev.getModifiersEx(), (int) clickPoint.getX(),
(int) clickPoint.getY(), ev.getClickCount(), ev.isPopupTrigger(),
ev.getButton());
}
diff --git a/Ghidra/Framework/Project/data/project.theme.properties b/Ghidra/Framework/Project/data/project.theme.properties
index 8289370d47..5343f77f89 100644
--- a/Ghidra/Framework/Project/data/project.theme.properties
+++ b/Ghidra/Framework/Project/data/project.theme.properties
@@ -69,7 +69,7 @@ icon.logviewer.toolbar.file.open = icon.folder.open
icon.projectdata.find.checkouts.search = icon.search {icon.check}
icon.projectdata.copy = icon.copy
icon.projectdata.cut = icon.cut
-icon.projectdata.delete = page_delete.png
+icon.projectdata.delete = icon.delete
icon.projectdata.new.folder = icon.folder.new
icon.projectdata.paste = icon.paste
icon.projectdata.rename = page_edit.png