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
|
{
GDK - The GIMP Drawing Kit
Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
}
unit gdk2; // keep unit name lowercase for kylix
{$IFDEF FPC}
{$mode objfpc}
{$ENDIF}
{$IFDEF VER140}
{$DEFINE KYLIX}
{$ENDIF}
interface
uses glib2, gdk2pixbuf, pango, cairo;
const
// OS dependent defines
{$ifdef windows}
{$DEFINE GDK_WINDOWING_WIN32}
gdklib = 'libgdk-win32-2.0-0.dll';
{$IFDEF FPC}
{$ifndef NO_SMART_LINK}
{$smartlink on}
{$endif}
{$ENDIF}
GDK_HAVE_WCHAR_H=1;
GDK_HAVE_WCTYPE_H=1;
{$else}
{$ifdef darwin}
gdklib = 'gdk-x11-2.0';
{$linklib gtk-x11-2.0}
{$linklib gdk-x11-2.0}
{$linklib pango-1.0.0}
{$linklib glib-2.0.0}
{$linklib gobject-2.0.0}
{$linklib gdk_pixbuf-2.0.0}
{$linklib atk-1.0.0}
{$else}
{$ifdef UseCustomLibs}
gdklib = '';
{$else}
gdklib = 'libgdk-x11-2.0.so';
{$endif}
{$endif}
{$endif}
{$IFNDEF KYLIX}
{$PACKRECORDS C}
{$ELSE}
{$ALIGN 4}
{$WEAKPACKAGEUNIT}
{$WARNINGS OFF}
{$ENDIF}
// the included header files:
{
number of points to buffer before sending them off
to scanlines() : Must be an even number
}
const
NUMPTSTOBUFFER = 200;
GDK_MAX_TIMECOORD_AXES = 128;
type
PGdkDeviceClass = ^TGdkDeviceClass;
TGdkDeviceClass = record
parent_class: TGObjectClass;
end;
PGdkVisualClass = ^TGdkVisualClass;
TGdkVisualClass = record
parent_class: TGObjectClass;
end;
{$DEFINE read_forward_definitions}
{$include gdkincludes.inc}
{$UNDEF read_forward_definitions}
{$DEFINE read_interface_types}
{$include gdkincludes.inc}
{$UNDEF read_interface_types}
{$DEFINE read_interface_rest}
{$include gdkincludes.inc}
{$UNDEF read_interface_rest}
procedure gdk_parse_args(argc:Pgint; var argv:PPgchar); cdecl; external gdklib;
procedure gdk_init(argc:Pgint; var argv:PPgchar); cdecl; external gdklib;
function gdk_init_check(argc:Pgint; var argv:PPgchar):gboolean; cdecl; external gdklib;
procedure gdk_notify_startup_complete; cdecl; external gdklib;
{$ifndef GDK_DISABLE_DEPRECATED}
procedure gdk_exit(error_code:gint); cdecl; external gdklib;
{$endif}
{ GDK_DISABLE_DEPRECATED }
function gdk_set_locale:Pgchar; cdecl; external gdklib;
function gdk_get_program_class:Pchar; cdecl; external gdklib;
procedure gdk_set_program_class(program_class:Pchar); cdecl; external gdklib;
{ Push and pop error handlers for X errors }
procedure gdk_error_trap_push; cdecl; external gdklib;
function gdk_error_trap_pop:gint; cdecl; external gdklib;
{$ifndef GDK_DISABLE_DEPRECATED}
procedure gdk_set_use_xshm(use_xshm:gboolean); cdecl; external gdklib;
function gdk_get_use_xshm:gboolean; cdecl; external gdklib;
{$endif}
{ GDK_DISABLE_DEPRECATED }
function gdk_get_display:Pgchar; cdecl; external gdklib;
function gdk_get_display_arg_name:Pgchar; cdecl; external gdklib;
{$ifndef GDK_DISABLE_DEPRECATED}
function gdk_input_add_full(source:gint; condition:TGdkInputCondition; _function:TGdkInputFunction; data:gpointer; destroy:TGdkDestroyNotify):gint; cdecl; external gdklib;
function gdk_input_add(source:gint; condition:TGdkInputCondition; _function:TGdkInputFunction; data:gpointer):gint; cdecl; external gdklib;
procedure gdk_input_remove(tag:gint); cdecl; external gdklib;
{$endif}
{ GDK_DISABLE_DEPRECATED }
function gdk_pointer_grab(window:PGdkWindow; owner_events:gboolean; event_mask:TGdkEventMask; confine_to:PGdkWindow; cursor:PGdkCursor;
time:guint32):TGdkGrabStatus; cdecl; external gdklib;
function gdk_keyboard_grab(window:PGdkWindow; owner_events:gboolean; time:guint32):TGdkGrabStatus; cdecl; external gdklib;
{$ifndef GDK_MULTIHEAD_SAFE}
procedure gdk_pointer_ungrab(time:guint32); cdecl; external gdklib;
procedure gdk_keyboard_ungrab(time:guint32); cdecl; external gdklib;
function gdk_pointer_is_grabbed:gboolean; cdecl; external gdklib;
function gdk_screen_width:gint; cdecl; external gdklib;
function gdk_screen_height:gint; cdecl; external gdklib;
function gdk_screen_width_mm:gint; cdecl; external gdklib;
function gdk_screen_height_mm:gint; cdecl; external gdklib;
procedure gdk_beep; cdecl; external gdklib;
{$endif}
{ GDK_MULTIHEAD_SAFE }
procedure gdk_flush; cdecl; external gdklib;
{$ifndef GDK_MULTIHEAD_SAFE}
procedure gdk_set_double_click_time(msec:guint); cdecl; external gdklib;
{$endif}
{ Rectangle utilities }
function gdk_rectangle_intersect(src1:PGdkRectangle; src2:PGdkRectangle; dest:PGdkRectangle):gboolean; cdecl; external gdklib;
procedure gdk_rectangle_union(src1:PGdkRectangle; src2:PGdkRectangle; dest:PGdkRectangle); cdecl; external gdklib;
function gdk_rectangle_get_type:GType; cdecl; external gdklib;
function GDK_TYPE_RECTANGLE : GType;
{ Conversion functions between wide char and multibyte strings. }
function gdk_wcstombs(src:PGdkWChar):Pgchar; cdecl; external gdklib;
function gdk_mbstowcs(dest:PGdkWChar; src:Pgchar; dest_max:gint):gint; cdecl; external gdklib;
{ Miscellaneous }
{$ifndef GDK_MULTIHEAD_SAFE}
function gdk_event_send_client_message(event:PGdkEvent; xid:guint32):gboolean; cdecl; external gdklib;
procedure gdk_event_send_clientmessage_toall(event:PGdkEvent); cdecl; external gdklib;
{$endif}
{$IFNDEF KYLIX}
{ Threading }
var
{$IFDEF WINDOWS}
gdk_threads_mutex : PGMutex; external gdklib name 'gdk_threads_mutex';
{$ELSE}
gdk_threads_mutex : PGMutex; cvar; external;
{$ENDIF}
{$ENDIF}
procedure gdk_threads_enter; cdecl; external gdklib;
procedure gdk_threads_leave; cdecl; external gdklib;
procedure gdk_threads_init; cdecl; external gdklib;
procedure gdk_threads_set_lock_functions(enter_fn: TGCallback; leave_fn: TGCallback); cdecl; external gdklib;
procedure _GDK_THREADS_ENTER;
procedure _GDK_THREADS_LEAVE;
implementation
{$IFNDEF KYLIX}
{ There is a bug in the compiler. If an external variable is not used, it will
create code, that can be relocated by the linker.
So, use them in this hidden procedure.
}
procedure CheckUnusedVariable; [Public];
begin
if (gdk_threads_mutex<>nil) then ;
end;
{$ENDIF}
//------------------------------------------------------------------------------
function GDK_TYPE_RECTANGLE : GType;
begin
GDK_TYPE_RECTANGLE:=gdk_rectangle_get_type;
end;
procedure _GDK_THREADS_ENTER;
begin
{$ifdef G_THREADS_ENABLED}
if (gdk_threads_mutex) then
g_mutex_lock (gdk_threads_mutex);
{$endif}
end;
procedure _GDK_THREADS_LEAVE;
begin
{$ifdef G_THREADS_ENABLED}
if (gdk_threads_mutex) then
g_mutex_unlock (gdk_threads_mutex);
{$endif}
end;
// call implementation parts of header files
{$DEFINE read_implementation}
{$include gdkincludes.inc}
{$UNDEF read_implementation}
end.
|