1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  The Gdk.Event.Gdk_Event struct contains a union of all of the event 
  26. --  structs, and allows access to the data fields in a number of ways. 
  27. -- 
  28. --  The event type is always the first field in all of the event structs, and 
  29. --  can always be accessed with the following code, no matter what type of 
  30. --  event it is: 
  31. -- 
  32. --    GdkEvent *event; 
  33. --    GdkEventType type; 
  34. --    type = event->type; 
  35. -- 
  36. --  To access other fields of the event structs, the pointer to the event can 
  37. --  be cast to the appropriate event struct pointer, or the union member name 
  38. --  can be used. For example if the event type is Gdk.Event.Button_Press then 
  39. --  the x coordinate of the button press can be accessed with: 
  40. -- 
  41. --    GdkEvent *event; 
  42. --    gdouble x; 
  43. --    x = ((GdkEventButton*)event)->x; 
  44. -- 
  45. --  or: 
  46. -- 
  47. --    GdkEvent *event; 
  48. --    gdouble x; 
  49. --    x = event->button.x; 
  50. -- 
  51. -- 
  52. --  </description> 
  53. --  <group>Gdk, the low-level API</group> 
  54. pragma Ada_2005; 
  55.  
  56. pragma Warnings (Off, "*is already use-visible*"); 
  57. with Cairo.Region;            use Cairo.Region; 
  58. with Gdk;                     use Gdk; 
  59. with Gdk.Rectangle;           use Gdk.Rectangle; 
  60. with Gdk.Types;               use Gdk.Types; 
  61. with Glib;                    use Glib; 
  62. with Glib.Generic_Properties; use Glib.Generic_Properties; 
  63. with Glib.Values;             use Glib.Values; 
  64. with Interfaces.C.Strings;    use Interfaces.C.Strings; 
  65.  
  66. package Gdk.Event is 
  67.  
  68.    type Gdk_Event_Type is ( 
  69.       Nothing, 
  70.       Delete, 
  71.       Destroy, 
  72.       Expose, 
  73.       Motion_Notify, 
  74.       Button_Press, 
  75.       Gdk_2button_Press, 
  76.       Gdk_3button_Press, 
  77.       Button_Release, 
  78.       Key_Press, 
  79.       Key_Release, 
  80.       Enter_Notify, 
  81.       Leave_Notify, 
  82.       Focus_Change, 
  83.       Configure, 
  84.       Map, 
  85.       Unmap, 
  86.       Property_Notify, 
  87.       Selection_Clear, 
  88.       Selection_Request, 
  89.       Selection_Notify, 
  90.       Proximity_In, 
  91.       Proximity_Out, 
  92.       Drag_Enter, 
  93.       Drag_Leave, 
  94.       Drag_Motion, 
  95.       Drag_Status, 
  96.       Drop_Start, 
  97.       Drop_Finished, 
  98.       Client_Event, 
  99.       Visibility_Notify, 
  100.       Scroll, 
  101.       Window_State, 
  102.       Setting, 
  103.       Owner_Change, 
  104.       Grab_Broken, 
  105.       Damage, 
  106.       Touch_Begin, 
  107.       Touch_Update, 
  108.       Touch_End, 
  109.       Touch_Cancel); 
  110.    pragma Convention (C, Gdk_Event_Type); 
  111.    --  Specifies the type of the event. 
  112.    -- 
  113.    --  Do not confuse these events with the signals that GTK+ widgets emit. 
  114.    --  Although many of these events result in corresponding signals being 
  115.    --  emitted, the events are often transformed or filtered along the way. 
  116.    -- 
  117.    --  In some language bindings, the values Gdk.Event.Gdk_2button_Press and 
  118.    --  Gdk.Event.Gdk_3button_Press would translate into something syntactically 
  119.    --  invalid (eg 'Gdk.EventType.2ButtonPress', where a symbol is not allowed 
  120.    --  to start with a number). In that case, the aliases 
  121.    --  GDK_DOUBLE_BUTTON_PRESS and GDK_TRIPLE_BUTTON_PRESS can be used instead. 
  122.  
  123.    for Gdk_Event_Type use ( 
  124.       Nothing => -1, 
  125.       Delete => 0, 
  126.       Destroy => 1, 
  127.       Expose => 2, 
  128.       Motion_Notify => 3, 
  129.       Button_Press => 4, 
  130.       Gdk_2button_Press => 5, 
  131.       Gdk_3button_Press => 6, 
  132.       Button_Release => 7, 
  133.       Key_Press => 8, 
  134.       Key_Release => 9, 
  135.       Enter_Notify => 10, 
  136.       Leave_Notify => 11, 
  137.       Focus_Change => 12, 
  138.       Configure => 13, 
  139.       Map => 14, 
  140.       Unmap => 15, 
  141.       Property_Notify => 16, 
  142.       Selection_Clear => 17, 
  143.       Selection_Request => 18, 
  144.       Selection_Notify => 19, 
  145.       Proximity_In => 20, 
  146.       Proximity_Out => 21, 
  147.       Drag_Enter => 22, 
  148.       Drag_Leave => 23, 
  149.       Drag_Motion => 24, 
  150.       Drag_Status => 25, 
  151.       Drop_Start => 26, 
  152.       Drop_Finished => 27, 
  153.       Client_Event => 28, 
  154.       Visibility_Notify => 29, 
  155.       Scroll => 31, 
  156.       Window_State => 32, 
  157.       Setting => 33, 
  158.       Owner_Change => 34, 
  159.       Grab_Broken => 35, 
  160.       Damage => 36, 
  161.       Touch_Begin => 37, 
  162.       Touch_Update => 38, 
  163.       Touch_End => 39, 
  164.       Touch_Cancel => 40); 
  165.  
  166.    type Gdk_Event_Mask is mod 2 ** Integer'Size; 
  167.    pragma Convention (C, Gdk_Event_Mask); 
  168.    --  A set of bit-flags to indicate which events a window is to receive. 
  169.    --  Most of these masks map onto one or more of the Gdk.Event.Gdk_Event_Type 
  170.    --  event types above. 
  171.    -- 
  172.    --  Gdk.Event.Pointer_Motion_Hint_Mask is a special mask which is used to 
  173.    --  reduce the number of Gdk.Event.Motion_Notify events received. Normally a 
  174.    --  Gdk.Event.Motion_Notify event is received each time the mouse moves. 
  175.    --  However, if the application spends a lot of time processing the event 
  176.    --  (updating the display, for example), it can lag behind the position of 
  177.    --  the mouse. When using Gdk.Event.Pointer_Motion_Hint_Mask, fewer 
  178.    --  Gdk.Event.Motion_Notify events will be sent, some of which are marked as 
  179.    --  a hint (the is_hint member is True). To receive more motion events after 
  180.    --  a motion hint event, the application needs to asks for more, by calling 
  181.    --  Gdk.Event.Request_Motions. 
  182.    -- 
  183.    --  If Gdk.Event.Touch_Mask is enabled, the window will receive touch 
  184.    --  events from touch-enabled devices. Those will come as sequences of 
  185.    --  Gdk.Event.Gdk_Event_Touch with type Gdk.Event.Touch_Update, enclosed by 
  186.    --  two events with type Gdk.Event.Touch_Begin and Gdk.Event.Touch_End (or 
  187.    --  Gdk.Event.Touch_Cancel). Gdk.Event.Get_Event_Sequence returns the event 
  188.    --  sequence for these events, so different sequences may be distinguished. 
  189.  
  190.    Exposure_Mask : constant Gdk_Event_Mask := 2; 
  191.    Pointer_Motion_Mask : constant Gdk_Event_Mask := 4; 
  192.    Pointer_Motion_Hint_Mask : constant Gdk_Event_Mask := 8; 
  193.    Button_Motion_Mask : constant Gdk_Event_Mask := 16; 
  194.    Button1_Motion_Mask : constant Gdk_Event_Mask := 32; 
  195.    Button2_Motion_Mask : constant Gdk_Event_Mask := 64; 
  196.    Button3_Motion_Mask : constant Gdk_Event_Mask := 128; 
  197.    Button_Press_Mask : constant Gdk_Event_Mask := 256; 
  198.    Button_Release_Mask : constant Gdk_Event_Mask := 512; 
  199.    Key_Press_Mask : constant Gdk_Event_Mask := 1024; 
  200.    Key_Release_Mask : constant Gdk_Event_Mask := 2048; 
  201.    Enter_Notify_Mask : constant Gdk_Event_Mask := 4096; 
  202.    Leave_Notify_Mask : constant Gdk_Event_Mask := 8192; 
  203.    Focus_Change_Mask : constant Gdk_Event_Mask := 16384; 
  204.    Structure_Mask : constant Gdk_Event_Mask := 32768; 
  205.    Property_Change_Mask : constant Gdk_Event_Mask := 65536; 
  206.    Visibility_Notify_Mask : constant Gdk_Event_Mask := 131072; 
  207.    Proximity_In_Mask : constant Gdk_Event_Mask := 262144; 
  208.    Proximity_Out_Mask : constant Gdk_Event_Mask := 524288; 
  209.    Substructure_Mask : constant Gdk_Event_Mask := 1048576; 
  210.    Scroll_Mask : constant Gdk_Event_Mask := 2097152; 
  211.    Touch_Mask : constant Gdk_Event_Mask := 4194304; 
  212.    Smooth_Scroll_Mask : constant Gdk_Event_Mask := 8388608; 
  213.    All_Events_Mask : constant Gdk_Event_Mask := 16777214; 
  214.  
  215.    type Gdk_Visibility_State is ( 
  216.       Visibility_Unobscured, 
  217.       Visibility_Partial, 
  218.       Visibility_Fully_Obscured); 
  219.    pragma Convention (C, Gdk_Visibility_State); 
  220.    --  Specifies the visiblity status of a window for a 
  221.    --  Gdk.Event.Gdk_Event_Visibility. 
  222.  
  223.    type Gdk_Scroll_Direction is ( 
  224.       Scroll_Up, 
  225.       Scroll_Down, 
  226.       Scroll_Left, 
  227.       Scroll_Right, 
  228.       Scroll_Smooth); 
  229.    pragma Convention (C, Gdk_Scroll_Direction); 
  230.    --  Specifies the direction for Gdk.Event.Gdk_Event_Scroll. 
  231.  
  232.    type Gdk_Notify_Type is ( 
  233.       Notify_Ancestor, 
  234.       Notify_Virtual, 
  235.       Notify_Inferior, 
  236.       Notify_Nonlinear, 
  237.       Notify_Nonlinear_Virtual, 
  238.       Notify_Unknown); 
  239.    pragma Convention (C, Gdk_Notify_Type); 
  240.    --  Specifies the kind of crossing for Gdk.Event.Gdk_Event_Crossing. 
  241.    -- 
  242.    --  See the X11 protocol specification of <type>LeaveNotify</type> for full 
  243.    --  details of crossing event generation. 
  244.  
  245.    type Gdk_Crossing_Mode is ( 
  246.       Crossing_Normal, 
  247.       Crossing_Grab, 
  248.       Crossing_Ungrab, 
  249.       Crossing_Gtk_Grab, 
  250.       Crossing_Gtk_Ungrab, 
  251.       Crossing_State_Changed, 
  252.       Crossing_Touch_Begin, 
  253.       Crossing_Touch_End, 
  254.       Crossing_Device_Switch); 
  255.    pragma Convention (C, Gdk_Crossing_Mode); 
  256.    --  Specifies the crossing mode for Gdk.Event.Gdk_Event_Crossing. 
  257.  
  258.    type Gdk_Property_State is ( 
  259.       Property_New_Value, 
  260.       Property_Delete); 
  261.    pragma Convention (C, Gdk_Property_State); 
  262.    --  Specifies the type of a property change for a 
  263.    --  Gdk.Event.Gdk_Event_Property. 
  264.  
  265.    type Gdk_Window_State is mod 2 ** Integer'Size; 
  266.    pragma Convention (C, Gdk_Window_State); 
  267.    --  Specifies the state of a toplevel window. 
  268.  
  269.    Window_State_Withdrawn : constant Gdk_Window_State := 1; 
  270.    Window_State_Iconified : constant Gdk_Window_State := 2; 
  271.    Window_State_Maximized : constant Gdk_Window_State := 4; 
  272.    Window_State_Sticky : constant Gdk_Window_State := 8; 
  273.    Window_State_Fullscreen : constant Gdk_Window_State := 16; 
  274.    Window_State_Above : constant Gdk_Window_State := 32; 
  275.    Window_State_Below : constant Gdk_Window_State := 64; 
  276.    Window_State_Focused : constant Gdk_Window_State := 128; 
  277.  
  278.    type Gdk_Setting_Action is ( 
  279.       Setting_Action_New, 
  280.       Setting_Action_Changed, 
  281.       Setting_Action_Deleted); 
  282.    pragma Convention (C, Gdk_Setting_Action); 
  283.    --  Specifies the kind of modification applied to a setting in a 
  284.    --  Gdk.Event.Gdk_Event_Setting. 
  285.  
  286.    type Gdk_Owner_Change is ( 
  287.       Owner_Change_New_Owner, 
  288.       Owner_Change_Destroy, 
  289.       Owner_Change_Close); 
  290.    pragma Convention (C, Gdk_Owner_Change); 
  291.    --  Specifies why a selection ownership was changed. 
  292.  
  293.    type Gdk_Event_Any is record 
  294.       The_Type : Gdk_Event_Type; 
  295.       Window : Gdk.Gdk_Window; 
  296.       Send_Event : Gint8; 
  297.    end record; 
  298.    pragma Convention (C, Gdk_Event_Any); 
  299.  
  300.    function From_Object_Free (B : access Gdk_Event_Any) return Gdk_Event_Any; 
  301.    pragma Inline (From_Object_Free); 
  302.    --  Contains the fields which are common to all event structs. Any event 
  303.    --  pointer can safely be cast to a pointer to a Gdk.Event.Gdk_Event_Any to 
  304.    --  access these fields. 
  305.  
  306.    type Gdk_Event_Button is record 
  307.       The_Type : Gdk_Event_Type; 
  308.       Window : Gdk.Gdk_Window; 
  309.       Send_Event : Gint8; 
  310.       Time : Guint32; 
  311.       X : Gdouble; 
  312.       Y : Gdouble; 
  313.       Axes : access Gdouble; 
  314.       State : Gdk.Types.Gdk_Modifier_Type; 
  315.       Button : Guint; 
  316.       Device : System.Address; 
  317.       X_Root : Gdouble; 
  318.       Y_Root : Gdouble; 
  319.    end record; 
  320.    pragma Convention (C, Gdk_Event_Button); 
  321.  
  322.    function From_Object_Free (B : access Gdk_Event_Button) return Gdk_Event_Button; 
  323.    pragma Inline (From_Object_Free); 
  324.    --  Used for button press and button release events. The Type field will be 
  325.    --  one of Gdk.Event.Button_Press, Gdk.Event.Gdk_2button_Press, 
  326.    --  Gdk.Event.Gdk_3button_Press or Gdk.Event.Button_Release, 
  327.    -- 
  328.    --  Double and triple-clicks result in a sequence of events being received. 
  329.    --  For double-clicks the order of events will be: 
  330.    -- 
  331.    --     * Gdk.Event.Button_Press 
  332.    -- 
  333.    --     * Gdk.Event.Button_Release 
  334.    -- 
  335.    --     * Gdk.Event.Button_Press 
  336.    -- 
  337.    --     * Gdk.Event.Gdk_2button_Press 
  338.    -- 
  339.    --     * Gdk.Event.Button_Release 
  340.    -- 
  341.    --  Note that the first click is received just like a normal button press, 
  342.    --  while the second click results in a Gdk.Event.Gdk_2button_Press being 
  343.    --  received just after the Gdk.Event.Button_Press. 
  344.    -- 
  345.    --  Triple-clicks are very similar to double-clicks, except that 
  346.    --  Gdk.Event.Gdk_3button_Press is inserted after the third click. The order 
  347.    --  of the events is: 
  348.    -- 
  349.    --     * Gdk.Event.Button_Press 
  350.    -- 
  351.    --     * Gdk.Event.Button_Release 
  352.    -- 
  353.    --     * Gdk.Event.Button_Press 
  354.    -- 
  355.    --     * Gdk.Event.Gdk_2button_Press 
  356.    -- 
  357.    --     * Gdk.Event.Button_Release 
  358.    -- 
  359.    --     * Gdk.Event.Button_Press 
  360.    -- 
  361.    --     * Gdk.Event.Gdk_3button_Press 
  362.    -- 
  363.    --     * Gdk.Event.Button_Release 
  364.    -- 
  365.    --  For a double click to occur, the second button press must occur within 
  366.    --  1/4 of a second of the first. For a triple click to occur, the third 
  367.    --  button press must also occur within 1/2 second of the first button 
  368.    --  press. 
  369.  
  370.    type Gdk_Event_Expose is record 
  371.       The_Type : Gdk_Event_Type; 
  372.       Window : Gdk.Gdk_Window; 
  373.       Send_Event : Gint8; 
  374.       Area : Gdk.Rectangle.Gdk_Rectangle; 
  375.       Region : Cairo.Region.Cairo_Region; 
  376.       Count : Gint; 
  377.    end record; 
  378.    pragma Convention (C, Gdk_Event_Expose); 
  379.  
  380.    function From_Object_Free (B : access Gdk_Event_Expose) return Gdk_Event_Expose; 
  381.    pragma Inline (From_Object_Free); 
  382.    --  Generated when all or part of a window becomes visible and needs to be 
  383.    --  redrawn. 
  384.  
  385.    type Gdk_Event_Visibility is record 
  386.       The_Type : Gdk_Event_Type; 
  387.       Window : Gdk.Gdk_Window; 
  388.       Send_Event : Gint8; 
  389.       State : Gdk_Visibility_State; 
  390.    end record; 
  391.    pragma Convention (C, Gdk_Event_Visibility); 
  392.  
  393.    function From_Object_Free (B : access Gdk_Event_Visibility) return Gdk_Event_Visibility; 
  394.    pragma Inline (From_Object_Free); 
  395.    --  Generated when the window visibility status has changed. 
  396.  
  397.    type Gdk_Event_Motion is record 
  398.       The_Type : Gdk_Event_Type; 
  399.       Window : Gdk.Gdk_Window; 
  400.       Send_Event : Gint8; 
  401.       Time : Guint32; 
  402.       X : Gdouble; 
  403.       Y : Gdouble; 
  404.       Axes : access Gdouble; 
  405.       State : Gdk.Types.Gdk_Modifier_Type; 
  406.       Is_Hint : Gint16; 
  407.       Device : System.Address; 
  408.       X_Root : Gdouble; 
  409.       Y_Root : Gdouble; 
  410.    end record; 
  411.    pragma Convention (C, Gdk_Event_Motion); 
  412.  
  413.    function From_Object_Free (B : access Gdk_Event_Motion) return Gdk_Event_Motion; 
  414.    pragma Inline (From_Object_Free); 
  415.    --  Generated when the pointer moves. 
  416.  
  417.    type Gdk_Event_Scroll is record 
  418.       The_Type : Gdk_Event_Type; 
  419.       Window : Gdk.Gdk_Window; 
  420.       Send_Event : Gint8; 
  421.       Time : Guint32; 
  422.       X : Gdouble; 
  423.       Y : Gdouble; 
  424.       State : Gdk.Types.Gdk_Modifier_Type; 
  425.       Direction : Gdk_Scroll_Direction; 
  426.       Device : System.Address; 
  427.       X_Root : Gdouble; 
  428.       Y_Root : Gdouble; 
  429.       Delta_X : Gdouble; 
  430.       Delta_Y : Gdouble; 
  431.    end record; 
  432.    pragma Convention (C, Gdk_Event_Scroll); 
  433.  
  434.    function From_Object_Free (B : access Gdk_Event_Scroll) return Gdk_Event_Scroll; 
  435.    pragma Inline (From_Object_Free); 
  436.    --  Generated from button presses for the buttons 4 to 7. Wheel mice are 
  437.    --  usually configured to generate button press events for buttons 4 and 5 
  438.    --  when the wheel is turned. 
  439.    -- 
  440.    --  Some GDK backends can also generate 'smooth' scroll events, which can 
  441.    --  be recognized by the Gdk.Event.Scroll_Smooth scroll direction. For 
  442.    --  these, the scroll deltas can be obtained with 
  443.    --  Gdk.Event.Get_Scroll_Deltas. 
  444.  
  445.    type Gdk_Event_Key is record 
  446.       The_Type : Gdk_Event_Type; 
  447.       Window : Gdk.Gdk_Window; 
  448.       Send_Event : Gint8; 
  449.       Time : Guint32; 
  450.       State : Gdk.Types.Gdk_Modifier_Type; 
  451.       Keyval : Gdk.Types.Gdk_Key_Type; 
  452.       Length : Gint; 
  453.       String : Interfaces.C.Strings.chars_ptr; 
  454.       Hardware_Keycode : Guint16; 
  455.       Group : Guint8; 
  456.       Is_Modifier : Guint; 
  457.    end record; 
  458.    pragma Convention (C, Gdk_Event_Key); 
  459.  
  460.    function From_Object_Free (B : access Gdk_Event_Key) return Gdk_Event_Key; 
  461.    pragma Inline (From_Object_Free); 
  462.    --  Describes a key press or key release event. 
  463.  
  464.    type Gdk_Event_Crossing is record 
  465.       The_Type : Gdk_Event_Type; 
  466.       Window : Gdk.Gdk_Window; 
  467.       Send_Event : Gint8; 
  468.       Subwindow : Gdk.Gdk_Window; 
  469.       Time : Guint32; 
  470.       X : Gdouble; 
  471.       Y : Gdouble; 
  472.       X_Root : Gdouble; 
  473.       Y_Root : Gdouble; 
  474.       Mode : Gdk_Crossing_Mode; 
  475.       Detail : Gdk_Notify_Type; 
  476.       Focus : Boolean; 
  477.       State : Gdk.Types.Gdk_Modifier_Type; 
  478.    end record; 
  479.    pragma Convention (C, Gdk_Event_Crossing); 
  480.  
  481.    function From_Object_Free (B : access Gdk_Event_Crossing) return Gdk_Event_Crossing; 
  482.    pragma Inline (From_Object_Free); 
  483.    --  Generated when the pointer enters or leaves a window. 
  484.  
  485.    type Gdk_Event_Focus is record 
  486.       The_Type : Gdk_Event_Type; 
  487.       Window : Gdk.Gdk_Window; 
  488.       Send_Event : Gint8; 
  489.       Gtk_In : Gint16; 
  490.    end record; 
  491.    pragma Convention (C, Gdk_Event_Focus); 
  492.  
  493.    function From_Object_Free (B : access Gdk_Event_Focus) return Gdk_Event_Focus; 
  494.    pragma Inline (From_Object_Free); 
  495.    --  Describes a change of keyboard focus. 
  496.  
  497.    type Gdk_Event_Configure is record 
  498.       The_Type : Gdk_Event_Type; 
  499.       Window : Gdk.Gdk_Window; 
  500.       Send_Event : Gint8; 
  501.       X : Gint; 
  502.       Y : Gint; 
  503.       Width : Gint; 
  504.       Height : Gint; 
  505.    end record; 
  506.    pragma Convention (C, Gdk_Event_Configure); 
  507.  
  508.    function From_Object_Free (B : access Gdk_Event_Configure) return Gdk_Event_Configure; 
  509.    pragma Inline (From_Object_Free); 
  510.    --  Generated when a window size or position has changed. 
  511.  
  512.    type Gdk_Event_Property is record 
  513.       The_Type : Gdk_Event_Type; 
  514.       Window : Gdk.Gdk_Window; 
  515.       Send_Event : Gint8; 
  516.       Atom : Gdk.Types.Gdk_Atom; 
  517.       Time : Guint32; 
  518.       State : Gdk_Property_State; 
  519.    end record; 
  520.    pragma Convention (C, Gdk_Event_Property); 
  521.  
  522.    function From_Object_Free (B : access Gdk_Event_Property) return Gdk_Event_Property; 
  523.    pragma Inline (From_Object_Free); 
  524.    --  Describes a property change on a window. 
  525.  
  526.    type Gdk_Event_Selection is record 
  527.       The_Type : Gdk_Event_Type; 
  528.       Window : Gdk.Gdk_Window; 
  529.       Send_Event : Gint8; 
  530.       Selection : Gdk.Types.Gdk_Atom; 
  531.       Target : Gdk.Types.Gdk_Atom; 
  532.       Property : Gdk.Types.Gdk_Atom; 
  533.       Time : Guint32; 
  534.       Requestor : Gdk.Gdk_Window; 
  535.    end record; 
  536.    pragma Convention (C, Gdk_Event_Selection); 
  537.  
  538.    function From_Object_Free (B : access Gdk_Event_Selection) return Gdk_Event_Selection; 
  539.    pragma Inline (From_Object_Free); 
  540.    --  Generated when a selection is requested or ownership of a selection is 
  541.    --  taken over by another client application. 
  542.  
  543.    type Gdk_Event_Owner_Change is record 
  544.       The_Type : Gdk_Event_Type; 
  545.       Window : Gdk.Gdk_Window; 
  546.       Send_Event : Gint8; 
  547.       Owner : Gdk.Gdk_Window; 
  548.       Reason : Gdk_Owner_Change; 
  549.       Selection : Gdk.Types.Gdk_Atom; 
  550.       Time : Guint32; 
  551.       Selection_Time : Guint32; 
  552.    end record; 
  553.    pragma Convention (C, Gdk_Event_Owner_Change); 
  554.  
  555.    function From_Object_Free (B : access Gdk_Event_Owner_Change) return Gdk_Event_Owner_Change; 
  556.    pragma Inline (From_Object_Free); 
  557.    --  Generated when the owner of a selection changes. On X11, this 
  558.    --  information is only available if the X server supports the XFIXES 
  559.    --  extension. 
  560.  
  561.    type Gdk_Event_Proximity is record 
  562.       The_Type : Gdk_Event_Type; 
  563.       Window : Gdk.Gdk_Window; 
  564.       Send_Event : Gint8; 
  565.       Time : Guint32; 
  566.       Device : System.Address; 
  567.    end record; 
  568.    pragma Convention (C, Gdk_Event_Proximity); 
  569.  
  570.    function From_Object_Free (B : access Gdk_Event_Proximity) return Gdk_Event_Proximity; 
  571.    pragma Inline (From_Object_Free); 
  572.    --  Proximity events are generated when using GDK's wrapper for the XInput 
  573.    --  extension. The XInput extension is an add-on for standard X that allows 
  574.    --  you to use nonstandard devices such as graphics tablets. A proximity 
  575.    --  event indicates that the stylus has moved in or out of contact with the 
  576.    --  tablet, or perhaps that the user's finger has moved in or out of contact 
  577.    --  with a touch screen. 
  578.    -- 
  579.    --  This event type will be used pretty rarely. It only is important for 
  580.    --  XInput aware programs that are drawing their own cursor. 
  581.  
  582.    type Gdk_Event_DND is record 
  583.       The_Type : Gdk_Event_Type; 
  584.       Window : Gdk.Gdk_Window; 
  585.       Send_Event : Gint8; 
  586.       Context : System.Address; 
  587.       Time : Guint32; 
  588.       X_Root : Gshort; 
  589.       Y_Root : Gshort; 
  590.    end record; 
  591.    pragma Convention (C, Gdk_Event_DND); 
  592.  
  593.    function From_Object_Free (B : access Gdk_Event_DND) return Gdk_Event_DND; 
  594.    pragma Inline (From_Object_Free); 
  595.    --  Generated during DND operations. 
  596.  
  597.    type Gdk_Event_Window_State is record 
  598.       The_Type : Gdk_Event_Type; 
  599.       Window : Gdk.Gdk_Window; 
  600.       Send_Event : Gint8; 
  601.       Changed_Mask : Gdk_Window_State; 
  602.       New_Window_State : Gdk_Window_State; 
  603.    end record; 
  604.    pragma Convention (C, Gdk_Event_Window_State); 
  605.  
  606.    function From_Object_Free (B : access Gdk_Event_Window_State) return Gdk_Event_Window_State; 
  607.    pragma Inline (From_Object_Free); 
  608.    --  Generated when the state of a toplevel window changes. 
  609.  
  610.    type Gdk_Event_Setting is record 
  611.       The_Type : Gdk_Event_Type; 
  612.       Window : Gdk.Gdk_Window; 
  613.       Send_Event : Gint8; 
  614.       Action : Gdk_Setting_Action; 
  615.       Name : Interfaces.C.Strings.chars_ptr; 
  616.    end record; 
  617.    pragma Convention (C, Gdk_Event_Setting); 
  618.  
  619.    function From_Object_Free (B : access Gdk_Event_Setting) return Gdk_Event_Setting; 
  620.    pragma Inline (From_Object_Free); 
  621.    --  Generated when a setting is modified. 
  622.  
  623.    type Gdk_Event_Touch is record 
  624.       The_Type : Gdk_Event_Type; 
  625.       Window : Gdk.Gdk_Window; 
  626.       Send_Event : Gint8; 
  627.       Time : Guint32; 
  628.       X : Gdouble; 
  629.       Y : Gdouble; 
  630.       Axes : access Gdouble; 
  631.       State : Gdk.Types.Gdk_Modifier_Type; 
  632.       Sequence : System.Address; 
  633.       Emulating_Pointer : Boolean; 
  634.       Device : System.Address; 
  635.       X_Root : Gdouble; 
  636.       Y_Root : Gdouble; 
  637.    end record; 
  638.    pragma Convention (C, Gdk_Event_Touch); 
  639.  
  640.    function From_Object_Free (B : access Gdk_Event_Touch) return Gdk_Event_Touch; 
  641.    pragma Inline (From_Object_Free); 
  642.    --  Used for touch events. Type field will be one of Gdk.Event.Touch_Begin, 
  643.    --  Gdk.Event.Touch_Update, Gdk.Event.Touch_End or Gdk.Event.Touch_Cancel. 
  644.    -- 
  645.    --  Touch events are grouped into sequences by means of the Sequence field, 
  646.    --  which can also be obtained with Gdk.Event.Get_Event_Sequence. Each 
  647.    --  sequence begins with a Gdk.Event.Touch_Begin event, followed by any 
  648.    --  number of Gdk.Event.Touch_Update events, and ends with a 
  649.    --  Gdk.Event.Touch_End (or Gdk.Event.Touch_Cancel) event. With multitouch 
  650.    --  devices, there may be several active sequences at the same time. 
  651.  
  652.    type Gdk_Event_Sequence is new Glib.C_Proxy; 
  653.    function From_Object_Free (B : access Gdk_Event_Sequence) return Gdk_Event_Sequence; 
  654.    pragma Inline (From_Object_Free); 
  655.  
  656.  
  657.    type Gdk_Event_Grab_Broken is record 
  658.       The_Type : Gdk_Event_Type; 
  659.       Window : Gdk.Gdk_Window; 
  660.       Send_Event : Gint8; 
  661.       Keyboard : Boolean; 
  662.       Implicit : Boolean; 
  663.       Grab_Window : Gdk.Gdk_Window; 
  664.    end record; 
  665.    pragma Convention (C, Gdk_Event_Grab_Broken); 
  666.  
  667.    function From_Object_Free (B : access Gdk_Event_Grab_Broken) return Gdk_Event_Grab_Broken; 
  668.    pragma Inline (From_Object_Free); 
  669.    --  Generated when a pointer or keyboard grab is broken. On X11, this 
  670.    --  happens when the grab window becomes unviewable (i.e. it or one of its 
  671.    --  ancestors is unmapped), or if the same application grabs the pointer or 
  672.    --  keyboard again. Note that implicit grabs (which are initiated by button 
  673.    --  presses) can also cause Gdk.Event.Gdk_Event_Grab_Broken events. 
  674.  
  675.    type Gdk_Event_Record (The_Type : Gdk_Event_Type := Gdk.Event.Nothing) is record 
  676.       case The_Type is 
  677.  
  678.          when Gdk.Event.Nothing 
  679.          | Gdk.Event.Delete 
  680.          | Gdk.Event.Destroy 
  681.          | Gdk.Event.Map 
  682.          | Gdk.Event.Unmap 
  683.          | Gdk.Event.Client_Event => 
  684.          Any : Gdk_Event_Any; 
  685.  
  686.          when Gdk.Event.Expose 
  687.          | Gdk.Event.Damage => 
  688.          Expose : Gdk_Event_Expose; 
  689.  
  690.          when Gdk.Event.Visibility_Notify => 
  691.          Visibility : Gdk_Event_Visibility; 
  692.  
  693.          when Gdk.Event.Motion_Notify => 
  694.          Motion : Gdk_Event_Motion; 
  695.  
  696.          when Gdk.Event.Button_Press 
  697.          | Gdk.Event.Gdk_2button_Press 
  698.          | Gdk.Event.Gdk_3button_Press 
  699.          | Gdk.Event.Button_Release => 
  700.          Button : Gdk_Event_Button; 
  701.  
  702.          when Gdk.Event.Touch_Begin 
  703.          | Gdk.Event.Touch_Update 
  704.          | Gdk.Event.Touch_End 
  705.          | Gdk.Event.Touch_Cancel => 
  706.          Touch : Gdk_Event_Touch; 
  707.  
  708.          when Gdk.Event.Scroll => 
  709.          Scroll : Gdk_Event_Scroll; 
  710.  
  711.          when Gdk.Event.Key_Press 
  712.          | Gdk.Event.Key_Release => 
  713.          Key : Gdk_Event_Key; 
  714.  
  715.          when Gdk.Event.Enter_Notify 
  716.          | Gdk.Event.Leave_Notify => 
  717.          Crossing : Gdk_Event_Crossing; 
  718.  
  719.          when Gdk.Event.Focus_Change => 
  720.          Focus_Change : Gdk_Event_Focus; 
  721.  
  722.          when Gdk.Event.Configure => 
  723.          Configure : Gdk_Event_Configure; 
  724.  
  725.          when Gdk.Event.Property_Notify => 
  726.          Property : Gdk_Event_Property; 
  727.  
  728.          when Gdk.Event.Selection_Clear 
  729.          | Gdk.Event.Selection_Request 
  730.          | Gdk.Event.Selection_Notify => 
  731.          Selection : Gdk_Event_Selection; 
  732.  
  733.          when Gdk.Event.Owner_Change => 
  734.          Owner_Change : Gdk_Event_Owner_Change; 
  735.  
  736.          when Gdk.Event.Proximity_In 
  737.          | Gdk.Event.Proximity_Out => 
  738.          Proximity : Gdk_Event_Proximity; 
  739.  
  740.          when Gdk.Event.Drag_Enter 
  741.          | Gdk.Event.Drag_Leave 
  742.          | Gdk.Event.Drag_Motion 
  743.          | Gdk.Event.Drag_Status 
  744.          | Gdk.Event.Drop_Start 
  745.          | Gdk.Event.Drop_Finished => 
  746.          Dnd : Gdk_Event_DND; 
  747.  
  748.          when Gdk.Event.Window_State => 
  749.          Window_State : Gdk_Event_Window_State; 
  750.  
  751.          when Gdk.Event.Setting => 
  752.          Setting : Gdk_Event_Setting; 
  753.  
  754.          when Gdk.Event.Grab_Broken => 
  755.          Grab_Broken : Gdk_Event_Grab_Broken; 
  756.       end case; 
  757.    end record; 
  758.    pragma Convention (C, Gdk_Event_Record); 
  759.    pragma Unchecked_Union(Gdk_Event_Record); 
  760.  
  761.    function From_Object_Free (B : access Gdk_Event_Record) return Gdk_Event_Record; 
  762.    pragma Inline (From_Object_Free); 
  763.    --  The Gdk.Event.Gdk_Event struct contains a union of all of the event 
  764.    --  structs, and allows access to the data fields in a number of ways. 
  765.    -- 
  766.    --  The event type is always the first field in all of the event structs, 
  767.    --  and can always be accessed with the following code, no matter what type 
  768.    --  of event it is: 
  769.    -- 
  770.    --    GdkEvent *event; 
  771.    --    GdkEventType type; 
  772.    --    type = event->type; 
  773.    -- 
  774.    --  To access other fields of the event structs, the pointer to the event 
  775.    --  can be cast to the appropriate event struct pointer, or the union member 
  776.    --  name can be used. For example if the event type is 
  777.    --  Gdk.Event.Button_Press then the x coordinate of the button press can be 
  778.    --  accessed with: 
  779.    -- 
  780.    --    GdkEvent *event; 
  781.    --    gdouble x; 
  782.    --    x = ((GdkEventButton*)event)->x; 
  783.    -- 
  784.    --  or: 
  785.    -- 
  786.    --    GdkEvent *event; 
  787.    --    gdouble x; 
  788.    --    x = event->button.x; 
  789.    -- 
  790.  
  791.    type Gdk_Event is access all Gdk_Event_Record; 
  792.    pragma No_Strict_Aliasing (Gdk_Event); 
  793.  
  794.    --------------- 
  795.    -- Callbacks -- 
  796.    --------------- 
  797.  
  798.    type Gdk_Event_Func is access procedure (Event : Gdk_Event); 
  799.    --  Specifies the type of function passed to Gdk.Event.Handler_Set to 
  800.    --  handle all GDK events. 
  801.    --  "event": the Gdk.Event.Gdk_Event to process. 
  802.  
  803.    ---------------------------- 
  804.    -- Enumeration Properties -- 
  805.    ---------------------------- 
  806.  
  807.    package Gdk_Event_Type_Properties is 
  808.       new Generic_Internal_Discrete_Property (Gdk_Event_Type); 
  809.    type Property_Gdk_Event_Type is new Gdk_Event_Type_Properties.Property; 
  810.  
  811.    package Gdk_Event_Mask_Properties is 
  812.       new Generic_Internal_Discrete_Property (Gdk_Event_Mask); 
  813.    type Property_Gdk_Event_Mask is new Gdk_Event_Mask_Properties.Property; 
  814.  
  815.    package Gdk_Visibility_State_Properties is 
  816.       new Generic_Internal_Discrete_Property (Gdk_Visibility_State); 
  817.    type Property_Gdk_Visibility_State is new Gdk_Visibility_State_Properties.Property; 
  818.  
  819.    package Gdk_Scroll_Direction_Properties is 
  820.       new Generic_Internal_Discrete_Property (Gdk_Scroll_Direction); 
  821.    type Property_Gdk_Scroll_Direction is new Gdk_Scroll_Direction_Properties.Property; 
  822.  
  823.    package Gdk_Notify_Type_Properties is 
  824.       new Generic_Internal_Discrete_Property (Gdk_Notify_Type); 
  825.    type Property_Gdk_Notify_Type is new Gdk_Notify_Type_Properties.Property; 
  826.  
  827.    package Gdk_Crossing_Mode_Properties is 
  828.       new Generic_Internal_Discrete_Property (Gdk_Crossing_Mode); 
  829.    type Property_Gdk_Crossing_Mode is new Gdk_Crossing_Mode_Properties.Property; 
  830.  
  831.    package Gdk_Property_State_Properties is 
  832.       new Generic_Internal_Discrete_Property (Gdk_Property_State); 
  833.    type Property_Gdk_Property_State is new Gdk_Property_State_Properties.Property; 
  834.  
  835.    package Gdk_Window_State_Properties is 
  836.       new Generic_Internal_Discrete_Property (Gdk_Window_State); 
  837.    type Property_Gdk_Window_State is new Gdk_Window_State_Properties.Property; 
  838.  
  839.    package Gdk_Setting_Action_Properties is 
  840.       new Generic_Internal_Discrete_Property (Gdk_Setting_Action); 
  841.    type Property_Gdk_Setting_Action is new Gdk_Setting_Action_Properties.Property; 
  842.  
  843.    package Gdk_Owner_Change_Properties is 
  844.       new Generic_Internal_Discrete_Property (Gdk_Owner_Change); 
  845.    type Property_Gdk_Owner_Change is new Gdk_Owner_Change_Properties.Property; 
  846.  
  847.    ------------------ 
  848.    -- Constructors -- 
  849.    ------------------ 
  850.  
  851.    procedure Gdk_New (Event : out Gdk_Event; The_Type : Gdk_Event_Type); 
  852.    --  Creates a new event of the given type. All fields are set to 0. 
  853.    --  Since: gtk+ 2.2 
  854.    --  "type": a Gdk.Event.Gdk_Event_Type 
  855.  
  856.    function Gdk_Event_New (The_Type : Gdk_Event_Type) return Gdk_Event; 
  857.    --  Creates a new event of the given type. All fields are set to 0. 
  858.    --  Since: gtk+ 2.2 
  859.    --  "type": a Gdk.Event.Gdk_Event_Type 
  860.  
  861.    function Get_Type return Glib.GType; 
  862.    pragma Import (C, Get_Type, "gdk_event_get_type"); 
  863.  
  864.    ------------- 
  865.    -- Methods -- 
  866.    ------------- 
  867.  
  868.    function Get_Angle 
  869.       (Event  : Gdk_Event; 
  870.        Event2 : Gdk_Event; 
  871.        Angle  : access Gdouble) return Boolean; 
  872.    --  If both events contain X/Y information, this function will return True 
  873.    --  and return in Angle the relative angle from Event1 to Event2. The 
  874.    --  rotation direction for positive angles is from the positive X axis 
  875.    --  towards the positive Y axis. 
  876.    --  Since: gtk+ 3.0 
  877.    --  "event2": second Gdk.Event.Gdk_Event 
  878.    --  "angle": return location for the relative angle between both events 
  879.  
  880.    function Get_Center 
  881.       (Event  : Gdk_Event; 
  882.        Event2 : Gdk_Event; 
  883.        X      : access Gdouble; 
  884.        Y      : access Gdouble) return Boolean; 
  885.    --  If both events contain X/Y information, the center of both coordinates 
  886.    --  will be returned in X and Y. 
  887.    --  Since: gtk+ 3.0 
  888.    --  "event2": second Gdk.Event.Gdk_Event 
  889.    --  "x": return location for the X coordinate of the center 
  890.    --  "y": return location for the Y coordinate of the center 
  891.  
  892.    function Get_Distance 
  893.       (Event    : Gdk_Event; 
  894.        Event2   : Gdk_Event; 
  895.        Distance : access Gdouble) return Boolean; 
  896.    --  If both events have X/Y information, the distance between both 
  897.    --  coordinates (as in a straight line going from Event1 to Event2) will be 
  898.    --  returned. 
  899.    --  Since: gtk+ 3.0 
  900.    --  "event2": second Gdk.Event.Gdk_Event 
  901.    --  "distance": return location for the distance 
  902.  
  903.    function Copy (Event : Gdk_Event) return Gdk_Event; 
  904.    pragma Import (C, Copy, "gdk_event_copy"); 
  905.    --  Copies a Gdk.Event.Gdk_Event, copying or incrementing the reference 
  906.    --  count of the resources associated with it (e.g. Gdk.Gdk_Window's and 
  907.    --  strings). 
  908.  
  909.    procedure Free (Event : Gdk_Event); 
  910.    pragma Import (C, Free, "gdk_event_free"); 
  911.    --  Frees a Gdk.Event.Gdk_Event, freeing or decrementing any resources 
  912.    --  associated with it. Note that this function should only be called with 
  913.    --  events returned from functions such as Gdk.Event.Peek, Gdk.Event.Get, 
  914.    --  Gdk.Event.Copy and gdk_event_new. 
  915.  
  916.    procedure Get_Axis 
  917.       (Event    : Gdk_Event; 
  918.        Axis_Use : Gdk_Axis_Use; 
  919.        Value    : out Gdouble); 
  920.    pragma Import (C, Get_Axis, "gdk_event_get_axis"); 
  921.    --  Extract the axis value for a particular axis use from an event 
  922.    --  structure. 
  923.    --  "axis_use": the axis use to look for 
  924.    --  "value": location to store the value found 
  925.  
  926.    procedure Get_Coords 
  927.       (Event : Gdk_Event; 
  928.        X_Win : out Gdouble; 
  929.        Y_Win : out Gdouble); 
  930.    pragma Import (C, Get_Coords, "gdk_event_get_coords"); 
  931.    --  Extract the event window relative x/y coordinates from an event. 
  932.    --  "x_win": location to put event window x coordinate 
  933.    --  "y_win": location to put event window y coordinate 
  934.  
  935.    function Get_Event_Sequence (Event : Gdk_Event) return System.Address; 
  936.    pragma Import (C, Get_Event_Sequence, "gdk_event_get_event_sequence"); 
  937.    --  If Event if of type Gdk.Event.Touch_Begin, Gdk.Event.Touch_Update, 
  938.    --  Gdk.Event.Touch_End or Gdk.Event.Touch_Cancel, returns the 
  939.    --  Gdk.Event.Gdk_Event_Sequence to which the event belongs. Otherwise, 
  940.    --  return null. 
  941.    --  Since: gtk+ 3.4 
  942.  
  943.    procedure Get_Root_Coords 
  944.       (Event  : Gdk_Event; 
  945.        X_Root : out Gdouble; 
  946.        Y_Root : out Gdouble); 
  947.    pragma Import (C, Get_Root_Coords, "gdk_event_get_root_coords"); 
  948.    --  Extract the root window relative x/y coordinates from an event. 
  949.    --  "x_root": location to put root window x coordinate 
  950.    --  "y_root": location to put root window y coordinate 
  951.  
  952.    procedure Get_Scroll_Deltas 
  953.       (Event   : Gdk_Event; 
  954.        Delta_X : out Gdouble; 
  955.        Delta_Y : out Gdouble); 
  956.    pragma Import (C, Get_Scroll_Deltas, "gdk_event_get_scroll_deltas"); 
  957.    --  Retrieves the scroll deltas from a Gdk.Event.Gdk_Event 
  958.    --  Since: gtk+ 3.4 
  959.    --  "delta_x": return location for X delta 
  960.    --  "delta_y": return location for Y delta 
  961.  
  962.    procedure Get_Scroll_Direction 
  963.       (Event     : Gdk_Event; 
  964.        Direction : out Gdk_Scroll_Direction); 
  965.    pragma Import (C, Get_Scroll_Direction, "gdk_event_get_scroll_direction"); 
  966.    --  Extracts the scroll direction from an event. 
  967.    --  Since: gtk+ 3.2 
  968.    --  "direction": location to store the scroll direction 
  969.  
  970.    function Get_Time (Event : Gdk_Event) return Guint32; 
  971.    pragma Import (C, Get_Time, "gdk_event_get_time"); 
  972.    --  Returns the time stamp from Event, if there is one; otherwise returns 
  973.    --  GDK_CURRENT_TIME. If Event is null, returns GDK_CURRENT_TIME. 
  974.  
  975.    procedure Put (Event : Gdk_Event); 
  976.    pragma Import (C, Put, "gdk_event_put"); 
  977.    --  Appends a copy of the given event onto the front of the event queue for 
  978.    --  event->any.window's display, or the default event queue if 
  979.    --  event->any.window is null. See Gdk.Display.Put_Event. 
  980.  
  981.    function Triggers_Context_Menu (Event : Gdk_Event) return Boolean; 
  982.    --  This function returns whether a Gdk.Event.Gdk_Event_Button should 
  983.    --  trigger a context menu, according to platform conventions. The right 
  984.    --  mouse button always triggers context menus. Additionally, if 
  985.    --  gdk_keymap_get_modifier_mask returns a non-0 mask for 
  986.    --  GDK_MODIFIER_INTENT_CONTEXT_MENU, then the left mouse button will also 
  987.    --  trigger a context menu if this modifier is pressed. 
  988.    --  This function should always be used instead of simply checking for 
  989.    --  event->button == GDK_BUTTON_SECONDARY. 
  990.    --  Since: gtk+ 3.4 
  991.  
  992.    function Get_Button (Event : Gdk_Event) return Guint; 
  993.    pragma Import (C, Get_Button, "ada_gdk_event_get_button"); 
  994.    --  Extract the button number from an event 
  995.  
  996.    function Get_State (Event : Gdk_Event) return Gdk.Types.Gdk_Modifier_Type; 
  997.    pragma Import (C, Get_State, "ada_gdk_event_get_state"); 
  998.    --  State of the mouse buttons and keyboard keys just prior to the event 
  999.  
  1000.    function Get_Key_Val (Event : Gdk_Event) return Gdk.Types.Gdk_Key_Type; 
  1001.    pragma Import (C, Get_Key_Val, "ada_gdk_event_get_keyval"); 
  1002.    --  Code of the key that was pressed (and that generated the event) 
  1003.  
  1004.    function Get_Keycode (Event : Gdk_Event) return Guint; 
  1005.    pragma Import (C, Get_Keycode, "ada_gdk_event_get_keycode"); 
  1006.    --  Hardware key code of the key that was pressed 
  1007.  
  1008.    function Get_Event_Type (Event : Gdk_Event) return Gdk_Event_Type; 
  1009.    pragma Import (C, Get_Event_Type, "ada_gdk_event_get_event_type"); 
  1010.    --  The type of the event 
  1011.  
  1012.    function Get_Window (Event : Gdk_Event) return Gdk.Gdk_Window; 
  1013.    pragma Import (C, Get_Window, "ada_gdk_event_get_window"); 
  1014.    --  The window to which the event was sent 
  1015.  
  1016.    procedure Handler_Set 
  1017.       (Func   : Gdk_Event_Func; 
  1018.        Notify : Glib.G_Destroy_Notify_Address); 
  1019.    --  Sets the function to call to handle all events from GDK. 
  1020.    --  Note that GTK+ uses this to install its own event handler, so it is 
  1021.    --  usually not useful for GTK+ applications. (Although an application can 
  1022.    --  call this function then call Gtk.Main.Main_Do_Event to pass events to 
  1023.    --  GTK+.) 
  1024.    --  "func": the function to call to handle events from GDK. 
  1025.    --  "notify": the function to call when the handler function is removed, 
  1026.    --  i.e. when Gdk.Event.Handler_Set is called with another event handler. 
  1027.  
  1028.    generic 
  1029.       type User_Data_Type (<>) is private; 
  1030.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  1031.    package Handler_Set_User_Data is 
  1032.  
  1033.       type Gdk_Event_Func is access procedure (Event : Gdk.Event.Gdk_Event; Data : User_Data_Type); 
  1034.       --  Specifies the type of function passed to Gdk.Event.Handler_Set to 
  1035.       --  handle all GDK events. 
  1036.       --  "event": the Gdk.Event.Gdk_Event to process. 
  1037.       --  "data": user data set when the event handler was installed with 
  1038.       --  Gdk.Event.Handler_Set. 
  1039.  
  1040.       procedure Handler_Set 
  1041.          (Func   : Gdk_Event_Func; 
  1042.           Data   : User_Data_Type; 
  1043.           Notify : Glib.G_Destroy_Notify_Address); 
  1044.       --  Sets the function to call to handle all events from GDK. 
  1045.       --  Note that GTK+ uses this to install its own event handler, so it is 
  1046.       --  usually not useful for GTK+ applications. (Although an application 
  1047.       --  can call this function then call Gtk.Main.Main_Do_Event to pass 
  1048.       --  events to GTK+.) 
  1049.       --  "func": the function to call to handle events from GDK. 
  1050.       --  "data": user data to pass to the function. 
  1051.       --  "notify": the function to call when the handler function is removed, 
  1052.       --  i.e. when Gdk.Event.Handler_Set is called with another event handler. 
  1053.  
  1054.    end Handler_Set_User_Data; 
  1055.  
  1056.    ---------------------- 
  1057.    -- GtkAda additions -- 
  1058.    ---------------------- 
  1059.  
  1060.    Double_Button_Press : constant Gdk_Event_Type := Gdk_2button_Press; 
  1061.    Triple_Button_Press : constant Gdk_Event_Type := Gdk_3button_Press; 
  1062.  
  1063.    function From_Address (C : System.Address) return Gdk_Event; 
  1064.    --  Convert a C handler to the matching Event structure. 
  1065.  
  1066.    function To_Address (C : Gdk_Event) return System.Address; 
  1067.    --  Convert an event to the underlying C handler. 
  1068.  
  1069.    function Get_Event (Value : Glib.Values.GValue) return Gdk_Event; 
  1070.    --  Convert a value into a Gdk_Event. 
  1071.  
  1072.    function To_Event (Event : access Gdk_Event_Button) return Gdk_Event; 
  1073.    function To_Event (Event : access Gdk_Event_Key) return Gdk_Event; 
  1074.    --  Cast Event into a Gdk_Event, which can be used to call some of 
  1075.    --  subprograms in the API. The return value is a pointer to Event, 
  1076.    --  which should therefore remain valid as long as the pointer is in 
  1077.    --  use. 
  1078.  
  1079.    ------------------------------- 
  1080.    -- Some constants used below -- 
  1081.    ------------------------------- 
  1082.    --  This constants have the '-1' since in some cases gtk itself uses 
  1083.    --  the extrema to return some meaningful value (for instance, the result 
  1084.    --  of Get_Area can have the values Guint16'Last to mean the whole area). 
  1085.  
  1086.    Invalid_Gdouble_Value : constant Gdouble := Gdouble'Last - 1.0; 
  1087.    Invalid_Gint_Value    : constant Gint    := Gint'Last - 1; 
  1088.    Invalid_Guint_Value   : constant Guint   := Guint'Last - 1; 
  1089.    Invalid_Guint32_Value : constant Guint32 := Guint32'Last - 1; 
  1090.    Invalid_Gulong_Value  : constant Gulong  := Gulong'Last - 1; 
  1091.  
  1092.    pragma Export (C, Invalid_Gdouble_Value, "ada_gdk_invalid_gdouble_value"); 
  1093.    pragma Export (C, Invalid_Gint_Value, "ada_gdk_invalid_gint_value"); 
  1094.    pragma Export (C, Invalid_Guint_Value, "ada_gdk_invalid_guint_value"); 
  1095.    pragma Export (C, Invalid_Guint32_Value, "ada_gdk_invalid_guint32_value"); 
  1096.    pragma Export (C, Invalid_Gulong_Value, "ada_gdk_invalid_gulong_value"); 
  1097.  
  1098.    --------------- 
  1099.    -- Functions -- 
  1100.    --------------- 
  1101.  
  1102.    function Get return Gdk_Event; 
  1103.    pragma Import (C, Get, "gdk_event_get"); 
  1104.    --  Checks all open displays for a Gdk.Event.Gdk_Event to process,to be 
  1105.    --  processed on, fetching events from the windowing system if necessary. 
  1106.    --  See Gdk.Display.Get_Event. 
  1107.  
  1108.    function Peek return Gdk_Event; 
  1109.    pragma Import (C, Peek, "gdk_event_peek"); 
  1110.    --  If there is an event waiting in the event queue of some open display, 
  1111.    --  returns a copy of it. See Gdk.Display.Peek_Event. 
  1112.  
  1113.    procedure Request_Motions (Event : Gdk_Event_Motion); 
  1114.    pragma Import (C, Request_Motions, "gdk_event_request_motions"); 
  1115.    --  Request more motion notifies if Event is a motion notify hint event. 
  1116.    --  This function should be used instead of Gdk.Window.Get_Pointer to 
  1117.    --  request further motion notifies, because it also works for extension 
  1118.    --  events where motion notifies are provided for devices other than the 
  1119.    --  core pointer. Coordinate extraction, processing and requesting more 
  1120.    --  motion events from a Gdk.Event.Motion_Notify event usually works like 
  1121.    --  this: 
  1122.    --  |[ { /* motion_event handler */ x = motion_event->x; y = 
  1123.    --  motion_event->y; /* handle (x,y) motion */ gdk_event_request_motions 
  1124.    --  (motion_event); /* handles is_hint events */ } ]| 
  1125.    --  Since: gtk+ 2.12 
  1126.    --  "event": a valid Gdk.Event.Gdk_Event 
  1127.  
  1128.    function Events_Pending return Boolean; 
  1129.    --  Checks if any events are ready to be processed for any display. 
  1130.  
  1131.    procedure Set_Show_Events (Show_Events : Boolean); 
  1132.    --  Sets whether a trace of received events is output. Note that GTK+ must 
  1133.    --  be compiled with debugging (that is, configured using the 
  1134.    --  <option>--enable-debug</option> option) to use this option. 
  1135.    --  "show_events": True to output event debugging information. 
  1136.  
  1137.    function Get_Show_Events return Boolean; 
  1138.    --  Gets whether event debugging output is enabled. 
  1139.  
  1140. end Gdk.Event;