#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

enum {
    spacing = 20,
    box_w = 320,
    box_h = 100,
    font_size = 25,
    win_w = box_w + 2 * spacing,
    win_h = box_h + 2 * spacing
};

static int global_handler(int event)
{
    if (event == FL_SHORTCUT
            && Fl::event_key() == 'g'
            && Fl::event_state(FL_CTRL)) {
        puts("Global shortcut Ctrl+G");
        fflush(stdout);
        return 1;
    }

    return 0;
}

int main()
{
    Fl_Window win(win_w, win_h, "Global shortcut");

    Fl_Box box(spacing, spacing, box_w, box_h, "Press Ctrl+G");
    box.box(FL_DOWN_BOX);
    box.labelsize(font_size);

    Fl::add_handler(global_handler);

    win.end();
    win.show();

    return Fl::run();
}
