WINDOW* vwm_fmod_wndlist(gpointer anything) { const char *title=" Window List "; WINDOW *window; int width = 0,height = 0; MENU *menu; ITEM **item_list; gchar **titles; guint item_count; if(viper_window_find_by_class((gpointer)vwm_fmod_wndlist) != NULL) return NULL; viper_thread_enter(); titles = viper_deck_get_wndlist(); item_count = g_strv_length(titles); if(item_count == 0) { viper_thread_leave(); return NULL; } menu = viper_menu_create(titles); item_list = (ITEM**)g_malloc0(sizeof(ITEM*)*(item_count+1)); // override the default of 1 column X 16 entries per row set_menu_format(menu,20,1); // hide character mark on left hand side set_menu_mark(menu," "); scale_menu(menu,&height,&width); width++; if((strlen(title) + 10) > width) width = (strlen(title) + 10); window = viper_window_create((gchar*)title,0.95,2,width,height,TRUE); viper_menu_bind(menu,window,0,0,width,height); // set_menu_sub(menu,window); set_menu_fore(menu, VIPER_COLORS(COLOR_MAGENTA,COLOR_WHITE) | A_REVERSE | A_BOLD); set_menu_back(menu,VIPER_COLORS(COLOR_BLACK,COLOR_WHITE)); // post_menu(menu); /* viper_event_set(window,"window-activate",vwm_fmod_wndlist_ON_ACTIVATE,NULL); */ viper_event_set(window,"window-destroy",vwm_fmod_wndlist_ON_DESTROY, (gpointer)menu); viper_window_set_key_func(window,vwm_fmod_wndlist_ON_KEYSTROKE); viper_window_set_userptr(window,(gpointer)menu); viper_window_set_state(window,STATE_EMINENT); viper_thread_leave(); g_strfreev(titles); return window; }
gint vwm_main_menu_hotkey(void) { WINDOW *window; window=viper_window_find_by_class(vwm_main_menu); if(window != NULL) { viper_thread_enter(); viper_window_close(window); viper_thread_leave(); return 0; } viper_thread_enter(); window=vwm_main_menu(); viper_window_set_class(window,vwm_main_menu); viper_window_set_top(window); viper_thread_leave(); return 0; }