app: add GimpToolWidget::hit() virtual function
... which takes the same arguments as GimpToolWidget::hover(), and
performs a hit-test, returning one of the following values:
- GIMP_HIT_DIRECT: The point corresponds to one of the widget's
elements directly.
- GIMP_HIT_INDIRECT: The point does not correspond to one of the
widget's elements directly, but the widget otherwise responds
to press events at this point.
- GIMP_HIT_NONE: The widget does not respond to press events at
this point.
Unlike hover(), hit() should not have any side effects.
(cherry picked from commit 385203f4d6
)
This commit is contained in:
@ -220,4 +220,17 @@ typedef enum
|
|||||||
} GimpZoomFocus;
|
} GimpZoomFocus;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* non-registered enums; register them if needed
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum /*< pdb-skip, skip >*/
|
||||||
|
{
|
||||||
|
GIMP_HIT_NONE,
|
||||||
|
GIMP_HIT_INDIRECT,
|
||||||
|
GIMP_HIT_DIRECT
|
||||||
|
} GimpHit;
|
||||||
|
|
||||||
|
|
||||||
#endif /* __DISPLAY_ENUMS_H__ */
|
#endif /* __DISPLAY_ENUMS_H__ */
|
||||||
|
@ -804,6 +804,22 @@ gimp_tool_widget_motion (GimpToolWidget *widget,
|
|||||||
coords, time, state);
|
coords, time, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GimpHit
|
||||||
|
gimp_tool_widget_hit (GimpToolWidget *widget,
|
||||||
|
const GimpCoords *coords,
|
||||||
|
GdkModifierType state,
|
||||||
|
gboolean proximity)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), GIMP_HIT_NONE);
|
||||||
|
g_return_val_if_fail (coords != NULL, GIMP_HIT_NONE);
|
||||||
|
|
||||||
|
if (GIMP_TOOL_WIDGET_GET_CLASS (widget)->hit)
|
||||||
|
return GIMP_TOOL_WIDGET_GET_CLASS (widget)->hit (widget,
|
||||||
|
coords, state, proximity);
|
||||||
|
|
||||||
|
return GIMP_HIT_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_tool_widget_hover (GimpToolWidget *widget,
|
gimp_tool_widget_hover (GimpToolWidget *widget,
|
||||||
const GimpCoords *coords,
|
const GimpCoords *coords,
|
||||||
|
@ -87,6 +87,10 @@ struct _GimpToolWidgetClass
|
|||||||
guint32 time,
|
guint32 time,
|
||||||
GdkModifierType state);
|
GdkModifierType state);
|
||||||
|
|
||||||
|
GimpHit (* hit) (GimpToolWidget *widget,
|
||||||
|
const GimpCoords *coords,
|
||||||
|
GdkModifierType state,
|
||||||
|
gboolean proximity);
|
||||||
void (* hover) (GimpToolWidget *widget,
|
void (* hover) (GimpToolWidget *widget,
|
||||||
const GimpCoords *coords,
|
const GimpCoords *coords,
|
||||||
GdkModifierType state,
|
GdkModifierType state,
|
||||||
@ -252,6 +256,10 @@ void gimp_tool_widget_motion (GimpToolWidget *widget,
|
|||||||
guint32 time,
|
guint32 time,
|
||||||
GdkModifierType state);
|
GdkModifierType state);
|
||||||
|
|
||||||
|
GimpHit gimp_tool_widget_hit (GimpToolWidget *widget,
|
||||||
|
const GimpCoords *coords,
|
||||||
|
GdkModifierType state,
|
||||||
|
gboolean proximity);
|
||||||
void gimp_tool_widget_hover (GimpToolWidget *widget,
|
void gimp_tool_widget_hover (GimpToolWidget *widget,
|
||||||
const GimpCoords *coords,
|
const GimpCoords *coords,
|
||||||
GdkModifierType state,
|
GdkModifierType state,
|
||||||
|
Reference in New Issue
Block a user