Skip to content

Instantly share code, notes, and snippets.

View chergert's full-sized avatar
💭
I'm on GitLab https://gitlab.gnome.org/chergert

Christian Hergert chergert

💭
I'm on GitLab https://gitlab.gnome.org/chergert
View GitHub Profile
From 7a3af0ed9aadced79abb54db6ef3fdba690d8e09 Mon Sep 17 00:00:00 2001
From: Christian Hergert <christian@sourceandstack.com>
Date: Sun, 24 May 2026 11:37:42 +0200
Subject: [PATCH] gtk/scrolledwindow: use bounce for undershoot/overshoot
This tries to match the feeling to Firefox on Linux for some level of
continuity.
---
gtk/gtkscrolledwindow.c | 103 ++++++++++++++++++++++++++++++++++++----
1 file changed, 93 insertions(+), 10 deletions(-)
## NOTE ##
If you just need to build, and you don't need to hack on GTK 4 itself, you can
probably just use brew. That is the simplest and fastest way to get started.
```
brew install gtk4
```
At that point, /usr/local/bin/gtk4-demo is there, and all the others.
@chergert
chergert / .buildconfig
Created December 10, 2018 23:38
example buildconfig
[default]
name=Default
config-opts=
run-opts=
prefix=/opt/gnome
app-id=
postbuild=
prebuild=scons
default=true
#include <stdio.h>
#include <assert.h>
typedef struct
{
double r;
double g;
double b;
double a;
} GdkRGBA;
@chergert
chergert / foo-widget.c
Last active May 15, 2024 20:40
simple widget example
#include "foo-widget.h"
struct _FooWidget
{
GtkBin parent_instance;
GtkLabel *label;
};
G_DEFINE_TYPE (FooWidget, foo_widget, GTK_TYPE_BIN)
#include <gio/gio.h>
#include <stdlib.h>
#include <glib-unix.h>
#include <gio/gunixfdlist.h>
static GMainLoop *main_loop;
static guint exited_subscription;
static void
host_command_exited_cb (GDBusConnection *connection,
if [ -n "$UNDER_JHBUILD" ]; then
export PS1="\e[44mjhbuild\e[0m \W\$ "
/opt/gnome/libexec/evolution-source-registry &>/dev/null &
/opt/gnome/libexec/evolution-calendar-factory &>/dev/null &
disown -a
fi
@chergert
chergert / gtkdoc-example.c
Last active January 23, 2016 19:15
Example of various types of gtk-doc
/* Documenting a module (generally a .c file) */
/**
* SECTION:section-name
* @title: SectionName
* @short_description: Frobnicate foo
*
* Description of modules purpose and most likely used functions.
*
@chergert
chergert / swap-selection-order.patch
Created September 21, 2015 09:18
swap the selection order on double/triple click
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index e9860d7..395c919 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -7711,7 +7711,7 @@ gtk_text_view_start_selection_drag (GtkTextView *text_view,
}
}
- gtk_text_buffer_select_range (buffer, &ins, &bound);
+ gtk_text_buffer_select_range (buffer, &bound, &ins);
@chergert
chergert / vdso-getcpu.c
Created September 17, 2015 08:48
example of fetching getcpu from the vsdo
#include <dlfcn.h>
#include <stdio.h>
#include <asm/vsyscall.h>
#include <sys/auxv.h>
int (*test_getcpu) (unsigned *cpu,
unsigned *node,
void *cache);
void *