Skip to content

Instantly share code, notes, and snippets.

View codebrainz's full-sized avatar

Matthew Brush codebrainz

View GitHub Profile
@codebrainz
codebrainz / cstr_hash.c
Created July 2, 2022 16:29
A decent C string hashing function
#include <stddef.h>
// sdbm from here:
// http://www.cse.yorku.ca/~oz/hash.html
static size_t cstr_hash(const char *str)
{
size_t hash = 0;
int c;
while ((c = *str++))
hash = c + (hash << 6) + (hash << 16) - hash;
@codebrainz
codebrainz / build
Created August 10, 2021 02:03
Test Meson build of Geany on Win10/Msys2
$ ninja -C build
ninja: Entering directory `build'
[34/261] Compiling C++ object libscintilla.a.p/scintilla_gtk_ScintillaGTK.cxx.o
../scintilla/gtk/ScintillaGTK.cxx: In function 'std::vector<int> MapImeIndicators(PangoAttrList*, const char*)':
../scintilla/gtk/ScintillaGTK.cxx:2301:13: warning: enumeration value 'PANGO_UNDERLINE_SINGLE_LINE' not handled in switch [-Wswitch]
2301 | switch (uline) {
| ^
../scintilla/gtk/ScintillaGTK.cxx:2301:13: warning: enumeration value 'PANGO_UNDERLINE_DOUBLE_LINE' not handled in switch [-Wswitch]
../scintilla/gtk/ScintillaGTK.cxx:2301:13: warning: enumeration value 'PANGO_UNDERLINE_ERROR_LINE' not handled in switch [-Wswitch]
[82/261] Compiling C object libfnmatch.a.p/ctags_fnmatch_fnmatch.c.o
@codebrainz
codebrainz / flags.hpp
Created February 26, 2020 02:21
For using C++ enum class values as bit flags.
#pragma once
#include <type_traits>
template <typename E>
struct enable_enum_flags {
static constexpr const bool value = false;
};
template <typename E>
@codebrainz
codebrainz / none.conf
Created October 26, 2019 00:16
A colourless Geany colour scheme.
[theme_info]
name=No Theme
description=A colour theme with no language highlighting.
version=0.01
author=
url=
[named_styles]
default=0x000000;0xffffff;false;false
diff --git a/meson.build b/meson.build
index ab1148cc..3d045976 100644
--- a/meson.build
+++ b/meson.build
@@ -32,11 +32,11 @@ def_cflags += '-DGEANY_DOCDIR="@0@"'.format(join_paths(prefix, get_option('datad
geany_cflags = def_cflags
have_gcc4_visibility = cc.has_argument('-fvisibility=hidden')
geany_cflags += '-DGEANY_PRIVATE'
-if target_machine.system() == 'windows'
- geany_cflags += '-DGEANY_EXPORT_SYMBOL="__declspec(dllexport)"'
Commands
========
Configure:
time ../configure --prefix=/opt/geany --disable-api-docs --disable-gtkdoc-header --disable-pdf-docs --disable-html-docs --disable-gtk3
Make:
time make -j12
Incremental:
@codebrainz
codebrainz / geany-gtk2.sh
Last active July 13, 2019 03:49
Compile Geany against GTK+ 2 on Debian-like distros.
#!/bin/sh
set -e
sudo apt-get install build-essential autotools-dev autoconf libgtk2.0-dev
mkdir -p ${HOME}/.local/src
cd ${HOME}/.local/src
git clone https://github.com/geany/geany.git
cd geany
./autogen.sh --prefix=${HOME}/.local --disable-gtk3
make
make install
if HAVE_DBUS
mousepad-dbus-infos.c: mousepad-dbus-infos.xml
$(AM_V_GEN)gdbus-codegen --interface-prefix org.xfce. --body --output $@ mousepad-dbus-infos.xml
mousepad-dbus-infos.h: mousepad-dbus-infos.xml
$(AM_V_GEN)gdbus-codegen --interface-prefix org.xfce. --header --output $@ mousepad-dbus-infos.xml
endif
@codebrainz
codebrainz / about-grt.patch
Created May 24, 2019 01:20
Add GTK+ and GLib runtime versions into Geany's about dialog.
diff --git a/src/about.c b/src/about.c
index 6c9a13896..7c31368a9 100644
--- a/src/about.c
+++ b/src/about.c
@@ -43,6 +43,7 @@
#define INFO "<span size=\"larger\" weight=\"bold\">%s</span>"
#define CODENAME "<span weight=\"bold\">\"" GEANY_CODENAME "\"</span>"
#define BUILDDATE "<span size=\"smaller\">%s</span>"
+#define RUNTIME BUILDDATE
#define COPYRIGHT _("Copyright (c) 2005\nThe Geany contributors")
/*
* document.c - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2005 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>,
* Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>, and others.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.