diff options
author | Gordon Norman Squash <gordsqsh@protonmail.com> | 2021-02-25 18:56:24 -0500 |
---|---|---|
committer | Gordon Norman Squash <gordsqsh@protonmail.com> | 2021-02-25 18:56:24 -0500 |
commit | 3a2cf548586f45051b2ebe095151ed36f2005d60 (patch) | |
tree | 102b5b85b397cf7edcc1f8b2df361ade29abcade /sgm-overlay-scrolling-override.c | |
parent | First commit to STLWRT-ian GTK Modules repository (diff) | |
download | sgm-3a2cf548586f45051b2ebe095151ed36f2005d60.tar.gz sgm-3a2cf548586f45051b2ebe095151ed36f2005d60.tar.bz2 sgm-3a2cf548586f45051b2ebe095151ed36f2005d60.zip |
Diffstat (limited to 'sgm-overlay-scrolling-override.c')
-rw-r--r-- | sgm-overlay-scrolling-override.c | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/sgm-overlay-scrolling-override.c b/sgm-overlay-scrolling-override.c deleted file mode 100644 index 13116af..0000000 --- a/sgm-overlay-scrolling-override.c +++ /dev/null @@ -1,144 +0,0 @@ -#include <gtk/gtk.h> -#include <glib.h> - - -enum -{ - /* - * In GTK+ 3.24.9 and later, the "overlay-scrolling" property is assigned - * a property number of 85. We might as well follow that convention here - * and avoid any property number collisions. - */ - PROP_OVERLAY_SCROLLING = 85 -}; - - -static gboolean overlay_scrolling_enabled = TRUE; - -static GParamSpec * gtk_overlay_scrolling_pspec; - - -static void (*original_gtk_settings_set_property) (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); - -static void (*original_gtk_settings_get_property) (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); - - -static void overridden_gtk_settings_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); - -static void overridden_gtk_settings_get_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); - - -G_MODULE_EXPORT const char * -g_module_check_init (GModule *module) -{ - /* - * Exit immediately on GTK+ versions prior to 3.15.0, since overlay - * scrolling hadn't been introduced yet! - */ - if (gtk_check_version (3,15,0) != NULL) - { - return "Your version of GTK+ is too old to support overlay scrolling.\n" - "This module is thus unnecessary and you should remove it."; - } - - /* - * Similarly, a property was introduced in GTK+ 3.24.9 to disable overlay - * scrolling globally, making this module redundant. - */ - else if (gtk_check_version (3,24,9) == NULL) - { - return "Your version of GTK+ already supports globally disabling overlay scrolling.\n" - "This module is thus redundant and you should remove it."; - } - - /* - * Otherwise, this module is useful for the current version of GTK+, so - * proceed with loading it. - */ - else - { - g_module_make_resident (module); - return NULL; - } -} - -G_MODULE_EXPORT int -gtk_module_init (gint * argc, char *** argv) -{ - GtkSettingsClass *gtk_settings_class; - GtkScrolledWindowClass *gtk_scrolled_window_class; - - (void) argc; - (void) argv; - - gtk_settings_class = g_type_class_ref (GTK_TYPE_SETTINGS); - - gtk_overlay_scrolling_pspec = g_param_spec_boolean ("gtk-overlay-scrolling", - "Overlay Scrolling", - "Whether to enable overlay scrolling mode globally", - overlay_scrolling_enabled, - G_PARAM_READWRITE); - - g_object_class_install_property (gtk_settings_class, - PROP_OVERLAY_SCROLLING, - gtk_overlay_scrolling_pspec); - - original_gtk_settings_set_property = G_OBJECT_CLASS (gtk_settings_class)->set_property; - G_OBJECT_CLASS (gtk_settings_class)->set_property = overridden_gtk_settings_class_set_property; - - original_gtk_settings_get_property = G_OBJECT_CLASS (gtk_settings_class)->get_property; - G_OBJECT_CLASS (gtk_settings_class)->get_property = overridden_gtk_settings_class_get_property; - - g_type_class_unref (gtk_settings_class); - - - - - return 0; -} - - -static void overridden_gtk_settings_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - switch (property_id) - { - case PROP_OVERLAY_SCROLLING: - overlay_scrolling_enabled = g_value_get_boolean (value); - break; - - default: - original_gtk_settings_set_property (object, property_id, value, pspec); - } -} - - -static void overridden_gtk_settings_get_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - switch (property_id) - { - case PROP_OVERLAY_SCROLLING: - g_value_set_boolean (value, overlay_scrolling_enabled); - break; - - default: - original_gtk_settings_get_property (object, property_id, value, pspec); - } -} |