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. --  Gdk.Display.Gdk_Display objects purpose are two fold: 
  26. -- 
  27. --     * To manage and provide information about input devices (pointers and 
  28. --  keyboards) 
  29. -- 
  30. --     * To manage and provide information about the available Gdk_Screens 
  31. -- 
  32. --  GdkDisplay objects are the GDK representation of an X Display, which can 
  33. --  be described as *a workstation consisting of a keyboard, a pointing device 
  34. --  (such as a mouse) and one or more screens*. It is used to open and keep 
  35. --  track of various GdkScreen objects currently instantiated by the 
  36. --  application. It is also used to access the keyboard(s) and mouse pointer(s) 
  37. --  of the display. 
  38. -- 
  39. --  Most of the input device handling has been factored out into the separate 
  40. --  Gdk.Device_Manager.Gdk_Device_Manager object. Every display has a device 
  41. --  manager, which you can obtain using gdk_display_get_device_manager. 
  42. -- 
  43. --  </description> 
  44. pragma Ada_2005; 
  45.  
  46. pragma Warnings (Off, "*is already use-visible*"); 
  47. with Gdk;         use Gdk; 
  48. with Gdk.Event;   use Gdk.Event; 
  49. with Gdk.Types;   use Gdk.Types; 
  50. with Glib;        use Glib; 
  51. with Glib.Object; use Glib.Object; 
  52.  
  53. package Gdk.Display is 
  54.  
  55.    type Gdk_Display_Record is new GObject_Record with null record; 
  56.    type Gdk_Display is access all Gdk_Display_Record'Class; 
  57.  
  58.    ------------------ 
  59.    -- Constructors -- 
  60.    ------------------ 
  61.  
  62.    function Get_Type return Glib.GType; 
  63.    pragma Import (C, Get_Type, "gdk_display_get_type"); 
  64.  
  65.    ------------- 
  66.    -- Methods -- 
  67.    ------------- 
  68.  
  69.    procedure Beep (Self : not null access Gdk_Display_Record); 
  70.    --  Emits a short beep on Display 
  71.    --  Since: gtk+ 2.2 
  72.  
  73.    procedure Close (Self : not null access Gdk_Display_Record); 
  74.    --  Closes the connection to the windowing system for the given display, 
  75.    --  and cleans up associated resources. 
  76.    --  Since: gtk+ 2.2 
  77.  
  78.    procedure Flush (Self : not null access Gdk_Display_Record); 
  79.    --  Flushes any requests queued for the windowing system; this happens 
  80.    --  automatically when the main loop blocks waiting for new events, but if 
  81.    --  your application is drawing without returning control to the main loop, 
  82.    --  you may need to call this function explicitely. A common case where this 
  83.    --  function needs to be called is when an application is executing drawing 
  84.    --  commands from a thread other than the thread where the main loop is 
  85.    --  running. 
  86.    --  This is most useful for X11. On windowing systems where requests are 
  87.    --  handled synchronously, this function will do nothing. 
  88.    --  Since: gtk+ 2.4 
  89.  
  90.    function Get_Default_Cursor_Size 
  91.       (Self : not null access Gdk_Display_Record) return Guint; 
  92.    --  Returns the default size to use for cursors on Display. 
  93.    --  Since: gtk+ 2.4 
  94.  
  95.    function Get_Default_Group 
  96.       (Self : not null access Gdk_Display_Record) return Gdk.Gdk_Window; 
  97.    --  Returns the default group leader window for all toplevel windows on 
  98.    --  Display. This window is implicitly created by GDK. See 
  99.    --  Gdk.Window.Set_Group. 
  100.    --  Since: gtk+ 2.4 
  101.  
  102.    function Get_Event 
  103.       (Self : not null access Gdk_Display_Record) return Gdk.Event.Gdk_Event; 
  104.    --  Gets the next Gdk.Event.Gdk_Event to be processed for Display, fetching 
  105.    --  events from the windowing system if necessary. 
  106.    --  Since: gtk+ 2.2 
  107.  
  108.    procedure Get_Maximal_Cursor_Size 
  109.       (Self   : not null access Gdk_Display_Record; 
  110.        Width  : out Guint; 
  111.        Height : out Guint); 
  112.    --  Gets the maximal size to use for cursors on Display. 
  113.    --  Since: gtk+ 2.4 
  114.    --  "width": the return location for the maximal cursor width 
  115.    --  "height": the return location for the maximal cursor height 
  116.  
  117.    function Get_N_Screens 
  118.       (Self : not null access Gdk_Display_Record) return Gint; 
  119.    --  Gets the number of screen managed by the Display. 
  120.    --  Since: gtk+ 2.2 
  121.  
  122.    function Get_Name 
  123.       (Self : not null access Gdk_Display_Record) return UTF8_String; 
  124.    --  Gets the name of the display. 
  125.    --  Since: gtk+ 2.2 
  126.  
  127.    function Has_Pending 
  128.       (Self : not null access Gdk_Display_Record) return Boolean; 
  129.    --  Returns whether the display has events that are waiting to be 
  130.    --  processed. 
  131.    --  Since: gtk+ 3.0 
  132.  
  133.    function Is_Closed 
  134.       (Self : not null access Gdk_Display_Record) return Boolean; 
  135.    --  Finds out if the display has been closed. 
  136.    --  Since: gtk+ 2.22 
  137.  
  138.    procedure Keyboard_Ungrab 
  139.       (Self : not null access Gdk_Display_Record; 
  140.        Time : Guint32); 
  141.    pragma Obsolescent (Keyboard_Ungrab); 
  142.    --  Release any keyboard grab 
  143.    --  Since: gtk+ 2.2 
  144.    --  Deprecated since 3.0, Use Gdk.Device.Ungrab, together with 
  145.    --  Gdk.Device.Grab instead. 
  146.    --  "time_": a timestap (e.g GDK_CURRENT_TIME). 
  147.  
  148.    procedure Notify_Startup_Complete 
  149.       (Self       : not null access Gdk_Display_Record; 
  150.        Startup_Id : UTF8_String); 
  151.    --  Indicates to the GUI environment that the application has finished 
  152.    --  loading, using a given identifier. 
  153.    --  GTK+ will call this function automatically for Gtk.Window.Gtk_Window 
  154.    --  with custom startup-notification identifier unless 
  155.    --  Gtk.Window.Set_Auto_Startup_Notification is called to disable that 
  156.    --  feature. 
  157.    --  Since: gtk+ 3.0 
  158.    --  "startup_id": a startup-notification identifier, for which notification 
  159.    --  process should be completed 
  160.  
  161.    function Peek_Event 
  162.       (Self : not null access Gdk_Display_Record) return Gdk.Event.Gdk_Event; 
  163.    --  Gets a copy of the first Gdk.Event.Gdk_Event in the Display's event 
  164.    --  queue, without removing the event from the queue. (Note that this 
  165.    --  function will not get more events from the windowing system. It only 
  166.    --  checks the events that have already been moved to the GDK event queue.) 
  167.    --  Since: gtk+ 2.2 
  168.  
  169.    function Pointer_Is_Grabbed 
  170.       (Self : not null access Gdk_Display_Record) return Boolean; 
  171.    pragma Obsolescent (Pointer_Is_Grabbed); 
  172.    --  Test if the pointer is grabbed. 
  173.    --  Since: gtk+ 2.2 
  174.    --  Deprecated since 3.0, Use gdk_display_device_is_grabbed instead. 
  175.  
  176.    procedure Pointer_Ungrab 
  177.       (Self : not null access Gdk_Display_Record; 
  178.        Time : Guint32); 
  179.    pragma Obsolescent (Pointer_Ungrab); 
  180.    --  Release any pointer grab. 
  181.    --  Since: gtk+ 2.2 
  182.    --  Deprecated since 3.0, Use Gdk.Device.Ungrab, together with 
  183.    --  Gdk.Device.Grab instead. 
  184.    --  "time_": a timestap (e.g. GDK_CURRENT_TIME). 
  185.  
  186.    procedure Put_Event 
  187.       (Self  : not null access Gdk_Display_Record; 
  188.        Event : Gdk.Event.Gdk_Event); 
  189.    --  Appends a copy of the given event onto the front of the event queue for 
  190.    --  Display. 
  191.    --  Since: gtk+ 2.2 
  192.    --  "event": a Gdk.Event.Gdk_Event. 
  193.  
  194.    function Request_Selection_Notification 
  195.       (Self      : not null access Gdk_Display_Record; 
  196.        Selection : Gdk.Types.Gdk_Atom) return Boolean; 
  197.    --  Request Gdk.Event.Gdk_Event_Owner_Change events for ownership changes 
  198.    --  of the selection named by the given atom. 
  199.    --  Since: gtk+ 2.6 
  200.    --  "selection": the Gdk.Types.Gdk_Atom naming the selection for which 
  201.    --  ownership change notification is requested 
  202.  
  203.    procedure Set_Double_Click_Distance 
  204.       (Self     : not null access Gdk_Display_Record; 
  205.        Distance : Guint); 
  206.    --  Sets the double click distance (two clicks within this distance count 
  207.    --  as a double click and result in a GDK_2_BUTTON_PRESS event). See also 
  208.    --  Gdk.Display.Set_Double_Click_Time. Applications should *not* set this, 
  209.    --  it is a global user-configured setting. 
  210.    --  Since: gtk+ 2.4 
  211.    --  "distance": distance in pixels 
  212.  
  213.    procedure Set_Double_Click_Time 
  214.       (Self : not null access Gdk_Display_Record; 
  215.        Msec : Guint); 
  216.    --  Sets the double click time (two clicks within this time interval count 
  217.    --  as a double click and result in a GDK_2_BUTTON_PRESS event). 
  218.    --  Applications should *not* set this, it is a global user-configured 
  219.    --  setting. 
  220.    --  Since: gtk+ 2.2 
  221.    --  "msec": double click time in milliseconds (thousandths of a second) 
  222.  
  223.    function Supports_Clipboard_Persistence 
  224.       (Self : not null access Gdk_Display_Record) return Boolean; 
  225.    --  Returns whether the speicifed display supports clipboard persistance; 
  226.    --  i.e. if it's possible to store the clipboard data after an application 
  227.    --  has quit. On X11 this checks if a clipboard daemon is running. 
  228.    --  Since: gtk+ 2.6 
  229.  
  230.    function Supports_Composite 
  231.       (Self : not null access Gdk_Display_Record) return Boolean; 
  232.    --  Returns True if Gdk.Window.Set_Composited can be used to redirect 
  233.    --  drawing on the window using compositing. 
  234.    --  Currently this only works on X11 with XComposite and XDamage extensions 
  235.    --  available. 
  236.    --  Since: gtk+ 2.12 
  237.  
  238.    function Supports_Cursor_Alpha 
  239.       (Self : not null access Gdk_Display_Record) return Boolean; 
  240.    --  Returns True if cursors can use an 8bit alpha channel on Display. 
  241.    --  Otherwise, cursors are restricted to bilevel alpha (i.e. a mask). 
  242.    --  Since: gtk+ 2.4 
  243.  
  244.    function Supports_Cursor_Color 
  245.       (Self : not null access Gdk_Display_Record) return Boolean; 
  246.    --  Returns True if multicolored cursors are supported on Display. 
  247.    --  Otherwise, cursors have only a forground and a background color. 
  248.    --  Since: gtk+ 2.4 
  249.  
  250.    function Supports_Input_Shapes 
  251.       (Self : not null access Gdk_Display_Record) return Boolean; 
  252.    --  Returns True if gdk_window_input_shape_combine_mask can be used to 
  253.    --  modify the input shape of windows on Display. 
  254.    --  Since: gtk+ 2.10 
  255.  
  256.    function Supports_Selection_Notification 
  257.       (Self : not null access Gdk_Display_Record) return Boolean; 
  258.    --  Returns whether Gdk.Event.Gdk_Event_Owner_Change events will be sent 
  259.    --  when the owner of a selection changes. 
  260.    --  Since: gtk+ 2.6 
  261.  
  262.    function Supports_Shapes 
  263.       (Self : not null access Gdk_Display_Record) return Boolean; 
  264.    --  Returns True if gdk_window_shape_combine_mask can be used to create 
  265.    --  shaped windows on Display. 
  266.    --  Since: gtk+ 2.10 
  267.  
  268.    procedure Sync (Self : not null access Gdk_Display_Record); 
  269.    --  Flushes any requests queued for the windowing system and waits until 
  270.    --  all requests have been handled. This is often used for making sure that 
  271.    --  the display is synchronized with the current state of the program. 
  272.    --  Calling Gdk.Display.Sync before gdk_error_trap_pop makes sure that any 
  273.    --  errors generated from earlier requests are handled before the error trap 
  274.    --  is removed. 
  275.    --  This is most useful for X11. On windowing systems where requests are 
  276.    --  handled synchronously, this function will do nothing. 
  277.    --  Since: gtk+ 2.2 
  278.  
  279.    ---------------------- 
  280.    -- GtkAda additions -- 
  281.    ---------------------- 
  282.  
  283.    procedure Store_Clipboard 
  284.      (Display          : not null access Gdk_Display_Record; 
  285.       Clipboard_Window : Gdk.Gdk_Window; 
  286.       Time             : Guint32; 
  287.       Targets          : Gdk.Types.Gdk_Atom_Array); 
  288.    --  Issues a request to the clipboard manager to store the clipboard data. 
  289.    --  On X11, this is a special program that works according to the 
  290.    --  freedesktop clipboard specification, available at <ulink 
  291.    --  url="http://www.freedesktop.org/Standards/clipboard-manager-spec"> 
  292.    --  http://www.freedesktop.org/Standards/clipboard-manager-spec</ulink>>. 
  293.    --  Since: gtk+ 2.6 
  294.    --  "clipboard_window": a Gdk.Gdk_Window belonging to the clipboard owner 
  295.    --  "time_": a timestamp 
  296.    --  "targets": an array of targets that should be saved, or null if all 
  297.    --  available targets should be saved. 
  298.    --  "n_targets": length of the Targets array 
  299.  
  300.    procedure Get_Window_At_Pointer 
  301.      (Display : access Gdk_Display_Record; 
  302.       Win_X   : out Glib.Gint; 
  303.       Win_Y   : out Glib.Gint; 
  304.       Win     : out Gdk.Gdk_Window); 
  305.    --  Obtains the window underneath the mouse pointer, returning the location 
  306.    --  of that window in Win_X, Win_Y. Returns nullif the window 
  307.    --  under the mouse pointer is not known to GDK (for example, belongs to 
  308.    --  another application). 
  309.    --  (Win_X, Win_Y) are relative to the origin of the window under the 
  310.    --  pointer. 
  311.    -- 
  312.    --  Obsolescent: use Gdk.Device.Get_Window_At_Position instead. 
  313.  
  314.    --------------- 
  315.    -- Functions -- 
  316.    --------------- 
  317.  
  318.    function Get_Default return Gdk_Display; 
  319.    --  Gets the default Gdk.Display.Gdk_Display. This is a convenience 
  320.    --  function for 'gdk_display_manager_get_default_display 
  321.    --  (gdk_display_manager_get ())'. 
  322.    --  Since: gtk+ 2.2 
  323.  
  324.    function Open (Display_Name : UTF8_String) return Gdk_Display; 
  325.    --  Opens a display. 
  326.    --  Since: gtk+ 2.2 
  327.    --  "display_name": the name of the display to open 
  328.  
  329.    function Open_Default_Libgtk_Only return Gdk_Display; 
  330.    --  Opens the default display specified by command line arguments or 
  331.    --  environment variables, sets it as the default display, and returns it. 
  332.    --  gdk_parse_args must have been called first. If the default display has 
  333.    --  previously been set, simply returns that. An internal function that 
  334.    --  should not be used by applications. 
  335.  
  336.    ------------- 
  337.    -- Signals -- 
  338.    ------------- 
  339.  
  340.    type Cb_Gdk_Display_Boolean_Void is not null access procedure 
  341.      (Self     : access Gdk_Display_Record'Class; 
  342.       Is_Error : Boolean); 
  343.  
  344.    type Cb_GObject_Boolean_Void is not null access procedure 
  345.      (Self     : access Glib.Object.GObject_Record'Class; 
  346.       Is_Error : Boolean); 
  347.  
  348.    Signal_Closed : constant Glib.Signal_Name := "closed"; 
  349.    procedure On_Closed 
  350.       (Self  : not null access Gdk_Display_Record; 
  351.        Call  : Cb_Gdk_Display_Boolean_Void; 
  352.        After : Boolean := False); 
  353.    procedure On_Closed 
  354.       (Self  : not null access Gdk_Display_Record; 
  355.        Call  : Cb_GObject_Boolean_Void; 
  356.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  357.        After : Boolean := False); 
  358.    --  The ::closed signal is emitted when the connection to the windowing 
  359.    --  system for Display is closed. 
  360.  
  361.    type Cb_Gdk_Display_Void is not null access procedure (Self : access Gdk_Display_Record'Class); 
  362.  
  363.    type Cb_GObject_Void is not null access procedure 
  364.      (Self : access Glib.Object.GObject_Record'Class); 
  365.  
  366.    Signal_Opened : constant Glib.Signal_Name := "opened"; 
  367.    procedure On_Opened 
  368.       (Self  : not null access Gdk_Display_Record; 
  369.        Call  : Cb_Gdk_Display_Void; 
  370.        After : Boolean := False); 
  371.    procedure On_Opened 
  372.       (Self  : not null access Gdk_Display_Record; 
  373.        Call  : Cb_GObject_Void; 
  374.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  375.        After : Boolean := False); 
  376.    --  The ::opened signal is emitted when the connection to the windowing 
  377.    --  system for Display is opened. 
  378.  
  379. end Gdk.Display;