1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006-2013, AdaCore                   -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  Gdk_Display objects purpose are two fold: 
  31. --     - To grab/ungrab keyboard focus and mouse pointer 
  32. --     - To manage and provide information about the Gdk_Screen(s) available 
  33. --       for this Gdk_Display 
  34. --  Gdk_Display objects are the GDK representation of the X Display which can 
  35. --  be described as a workstation consisting of a keyboard a pointing device 
  36. --  (such as a mouse) and one or more screens. It is used to open and keep 
  37. --  track of various Gdk_Screen objects currently instanciated by the 
  38. --  application. It is also used to grab and release the keyboard and the mouse 
  39. --  pointer. 
  40. --  </description> 
  41. --  <c_version>2.8.17</c_version> 
  42. --  <group>Gdk, the low-level API</group> 
  43. --  <see>Gdk_Screen</see> 
  44.  
  45. with Gdk.Event; 
  46. with Gdk.Types; 
  47. with Glib.Object; 
  48.  
  49. package Gdk.Display is 
  50.  
  51.    type Gdk_Display_Record is new Glib.Object.GObject_Record with null record; 
  52.    type Gdk_Display is access all Gdk_Display_Record'Class; 
  53.  
  54.    function Get_Type return Glib.GType; 
  55.    --  Return the internal type associated with a Gdk_Display 
  56.  
  57.    function Open (Display_Name : String) return Gdk_Display; 
  58.    --  Open a new display. Display_Name follows the unix convention, and should 
  59.    --  have the format host:screen, for instance "foo.com:0". 
  60.  
  61.    function Get_Default return Gdk_Display; 
  62.    --  Gets the default Gdk_Display 
  63.  
  64.    function Get_Name (Display : access Gdk_Display_Record) return String; 
  65.    --  Return the name of the screen 
  66.  
  67.    function Get_N_Screens 
  68.      (Display : access Gdk_Display_Record) return Glib.Gint; 
  69.    --  Return the number of screens managed by the display. 
  70.    --  See the function Gdk.Screen.Get_Screen or Gdk.Screen.Get_Default_Screen 
  71.  
  72.    procedure Pointer_Ungrab 
  73.      (Display : access Gdk_Display_Record; 
  74.       Time    : Glib.Guint32 := Gdk.Types.Current_Time); 
  75.    --  Release any pointer grab. 
  76.  
  77.    procedure Keyboard_Ungrab 
  78.      (Display : access Gdk_Display_Record; 
  79.       Time    : Glib.Guint32 := Gdk.Types.Current_Time); 
  80.    --  Release any keyboard grab 
  81.  
  82.    function Pointer_Is_Grabbed 
  83.      (Display : access Gdk_Display_Record) return Boolean; 
  84.    --  Test if the pointer is grabbed. 
  85.  
  86.    procedure Beep (Display : access Gdk_Display_Record); 
  87.    --  Emits a short beep on display 
  88.  
  89.    procedure Sync (Display : access Gdk_Display_Record); 
  90.    --  Flushes any requests queued for the windowing system and waits until all 
  91.    --  requests have been handled. This is often used for making sure that the 
  92.    --  display is synchronized with the current state of the program. Calling 
  93.    --  Sync before Gdk.Error.Trap_Pop makes sure that any errors generated from 
  94.    --  earlier requests are handled before the error trap is removed. 
  95.    -- 
  96.    --  This is most useful for X11. On windowing systems where requests are 
  97.    --  handled synchronously, this function will do nothing. 
  98.  
  99.    procedure Flush (Display : access Gdk_Display_Record); 
  100.    --  Flushes any requests queued for the windowing system; this happens 
  101.    --  automatically when the main loop blocks waiting for new events, but if 
  102.    --  your application is drawing without returning control to the main loop, 
  103.    --  you may need to call this function explicitely. A common case where this 
  104.    --  function needs to be called is when an application is executing drawing 
  105.    --  commands from a thread other than the thread where the main loop is 
  106.    --  running. 
  107.    -- 
  108.    --  This is most useful for X11. On windowing systems where requests are 
  109.    --  handled synchronously, this function will do nothing. 
  110.  
  111.    procedure Close (Display : access Gdk_Display_Record); 
  112.    --  Closes the connection to the windowing system for the given display, 
  113.    --  and cleans up associated resources. 
  114.  
  115.    function Get_Event 
  116.      (Display : access Gdk_Display_Record) return Gdk.Event.Gdk_Event; 
  117.    --  Gets the next Gdk_Event to be processed for Display, fetching events 
  118.    --  from the windowing system if necessary. 
  119.    --  null is returned if no events are pending. 
  120.    --  The returned Gdk_Event must be freed with Gdk.Event.Free 
  121.  
  122.    function Peek_Event 
  123.      (Display : access Gdk_Display_Record) return Gdk.Event.Gdk_Event; 
  124.    --  Gets a copy of the first Gdk_Event in the Display's event queue, without 
  125.    --  removing the event from the queue. (Note that this function will not get 
  126.    --  more events from the windowing system. It only checks the events that 
  127.    --  have already been moved to the GDK event queue.) 
  128.    --  null is returned if there are no events in the queue. The returned event 
  129.    --  should be freed with Gdk.Event.Free. 
  130.  
  131.    procedure Put_Event 
  132.      (Display : access Gdk_Display_Record; 
  133.       Event   : Gdk.Event.Gdk_Event); 
  134.    --  Appends a copy of the given event onto the front of the event 
  135.    --  queue for Display. 
  136.  
  137.    procedure Set_Double_Click_Time 
  138.      (Display : access Gdk_Display_Record; 
  139.       Msec    : Glib.Guint); 
  140.    --  Sets the double click time (two clicks within this time interval count 
  141.    --  as a double click and result in a GDK_2BUTTON_PRESS event). Applications 
  142.    --  should not set this, it is a global user-configured setting. 
  143.  
  144.    procedure Set_Double_Click_Distance 
  145.      (Display  : access Gdk_Display_Record; 
  146.       Distance : Glib.Guint); 
  147.    --  Sets the double click distance (two clicks within this distance count as 
  148.    --  a double click and result in a GDK_2BUTTON_PRESS event). See also 
  149.    --  Set_Double_Click_Time. Applications should not set this, it is a global 
  150.    --  user-configured setting. 
  151.  
  152.    procedure Get_Window_At_Pointer 
  153.      (Display : access Gdk_Display_Record; 
  154.       Win_X   : out Glib.Gint; 
  155.       Win_Y   : out Glib.Gint; 
  156.       Win     : out Gdk.Gdk_Window); 
  157.    --  Obtains the window underneath the mouse pointer, returning the location 
  158.    --  of that window in Win_X, Win_Y. Returns nullif the window 
  159.    --  under the mouse pointer is not known to GDK (for example, belongs to 
  160.    --  another application). 
  161.    --  (Win_X, Win_Y) are relative to the origin of the window under the 
  162.    --  pointer. 
  163.  
  164.    function Supports_Cursor_Color 
  165.      (Display : access Gdk_Display_Record) return Boolean; 
  166.    --  Returns TRUE if multicolored cursors are supported on display. 
  167.    --  Otherwise, cursors have only a forground and a background color. 
  168.  
  169.    function Supports_Cursor_Alpha 
  170.      (Display : access Gdk_Display_Record) return Boolean; 
  171.    --  Returns TRUE if cursors can use an 8bit alpha channel on display. 
  172.    --  Otherwise, cursors are restricted to bilevel alpha (i.e. a mask). 
  173.  
  174.    function Get_Default_Cursor_Size 
  175.      (Display : access Gdk_Display_Record) return Glib.Guint; 
  176.    --  Returns the default size to use for cursors on display. 
  177.  
  178.    procedure Get_Maximal_Cursor_Size 
  179.      (Display : access Gdk_Display_Record; 
  180.       Width   : out Glib.Guint; 
  181.       Height  : out Glib.Guint); 
  182.    --  Gets the maximal size to use for cursors on display 
  183.  
  184.    function Get_Default_Group 
  185.      (Display : access Gdk_Display_Record) return Gdk.Gdk_Window; 
  186.    --  Returns the default group leader window for all toplevel windows on 
  187.    --  display. This window is implicitly created by GDK. See 
  188.    --  Gdk.Window.Set_Group. 
  189.  
  190.    function Supports_Selection_Notification 
  191.      (Display : access Gdk_Display_Record) return Boolean; 
  192.    --  Returns whether Gdk.Event.Owner_Change events will be sent when the 
  193.    --  owner of a selection changes. 
  194.  
  195.    function Request_Selection_Notification 
  196.      (Display   : access Gdk_Display_Record; 
  197.       Selection : Gdk.Types.Gdk_Atom) return Boolean; 
  198.    --  Request Gdk.Event.Owner_Change events for ownership changes of the 
  199.    --  selection named by the given atom. 
  200.  
  201.    function Supports_Clipboard_Persistence 
  202.      (Display : access Gdk_Display_Record) return Boolean; 
  203.    --  Returns whether the specifed display supports clipboard persistance; 
  204.    --  i.e. if it's possible to store the clipboard data after an application 
  205.    --  has quit. On X11 this checks if a clipboard daemon is running. 
  206.  
  207.    procedure Store_Clipboard 
  208.      (Display          : access Gdk_Display_Record; 
  209.       Clipboard_Window : Gdk.Gdk_Window; 
  210.       Time             : Glib.Guint32; 
  211.       Targets          : Gdk.Types.Gdk_Atom_Array); 
  212.    --  Issues a request to the clipboard manager to store the clipboard data. 
  213.    --  On X11, this is a special program that works according to the 
  214.    --  freedesktop clipboard specification, available at 
  215.    --  http://www.freedesktop.org/Standards/clipboard-manager-spec. 
  216.    --  See also Gtk.Clipboard.Store. 
  217.  
  218.    ------------- 
  219.    -- Signals -- 
  220.    ------------- 
  221.  
  222.    --  <signals> 
  223.    --  The following new signals are defined for this object: 
  224.    -- 
  225.    --  - "closed" 
  226.    --    procedure Handler 
  227.    --      (Display  : access Gdk_Display_Record'Class; 
  228.    --       Is_Error : Boolean); 
  229.    --    The ::closed signal is emitted when the connection to the windowing 
  230.    --    system for display is closed. Is_Error is set to true if the 
  231.    --    connection is closed due to an error. 
  232.    --  </signals> 
  233.  
  234.    Signal_Closed : constant Glib.Signal_Name := "closed"; 
  235.  
  236. private 
  237.    pragma Import (C, Get_Type, "gdk_display_get_type"); 
  238. end Gdk.Display; 
  239.  
  240. --  Binding provided in gdk-screen.ads for circularity dependencies reasons: 
  241. --  No binding: gdk_display_get_default_screen 
  242. --  No binding: gdk_display_get_pointer 
  243. --  No binding: gdk_display_get_screen 
  244. --  No binding: gdk_display_warp_pointer 
  245.  
  246. --  Binding might be nice later: 
  247. --  No binding: gdk_display_set_pointer_hooks 
  248.  
  249. --  No binding needed (too low-level): 
  250. --  No binding: gdk_display_get_core_pointer 
  251. --  No binding: gdk_display_list_devices 
  252. --  No binding: gdk_display_add_client_message_filter 
  253.  
  254. --  Function has no implementation 
  255. --  No binding: gdk_display_open_default_libgtk_only