/usr/share/ada/adainclude/gtkada/gdk-event.adb is in libgtkada16.1.0-dev 17.0.2017-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet --
-- Copyright (C) 2000-2017, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
pragma Style_Checks (Off);
pragma Warnings (Off, "*is already use-visible*");
with Ada.Unchecked_Conversion;
with Glib.Object;
package body Gdk.Event is
function From_Object_Free (B : access Gdk_Event_Sequence) return Gdk_Event_Sequence is
Result : constant Gdk_Event_Sequence := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Any) return Gdk_Event_Any is
Result : constant Gdk_Event_Any := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Button) return Gdk_Event_Button is
Result : constant Gdk_Event_Button := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Expose) return Gdk_Event_Expose is
Result : constant Gdk_Event_Expose := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Visibility) return Gdk_Event_Visibility is
Result : constant Gdk_Event_Visibility := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Motion) return Gdk_Event_Motion is
Result : constant Gdk_Event_Motion := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Scroll) return Gdk_Event_Scroll is
Result : constant Gdk_Event_Scroll := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Key) return Gdk_Event_Key is
Result : constant Gdk_Event_Key := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Crossing) return Gdk_Event_Crossing is
Result : constant Gdk_Event_Crossing := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Focus) return Gdk_Event_Focus is
Result : constant Gdk_Event_Focus := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Configure) return Gdk_Event_Configure is
Result : constant Gdk_Event_Configure := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Property) return Gdk_Event_Property is
Result : constant Gdk_Event_Property := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Selection) return Gdk_Event_Selection is
Result : constant Gdk_Event_Selection := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Owner_Change) return Gdk_Event_Owner_Change is
Result : constant Gdk_Event_Owner_Change := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Proximity) return Gdk_Event_Proximity is
Result : constant Gdk_Event_Proximity := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_DND) return Gdk_Event_DND is
Result : constant Gdk_Event_DND := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Window_State) return Gdk_Event_Window_State is
Result : constant Gdk_Event_Window_State := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Setting) return Gdk_Event_Setting is
Result : constant Gdk_Event_Setting := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Touch) return Gdk_Event_Touch is
Result : constant Gdk_Event_Touch := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Grab_Broken) return Gdk_Event_Grab_Broken is
Result : constant Gdk_Event_Grab_Broken := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Object_Free (B : access Gdk_Event_Record) return Gdk_Event_Record is
Result : constant Gdk_Event_Record := B.all;
begin
Glib.g_free (B.all'Address);
return Result;
end From_Object_Free;
function From_Address (C : System.Address) return Gdk_Event is
function Convert is new Ada.Unchecked_Conversion
(Glib.C_Proxy, Gdk_Event);
begin
return Convert (Glib.C_Proxy'(Glib.To_Proxy (C)));
end From_Address;
function To_Address (C : Gdk_Event) return System.Address is
function Convert is new Ada.Unchecked_Conversion
(Gdk_Event, Glib.C_Proxy);
begin
return Glib.To_Address (Convert (C));
end To_Address;
function Get_Event (Value : Glib.Values.GValue) return Gdk_Event is
function Convert is new Ada.Unchecked_Conversion
(Glib.C_Proxy, Gdk_Event);
begin
return Convert (Glib.Values.Get_Proxy (Value));
end Get_Event;
function To_Event (Event : access Gdk_Event_Button) return Gdk_Event is
type Gdk_Event_Button_Access is access all Gdk_Event_Button;
function Convert is new Ada.Unchecked_Conversion
(Gdk_Event_Button_Access, Gdk_Event);
begin
return Convert (Gdk_Event_Button_Access (Event));
end To_Event;
function To_Event (Event : access Gdk_Event_Key) return Gdk_Event is
type Gdk_Event_Key_Access is access all Gdk_Event_Key;
function Convert is new Ada.Unchecked_Conversion
(Gdk_Event_Key_Access, Gdk_Event);
begin
return Convert (Gdk_Event_Key_Access (Event));
end To_Event;
procedure C_Gdk_Event_Handler_Set
(Func : System.Address;
Data : System.Address;
Notify : System.Address);
pragma Import (C, C_Gdk_Event_Handler_Set, "gdk_event_handler_set");
-- Sets the function to call to handle all events from GDK.
-- Note that GTK+ uses this to install its own event handler, so it is
-- usually not useful for GTK+ applications. (Although an application can
-- call this function then call Gtk.Main.Main_Do_Event to pass events to
-- GTK+.)
-- "func": the function to call to handle events from GDK.
-- "data": user data to pass to the function.
-- "notify": the function to call when the handler function is removed,
-- i.e. when Gdk.Event.Handler_Set is called with another event handler.
function To_Gdk_Event_Func is new Ada.Unchecked_Conversion
(System.Address, Gdk_Event_Func);
function To_Address is new Ada.Unchecked_Conversion
(Gdk_Event_Func, System.Address);
procedure Internal_Gdk_Event_Func
(Event : Gdk.Event.Gdk_Event;
Data : System.Address);
pragma Convention (C, Internal_Gdk_Event_Func);
-- "event": the Gdk.Event.Gdk_Event to process.
-- "data": user data set when the event handler was installed with
-- Gdk.Event.Handler_Set.
-----------------------------
-- Internal_Gdk_Event_Func --
-----------------------------
procedure Internal_Gdk_Event_Func
(Event : Gdk.Event.Gdk_Event;
Data : System.Address)
is
Func : constant Gdk_Event_Func := To_Gdk_Event_Func (Data);
begin
Func (Event);
end Internal_Gdk_Event_Func;
-------------------
-- Gdk_Event_New --
-------------------
function Gdk_Event_New (The_Type : Gdk_Event_Type) return Gdk_Event is
function Internal (The_Type : Gdk_Event_Type) return Gdk_Event;
pragma Import (C, Internal, "gdk_event_new");
Event : Gdk_Event;
begin
Event := Internal (The_Type);
return Event;
end Gdk_Event_New;
-------------
-- Gdk_New --
-------------
procedure Gdk_New (Event : out Gdk_Event; The_Type : Gdk_Event_Type) is
function Internal (The_Type : Gdk_Event_Type) return Gdk_Event;
pragma Import (C, Internal, "gdk_event_new");
begin
Event := Internal (The_Type);
end Gdk_New;
---------------
-- Get_Angle --
---------------
function Get_Angle
(Event : Gdk_Event;
Event2 : Gdk_Event;
Angle : access Gdouble) return Boolean
is
function Internal
(Event : Gdk_Event;
Event2 : Gdk_Event;
Acc_Angle : access Gdouble) return Glib.Gboolean;
pragma Import (C, Internal, "gdk_events_get_angle");
Acc_Angle : aliased Gdouble;
Tmp_Return : Glib.Gboolean;
begin
Tmp_Return := Internal (Event, Event2, Acc_Angle'Access);
Angle.all := Acc_Angle;
return Tmp_Return /= 0;
end Get_Angle;
----------------
-- Get_Center --
----------------
function Get_Center
(Event : Gdk_Event;
Event2 : Gdk_Event;
X : access Gdouble;
Y : access Gdouble) return Boolean
is
function Internal
(Event : Gdk_Event;
Event2 : Gdk_Event;
Acc_X : access Gdouble;
Acc_Y : access Gdouble) return Glib.Gboolean;
pragma Import (C, Internal, "gdk_events_get_center");
Acc_X : aliased Gdouble;
Acc_Y : aliased Gdouble;
Tmp_Return : Glib.Gboolean;
begin
Tmp_Return := Internal (Event, Event2, Acc_X'Access, Acc_Y'Access);
X.all := Acc_X;
Y.all := Acc_Y;
return Tmp_Return /= 0;
end Get_Center;
------------------
-- Get_Distance --
------------------
function Get_Distance
(Event : Gdk_Event;
Event2 : Gdk_Event;
Distance : access Gdouble) return Boolean
is
function Internal
(Event : Gdk_Event;
Event2 : Gdk_Event;
Acc_Distance : access Gdouble) return Glib.Gboolean;
pragma Import (C, Internal, "gdk_events_get_distance");
Acc_Distance : aliased Gdouble;
Tmp_Return : Glib.Gboolean;
begin
Tmp_Return := Internal (Event, Event2, Acc_Distance'Access);
Distance.all := Acc_Distance;
return Tmp_Return /= 0;
end Get_Distance;
-----------------
-- Handler_Set --
-----------------
procedure Handler_Set (Func : Gdk_Event_Func) is
begin
if Func = null then
C_Gdk_Event_Handler_Set (System.Null_Address, System.Null_Address, System.Null_Address);
else
C_Gdk_Event_Handler_Set (Internal_Gdk_Event_Func'Address, To_Address (Func), System.Null_Address);
end if;
end Handler_Set;
package body Handler_Set_User_Data is
package Users is new Glib.Object.User_Data_Closure
(User_Data_Type, Destroy);
function To_Gdk_Event_Func is new Ada.Unchecked_Conversion
(System.Address, Gdk_Event_Func);
function To_Address is new Ada.Unchecked_Conversion
(Gdk_Event_Func, System.Address);
procedure Internal_Cb
(Event : Gdk.Event.Gdk_Event;
Data : System.Address);
pragma Convention (C, Internal_Cb);
-- Specifies the type of function passed to Gdk.Event.Handler_Set to
-- handle all GDK events.
-- "event": the Gdk.Event.Gdk_Event to process.
-- "data": user data set when the event handler was installed with
-- Gdk.Event.Handler_Set.
-----------------
-- Handler_Set --
-----------------
procedure Handler_Set (Func : Gdk_Event_Func; Data : User_Data_Type) is
D : System.Address;
begin
if Func = null then
C_Gdk_Event_Handler_Set (System.Null_Address, System.Null_Address, Users.Free_Data'Address);
else
D := Users.Build (To_Address (Func), Data);
C_Gdk_Event_Handler_Set (Internal_Cb'Address, D, Users.Free_Data'Address);
end if;
end Handler_Set;
-----------------
-- Internal_Cb --
-----------------
procedure Internal_Cb
(Event : Gdk.Event.Gdk_Event;
Data : System.Address)
is
D : constant Users.Internal_Data_Access := Users.Convert (Data);
begin
To_Gdk_Event_Func (D.Func) (Event, D.Data.all);
end Internal_Cb;
end Handler_Set_User_Data;
---------------------------
-- Triggers_Context_Menu --
---------------------------
function Triggers_Context_Menu (Event : Gdk_Event) return Boolean is
function Internal (Event : Gdk_Event) return Glib.Gboolean;
pragma Import (C, Internal, "gdk_event_triggers_context_menu");
begin
return Internal (Event) /= 0;
end Triggers_Context_Menu;
--------------------
-- Events_Pending --
--------------------
function Events_Pending return Boolean is
function Internal return Glib.Gboolean;
pragma Import (C, Internal, "gdk_events_pending");
begin
return Internal /= 0;
end Events_Pending;
---------------------
-- Get_Show_Events --
---------------------
function Get_Show_Events return Boolean is
function Internal return Glib.Gboolean;
pragma Import (C, Internal, "gdk_get_show_events");
begin
return Internal /= 0;
end Get_Show_Events;
---------------------
-- Set_Show_Events --
---------------------
procedure Set_Show_Events (Show_Events : Boolean) is
procedure Internal (Show_Events : Glib.Gboolean);
pragma Import (C, Internal, "gdk_set_show_events");
begin
Internal (Boolean'Pos (Show_Events));
end Set_Show_Events;
end Gdk.Event;
|