#include #include #include #include #include #include "kbs.h" #define USERBUTCOLOR 24 #define USERBUTMAX 20 typedef struct { Window w; char bname[10]; int com; } USERBUT; int nuserbut=0; USERBUT userbut[USERBUTMAX]; extern Display *display; extern Window main_win; Window make_fancy_window(); extern int DCURYs,DCURXs,CURY_OFFs; extern GC small_gc; user_button_events(XEvent report) { switch(report.type){ case Expose: case MapNotify: user_button_draw(report.xany.window); break; case EnterNotify: user_button_cross(report.xcrossing.window,2); break; case LeaveNotify: user_button_cross(report.xcrossing.window,1); break; case ButtonPress: user_button_press(report.xbutton.window); break; } } user_button_press(Window w) { int i; for(i=0;i=USERBUTMAX)return; if(strlen(s)==0)return; get_button_info(s,bname,sc); if(strlen(bname)==0||strlen(sc)==0)return; z=find_kbs(sc); if(z==-1){ printf("%s - not implemented\n",sc); return; } userbut[nuserbut].com=z; strcpy(userbut[nuserbut].bname,bname); printf(" added button(%d) -- %s %d\n", nuserbut,userbut[nuserbut].bname,userbut[nuserbut].com); nuserbut++; } create_user_buttons(int x0,int y0, Window base) { int i; int x=x0; int l; if(nuserbut==0)return; for(i=0;i