[gimp] app: add virtual functions GimpToolWidget::key_press() and ::key_release()



commit 91deb6147597f2ec74b3322af685373b3d7e8a35
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jun 20 23:01:18 2017 +0200

    app: add virtual functions GimpToolWidget::key_press() and ::key_release()
    
    and api to call them. Not used anywhere yet.

 app/display/gimptoolwidget.c |   26 ++++++++++++++++++++++++++
 app/display/gimptoolwidget.h |   10 ++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/app/display/gimptoolwidget.c b/app/display/gimptoolwidget.c
index 5bbabde..562e8b3 100644
--- a/app/display/gimptoolwidget.c
+++ b/app/display/gimptoolwidget.c
@@ -492,6 +492,32 @@ gimp_tool_widget_hover (GimpToolWidget   *widget,
                                                 coords, state, proximity);
 }
 
+gboolean
+gimp_tool_widget_key_press (GimpToolWidget *widget,
+                            GdkEventKey    *kevent)
+{
+  g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), FALSE);
+  g_return_val_if_fail (kevent != NULL, FALSE);
+
+  if (GIMP_TOOL_WIDGET_GET_CLASS (widget)->key_press)
+    return GIMP_TOOL_WIDGET_GET_CLASS (widget)->key_press (widget, kevent);
+
+  return FALSE;
+}
+
+gboolean
+gimp_tool_widget_key_release (GimpToolWidget *widget,
+                              GdkEventKey    *kevent)
+{
+  g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), FALSE);
+  g_return_val_if_fail (kevent != NULL, FALSE);
+
+  if (GIMP_TOOL_WIDGET_GET_CLASS (widget)->key_release)
+    return GIMP_TOOL_WIDGET_GET_CLASS (widget)->key_release (widget, kevent);
+
+  return FALSE;
+}
+
 void
 gimp_tool_widget_motion_modifier (GimpToolWidget  *widget,
                                   GdkModifierType  key,
diff --git a/app/display/gimptoolwidget.h b/app/display/gimptoolwidget.h
index 6481223..0f8d5e5 100644
--- a/app/display/gimptoolwidget.h
+++ b/app/display/gimptoolwidget.h
@@ -78,6 +78,11 @@ struct _GimpToolWidgetClass
                                 GdkModifierType        state,
                                 gboolean               proximity);
 
+  gboolean (* key_press)       (GimpToolWidget        *widget,
+                                GdkEventKey           *kevent);
+  gboolean (* key_release)     (GimpToolWidget        *widget,
+                                GdkEventKey           *kevent);
+
   void     (* motion_modifier) (GimpToolWidget        *widget,
                                 GdkModifierType        key,
                                 gboolean               press,
@@ -172,6 +177,11 @@ void       gimp_tool_widget_hover           (GimpToolWidget        *widget,
                                              GdkModifierType        state,
                                              gboolean               proximity);
 
+gboolean   gimp_tool_widget_key_press       (GimpToolWidget        *widget,
+                                             GdkEventKey           *kevent);
+gboolean   gimp_tool_widget_key_release     (GimpToolWidget        *widget,
+                                             GdkEventKey           *kevent);
+
 void       gimp_tool_widget_motion_modifier (GimpToolWidget        *widget,
                                              GdkModifierType        key,
                                              gboolean               press,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]