Debian Codegraph @

gtk/inspector/focusoverlay.c

raw symbols SCIP
1 /*
2 * Copyright © 2018 Benjamin Otte
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authors: Benjamin Otte <[email protected]>
18 */
19
20 #include "config.h"cxx . . $ `<file>/build/config.h`/
21
22 #include "focusoverlay.h"cxx . . $ `<file>/gtk/inspector/focusoverlay.h`/
23
24 #include "gtkwidget.h"cxx . . $ `<file>/gtk/gtkwidget.h`/
25 #include "gtkroot.h"cxx . . $ `<file>/gtk/gtkroot.h`/
26 #include "gtknative.h"cxx . . $ `<file>/gtk/gtknative.h`/
27
28 struct _GtkFocusOverlaycxx . . $ _GtkFocusOverlay#
29 {
30 GtkInspectorOverlaycxx . . $ GtkInspectorOverlay# parent_instancecxx . . $ _GtkFocusOverlay#parent_instance.;
31
32 GdkRGBAcxx . . $ GdkRGBA# colorcxx . . $ _GtkFocusOverlay#color.;
33 };
34
35 struct _GtkFocusOverlayClasscxx . . $ _GtkFocusOverlayClass#
36 {
37 GtkInspectorOverlayClasscxx . . $ GtkInspectorOverlayClass# parent_classcxx . . $ _GtkFocusOverlayClass#parent_class.;
38 };
39
40 G_DEFINE_TYPEcxx . . $ `<external>/9567554376676449156/gtype.h:1834:9`! (GtkFocusOverlay, gtk_focus_overlay, GTK_TYPE_INSPECTOR_OVERLAYcxx . . $ `gtk/inspector/inspectoroverlay.h:26:9`!)
41
42 static void
43 gtk_focus_overlay_snapshotcxx . . $ gtk_focus_overlay_snapshot(49ccbdb25f37a252). (GtkInspectorOverlaycxx . . $ GtkInspectorOverlay# *overlay,
44 GtkSnapshotcxx . . $ GtkSnapshot# *snapshot,
45 GskRenderNodecxx . . $ GskRenderNode# *node,
46 GtkWidgetcxx . . $ GtkWidget# *widget)
47 {
48 GtkFocusOverlaycxx . . $ GtkFocusOverlay# *self = GTK_FOCUS_OVERLAYcxx . . $ GTK_FOCUS_OVERLAY(799431dfb4365a3d). (overlay);
49 GtkWidgetcxx . . $ GtkWidget# *focus;
50 graphene_rect_tcxx . . $ graphene_rect_t# bounds;
51
52 if (!GTK_IS_NATIVEcxx . . $ GTK_IS_NATIVE(dedf1e9b1c614a07). (widget))
53 return;
54
55 focus = gtk_root_get_focuscxx . . $ gtk_root_get_focus(6cfa63b8db06e3bd). (GTK_ROOTcxx . . $ GTK_ROOT(f6c8ec4260875b7f). (gtk_widget_get_rootcxx . . $ gtk_widget_get_root(978ce13b0a79da4). (widget)));
56 if (!focus)
57 return;
58
59 if (!gtk_widget_is_ancestorcxx . . $ gtk_widget_is_ancestor(d05965862da967f). (focus, widget))
60 return;
61
62 if (GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (gtk_widget_get_native (focus)) != widget)
63 return;
64
65 if (!gtk_widget_compute_boundscxx . . $ gtk_widget_compute_bounds(167d30efbd6565d7). (focus, widget, &bounds))
66 return;
67
68 gtk_snapshot_append_colorcxx . . $ gtk_snapshot_append_color(402330aed7850122). (snapshot, &self->colorcxx . . $ _GtkFocusOverlay#color., &bounds);
69 }
70
71 static void
72 gtk_focus_overlay_queue_drawcxx . . $ gtk_focus_overlay_queue_draw(2042e79fc25a5242). (GtkInspectorOverlaycxx . . $ GtkInspectorOverlay# *overlay)
73 {
74 }
75
76 static void
77 gtk_focus_overlay_class_initcxx . . $ gtk_focus_overlay_class_init(92203679e14bc3ba). (GtkFocusOverlayClasscxx . . $ GtkFocusOverlayClass# *klass)
78 {
79 GtkInspectorOverlayClasscxx . . $ GtkInspectorOverlayClass# *overlay_class = GTK_INSPECTOR_OVERLAY_CLASScxx . . $ GTK_INSPECTOR_OVERLAY_CLASS(562f990d41eee0d2). (klass);
80
81 overlay_class->snapshotcxx . . $ _GtkInspectorOverlayClass#snapshot. = gtk_focus_overlay_snapshotcxx . . $ gtk_focus_overlay_snapshot(49ccbdb25f37a252).;
82 overlay_class->queue_drawcxx . . $ _GtkInspectorOverlayClass#queue_draw. = gtk_focus_overlay_queue_drawcxx . . $ gtk_focus_overlay_queue_draw(2042e79fc25a5242).;
83 }
84
85 static void
86 gtk_focus_overlay_initcxx . . $ gtk_focus_overlay_init(e445d7680df6118e). (GtkFocusOverlaycxx . . $ GtkFocusOverlay# *self)
87 {
88 self->colorcxx . . $ _GtkFocusOverlay#color. = (GdkRGBAcxx . . $ GdkRGBA#) { 0.5, 0.0, 1.0, 0.2 };
89 }
90
91 GtkInspectorOverlaycxx . . $ GtkInspectorOverlay# *
92 gtk_focus_overlay_newcxx . . $ gtk_focus_overlay_new(1538c992afb1e868). (void)
93 {
94 GtkFocusOverlaycxx . . $ GtkFocusOverlay# *self;
95
96 self = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_FOCUS_OVERLAYcxx . . $ `gtk/inspector/focusoverlay.h:26:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
97
98 return GTK_INSPECTOR_OVERLAYcxx . . $ GTK_INSPECTOR_OVERLAY(eb9a907969d2724f). (self);
99 }
100
101 void
102 gtk_focus_overlay_set_colorcxx . . $ gtk_focus_overlay_set_color(a7bf10c69a656125). (GtkFocusOverlaycxx . . $ GtkFocusOverlay# *self,
103 const GdkRGBAcxx . . $ GdkRGBA# *color)
104 {
105 if (gdk_rgba_equalcxx . . $ gdk_rgba_equal(9148c8c3ff42c9d8). (&self->colorcxx . . $ _GtkFocusOverlay#color., color))
106 return;
107
108 self->colorcxx . . $ _GtkFocusOverlay#color. = *color;
109 gtk_inspector_overlay_queue_drawcxx . . $ gtk_inspector_overlay_queue_draw(2042e79fc25a5242). (GTK_INSPECTOR_OVERLAYcxx . . $ GTK_INSPECTOR_OVERLAY(eb9a907969d2724f). (self));
110 }