1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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 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 
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24 
25 #ifndef __GTK_PRIVATE_H__
26 #define __GTK_PRIVATE_H__
27 
28 #include <glib-object.h>
29 #include <gdk/gdk.h>
30 #include <gdk/gdk-private.h>
31 
32 #include "gtkcsstypesprivate.h"
33 #include "gtktexthandleprivate.h"
34 #include "gtkplacessidebarprivate.h"
35 #include "gtkeventcontrollerprivate.h"
36 #include "gtkwindowgroup.h"
37 
38 G_BEGIN_DECLS
39 
40 #define GTK_PARAM_READABLE G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
41 #define GTK_PARAM_WRITABLE G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
42 #define GTK_PARAM_READWRITE G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
43 
44 #define OPPOSITE_ORIENTATION(_orientation) (1 - (_orientation))
45 
46 #ifndef G_ENABLE_CONSISTENCY_CHECKS
47 /* This is true for buildtypes release and debugoptimized */
48 #define gtk_internal_return_if_fail(__expr) G_STMT_START{ (void)0; }G_STMT_END
49 #define gtk_internal_return_val_if_fail(__expr, __val) G_STMT_START{ (void)0; }G_STMT_END
50 #else
51 /* This is true for debug builds */
52 #define gtk_internal_return_if_fail(__expr) g_return_if_fail(__expr)
53 #define gtk_internal_return_val_if_fail(__expr, __val) g_return_val_if_fail(__expr, __val)
54 #endif
55 
56 const char * _gtk_get_datadir            (void);
57 const char * _gtk_get_libdir             (void);
58 const char * _gtk_get_sysconfdir         (void);
59 const char * _gtk_get_localedir          (void);
60 const char * _gtk_get_data_prefix        (void);
61 
62 gboolean      _gtk_fnmatch                (const char *pattern,
63                                            const char *string,
64                                            gboolean    no_leading_period,
65                                            gboolean    casefold);
66 
67 char *        _gtk_make_ci_glob_pattern   (const char *pattern);
68 
69 
70 char        * _gtk_get_lc_ctype           (void);
71 
72 void          _gtk_ensure_resources       (void);
73 
74 void          gtk_main_sync               (void);
75 
76 GtkWidget *   gtk_window_group_get_current_grab (GtkWindowGroup *window_group);
77 void          gtk_grab_add                      (GtkWidget      *widget);
78 void          gtk_grab_remove                   (GtkWidget      *widget);
79 
80 gboolean _gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
81                                            GValue                *return_accu,
82                                            const GValue          *handler_return,
83                                            gpointer               dummy);
84 
85 gboolean _gtk_single_string_accumulator   (GSignalInvocationHint *ihint,
86                                            GValue                *return_accu,
87                                            const GValue          *handler_return,
88                                            gpointer               dummy);
89 
90 gboolean         gtk_propagate_event_internal  (GtkWidget       *widget,
91                                                 GdkEvent        *event,
92                                                 GtkWidget       *topmost);
93 gboolean   gtk_propagate_event          (GtkWidget       *widget,
94                                          GdkEvent        *event);
95 void       gtk_main_do_event       (GdkEvent           *event);
96 
97 GtkWidget *gtk_get_event_widget         (GdkEvent  *event);
98 
99 guint32    gtk_get_current_event_time   (void);
100 
101 void check_crossing_invariants (GtkWidget       *widget,
102                                 GtkCrossingData *crossing);
103 
104 double _gtk_get_slowdown (void);
105 void    _gtk_set_slowdown (double slowdown_factor);
106 
107 char *gtk_get_portal_request_path (GDBusConnection  *connection,
108                                    char            **token);
109 char *gtk_get_portal_session_path (GDBusConnection  *connection,
110                                    char            **token);
111 guint gtk_get_portal_interface_version (GDBusConnection *connection,
112                                         const char      *interface_name);
113 
114 #define PORTAL_BUS_NAME "org.freedesktop.portal.Desktop"
115 #define PORTAL_OBJECT_PATH "/org/freedesktop/portal/desktop"
116 #define PORTAL_REQUEST_INTERFACE "org.freedesktop.portal.Request"
117 #define PORTAL_SESSION_INTERFACE "org.freedesktop.portal.Session"
118 #define PORTAL_FILECHOOSER_INTERFACE "org.freedesktop.portal.FileChooser"
119 #define PORTAL_PRINT_INTERFACE "org.freedesktop.portal.Print"
120 #define PORTAL_SCREENSHOT_INTERFACE "org.freedesktop.portal.Screenshot"
121 #define PORTAL_INHIBIT_INTERFACE "org.freedesktop.portal.Inhibit"
122 
123 #ifdef G_OS_WIN32
124 void _gtk_load_dll_with_libgtk3_manifest (const char *dllname);
125 #endif
126 
127 gboolean        gtk_simulate_touchscreen (void);
128 
129 void  gtk_set_display_debug_flags (GdkDisplay *display,
130                                    guint       flags);
131 guint gtk_get_display_debug_flags (GdkDisplay *display);
132 gboolean gtk_get_any_display_debug_flag_set (void);
133 
134 GBytes *get_emoji_data (void);
135 
136 #ifdef G_ENABLE_DEBUG
137 
138 #define GTK_DISPLAY_DEBUG_CHECK(display,type) (gtk_get_any_display_debug_flag_set () && G_UNLIKELY (gtk_get_display_debug_flags (display) & GTK_DEBUG_##type))
139 #define GTK_DISPLAY_NOTE(display,type,action) \
140   G_STMT_START { \
141   if (GTK_DISPLAY_DEBUG_CHECK (display,type)) { action; }; \
142   } G_STMT_END
143 
144 #else
145 
146 #define GTK_DISPLAY_DEBUG_CHECK(display,type) 0
147 #define GTK_DISPLAY_NOTE(display,type,action)
148 
149 #endif /* G_ENABLE_DEBUG */
150 
151 char * _gtk_elide_underscores (const char *original);
152 
153 void setlocale_initialization (void);
154 
155 G_END_DECLS
156 
157 #endif /* __GTK_PRIVATE_H__ */
158