Skip to content

Instantly share code, notes, and snippets.

View vadz's full-sized avatar

VZ vadz

View GitHub Profile
@vadz
vadz / xcb_debug.c
Last active September 6, 2024 16:13
Simple shared library to debug XCB events received by the application
// Compile with
//
// $ cc -Wall -shared -fPIC -o libxcb_debug.so xcb_debug.c `pkg-config --cflags --libs xcb`
//
// Use with
//
// $ LD_PRELOAD=libxcb_debug.so any_program_using_xcb
#define _GNU_SOURCE
#include <dlfcn.h>
#include <errno.h>
@vadz
vadz / transparent_textctrl.cpp
Created April 6, 2024 23:22
Example of a "transparent" wxTextCtrl under Windows
#include <wx/app.h>
#include <wx/artprov.h>
#include <wx/custombgwin.h>
#include <wx/dcclient.h>
#include <wx/frame.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/msw/private.h>
@vadz
vadz / build-glibc.yml
Created March 20, 2024 00:08
Workflow to build glibc-2.28 under Ubuntu 18.04
# Build glibc 2.28 under Ubuntu 18.04 to be able to use it with node 20.
name: Build glibc 2.28 under Ubuntu 18.04
on:
push:
jobs:
test:
runs-on: ubuntu-latest
container: ubuntu:18.04
@vadz
vadz / splitter.cpp
Created March 19, 2024 16:46
Example of using `wxSplitterWindow`
#include <wx/app.h>
#include <wx/frame.h>
#include <wx/splitter.h>
#include <wx/textctrl.h>
class TextCtrlShowingSize : public wxTextCtrl {
public:
explicit TextCtrlShowingSize(wxWindow* parent) : wxTextCtrl(parent, wxID_ANY, {}) {
Bind(wxEVT_SIZE, [this](wxSizeEvent& event) {
auto size = event.GetSize();
@vadz
vadz / aui-tabart.cpp
Created March 16, 2024 17:24
Example of using custom tab art with wxAUI
#include <wx/app.h>
#include <wx/dc.h>
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/aui/aui.h>
class TestDockArt : public wxAuiDefaultDockArt {
@vadz
vadz / aui-dockart.cpp
Created March 16, 2024 17:18
Example of defining a custom dock art provider
#include <wx/app.h>
#include <wx/dc.h>
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/aui/aui.h>
class TestDockArt : public wxAuiDefaultDockArt {
@vadz
vadz / aui-panel.cpp
Created March 16, 2024 17:10
Example of using AUI with a panel (and not a frame)
#include <wx/app.h>
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/aui/aui.h>
class TestPanel : public wxPanel {
public:
@vadz
vadz / tst.cpp
Created March 16, 2024 16:54
Example of using layered window with wxWidgets
// This is a simple example of a wxWidgets application using window without the
// standard "chrome", i.e. title bar and borders.
//
// With MSVS you can use the provided solution file to build it. With other
// compilers, remmeber to link against dwmapi.lib in addition to all the rest.
#include "wx/app.h"
#include "wx/button.h"
#include "wx/dcclient.h"
#include "wx/frame.h"
#include "wx/graphics.h"
@vadz
vadz / fix_wl_display_flush.c
Created October 3, 2023 22:50
LD-preloadable library preventing GTK from killing applications using it under Wayland
/*
Build with
$ cc -Wall -O2 -fPIC -shared -o libfix_wl_display_flush.so fix_wl_display_flush.c
Use as
$ LD_PRELOAD=libfix_wl_display_flush.so ./app
*/
#define _GNU_SOURCE
@vadz
vadz / winloc.cpp
Created June 10, 2021 18:34
Show value of some, or all, MSW locale settings
#define UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <strsafe.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
struct LocaleOption