示例#1
0
// Read wmanager.conf and initialize an array that will be used later
void read_hotkeys_configuration()
{
    // All configurable hotkeys below - edit to add new keys
    static struct {
        char *name;	// as used in wmanager.conf file
        void (*func)(char *name);	// callback function for this key
        char *def_key;	// default hotkey
    } configurables[] = {
        {"PreviousWindow",	PreviousWindow,	"Alt+Tab"},
        {"NextWindow",	NextWindow,	"Alt+Shift+Tab"},
        {"Desktop1",	FKey_DeskNumber,	"Alt+F1"},
        {"Desktop2",	FKey_DeskNumber,	"Alt+F2"},
        {"Desktop3",	FKey_DeskNumber,	"Alt+F3"},
        {"Desktop4",	FKey_DeskNumber,	"Alt+F4"},
        {"Desktop5",	FKey_DeskNumber,	"Alt+F5"},
        {"Desktop6",	FKey_DeskNumber,	"Alt+F6"},
        {"Desktop7",	FKey_DeskNumber,	"Alt+F7"},
        {"Desktop8",	FKey_DeskNumber,	"Alt+F8"},
        {"PreviousDesktop",	PreviousDesk,	"Alt+Ctrl+Right"},
        {"NextDesktop",	NextDesk,	"Alt+Ctrl+Left"},
        {"FindUtil",	FindUtil,	"Ctrl+F3"},
        {"FastRun",	FastRun,	"Ctrl+F12"},
        {"CloseWindow",	CloseWindow,	"Ctrl+F4"},
        {"MinimizeWindow",	MinimizeWindow,	"Ctrl+F7"},
        {"MaximizeWindow",	MaximizeWindow,	"Ctrl+F8"},

        // Slots for user-defined applications and hotkeys
        // 12 ought to be enough :-)
        {"App1",LaunchApp,""},
        {"App2",LaunchApp,""},
        {"App3",LaunchApp,""},
        {"App4",LaunchApp,""},
        {"App5",LaunchApp,""},
        {"App6",LaunchApp,""},
        {"App7",LaunchApp,""},
        {"App8",LaunchApp,""},
        {"App9",LaunchApp,""},
        {"App10",LaunchApp,""},
        {"App11",LaunchApp,""},
        {"App12",LaunchApp,""},

        {"",NULL,""}
    };

    char buf[256];
    int j=0;

    Fl_Config wmconf(fl_find_config_file ("wmanager.conf",0));
    wmconf.set_section("Hotkeys");

    for (int i=0; configurables[i].name[0]; i++) {
        wmconf.read(configurables[i].name, buf, configurables[i].def_key, sizeof(buf));
        if (buf && buf[0]) {
            keybindings[j].key=parse_hotkey(buf);
            keybindings[j].name = strdup(configurables[i].name);
            keybindings[j++].func=configurables[i].func;
        }
    }
    keybindings[j].key = 0;
}
示例#2
0
文件: radio.c 项目: LubkaB/mc
WRadio *
radio_new (int y, int x, int count, const char **texts)
{
    WRadio *r;
    Widget *w;
    int i, wmax = 0;

    r = g_new (WRadio, 1);
    w = WIDGET (r);

    /* Compute the longest string */
    r->texts = g_new (hotkey_t, count);

    for (i = 0; i < count; i++)
    {
        int width;

        r->texts[i] = parse_hotkey (texts[i]);
        width = hotkey_width (r->texts[i]);
        wmax = max (width, wmax);
    }

    widget_init (w, y, x, count, 4 + wmax, radio_callback, radio_event);
    /* 4 is width of "(*) " */
    r->state = 1;
    r->pos = 0;
    r->sel = 0;
    r->count = count;
    widget_want_hotkey (w, TRUE);

    return r;
}
示例#3
0
文件: button.c 项目: artzub/mc
void
button_set_text (WButton * b, const char *text)
{
    release_hotkey (b->text);
    b->text = parse_hotkey (text);
    b->widget.cols = button_get_len (b);
    dlg_redraw (b->widget.owner);
}
示例#4
0
文件: menu.c 项目: BpArCuCTeMbI/mc
menu_entry_t *
menu_entry_create (const char *name, long command)
{
    menu_entry_t *entry;

    entry = g_new (menu_entry_t, 1);
    entry->first_letter = ' ';
    entry->text = parse_hotkey (name);
    entry->command = command;
    entry->shortcut = NULL;

    return entry;
}
示例#5
0
文件: check.c 项目: BrEacK/mc
WCheck *
check_new (int y, int x, int state, const char *text)
{
    WCheck *c;

    c = g_new (WCheck, 1);
    c->text = parse_hotkey (text);
    init_widget (&c->widget, y, x, 1, 4 + hotkey_width (c->text), check_callback, check_event);
    /* 4 is width of "[X] " */
    c->state = state ? C_BOOL : 0;
    widget_want_hotkey (c->widget, TRUE);

    return c;
}
示例#6
0
文件: menu.c 项目: BpArCuCTeMbI/mc
menu_t *
create_menu (const char *name, GList * entries, const char *help_node)
{
    menu_t *menu;

    menu = g_new (menu_t, 1);
    menu->start_x = 0;
    menu->text = parse_hotkey (name);
    menu->entries = entries;
    menu->max_entry_len = 1;
    menu->max_hotkey_len = 0;
    menu->selected = 0;
    menu->help_node = g_strdup (help_node);

    return menu;
}
示例#7
0
文件: check.c 项目: Acidburn0zzz/mc
WCheck *
check_new (int y, int x, int state, const char *text)
{
    WCheck *c;
    Widget *w;

    c = g_new (WCheck, 1);
    w = WIDGET (c);
    c->text = parse_hotkey (text);
    /* 4 is width of "[X] " */
    widget_init (w, y, x, 1, 4 + hotkey_width (c->text), check_callback, check_mouse_callback);
    c->state = state ? C_BOOL : 0;
    widget_want_cursor (w, TRUE);
    widget_want_hotkey (w, TRUE);

    return c;
}
示例#8
0
文件: button.c 项目: artzub/mc
WButton *
button_new (int y, int x, int action, button_flags_t flags, const char *text, bcback_fn callback)
{
    WButton *b;

    b = g_new (WButton, 1);
    b->action = action;
    b->flags = flags;
    b->text = parse_hotkey (text);

    init_widget (&b->widget, y, x, 1, button_get_len (b), button_callback, button_event);

    b->selected = FALSE;
    b->callback = callback;
    widget_want_hotkey (b->widget, TRUE);
    b->hotpos = (b->text.hotkey != NULL) ? str_term_width1 (b->text.start) : -1;

    return b;
}
示例#9
0
文件: menu.c 项目: BpArCuCTeMbI/mc
void
menu_set_name (menu_t * menu, const char *name)
{
    release_hotkey (menu->text);
    menu->text = parse_hotkey (name);
}