Bug Summary

File:kanberra-ctk-module.c
Warning:line 442, column 33
Value stored to 'ret' is never read

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 kanberra-ctk-module.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -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 -fhalf-no-semantic-interposition -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 -fcoverage-compilation-dir=/rootdir/src -resource-dir /usr/lib/llvm-14/lib/clang/14.0.6 -D HAVE_CONFIG_H -I . -I .. -I /usr/include/ctk-3.0 -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/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/uuid -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/gio-unix-2.0 -I /usr/include/atk-1.0 -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 -D PIC -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/src -ferror-limit 19 -fgnuc-version=4.2.1 -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.core.SizeofPtr -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/2022-12-26-013403-18485-1 -x c kanberra-ctk-module.c
1/*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3/***
4 This file is part of libkanberra.
5
6 Copyright 2008 Lennart Poettering
7
8 libkanberra is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation, either version 2.1 of the
11 License, or (at your option) any later version.
12
13 libkanberra is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with libkanberra. If not, see
20 <http://www.gnu.org/licenses/>.
21***/
22
23#ifdef HAVE_CONFIG_H1
24#include <config.h>
25#endif
26
27#include <ctk/ctk.h>
28#include <cdk/cdkx.h>
29#include <X11/Xatom.h>
30
31#include "kanberra-ctk.h"
32
33typedef struct {
34 guint signal_id;
35 gboolean arg1_is_set;
36 GObject *object;
37 GValue arg1;
38 CdkEvent *event;
39} SoundEventData;
40
41/*
42 We generate these sounds:
43
44 dialog-error
45 dialog-warning
46 dialog-information
47 dialog-question
48 window-new
49 window-close
50 window-minimized
51 window-unminimized
52 window-maximized
53 window-unmaximized
54 notebook-tab-changed
55 dialog-ok
56 dialog-cancel
57 item-selected
58 link-pressed
59 link-released
60 button-pressed
61 button-released
62 menu-click
63 button-toggle-on
64 button-toggle-off
65 menu-popup
66 menu-popdown
67 menu-replace
68 tooltip-popup
69 tooltip-popdown
70 drag-start
71 drag-accept
72 drag-fail
73 expander-toggle-on
74 expander-toggle-off
75
76 TODO:
77 scroll-xxx
78 window-switch
79 window-resize-xxx
80 window-move-xxx
81
82*/
83
84static gboolean disabled = FALSE(0);
85
86static GQueue sound_event_queue = G_QUEUE_INIT{ ((void*)0), ((void*)0), 0 };
87
88static guint idle_id = 0;
89
90static guint
91 signal_id_dialog_response,
92 signal_id_widget_show,
93 signal_id_widget_hide,
94 signal_id_check_menu_item_toggled,
95 signal_id_menu_item_activate,
96 signal_id_toggle_button_toggled,
97 signal_id_button_pressed,
98 signal_id_button_released,
99 signal_id_widget_window_state_event,
100 signal_id_notebook_switch_page,
101 signal_id_tree_view_cursor_changed,
102 signal_id_icon_view_selection_changed,
103 signal_id_widget_drag_begin,
104 signal_id_widget_drag_failed,
105 signal_id_widget_drag_drop,
106 signal_id_expander_activate;
107
108static GQuark
109 disable_sound_quark,
110 was_iconized_quark,
111 is_xembed_quark;
112
113/* Make sure GCC doesn't warn us about a missing prototype for this
114 * exported function */
115void ctk_module_init(gint *argc, gchar ***argv[]);
116
117static const char *translate_message_tye(CtkMessageType mt) {
118 static const char *const message_type_table[] = {
119 [CTK_MESSAGE_INFO] = "dialog-information",
120 [CTK_MESSAGE_WARNING] = "dialog-warning",
121 [CTK_MESSAGE_QUESTION] = "dialog-question",
122 [CTK_MESSAGE_ERROR] = "dialog-error",
123 [CTK_MESSAGE_OTHER] = NULL((void*)0)
124 };
125
126 if (mt >= G_N_ELEMENTS(message_type_table)(sizeof (message_type_table) / sizeof ((message_type_table)[0
]))
)
127 return NULL((void*)0);
128
129 return message_type_table[mt];
130}
131
132static const char *translate_response(int response) {
133 static const char *const response_table[] = {
134 [-CTK_RESPONSE_NONE] = NULL((void*)0),
135 [-CTK_RESPONSE_REJECT] = "dialog-cancel",
136 [-CTK_RESPONSE_DELETE_EVENT] = "dialog-cancel",
137 [-CTK_RESPONSE_ACCEPT] = "dialog-ok",
138 [-CTK_RESPONSE_OK] = "dialog-ok",
139 [-CTK_RESPONSE_CANCEL] = "dialog-cancel",
140 [-CTK_RESPONSE_CLOSE] = "dialog-ok",
141 [-CTK_RESPONSE_YES] = "dialog-ok",
142 [-CTK_RESPONSE_NO] = "dialog-cancel",
143 [-CTK_RESPONSE_APPLY] = "dialog-ok",
144 [-CTK_RESPONSE_HELP] = NULL((void*)0),
145 };
146
147 if (response >= 0)
148 return NULL((void*)0);
149
150 if ((unsigned) -response >= G_N_ELEMENTS(response_table)(sizeof (response_table) / sizeof ((response_table)[0])))
151 return NULL((void*)0);
152
153 return response_table[-response];
154}
155
156static gboolean is_child_of_combo_box(CtkWidget *w) {
157
158 while (w) {
159
160 if (CTK_IS_COMBO_BOX(w)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(w)); GType __t = ((ctk_combo_box_get_type ())); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
161 return TRUE(!(0));
162
163 w = ctk_widget_get_parent(w);
164 }
165
166 return FALSE(0);
167}
168
169static CtkDialog* find_parent_dialog(CtkWidget *w) {
170
171 while (w) {
172
173 if (CTK_IS_DIALOG(w)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(w)); GType __t = ((ctk_dialog_get_type ())); gboolean __r; if
(!__inst) __r = (0); else if (__inst->g_class && __inst
->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a
(__inst, __t); __r; }))))
)
174 return CTK_DIALOG(w)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((w)), ((ctk_dialog_get_type ()))))))
;
175
176 w = ctk_widget_get_parent(w);
177 }
178
179 return NULL((void*)0);
180}
181
182static void free_sound_event(SoundEventData *d) {
183
184 g_object_unref(d->object);
185
186 if (d->arg1_is_set)
187 g_value_unset(&d->arg1);
188
189 if (d->event)
190 cdk_event_free(d->event);
191
192 g_slice_free(SoundEventData, d)do { if (1) g_slice_free1 (sizeof (SoundEventData), (d)); else
(void) ((SoundEventData*) 0 == (d)); } while (0)
;
193}
194
195static gboolean is_menu_hint(CdkWindowTypeHint hint) {
196 return
197 hint == CDK_WINDOW_TYPE_HINT_POPUP_MENU ||
198 hint == CDK_WINDOW_TYPE_HINT_DROPDOWN_MENU ||
199 hint == CDK_WINDOW_TYPE_HINT_MENU;
200}
201
202static SoundEventData* filter_sound_event(SoundEventData *d) {
203 GList *i, *n;
204
205 do {
206
207 for (i = sound_event_queue.head; i; i = n) {
208 SoundEventData *j;
209
210 j = i->data;
211 n = i->next;
212
213 if (d->object == j->object) {
214
215 /* Let's drop a show event immediately followed by a
216 * hide event */
217
218 if (d->signal_id == signal_id_widget_show &&
219 j->signal_id == signal_id_widget_hide) {
220
221 free_sound_event(d);
222 free_sound_event(j);
223 g_queue_delete_link(&sound_event_queue, i);
224
225 return NULL((void*)0);
226 }
227
228 /* Let's drop widget hide events in favour of dialog
229 * response.
230 *
231 * Let's drop widget window state events in favour of
232 * widget hide/show.
233 *
234 * Let's drop double events */
235
236 if ((d->signal_id == signal_id_widget_hide &&
237 j->signal_id == signal_id_dialog_response) ||
238
239 (d->signal_id == signal_id_widget_window_state_event &&
240 j->signal_id == signal_id_widget_hide) ||
241
242 (d->signal_id == signal_id_widget_window_state_event &&
243 j->signal_id == signal_id_widget_show)) {
244
245 free_sound_event(d);
246 d = j;
247 g_queue_delete_link(&sound_event_queue, i);
248 break;
249 }
250
251 if ((d->signal_id == signal_id_dialog_response &&
252 j->signal_id == signal_id_widget_hide) ||
253
254 (d->signal_id == signal_id_widget_show &&
255 j->signal_id == signal_id_widget_window_state_event) ||
256
257 (d->signal_id == signal_id_widget_hide &&
258 j->signal_id == signal_id_widget_window_state_event) ||
259
260 (d->signal_id == j->signal_id)) {
261
262 free_sound_event(j);
263 g_queue_delete_link(&sound_event_queue, i);
264 }
265
266 } else if (CTK_IS_WINDOW(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
&& CTK_IS_WINDOW(j->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(j->object)); GType __t = ((ctk_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
) {
267
268 CdkWindowTypeHint dhint, jhint;
269
270 dhint = ctk_window_get_type_hint(CTK_WINDOW(d->object)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_window_get_type ()))))))
);
271 jhint = ctk_window_get_type_hint(CTK_WINDOW(j->object)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((j->object)), ((ctk_window_get_type ()))))))
);
272
273 if (is_menu_hint(dhint) && is_menu_hint(jhint)) {
274
275 if (d->signal_id == signal_id_widget_hide &&
276 j->signal_id == signal_id_widget_show) {
277 free_sound_event(d);
278 d = j;
279 g_queue_delete_link(&sound_event_queue, i);
280 break;
281 }
282
283 if (d->signal_id == signal_id_widget_show &&
284 j->signal_id == signal_id_widget_hide) {
285
286 free_sound_event(j);
287 g_queue_delete_link(&sound_event_queue, i);
288 }
289 }
290 }
291 }
292
293 /* If we exited the iteration early, let's retry. */
294
295 } while (i);
296
297 /* FIXME: Filter menu hide on menu show */
298
299 return d;
300}
301
302static gint window_get_desktop(CdkDisplay *d, CdkWindow *w) {
303 Atom type_return;
304 gint format_return;
305 gulong nitems_return;
306 gulong bytes_after_return;
307 guchar *data = NULL((void*)0);
308 gint ret = -1;
309
310#ifdef CDK_IS_X11_DISPLAY
311 if (!CDK_IS_X11_DISPLAY(d)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d)); GType __t = ((cdk_x11_display_get_type())); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
312 return 0;
313#endif
314
315 if (XGetWindowProperty(CDK_DISPLAY_XDISPLAY(d)(cdk_x11_display_get_xdisplay (d)), CDK_WINDOW_XID(w)(cdk_x11_window_get_xid (w)),
316 cdk_x11_get_xatom_by_name_for_display(d, "_NET_WM_DESKTOP"),
317 0, G_MAXLONG9223372036854775807L, False0, XA_CARDINAL((Atom) 6), &type_return,
318 &format_return, &nitems_return, &bytes_after_return,
319 &data) != Success0)
320 return -1;
321
322 if (type_return == XA_CARDINAL((Atom) 6) && format_return == 32 && data) {
323 guint32 desktop = *(guint32*) data;
324
325 if (desktop != 0xFFFFFFFF)
326 ret = (gint) desktop;
327 }
328
329 if (type_return != None0L && data != NULL((void*)0))
330 XFree(data);
331
332 return ret;
333}
334
335static gint display_get_desktop(CdkDisplay *d) {
336 Atom type_return;
337 gint format_return;
338 gulong nitems_return;
339 gulong bytes_after_return;
340 guchar *data = NULL((void*)0);
341 gint ret = -1;
342
343#ifdef CDK_IS_X11_DISPLAY
344 if (!CDK_IS_X11_DISPLAY(d)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d)); GType __t = ((cdk_x11_display_get_type())); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
345 return 0;
346#endif
347
348 if (XGetWindowProperty(CDK_DISPLAY_XDISPLAY(d)(cdk_x11_display_get_xdisplay (d)), DefaultRootWindow(CDK_DISPLAY_XDISPLAY(d))((&((_XPrivDisplay)((cdk_x11_display_get_xdisplay (d))))->
screens[(((_XPrivDisplay)((cdk_x11_display_get_xdisplay (d)))
)->default_screen)])->root)
,
349 cdk_x11_get_xatom_by_name_for_display(d, "_NET_CURRENT_DESKTOP"),
350 0, G_MAXLONG9223372036854775807L, False0, XA_CARDINAL((Atom) 6), &type_return,
351 &format_return, &nitems_return, &bytes_after_return,
352 &data) != Success0)
353 return -1;
354
355 if (type_return == XA_CARDINAL((Atom) 6) && format_return == 32 && data) {
356
357 guint32 desktop = *(guint32*) data;
358
359 if (desktop != 0xFFFFFFFF)
360 ret = (gint) desktop;
361 }
362
363 if (type_return != None0L && data != NULL((void*)0))
364 XFree(data);
365
366 return ret;
367}
368
369static gboolean window_is_xembed(CdkDisplay *d, CdkWindow *w) {
370 Atom type_return;
371 gint format_return;
372 gulong nitems_return;
373 gulong bytes_after_return;
374 guchar *data = NULL((void*)0);
375 gboolean ret = FALSE(0);
376 Atom xembed;
377
378#ifdef CDK_IS_X11_DISPLAY
379 if (!CDK_IS_X11_DISPLAY(d)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d)); GType __t = ((cdk_x11_display_get_type())); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
380 return FALSE(0);
381#endif
382
383 /* Gnome Panel applets are XEMBED windows. We need to make sure we
384 * ignore them */
385
386 xembed = cdk_x11_get_xatom_by_name_for_display(d, "_XEMBED_INFO");
387
388 /* be robust against not existing XIDs (LP: #834403) */
389 cdk_x11_display_error_trap_push (d);
390 if (XGetWindowProperty(CDK_DISPLAY_XDISPLAY(d)(cdk_x11_display_get_xdisplay (d)), CDK_WINDOW_XID(w)(cdk_x11_window_get_xid (w)),
391 xembed,
392 0, 2, False0, xembed, &type_return,
393 &format_return, &nitems_return, &bytes_after_return,
394 &data) != Success0) {
395 return FALSE(0);
396 }
397
398 cdk_x11_display_error_trap_pop_ignored (d);
399
400 if (type_return == xembed && format_return == 32 && data)
401 ret = TRUE(!(0));
402
403 if (type_return != None0L && data != NULL((void*)0))
404 XFree(data);
405
406 return ret;
407}
408
409static void dispatch_sound_event(SoundEventData *d) {
410 int ret = KA_SUCCESS;
411 static gboolean menu_is_popped_up = FALSE(0);
412
413 if (g_object_get_qdata(d->object, disable_sound_quark))
414 return;
415
416 /* The CdkWindow of the the widget might have changed while this
417 * event was queued for us. Make sure to update it from the
418 * current one if necessary. */
419 if (d->event && d->event->any.window) {
420 CdkWindow *window;
421
422 g_object_unref(G_OBJECT(d->event->any.window)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->event->any.window)), (((GType) ((20) << (
2))))))))
);
423
424 if ((window = ctk_widget_get_window(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
)))
425 d->event->any.window = CDK_WINDOW(g_object_ref(G_OBJECT(window)))((((CdkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((__typeof__ (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((window)), (((GType) ((20) << (2)))
))))))) (g_object_ref) (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((window)), (((GType) ((20) << (2)))
))))))))), ((cdk_window_get_type ()))))))
;
426 else
427 d->event->any.window = NULL((void*)0);
428 }
429
430 if (d->signal_id == signal_id_widget_show) {
431 CdkWindowTypeHint hint;
432
433 /* Show/hide signals for non-windows have already been filtered out
434 * by the emission hook! */
435
436 hint = ctk_window_get_type_hint(CTK_WINDOW(d->object)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_window_get_type ()))))))
);
437
438 if (is_menu_hint(hint)) {
439
440 if (!menu_is_popped_up) {
441
442 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
Value stored to 'ret' is never read
443 KA_PROP_EVENT_ID"event.id", "menu-popup",
444 KA_PROP_EVENT_DESCRIPTION"event.description", "Menu popped up",
445 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
446 NULL((void*)0));
447 } else {
448 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
449 KA_PROP_EVENT_ID"event.id", "menu-replace",
450 KA_PROP_EVENT_DESCRIPTION"event.description", "Menu replaced",
451 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
452 NULL((void*)0));
453 }
454
455 menu_is_popped_up = TRUE(!(0));
456
457 } else if (hint == CDK_WINDOW_TYPE_HINT_TOOLTIP) {
458
459 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
460 KA_PROP_EVENT_ID"event.id", "tooltip-popup",
461 KA_PROP_EVENT_DESCRIPTION"event.description", "Tooltip popped up",
462 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
463 NULL((void*)0));
464
465 } else if (hint == CDK_WINDOW_TYPE_HINT_NORMAL ||
466 hint == CDK_WINDOW_TYPE_HINT_DIALOG) {
467
468 gboolean played_sound = FALSE(0);
469 gboolean is_xembed;
470
471 is_xembed =
472 ctk_widget_get_realized(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
) &&
473 window_is_xembed(
474 ctk_widget_get_display(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
),
475 ctk_widget_get_window(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
));
476
477 g_object_set_qdata(d->object, is_xembed_quark, GINT_TO_POINTER(is_xembed)((gpointer) (glong) (is_xembed)));
478
479 if (CTK_IS_MESSAGE_DIALOG(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_message_dialog_get_type ()
)); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))
) {
480 CtkMessageType mt;
481 const char *id;
482
483 g_object_get(d->object, "message_type", &mt, NULL((void*)0));
484
485 if ((id = translate_message_tye(mt))) {
486
487 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
488 KA_PROP_EVENT_ID"event.id", id,
489 KA_PROP_EVENT_DESCRIPTION"event.description", "Message dialog shown",
490 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
491 NULL((void*)0));
492 played_sound = TRUE(!(0));
493 }
494
495 }
496
497 if (!played_sound &&
498 !is_xembed &&
499 ctk_window_get_decorated(CTK_WINDOW(d->object)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_window_get_type ()))))))
)) {
500
501 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
502 KA_PROP_EVENT_ID"event.id", "window-new",
503 KA_PROP_EVENT_DESCRIPTION"event.description", "Window shown",
504 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
505 NULL((void*)0));
506
507 }
508 }
509 }
510
511 if (CTK_IS_DIALOG(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_dialog_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
&& d->signal_id == signal_id_dialog_response) {
512
513 int response;
514 const char *id;
515
516 response = g_value_get_int(&d->arg1);
517
518 if ((id = translate_response(response))) {
519
520 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
521 KA_PROP_EVENT_ID"event.id", id,
522 KA_PROP_EVENT_DESCRIPTION"event.description", "Dialog closed",
523 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
524 NULL((void*)0));
525 } else {
526 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
527 KA_PROP_EVENT_ID"event.id", "window-close",
528 KA_PROP_EVENT_DESCRIPTION"event.description", "Window closed",
529 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
530 NULL((void*)0));
531 }
532
533 } else if (d->signal_id == signal_id_widget_hide) {
534 CdkWindowTypeHint hint;
535
536 hint = ctk_window_get_type_hint(CTK_WINDOW(d->object)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_window_get_type ()))))))
);
537
538 if (is_menu_hint(hint)) {
539
540 if (CTK_IS_MENU(ctk_bin_get_child(CTK_BIN(d->object)))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(ctk_bin_get_child(((((CtkBin*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((d->object)), ((ctk_bin_get_type ())))
)))))); GType __t = ((ctk_menu_get_type ())); gboolean __r; if
(!__inst) __r = (0); else if (__inst->g_class && __inst
->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a
(__inst, __t); __r; }))))
) {
541
542 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
543 KA_PROP_EVENT_ID"event.id", "menu-popdown",
544 KA_PROP_EVENT_DESCRIPTION"event.description", "Menu popped down",
545 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
546 NULL((void*)0));
547 }
548
549 menu_is_popped_up = FALSE(0);
550
551 } else if (hint == CDK_WINDOW_TYPE_HINT_TOOLTIP) {
552
553 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
554 KA_PROP_EVENT_ID"event.id", "tooltip-popdown",
555 KA_PROP_EVENT_DESCRIPTION"event.description", "Tooltip popped down",
556 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
557 NULL((void*)0));
558
559 } else if ((hint == CDK_WINDOW_TYPE_HINT_NORMAL ||
560 hint == CDK_WINDOW_TYPE_HINT_DIALOG)) {
561
562 gboolean is_xembed;
563
564 is_xembed = !!g_object_get_qdata(d->object, is_xembed_quark);
565
566 if (!is_xembed &&
567 ctk_window_get_decorated(CTK_WINDOW(d->object)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_window_get_type ()))))))
))
568 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
569 KA_PROP_EVENT_ID"event.id", "window-close",
570 KA_PROP_EVENT_DESCRIPTION"event.description", "Window closed",
571 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
572 NULL((void*)0));
573 }
574 }
575
576 if (CTK_IS_WINDOW(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_window_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
&& d->signal_id == signal_id_widget_window_state_event) {
577 CdkEventWindowState *e;
578 gint w_desktop = -1, c_desktop = -1;
579
580 e = (CdkEventWindowState*) d->event;
581
582 /* Unfortunately CDK_WINDOW_STATE_ICONIFIED is used both for
583 * proper minimizing and when a window becomes invisible
584 * because the desktop was switched. To handle this we check
585 * if the window becoming invisible is actually on the current
586 * desktop, and only if that's the case we assume it is being
587 * minimized. We then store this information, so that we know
588 * later on when the window is unminimized again. */
589
590 if (ctk_widget_get_realized(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
)) {
591 CdkDisplay *display;
592
593 display = ctk_widget_get_display(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
);
594 w_desktop = window_get_desktop(display, ctk_widget_get_window(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
));
595 c_desktop = display_get_desktop(display);
596 }
597
598 if ((e->changed_mask & CDK_WINDOW_STATE_ICONIFIED) &&
599 (e->new_window_state & CDK_WINDOW_STATE_ICONIFIED) &&
600 (w_desktop == c_desktop || w_desktop < 0)) {
601
602 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
603 KA_PROP_EVENT_ID"event.id", "window-minimized",
604 KA_PROP_EVENT_DESCRIPTION"event.description", "Window minimized",
605 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
606 NULL((void*)0));
607
608 g_object_set_qdata(d->object, was_iconized_quark, GINT_TO_POINTER(1)((gpointer) (glong) (1)));
609
610 } else if ((e->changed_mask & (CDK_WINDOW_STATE_MAXIMIZED|CDK_WINDOW_STATE_FULLSCREEN)) &&
611 (e->new_window_state & (CDK_WINDOW_STATE_MAXIMIZED|CDK_WINDOW_STATE_FULLSCREEN))) {
612
613 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
614 KA_PROP_EVENT_ID"event.id", "window-maximized",
615 KA_PROP_EVENT_DESCRIPTION"event.description", "Window maximized",
616 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
617 NULL((void*)0));
618
619 g_object_set_qdata(d->object, was_iconized_quark, GINT_TO_POINTER(0)((gpointer) (glong) (0)));
620
621 } else if ((e->changed_mask & CDK_WINDOW_STATE_ICONIFIED) &&
622 !(e->new_window_state & CDK_WINDOW_STATE_ICONIFIED) &&
623 g_object_get_qdata(d->object, was_iconized_quark)) {
624
625 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
626 KA_PROP_EVENT_ID"event.id", "window-unminimized",
627 KA_PROP_EVENT_DESCRIPTION"event.description", "Window unminimized",
628 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
629 NULL((void*)0));
630
631 g_object_set_qdata(d->object, was_iconized_quark, GINT_TO_POINTER(0)((gpointer) (glong) (0)));
632
633 } else if ((e->changed_mask & (CDK_WINDOW_STATE_MAXIMIZED|CDK_WINDOW_STATE_FULLSCREEN)) &&
634 !(e->new_window_state & (CDK_WINDOW_STATE_MAXIMIZED|CDK_WINDOW_STATE_FULLSCREEN))) {
635
636 ret = ka_ctk_play_for_widget(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
, 0,
637 KA_PROP_EVENT_ID"event.id", "window-unmaximized",
638 KA_PROP_EVENT_DESCRIPTION"event.description", "Window unmaximized",
639 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
640 NULL((void*)0));
641 }
642 }
643
644 if (CTK_IS_CHECK_MENU_ITEM(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_check_menu_item_get_type (
))); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))
&& d->signal_id == signal_id_check_menu_item_toggled) {
645
646 if (ctk_check_menu_item_get_active(CTK_CHECK_MENU_ITEM(d->object)((((CtkCheckMenuItem*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((d->object)), ((ctk_check_menu_item_get_type
()))))))
))
647 ret = ka_ctk_play_for_event(d->event, 0,
648 KA_PROP_EVENT_ID"event.id", "button-toggle-on",
649 KA_PROP_EVENT_DESCRIPTION"event.description", "Check menu item checked",
650 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
651 NULL((void*)0));
652 else
653 ret = ka_ctk_play_for_event(d->event, 0,
654 KA_PROP_EVENT_ID"event.id", "button-toggle-off",
655 KA_PROP_EVENT_DESCRIPTION"event.description", "Check menu item unchecked",
656 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
657 NULL((void*)0));
658
659 } else if (CTK_IS_MENU_ITEM(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_menu_item_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
&& d->signal_id == signal_id_menu_item_activate) {
660
661 if (!ctk_menu_item_get_submenu(CTK_MENU_ITEM(d->object)((((CtkMenuItem*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_menu_item_get_type ()))))))
))
662 ret = ka_ctk_play_for_event(d->event, 0,
663 KA_PROP_EVENT_ID"event.id", "menu-click",
664 KA_PROP_EVENT_DESCRIPTION"event.description", "Menu item clicked",
665 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
666 NULL((void*)0));
667 }
668
669 if (CTK_IS_TOGGLE_BUTTON(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_toggle_button_get_type ())
); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))
) {
670
671 if (d->signal_id == signal_id_toggle_button_toggled) {
672
673 if (!is_child_of_combo_box(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
)) {
674
675 /* We don't want to play this sound if this is a toggle
676 * button belonging to combo box. */
677
678 if (ctk_toggle_button_get_active(CTK_TOGGLE_BUTTON(d->object)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_toggle_button_get_type ()))))))
))
679 ret = ka_ctk_play_for_event(d->event, 0,
680 KA_PROP_EVENT_ID"event.id", "button-toggle-on",
681 KA_PROP_EVENT_DESCRIPTION"event.description", "Toggle button checked",
682 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
683 NULL((void*)0));
684 else
685 ret = ka_ctk_play_for_event(d->event, 0,
686 KA_PROP_EVENT_ID"event.id", "button-toggle-off",
687 KA_PROP_EVENT_DESCRIPTION"event.description", "Toggle button unchecked",
688 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
689 NULL((void*)0));
690 }
691 }
692
693 } else if (CTK_IS_LINK_BUTTON(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_link_button_get_type ()));
gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class
&& __inst->g_class->g_type == __t) __r = (!(0)
); else __r = g_type_check_instance_is_a (__inst, __t); __r; }
))))
) {
694
695 if (d->signal_id == signal_id_button_pressed) {
696 ret = ka_ctk_play_for_event(d->event, 0,
697 KA_PROP_EVENT_ID"event.id", "link-pressed",
698 KA_PROP_EVENT_DESCRIPTION"event.description", "Link pressed",
699 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
700 NULL((void*)0));
701
702 } else if (d->signal_id == signal_id_button_released) {
703
704 ret = ka_ctk_play_for_event(d->event, 0,
705 KA_PROP_EVENT_ID"event.id", "link-released",
706 KA_PROP_EVENT_DESCRIPTION"event.description", "Link released",
707 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
708 NULL((void*)0));
709 }
710
711 } else if (CTK_IS_BUTTON(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_button_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
&& !CTK_IS_TOGGLE_BUTTON(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_toggle_button_get_type ())
); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))
) {
712
713 if (d->signal_id == signal_id_button_pressed) {
714 ret = ka_ctk_play_for_event(d->event, 0,
715 KA_PROP_EVENT_ID"event.id", "button-pressed",
716 KA_PROP_EVENT_DESCRIPTION"event.description", "Button pressed",
717 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
718 NULL((void*)0));
719
720 } else if (d->signal_id == signal_id_button_released) {
721 CtkDialog *dialog;
722 gboolean dont_play = FALSE(0);
723
724 if ((dialog = find_parent_dialog(CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
))) {
725 int response;
726
727 /* Don't play the click sound if this is a response widget
728 * we will generate a dialog-xxx event sound anyway. */
729
730 response = ctk_dialog_get_response_for_widget(dialog, CTK_WIDGET(d->object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_widget_get_type ()))))))
);
731 dont_play = !!translate_response(response);
732 }
733
734 if (!dont_play)
735 ret = ka_ctk_play_for_event(d->event, 0,
736 KA_PROP_EVENT_ID"event.id", "button-released",
737 KA_PROP_EVENT_DESCRIPTION"event.description", "Button released",
738 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
739 NULL((void*)0));
740 }
741 }
742
743 if (CTK_IS_NOTEBOOK(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_notebook_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
&& d->signal_id == signal_id_notebook_switch_page) {
744 ret = ka_ctk_play_for_event(d->event, 0,
745 KA_PROP_EVENT_ID"event.id", "notebook-tab-changed",
746 KA_PROP_EVENT_DESCRIPTION"event.description", "Tab changed",
747 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
748 NULL((void*)0));
749 goto finish;
750 }
751
752 if (CTK_IS_TREE_VIEW(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_tree_view_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
&& d->signal_id == signal_id_tree_view_cursor_changed) {
753 ret = ka_ctk_play_for_event(d->event, 0,
754 KA_PROP_EVENT_ID"event.id", "item-selected",
755 KA_PROP_EVENT_DESCRIPTION"event.description", "Item selected",
756 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
757 NULL((void*)0));
758 goto finish;
759 }
760
761 if (CTK_IS_ICON_VIEW(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_icon_view_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
&& d->signal_id == signal_id_icon_view_selection_changed) {
762 ret = ka_ctk_play_for_event(d->event, 0,
763 KA_PROP_EVENT_ID"event.id", "item-selected",
764 KA_PROP_EVENT_DESCRIPTION"event.description", "Item selected",
765 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
766 NULL((void*)0));
767 goto finish;
768 }
769
770 if (CTK_IS_EXPANDER(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_expander_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
&& d->signal_id == signal_id_expander_activate) {
771
772 if (ctk_expander_get_expanded(CTK_EXPANDER(d->object)((((CtkExpander*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((d->object)), ((ctk_expander_get_type ()))))))
))
773 ret = ka_ctk_play_for_event(d->event, 0,
774 KA_PROP_EVENT_ID"event.id", "expander-toggle-on",
775 KA_PROP_EVENT_DESCRIPTION"event.description", "Expander expanded",
776 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
777 NULL((void*)0));
778 else
779 ret = ka_ctk_play_for_event(d->event, 0,
780 KA_PROP_EVENT_ID"event.id", "expander-toggle-off",
781 KA_PROP_EVENT_DESCRIPTION"event.description", "Expander unexpanded",
782 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
783 NULL((void*)0));
784
785 goto finish;
786 }
787
788 if (CTK_IS_WIDGET(d->object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(d->object)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
) {
789
790 if (d->signal_id == signal_id_widget_drag_begin) {
791
792 ret = ka_ctk_play_for_event(d->event, 0,
793 KA_PROP_EVENT_ID"event.id", "drag-start",
794 KA_PROP_EVENT_DESCRIPTION"event.description", "Drag started",
795 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
796 NULL((void*)0));
797 goto finish;
798
799 } else if (d->signal_id == signal_id_widget_drag_drop) {
800
801 ret = ka_ctk_play_for_event(d->event, 0,
802 KA_PROP_EVENT_ID"event.id", "drag-accept",
803 KA_PROP_EVENT_DESCRIPTION"event.description", "Drag accepted",
804 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
805 NULL((void*)0));
806 goto finish;
807
808 } else if (d->signal_id == signal_id_widget_drag_failed) {
809
810 ret = ka_ctk_play_for_event(d->event, 0,
811 KA_PROP_EVENT_ID"event.id", "drag-fail",
812 KA_PROP_EVENT_DESCRIPTION"event.description", "Drag failed",
813 KA_PROP_KANBERRA_CACHE_CONTROL"kanberra.cache-control", "permanent",
814 NULL((void*)0));
815 goto finish;
816 }
817 }
818
819finish:
820
821 ;
822 /* if (ret != KA_SUCCESS) */
823 /* g_warning("Failed to play event sound: %s", ka_strerror(ret)); */
824}
825
826static void dispatch_queue(void) {
827 SoundEventData *d;
828
829 while ((d = g_queue_pop_head(&sound_event_queue))) {
830
831 if (!(d = filter_sound_event(d)))
832 continue;
833
834 dispatch_sound_event(d);
835 free_sound_event(d);
836 }
837}
838
839static gboolean idle_cb(void *userdata) {
840 idle_id = 0;
841
842 dispatch_queue();
843
844 return FALSE(0);
845}
846
847static void connect_settings(void);
848
849static gboolean emission_hook_cb(GSignalInvocationHint *hint, guint n_param_values, const GValue *param_values, gpointer data) {
850 static SoundEventData *d = NULL((void*)0);
851 CdkEvent *e;
852 GObject *object;
853
854 connect_settings();
855
856 if (disabled)
857 return TRUE(!(0));
858
859 object = g_value_get_object(&param_values[0]);
860
861 /* g_message("signal '%s' on object of type '%s' with name '%s'", */
862 /* g_signal_name(hint->signal_id), */
863 /* G_OBJECT_TYPE_NAME(object), */
864 /* ctk_widget_get_name(CTK_WIDGET(object))); */
865
866 /* if (CTK_IS_WINDOW(object)) */
867 /* g_message("window role='%s' title='%s' type='%u'", */
868 /* ctk_window_get_role(CTK_WINDOW(object)), */
869 /* ctk_window_get_title(CTK_WINDOW(object)), */
870 /* ctk_window_get_type_hint(CTK_WINDOW(object))); */
871
872 /* Filter a few very often occuring signals as quickly as possible */
873 if ((hint->signal_id == signal_id_widget_hide ||
874 hint->signal_id == signal_id_widget_show ||
875 hint->signal_id == signal_id_widget_window_state_event) &&
876 !CTK_IS_WINDOW(object)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(object)); GType __t = ((ctk_window_get_type ())); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
877 return TRUE(!(0));
878
879 if (hint->signal_id != signal_id_widget_hide &&
880 hint->signal_id != signal_id_dialog_response &&
881 !ctk_widget_is_drawable(CTK_WIDGET (object)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((ctk_widget_get_type ()))))))
))
882 return TRUE(!(0));
883
884 d = g_slice_new0(SoundEventData)((SoundEventData*) g_slice_alloc0 (sizeof (SoundEventData)));
885
886 d->object = g_object_ref(object)((__typeof__ (object)) (g_object_ref) (object));
887
888 d->signal_id = hint->signal_id;
889
890 if (d->signal_id == signal_id_widget_window_state_event) {
891 d->event = cdk_event_copy(g_value_peek_pointer(&param_values[1]));
892 } else if ((e = ctk_get_current_event()))
893 d->event = cdk_event_copy(e);
894
895 if (n_param_values > 1) {
896 g_value_init(&d->arg1, G_VALUE_TYPE(&param_values[1])(((GValue*) (&param_values[1]))->g_type));
897 g_value_copy(&param_values[1], &d->arg1);
898 d->arg1_is_set = TRUE(!(0));
899 }
900
901 g_queue_push_tail(&sound_event_queue, d);
902
903 if (idle_id == 0)
904 idle_id = cdk_threads_add_idle_full(CDK_PRIORITY_REDRAW(100 + 20)-1, (GSourceFunc) idle_cb, NULL((void*)0), NULL((void*)0));
905
906 return TRUE(!(0));
907}
908
909static void install_hook(GType type, const char *sig, guint *sn) {
910 GTypeClass *type_class;
911
912 type_class = g_type_class_ref(type);
913
914 *sn = g_signal_lookup(sig, type);
915 g_signal_add_emission_hook(*sn, 0, emission_hook_cb, NULL((void*)0), NULL((void*)0));
916
917 g_type_class_unref(type_class);
918}
919
920static void read_enable_input_feedback_sounds(CtkSettings *s) {
921 gboolean enabled = !disabled;
922
923 if (g_getenv("KANBERRA_FORCE_INPUT_FEEDBACK_SOUNDS"))
924 disabled = FALSE(0);
925 else {
926 g_object_get(G_OBJECT(s)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((s)), (((GType) ((20) << (2))))))))
, "ctk-enable-input-feedback-sounds", &enabled, NULL((void*)0));
927 disabled = !enabled;
928 }
929}
930
931static void enable_input_feedback_sounds_changed(CtkSettings *s, GParamSpec *arg1, gpointer userdata) {
932 read_enable_input_feedback_sounds(s);
933}
934
935static void connect_settings(void) {
936 CtkSettings *s;
937 static gboolean connected = FALSE(0);
938
939 if (connected)
940 return;
941
942 if (!(s = ctk_settings_get_default()))
943 return;
944
945 if (g_object_class_find_property(G_OBJECT_GET_CLASS(s)((((GObjectClass*) (((GTypeInstance*) ((s)))->g_class)))), "ctk-enable-input-feedback-sounds")) {
946 g_signal_connect(G_OBJECT(s), "notify::ctk-enable-input-feedback-sounds", G_CALLBACK(enable_input_feedback_sounds_changed), NULL)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((s)), (((GType) ((20) << (2))))))))
), ("notify::ctk-enable-input-feedback-sounds"), (((GCallback
) (enable_input_feedback_sounds_changed))), (((void*)0)), ((void
*)0), (GConnectFlags) 0)
;
947 read_enable_input_feedback_sounds(s);
948 } else
949 g_debug("This Ctk+ version doesn't have the CtkSettings::ctk-enable-input-feedback-sounds property.");
950
951 connected = TRUE(!(0));
952}
953
954#if CTK_CHECK_VERSION(3,0,0)((3) > (3) || ((3) == (3) && (25) > (0)) || ((3
) == (3) && (25) == (0) && (4) >= (0)))
955#warning "We really need a quit handler in Ctk 3.0, https://bugzilla.gnome.org/show_bug.cgi?id=639770"
956#else
957static gboolean quit_handler(gpointer data) {
958 dispatch_queue();
959 return FALSE(0);
960}
961#endif
962
963G_MODULE_EXPORT__attribute__((visibility("default"))) void ctk_module_init(gint *argc, gchar ***argv[]) {
964
965 /* This is the same quark libgnomeui uses! */
966 disable_sound_quark = g_quark_from_string("gnome_disable_sound_events");
967 was_iconized_quark = g_quark_from_string("kanberra_was_iconized");
968 is_xembed_quark = g_quark_from_string("kanberra_is_xembed");
969
970 /* Hook up the ctk setting */
971 connect_settings();
972
973 install_hook(CTK_TYPE_WINDOW(ctk_window_get_type ()), "show", &signal_id_widget_show);
974 install_hook(CTK_TYPE_WINDOW(ctk_window_get_type ()), "hide", &signal_id_widget_hide);
975 install_hook(CTK_TYPE_DIALOG(ctk_dialog_get_type ()), "response", &signal_id_dialog_response);
976 install_hook(CTK_TYPE_MENU_ITEM(ctk_menu_item_get_type ()), "activate", &signal_id_menu_item_activate);
977 install_hook(CTK_TYPE_CHECK_MENU_ITEM(ctk_check_menu_item_get_type ()), "toggled", &signal_id_check_menu_item_toggled);
978 install_hook(CTK_TYPE_TOGGLE_BUTTON(ctk_toggle_button_get_type ()), "toggled", &signal_id_toggle_button_toggled);
979 install_hook(CTK_TYPE_BUTTON(ctk_button_get_type ()), "pressed", &signal_id_button_pressed);
980 install_hook(CTK_TYPE_BUTTON(ctk_button_get_type ()), "released", &signal_id_button_released);
981 install_hook(CTK_TYPE_WIDGET(ctk_widget_get_type ()), "window-state-event", &signal_id_widget_window_state_event);
982 install_hook(CTK_TYPE_NOTEBOOK(ctk_notebook_get_type ()), "switch-page", &signal_id_notebook_switch_page);
983 install_hook(CTK_TYPE_TREE_VIEW(ctk_tree_view_get_type ()), "cursor-changed", &signal_id_tree_view_cursor_changed);
984 install_hook(CTK_TYPE_ICON_VIEW(ctk_icon_view_get_type ()), "selection-changed", &signal_id_icon_view_selection_changed);
985 install_hook(CTK_TYPE_WIDGET(ctk_widget_get_type ()), "drag-begin", &signal_id_widget_drag_begin);
986 install_hook(CTK_TYPE_WIDGET(ctk_widget_get_type ()), "drag-drop", &signal_id_widget_drag_drop);
987 install_hook(CTK_TYPE_WIDGET(ctk_widget_get_type ()), "drag-failed", &signal_id_widget_drag_failed);
988 install_hook(CTK_TYPE_EXPANDER(ctk_expander_get_type ()), "activate", &signal_id_expander_activate);
989
990#if !CTK_CHECK_VERSION(3,0,0)((3) > (3) || ((3) == (3) && (25) > (0)) || ((3
) == (3) && (25) == (0) && (4) >= (0)))
991 ctk_quit_add(1, quit_handler, NULL((void*)0));
992#endif
993}
994
995G_MODULE_EXPORT__attribute__((visibility("default"))) gchar* g_module_check_init(GModule *module);
996
997G_MODULE_EXPORT__attribute__((visibility("default"))) gchar* g_module_check_init(GModule *module) {
998 g_module_make_resident(module);
999 return NULL((void*)0);
1000}