Bug Summary

File:tests/testsocket.c
Warning:line 400, column 7
This statement is never executed

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name testsocket.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/rootdir/tests -fcoverage-compilation-dir=/rootdir/tests -resource-dir /usr/lib/llvm-19/lib/clang/19 -D HAVE_CONFIG_H -I . -I .. -I .. -I ../cdk -I ../cdk -D G_ENABLE_DEBUG -D G_ENABLE_CONSISTENCY_CHECKS -D GLIB_MIN_REQUIRED_VERSION=GLIB_VERSION_2_66 -D GLIB_MAX_ALLOWED_VERSION=GLIB_VERSION_2_66 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/atk-1.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/gio-unix-2.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/pango-1.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-12-19-111339-43635-1 -x c testsocket.c
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
2/* testsocket.c
3 * Copyright (C) 2001 Red Hat, Inc
4 * Author: Owen Taylor
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library 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 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "config.h"
21#include <ctk/ctk.h>
22#include <ctk/ctkx.h>
23
24#include <string.h>
25#include <stdlib.h>
26#include <stdio.h>
27
28int n_children = 0;
29
30GSList *sockets = NULL((void*)0);
31
32CtkWidget *window;
33CtkWidget *box;
34
35typedef struct
36{
37 CtkWidget *box;
38 CtkWidget *frame;
39 CtkWidget *socket;
40} Socket;
41
42extern guint32 create_child_plug (guint32 xid,
43 gboolean local);
44
45static void
46quit_cb (gpointer callback_data G_GNUC_UNUSED__attribute__ ((__unused__)),
47 guint callback_action G_GNUC_UNUSED__attribute__ ((__unused__)),
48 CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)))
49{
50 CtkWidget *message_dialog = ctk_message_dialog_new (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, 0,
51 CTK_MESSAGE_QUESTION,
52 CTK_BUTTONS_YES_NO,
53 "Really Quit?");
54 ctk_dialog_set_default_response (CTK_DIALOG (message_dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((message_dialog)), ((ctk_dialog_get_type ()))))))
, CTK_RESPONSE_NO);
55
56 if (ctk_dialog_run (CTK_DIALOG (message_dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((message_dialog)), ((ctk_dialog_get_type ()))))))
) == CTK_RESPONSE_YES)
57 ctk_widget_destroy (window);
58
59 ctk_widget_destroy (message_dialog);
60}
61
62static void
63socket_destroyed (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
64 Socket *socket)
65{
66 sockets = g_slist_remove (sockets, socket);
67 g_free (socket);
68}
69
70static void
71plug_added (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
72 Socket *socket)
73{
74 g_print ("Plug added to socket\n");
75
76 ctk_widget_show (socket->socket);
77 ctk_widget_hide (socket->frame);
78}
79
80static gboolean
81plug_removed (CtkWidget *widget G_GNUC_UNUSED__attribute__ ((__unused__)),
82 Socket *socket)
83{
84 g_print ("Plug removed from socket\n");
85
86 ctk_widget_hide (socket->socket);
87 ctk_widget_show (socket->frame);
88
89 return TRUE(!(0));
90}
91
92static Socket *
93create_socket (void)
94{
95 CtkWidget *label;
96
97 Socket *socket = g_new (Socket, 1)((Socket *) g_malloc_n ((1), sizeof (Socket)));
98
99 socket->box = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
100
101 socket->socket = ctk_socket_new ();
102
103 ctk_box_pack_start (CTK_BOX (socket->box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((socket->box)), ((ctk_box_get_type ()))))))
, socket->socket, TRUE(!(0)), TRUE(!(0)), 0);
104
105 socket->frame = ctk_frame_new (NULL((void*)0));
106 ctk_frame_set_shadow_type (CTK_FRAME (socket->frame)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((socket->frame)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
107 ctk_box_pack_start (CTK_BOX (socket->box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((socket->box)), ((ctk_box_get_type ()))))))
, socket->frame, TRUE(!(0)), TRUE(!(0)), 0);
108 ctk_widget_show (socket->frame);
109
110 label = ctk_label_new (NULL((void*)0));
111 ctk_label_set_markup (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((label)), ((ctk_label_get_type ()))))))
, "<span color=\"red\">Empty</span>");
112 ctk_container_add (CTK_CONTAINER (socket->frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((socket->frame)), ((ctk_container_get_type ()))))))
, label);
113 ctk_widget_show (label);
114
115 sockets = g_slist_prepend (sockets, socket);
116
117
118 g_signal_connect (socket->socket, "destroy",g_signal_connect_data ((socket->socket), ("destroy"), (((GCallback
) (socket_destroyed))), (socket), ((void*)0), (GConnectFlags)
0)
119 G_CALLBACK (socket_destroyed), socket)g_signal_connect_data ((socket->socket), ("destroy"), (((GCallback
) (socket_destroyed))), (socket), ((void*)0), (GConnectFlags)
0)
;
120 g_signal_connect (socket->socket, "plug_added",g_signal_connect_data ((socket->socket), ("plug_added"), (
((GCallback) (plug_added))), (socket), ((void*)0), (GConnectFlags
) 0)
121 G_CALLBACK (plug_added), socket)g_signal_connect_data ((socket->socket), ("plug_added"), (
((GCallback) (plug_added))), (socket), ((void*)0), (GConnectFlags
) 0)
;
122 g_signal_connect (socket->socket, "plug_removed",g_signal_connect_data ((socket->socket), ("plug_removed"),
(((GCallback) (plug_removed))), (socket), ((void*)0), (GConnectFlags
) 0)
123 G_CALLBACK (plug_removed), socket)g_signal_connect_data ((socket->socket), ("plug_removed"),
(((GCallback) (plug_removed))), (socket), ((void*)0), (GConnectFlags
) 0)
;
124
125 return socket;
126}
127
128void
129remove_child (CtkWidget *window G_GNUC_UNUSED__attribute__ ((__unused__)))
130{
131 if (sockets)
132 {
133 Socket *socket = sockets->data;
134 ctk_widget_destroy (socket->box);
135 }
136}
137
138static gboolean
139child_read_watch (GIOChannel *channel,
140 GIOCondition cond G_GNUC_UNUSED__attribute__ ((__unused__)),
141 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
142{
143 GIOStatus status;
144 GError *error = NULL((void*)0);
145 char *line;
146 gsize term;
147 int xid;
148
149 status = g_io_channel_read_line (channel, &line, NULL((void*)0), &term, &error);
150 switch (status)
151 {
152 case G_IO_STATUS_NORMAL:
153 line[term] = '\0';
154 xid = strtol (line, NULL((void*)0), 0);
155 if (xid == 0)
156 {
157 fprintf (stderrstderr, "Invalid window id '%s'\n", line);
158 }
159 else
160 {
161 Socket *socket = create_socket ();
162 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, socket->box, TRUE(!(0)), TRUE(!(0)), 0);
163 ctk_widget_show (socket->box);
164
165 ctk_socket_add_id (CTK_SOCKET (socket->socket)((((CtkSocket*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((socket->socket)), ((ctk_socket_get_type ()))))))
, xid);
166 }
167 g_free (line);
168 return TRUE(!(0));
169 case G_IO_STATUS_AGAIN:
170 return TRUE(!(0));
171 case G_IO_STATUS_EOF:
172 n_children--;
173 return FALSE(0);
174 case G_IO_STATUS_ERROR:
175 fprintf (stderrstderr, "Error reading fd from child: %s\n", error->message);
176 exit (1);
177 return FALSE(0);
178 default:
179 g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "testsocket.c", 179
, ((const char*) (__func__)), ((void*)0)); } while (0)
;
180 return FALSE(0);
181 }
182
183}
184
185void
186add_child (CtkWidget *window G_GNUC_UNUSED__attribute__ ((__unused__)),
187 gboolean active)
188{
189 char *argv[3] = { "./testsocket_child", NULL((void*)0), NULL((void*)0) };
190 char buffer[20];
191 int out_fd;
192 GIOChannel *channel;
193 GError *error = NULL((void*)0);
194
195 if (active)
196 {
197 Socket *socket;
198
199 socket = create_socket ();
200 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, socket->box, TRUE(!(0)), TRUE(!(0)), 0);
201 ctk_widget_show (socket->box);
202 sprintf(buffer, "%#lx", (gulong) ctk_socket_get_id (CTK_SOCKET (socket->socket)((((CtkSocket*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((socket->socket)), ((ctk_socket_get_type ()))))))
));
203 argv[1] = buffer;
204 }
205
206 if (!g_spawn_async_with_pipes (NULL((void*)0), argv, NULL((void*)0), 0, NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), &out_fd, NULL((void*)0), &error))
207 {
208 fprintf (stderrstderr, "Can't exec testsocket_child: %s\n", error->message);
209 exit (1);
210 }
211
212 n_children++;
213 channel = g_io_channel_unix_new (out_fd);
214 g_io_channel_set_close_on_unref (channel, TRUE(!(0)));
215 g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, &error);
216 if (error)
217 {
218 fprintf (stderrstderr, "Error making channel non-blocking: %s\n", error->message);
219 exit (1);
220 }
221
222 g_io_add_watch (channel, G_IO_IN | G_IO_HUP, child_read_watch, NULL((void*)0));
223 g_io_channel_unref (channel);
224}
225
226void
227add_active_child (CtkWidget *window)
228{
229 add_child (window, TRUE(!(0)));
230}
231
232void
233add_passive_child (CtkWidget *window)
234{
235 add_child (window, FALSE(0));
236}
237
238void
239add_local_active_child (CtkWidget *window G_GNUC_UNUSED__attribute__ ((__unused__)))
240{
241 Socket *socket;
242
243 socket = create_socket ();
244 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, socket->box, TRUE(!(0)), TRUE(!(0)), 0);
245 ctk_widget_show (socket->box);
246
247 create_child_plug (ctk_socket_get_id (CTK_SOCKET (socket->socket)((((CtkSocket*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((socket->socket)), ((ctk_socket_get_type ()))))))
), TRUE(!(0)));
248}
249
250void
251add_local_passive_child (CtkWidget *window G_GNUC_UNUSED__attribute__ ((__unused__)))
252{
253 Socket *socket;
254 Window xid;
255
256 socket = create_socket ();
257 ctk_box_pack_start (CTK_BOX (box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((box)), ((ctk_box_get_type ()))))))
, socket->box, TRUE(!(0)), TRUE(!(0)), 0);
258 ctk_widget_show (socket->box);
259
260 xid = create_child_plug (0, TRUE(!(0)));
261 ctk_socket_add_id (CTK_SOCKET (socket->socket)((((CtkSocket*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((socket->socket)), ((ctk_socket_get_type ()))))))
, xid);
262}
263
264static const char *
265grab_string (int status)
266{
267 switch (status) {
268 case CDK_GRAB_SUCCESS: return "GrabSuccess";
269 case CDK_GRAB_ALREADY_GRABBED: return "AlreadyGrabbed";
270 case CDK_GRAB_INVALID_TIME: return "GrabInvalidTime";
271 case CDK_GRAB_NOT_VIEWABLE: return "GrabNotViewable";
272 case CDK_GRAB_FROZEN: return "GrabFrozen";
273 default:
274 {
275 static char foo [255];
276 sprintf (foo, "unknown status: %d", status);
277 return foo;
278 }
279 }
280}
281
282static void
283grab_window_toggled (CtkToggleButton *button,
284 CtkWidget *widget)
285{
286 CdkDevice *device = ctk_get_current_event_device ();
287 CdkSeat *seat = cdk_device_get_seat (device);
288
289 if (ctk_toggle_button_get_active (button))
290 {
291 int status;
292
293 status = cdk_seat_grab (seat, ctk_widget_get_window (widget),
294 CDK_SEAT_CAPABILITY_KEYBOARD,
295 FALSE(0), NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0));
296
297 if (status != CDK_GRAB_SUCCESS)
298 g_warning ("Could not grab keyboard! (%s)", grab_string (status));
299
300 }
301 else
302 {
303 cdk_seat_ungrab (seat);
304 }
305}
306
307int
308main (int argc, char *argv[])
309{
310 CtkWidget *button;
311 CtkWidget *hbox;
312 CtkWidget *vbox;
313 CtkWidget *menubar;
314 CtkWidget *menuitem;
315 CtkWidget *menu;
316 CtkWidget *entry;
317 CtkWidget *checkbutton;
318 CtkAccelGroup *accel_group;
319
320 ctk_init (&argc, &argv);
321
322 window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
323 g_signal_connect (window, "destroy",g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_main_quit))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
324 G_CALLBACK (ctk_main_quit), NULL)g_signal_connect_data ((window), ("destroy"), (((GCallback) (
ctk_main_quit))), (((void*)0)), ((void*)0), (GConnectFlags) 0
)
;
325
326 ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, "Socket Test");
327 ctk_container_set_border_width (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, 0);
328
329 vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);
330 ctk_container_add (CTK_CONTAINER (window)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_container_get_type ()))))))
, vbox);
331
332 menubar = ctk_menu_bar_new ();
333 menuitem = ctk_menu_item_new_with_mnemonic ("_File");
334 ctk_menu_shell_append (CTK_MENU_SHELL (menubar)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menubar)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
335
336 menu = ctk_menu_new ();
337 ctk_menu_item_set_submenu (CTK_MENU_ITEM (menuitem)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menuitem)), ((ctk_menu_item_get_type ()))))))
, menu);
338 menuitem = ctk_menu_item_new_with_mnemonic ("_Quit");
339 g_signal_connect (menuitem, "activate", G_CALLBACK (quit_cb), window)g_signal_connect_data ((menuitem), ("activate"), (((GCallback
) (quit_cb))), (window), ((void*)0), (GConnectFlags) 0)
;
340 ctk_menu_shell_append (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, menuitem);
341
342 accel_group = ctk_accel_group_new ();
343 ctk_window_add_accel_group (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((window)), ((ctk_window_get_type ()))))))
, accel_group);
344 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, menubar, FALSE(0), FALSE(0), 0);
345
346 button = ctk_button_new_with_label ("Add Active Child");
347 ctk_box_pack_start (CTK_BOX(vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
348
349 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
add_active_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED)
350 G_CALLBACK (add_active_child), vbox)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
add_active_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED)
;
351
352 button = ctk_button_new_with_label ("Add Passive Child");
353 ctk_box_pack_start (CTK_BOX(vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
354
355 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
add_passive_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED)
356 G_CALLBACK (add_passive_child), vbox)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
add_passive_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED)
;
357
358 button = ctk_button_new_with_label ("Add Local Active Child");
359 ctk_box_pack_start (CTK_BOX(vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
360
361 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
add_local_active_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED
)
362 G_CALLBACK (add_local_active_child), vbox)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
add_local_active_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED
)
;
363
364 button = ctk_button_new_with_label ("Add Local Passive Child");
365 ctk_box_pack_start (CTK_BOX(vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
366
367 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
add_local_passive_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED
)
368 G_CALLBACK (add_local_passive_child), vbox)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
add_local_passive_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED
)
;
369
370 button = ctk_button_new_with_label ("Remove Last Child");
371 ctk_box_pack_start (CTK_BOX(vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, button, FALSE(0), FALSE(0), 0);
372
373 g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) (
remove_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED)
374 G_CALLBACK (remove_child), vbox)g_signal_connect_data ((button), ("clicked"), (((GCallback) (
remove_child))), (vbox), ((void*)0), G_CONNECT_SWAPPED)
;
375
376 checkbutton = ctk_check_button_new_with_label ("Grab keyboard");
377 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, checkbutton, FALSE(0), FALSE(0), 0);
378
379 g_signal_connect (checkbutton, "toggled",g_signal_connect_data ((checkbutton), ("toggled"), (((GCallback
) (grab_window_toggled))), (window), ((void*)0), (GConnectFlags
) 0)
380 G_CALLBACK (grab_window_toggled),g_signal_connect_data ((checkbutton), ("toggled"), (((GCallback
) (grab_window_toggled))), (window), ((void*)0), (GConnectFlags
) 0)
381 window)g_signal_connect_data ((checkbutton), ("toggled"), (((GCallback
) (grab_window_toggled))), (window), ((void*)0), (GConnectFlags
) 0)
;
382
383 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
384 ctk_box_pack_start (CTK_BOX(vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 0);
385
386 entry = ctk_entry_new ();
387 ctk_box_pack_start (CTK_BOX(hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((hbox)), ((ctk_box_get_type ()))))))
, entry, FALSE(0), FALSE(0), 0);
388
389 hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0);
390 ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((vbox)), ((ctk_box_get_type ()))))))
, hbox, FALSE(0), FALSE(0), 0);
391
392 box = hbox;
393
394 ctk_widget_show_all (window);
395
396 ctk_main ();
397
398 if (n_children)
399 {
400 g_print ("Waiting for children to exit\n");
This statement is never executed
401
402 while (n_children)
403 g_main_context_iteration (NULL((void*)0), TRUE(!(0)));
404 }
405
406 return 0;
407}