diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /widget/gtk/compat | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/gtk/compat')
-rw-r--r-- | widget/gtk/compat/gdk/gdkdnd.h | 29 | ||||
-rw-r--r-- | widget/gtk/compat/gdk/gdkkeysyms.h | 266 | ||||
-rw-r--r-- | widget/gtk/compat/gdk/gdkvisual.h | 15 | ||||
-rw-r--r-- | widget/gtk/compat/gdk/gdkwindow.h | 27 | ||||
-rw-r--r-- | widget/gtk/compat/gdk/gdkx.h | 42 | ||||
-rw-r--r-- | widget/gtk/compat/glib/gmem.h | 48 | ||||
-rw-r--r-- | widget/gtk/compat/gtk/gtkwidget.h | 43 | ||||
-rw-r--r-- | widget/gtk/compat/gtk/gtkwindow.h | 26 |
8 files changed, 496 insertions, 0 deletions
diff --git a/widget/gtk/compat/gdk/gdkdnd.h b/widget/gtk/compat/gdk/gdkdnd.h new file mode 100644 index 0000000000..bf9888d84f --- /dev/null +++ b/widget/gtk/compat/gdk/gdkdnd.h @@ -0,0 +1,29 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GDKDND_WRAPPER_H +#define GDKDND_WRAPPER_H + +#define gdk_drag_context_get_actions gdk_drag_context_get_actions_ +#define gdk_drag_context_list_targets gdk_drag_context_list_targets_ +#define gdk_drag_context_get_dest_window gdk_drag_context_get_dest_window_ +#include_next <gdk/gdkdnd.h> +#undef gdk_drag_context_get_actions +#undef gdk_drag_context_list_targets +#undef gdk_drag_context_get_dest_window + +static inline GdkDragAction gdk_drag_context_get_actions( + GdkDragContext* context) { + return context->actions; +} + +static inline GList* gdk_drag_context_list_targets(GdkDragContext* context) { + return context->targets; +} + +static inline GdkWindow* gdk_drag_context_get_dest_window( + GdkDragContext* context) { + return context->dest_window; +} +#endif /* GDKDND_WRAPPER_H */ diff --git a/widget/gtk/compat/gdk/gdkkeysyms.h b/widget/gtk/compat/gdk/gdkkeysyms.h new file mode 100644 index 0000000000..2f48d61fcc --- /dev/null +++ b/widget/gtk/compat/gdk/gdkkeysyms.h @@ -0,0 +1,266 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GDKKEYSYMS_WRAPPER_H +#define GDKKEYSYMS_WRAPPER_H + +#include_next <gdk/gdkkeysyms.h> + +#ifndef GDK_ISO_Level5_Shift +# define GDK_ISO_Level5_Shift 0xFE11 +#endif + +#ifndef GDK_ISO_Level5_Latch +# define GDK_ISO_Level5_Latch 0xFE12 +#endif + +#ifndef GDK_ISO_Level5_Lock +# define GDK_ISO_Level5_Lock 0xFE13 +#endif + +#ifndef GDK_dead_greek +# define GDK_dead_greek 0xFE8C +#endif + +#ifndef GDK_ch +# define GDK_ch 0xFEA0 +#endif + +#ifndef GDK_Ch +# define GDK_Ch 0xFEA1 +#endif + +#ifndef GDK_CH +# define GDK_CH 0xFEA2 +#endif + +#ifndef GDK_c_h +# define GDK_c_h 0xFEA3 +#endif + +#ifndef GDK_C_h +# define GDK_C_h 0xFEA4 +#endif + +#ifndef GDK_C_H +# define GDK_C_H 0xFEA5 +#endif + +#ifndef GDK_MonBrightnessUp +# define GDK_MonBrightnessUp 0x1008FF02 +#endif + +#ifndef GDK_MonBrightnessDown +# define GDK_MonBrightnessDown 0x1008FF03 +#endif + +#ifndef GDK_AudioLowerVolume +# define GDK_AudioLowerVolume 0x1008FF11 +#endif + +#ifndef GDK_AudioMute +# define GDK_AudioMute 0x1008FF12 +#endif + +#ifndef GDK_AudioRaiseVolume +# define GDK_AudioRaiseVolume 0x1008FF13 +#endif + +#ifndef GDK_AudioPlay +# define GDK_AudioPlay 0x1008FF14 +#endif + +#ifndef GDK_AudioStop +# define GDK_AudioStop 0x1008FF15 +#endif + +#ifndef GDK_AudioPrev +# define GDK_AudioPrev 0x1008FF16 +#endif + +#ifndef GDK_AudioNext +# define GDK_AudioNext 0x1008FF17 +#endif + +#ifndef GDK_HomePage +# define GDK_HomePage 0x1008FF18 +#endif + +#ifndef GDK_Mail +# define GDK_Mail 0x1008FF19 +#endif + +#ifndef GDK_Search +# define GDK_Search 0x1008FF1B +#endif + +#ifndef GDK_AudioRecord +# define GDK_AudioRecord 0x1008FF1C +#endif + +#ifndef GDK_Back +# define GDK_Back 0x1008FF26 +#endif + +#ifndef GDK_Forward +# define GDK_Forward 0x1008FF27 +#endif + +#ifndef GDK_Stop +# define GDK_Stop 0x1008FF28 +#endif + +#ifndef GDK_Refresh +# define GDK_Refresh 0x1008FF29 +#endif + +#ifndef GDK_PowerOff +# define GDK_PowerOff 0x1008FF2A +#endif + +#ifndef GDK_Eject +# define GDK_Eject 0x1008FF2C +#endif + +#ifndef GDK_AudioPause +# define GDK_AudioPause 0x1008FF31 +#endif + +#ifndef GDK_BrightnessAdjust +# define GDK_BrightnessAdjust 0x1008FF3B +#endif + +#ifndef GDK_AudioRewind +# define GDK_AudioRewind 0x1008FF3E +#endif + +#ifndef GDK_Launch0 +# define GDK_Launch0 0x1008FF40 +#endif + +#ifndef GDK_Launch1 +# define GDK_Launch1 0x1008FF41 +#endif + +#ifndef GDK_Launch2 +# define GDK_Launch2 0x1008FF42 +#endif + +#ifndef GDK_Launch3 +# define GDK_Launch3 0x1008FF43 +#endif + +#ifndef GDK_Launch4 +# define GDK_Launch4 0x1008FF44 +#endif + +#ifndef GDK_Launch5 +# define GDK_Launch5 0x1008FF45 +#endif + +#ifndef GDK_Launch6 +# define GDK_Launch6 0x1008FF46 +#endif + +#ifndef GDK_Launch7 +# define GDK_Launch7 0x1008FF47 +#endif + +#ifndef GDK_Launch8 +# define GDK_Launch8 0x1008FF48 +#endif + +#ifndef GDK_Launch9 +# define GDK_Launch9 0x1008FF49 +#endif + +#ifndef GDK_LaunchA +# define GDK_LaunchA 0x1008FF4A +#endif + +#ifndef GDK_LaunchB +# define GDK_LaunchB 0x1008FF4B +#endif + +#ifndef GDK_LaunchC +# define GDK_LaunchC 0x1008FF4C +#endif + +#ifndef GDK_LaunchD +# define GDK_LaunchD 0x1008FF4D +#endif + +#ifndef GDK_LaunchE +# define GDK_LaunchE 0x1008FF4E +#endif + +#ifndef GDK_LaunchF +# define GDK_LaunchF 0x1008FF4F +#endif + +#ifndef GDK_Copy +# define GDK_Copy 0x1008FF57 +#endif + +#ifndef GDK_Cut +# define GDK_Cut 0x1008FF58 +#endif + +#ifndef GDK_Paste +# define GDK_Paste 0x1008FF6D +#endif + +#ifndef GDK_Reload +# define GDK_Reload 0x1008FF73 +#endif + +#ifndef GDK_AudioRandomPlay +# define GDK_AudioRandomPlay 0x1008FF99 +#endif + +#ifndef GDK_Subtitle +# define GDK_Subtitle 0x1008FF9A +#endif + +#ifndef GDK_Red +# define GDK_Red 0x1008FFA3 +#endif + +#ifndef GDK_Green +# define GDK_Green 0x1008FFA4 +#endif + +#ifndef GDK_Yellow +# define GDK_Yellow 0x1008FFA5 +#endif + +#ifndef GDK_Blue +# define GDK_Blue 0x1008FFA6 +#endif + +#ifndef GDK_TouchpadToggle +# define GDK_TouchpadToggle 0x1008FFA9 +#endif + +#ifndef GDK_TouchpadOn +# define GDK_TouchpadOn 0x1008FFB0 +#endif + +#ifndef GDK_TouchpadOff +# define GDK_TouchpadOff 0x1008ffb1 +#endif + +#ifndef GDK_LogWindowTree +# define GDK_LogWindowTree 0x1008FE24 +#endif + +#ifndef GDK_LogGrabInfo +# define GDK_LogGrabInfo 0x1008FE25 +#endif + +#ifndef GDK_Sleep +# define GDK_Sleep 0x1008FF2F +#endif + +#endif /* GDKKEYSYMS_WRAPPER_H */ diff --git a/widget/gtk/compat/gdk/gdkvisual.h b/widget/gtk/compat/gdk/gdkvisual.h new file mode 100644 index 0000000000..e5187a78da --- /dev/null +++ b/widget/gtk/compat/gdk/gdkvisual.h @@ -0,0 +1,15 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GDKVISUAL_WRAPPER_H +#define GDKVISUAL_WRAPPER_H + +#define gdk_visual_get_depth gdk_visual_get_depth_ +#include_next <gdk/gdkvisual.h> +#undef gdk_visual_get_depth + +static inline gint gdk_visual_get_depth(GdkVisual* visual) { + return visual->depth; +} +#endif /* GDKVISUAL_WRAPPER_H */ diff --git a/widget/gtk/compat/gdk/gdkwindow.h b/widget/gtk/compat/gdk/gdkwindow.h new file mode 100644 index 0000000000..a4d2efbc89 --- /dev/null +++ b/widget/gtk/compat/gdk/gdkwindow.h @@ -0,0 +1,27 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GDKWINDOW_WRAPPER_H +#define GDKWINDOW_WRAPPER_H + +#define gdk_window_get_display gdk_window_get_display_ +#define gdk_window_get_screen gdk_window_get_screen_ +#include_next <gdk/gdkwindow.h> +#undef gdk_window_get_display +#undef gdk_window_get_screen + +static inline GdkDisplay* gdk_window_get_display(GdkWindow* window) { + return gdk_drawable_get_display(GDK_DRAWABLE(window)); +} + +static inline GdkScreen* gdk_window_get_screen(GdkWindow* window) { + return gdk_drawable_get_screen(window); +} + +#if GDK_PIXBUF_MAJOR == 2 && GDK_PIXBUF_MINOR < 18 +static inline gboolean gdk_window_is_destroyed(GdkWindow* window) { + return GDK_WINDOW_OBJECT(window)->destroyed; +} +#endif +#endif /* GDKWINDOW_WRAPPER_H */ diff --git a/widget/gtk/compat/gdk/gdkx.h b/widget/gtk/compat/gdk/gdkx.h new file mode 100644 index 0000000000..7b0718f3cb --- /dev/null +++ b/widget/gtk/compat/gdk/gdkx.h @@ -0,0 +1,42 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GDKX_WRAPPER_H +#define GDKX_WRAPPER_H + +#include <gtk/gtkversion.h> + +#define gdk_x11_window_foreign_new_for_display \ + gdk_x11_window_foreign_new_for_display_ +#define gdk_x11_window_lookup_for_display gdk_x11_window_lookup_for_display_ +#define gdk_x11_window_get_xid gdk_x11_window_get_xid_ +#if !GTK_CHECK_VERSION(2, 24, 0) +# define gdk_x11_set_sm_client_id gdk_x11_set_sm_client_id_ +#endif +#include_next <gdk/gdkx.h> +#undef gdk_x11_window_foreign_new_for_display +#undef gdk_x11_window_lookup_for_display +#undef gdk_x11_window_get_xid + +static inline GdkWindow* gdk_x11_window_foreign_new_for_display( + GdkDisplay* display, Window window) { + return gdk_window_foreign_new_for_display(display, window); +} + +static inline GdkWindow* gdk_x11_window_lookup_for_display(GdkDisplay* display, + Window window) { + return gdk_window_lookup_for_display(display, window); +} + +static inline Window gdk_x11_window_get_xid(GdkWindow* window) { + return (GDK_WINDOW_XWINDOW(window)); +} + +#if !GTK_CHECK_VERSION(2, 24, 0) +# undef gdk_x11_set_sm_client_id +static inline void gdk_x11_set_sm_client_id(const gchar* sm_client_id) { + gdk_set_sm_client_id(sm_client_id); +} +#endif +#endif /* GDKX_WRAPPER_H */ diff --git a/widget/gtk/compat/glib/gmem.h b/widget/gtk/compat/glib/gmem.h new file mode 100644 index 0000000000..78f24bbd8d --- /dev/null +++ b/widget/gtk/compat/glib/gmem.h @@ -0,0 +1,48 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GMEM_WRAPPER_H +#define GMEM_WRAPPER_H + +#define g_malloc_n g_malloc_n_ +#define g_malloc0_n g_malloc0_n_ +#define g_realloc_n g_realloc_n_ +#include_next <glib/gmem.h> +#undef g_malloc_n +#undef g_malloc0_n +#undef g_realloc_n + +#include <glib/gmessages.h> + +#undef g_new +#define g_new(type, num) ((type*)g_malloc_n((num), sizeof(type))) + +#undef g_new0 +#define g_new0(type, num) ((type*)g_malloc0_n((num), sizeof(type))) + +#undef g_renew +#define g_renew(type, ptr, num) ((type*)g_realloc_n(ptr, (num), sizeof(type))) + +#define _CHECK_OVERFLOW(num, type_size) \ + if (G_UNLIKELY(type_size > 0 && num > G_MAXSIZE / type_size)) { \ + g_error("%s: overflow allocating %" G_GSIZE_FORMAT "*%" G_GSIZE_FORMAT \ + " bytes", \ + G_STRLOC, num, type_size); \ + } + +static inline gpointer g_malloc_n(gsize num, gsize type_size) { + _CHECK_OVERFLOW(num, type_size) + return g_malloc(num * type_size); +} + +static inline gpointer g_malloc0_n(gsize num, gsize type_size) { + _CHECK_OVERFLOW(num, type_size) + return g_malloc0(num * type_size); +} + +static inline gpointer g_realloc_n(gpointer ptr, gsize num, gsize type_size) { + _CHECK_OVERFLOW(num, type_size) + return g_realloc(ptr, num * type_size); +} +#endif /* GMEM_WRAPPER_H */ diff --git a/widget/gtk/compat/gtk/gtkwidget.h b/widget/gtk/compat/gtk/gtkwidget.h new file mode 100644 index 0000000000..21165d61fa --- /dev/null +++ b/widget/gtk/compat/gtk/gtkwidget.h @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GTKWIDGET_WRAPPER_H +#define GTKWIDGET_WRAPPER_H + +#define gtk_widget_set_mapped gtk_widget_set_mapped_ +#define gtk_widget_get_mapped gtk_widget_get_mapped_ +#define gtk_widget_set_realized gtk_widget_set_realized_ +#define gtk_widget_get_realized gtk_widget_get_realized_ +#include_next <gtk/gtkwidget.h> +#undef gtk_widget_set_mapped +#undef gtk_widget_get_mapped +#undef gtk_widget_set_realized +#undef gtk_widget_get_realized + +#include <gtk/gtkversion.h> + +static inline void gtk_widget_set_mapped(GtkWidget* widget, gboolean mapped) { + if (mapped) + GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_MAPPED); +} + +static inline gboolean gtk_widget_get_mapped(GtkWidget* widget) { + return GTK_WIDGET_MAPPED(widget); +} + +static inline void gtk_widget_set_realized(GtkWidget* widget, + gboolean realized) { + if (realized) + GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED); +} + +static inline gboolean gtk_widget_get_realized(GtkWidget* widget) { + return GTK_WIDGET_REALIZED(widget); +} + +#endif /* GTKWIDGET_WRAPPER_H */ diff --git a/widget/gtk/compat/gtk/gtkwindow.h b/widget/gtk/compat/gtk/gtkwindow.h new file mode 100644 index 0000000000..7c3d5873bd --- /dev/null +++ b/widget/gtk/compat/gtk/gtkwindow.h @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GTKWINDOW_WRAPPER_H +#define GTKWINDOW_WRAPPER_H + +#define gtk_window_group_get_current_grab gtk_window_group_get_current_grab_ +#define gtk_window_get_window_type gtk_window_get_window_type_ +#include_next <gtk/gtkwindow.h> +#undef gtk_window_group_get_current_grab +#undef gtk_window_get_window_type + +static inline GtkWidget* gtk_window_group_get_current_grab( + GtkWindowGroup* window_group) { + if (!window_group->grabs) return NULL; + + return GTK_WIDGET(window_group->grabs->data); +} + +static inline GtkWindowType gtk_window_get_window_type(GtkWindow* window) { + gint type; + g_object_get(window, "type", &type, (void*)NULL); + return (GtkWindowType)type; +} +#endif /* GTKWINDOW_WRAPPER_H */ |