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
## 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 *
@chergert
chergert / remove-glist-from-gdkwindow.patch
Last active September 13, 2015 12:40
Patch to use my GArrayList to drop GList. still room for more.
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index e5ec4b2..080d61a 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -211,7 +211,7 @@ struct _GdkWindow
gint8 toplevel_window_type;
GList *filters;
- GList *children;
+ GArrayList children;