111 |
111 |
else
|
112 |
112 |
{
|
113 |
113 |
Widget w = tc.getWidget(widgetId);
|
114 |
|
if (w instanceof AbstractContainer)
|
|
114 |
if (w.isDisplayed())
|
115 |
115 |
{
|
116 |
|
// it needs to get the widget's location with respect to the parent window
|
117 |
|
NativePoint origin = w.screenPhysicalLocation();
|
118 |
|
Widget target = w.findMouseSource(
|
119 |
|
new NativePoint(event.getX() - origin.x, event.getY() - origin.y));
|
120 |
|
if (target != null && target.getId() != null)
|
121 |
|
{
|
122 |
|
effectiveWidgetId = target.getId().asInt();
|
123 |
|
}
|
124 |
|
else
|
125 |
|
{
|
126 |
|
// TODO: move this widget-specific logic into methods that are implemented in
|
127 |
|
// the widget hierarchy so that we do not have direct references to widget
|
128 |
|
// classes in this common code
|
129 |
|
|
130 |
|
Widget editor = WidgetRegistry.findAncestor(target,
|
131 |
|
t -> EditorGuiImpl.class.equals(t.getClass()));
|
132 |
|
if (editor != null && editor.getId() != null)
|
133 |
|
{
|
134 |
|
effectiveWidgetId = editor.getId().asInt();
|
135 |
|
}
|
136 |
|
}
|
|
116 |
if (w instanceof AbstractContainer)
|
|
117 |
{
|
|
118 |
// it needs to get the widget's location with respect to the parent window
|
|
119 |
NativePoint origin = w.screenPhysicalLocation();
|
|
120 |
Widget target = w.findMouseSource(
|
|
121 |
new NativePoint(event.getX() - origin.x, event.getY() - origin.y));
|
|
122 |
if (target != null && target.getId() != null)
|
|
123 |
{
|
|
124 |
effectiveWidgetId = target.getId().asInt();
|
|
125 |
}
|
|
126 |
else
|
|
127 |
{
|
|
128 |
// TODO: move this widget-specific logic into methods that are implemented in
|
|
129 |
// the widget hierarchy so that we do not have direct references to widget
|
|
130 |
// classes in this common code
|
|
131 |
|
|
132 |
Widget editor = WidgetRegistry.findAncestor(target,
|
|
133 |
t -> EditorGuiImpl.class.equals(t.getClass()));
|
|
134 |
if (editor != null && editor.getId() != null)
|
|
135 |
{
|
|
136 |
effectiveWidgetId = editor.getId().asInt();
|
|
137 |
}
|
|
138 |
}
|
|
139 |
}
|
|
140 |
tc.postMouseEvent(event, windowId, effectiveWidgetId);
|
137 |
141 |
}
|
138 |
|
tc.postMouseEvent(event, windowId, effectiveWidgetId);
|
139 |
142 |
}
|
140 |
143 |
});
|
141 |
144 |
}
|