ci: tests for macOS on Gitlab CI
[nit.git] / lib / gtk / v3_4 / gdk.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Services from GDK
16 module gdk is pkgconfig "gtk+-3.0"
17
18 import gtk_core
19
20 `{
21 #ifdef Task_gdk_main
22 // Callback to Task::gdk_main
23 gboolean nit_gdk_callback_task(gpointer user_data) {
24 Task_decr_ref(user_data);
25 return Task_gdk_main(user_data);
26 }
27 #endif
28 `}
29
30 redef class Task
31
32 # Small unit of code executed by the GDK loop when idle
33 #
34 # Returns `true` if this object should be invoked again.
35 fun gdk_main: Bool
36 do
37 main
38 return false
39 end
40 end
41
42 # Add a callback to execute whenever there are no higher priority events pending
43 fun gdk_threads_add_idle(task: Task): Int import Task.gdk_main `{
44 Task_incr_ref(task);
45 return gdk_threads_add_idle(&nit_gdk_callback_task, task);
46 `}