mirror of
https://github.com/gryf/window-maker.github.io.git
synced 2025-12-17 11:10:18 +01:00
Deploy gryf/window-maker.github.io to github.com/gryf/window-maker.github.io.git:gh-pages
This commit is contained in:
46
WINGs_tutorial/ThirdWindow.c
Normal file
46
WINGs_tutorial/ThirdWindow.c
Normal file
@@ -0,0 +1,46 @@
|
||||
void closeAll(WMWidget *self,void *data){
|
||||
fprintf(stderr, "I've been used!\n");
|
||||
WMDestroyWidget(self);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
handleEvents(XEvent *event, void *data)
|
||||
{
|
||||
WMWidget *widget = (WMWidget*)data;
|
||||
switch (event->type) {
|
||||
case ButtonPress:
|
||||
closeAll(widget,NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main (int argc, char **argv){
|
||||
|
||||
Display *display;
|
||||
WMScreen *screen;
|
||||
|
||||
WMWindow *win;
|
||||
WMColor *color;
|
||||
|
||||
WMInitializeApplication("ThirdWindow", &argc, argv);
|
||||
|
||||
if (!(display = XOpenDisplay(""))){
|
||||
fprintf(stderr,"error: cannot open display\n");
|
||||
exit(1);
|
||||
}
|
||||
screen = WMCreateScreen(display, DefaultScreen(display));
|
||||
|
||||
win = WMCreateWindow(screen, "");
|
||||
WMSetWindowCloseAction(win, closeAll, NULL);
|
||||
WMCreateEventHandler(WMWidgetView(win), ButtonPressMask,handleEvents, win);
|
||||
color = WMCreateRGBColor(screen, 124<<9,206<<8,162<<8, False);
|
||||
WMSetWidgetBackgroundColor((WMWidget *)win, color);
|
||||
|
||||
WMMapWidget(win);
|
||||
WMRealizeWidget(win);
|
||||
|
||||
WMScreenMainLoop(screen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user