Recolor on resize window
This commit is contained in:
parent
c15c266241
commit
28dd75b433
18
main.c
18
main.c
@ -7,7 +7,17 @@ int main()
|
||||
{
|
||||
Display *display = XOpenDisplay(NULL);
|
||||
Window main_window = XDefaultRootWindow(display);
|
||||
Window window = XCreateSimpleWindow(display, main_window, 0, 0, 250, 250, 1, 0, 0x00aade87);
|
||||
int screen = DefaultScreen(display);
|
||||
GC context = XDefaultGC(display, screen);
|
||||
|
||||
XSetWindowAttributes attributes = {};
|
||||
attributes.background_pixel = 0xffffccaa;
|
||||
attributes.event_mask = ResizeRedirectMask | ExposureMask;
|
||||
Window window = XCreateWindow(display, main_window,
|
||||
0, 0, 1920, 1080,
|
||||
1, CopyFromParent, CopyFromParent, CopyFromParent,
|
||||
CWBackPixel | CWEventMask, &attributes);
|
||||
|
||||
XMapWindow(display, window);
|
||||
XFlush(display);
|
||||
|
||||
@ -23,7 +33,7 @@ int main()
|
||||
XEvent general_event = {};
|
||||
XNextEvent(display, &general_event);
|
||||
|
||||
printf("Type: %d", general_event.type);
|
||||
printf("Type: %d \n", general_event.type);
|
||||
switch(general_event.type)
|
||||
{
|
||||
case ClientMessage:
|
||||
@ -39,13 +49,15 @@ int main()
|
||||
{
|
||||
static unsigned long color = 0x00aade87;
|
||||
if(color == 0x00aade87)
|
||||
color = 0x00bbde87;
|
||||
color = 0xd000d087;
|
||||
else
|
||||
color = 0x00aade87;
|
||||
|
||||
XSetWindowBackground(display, window, color);
|
||||
} break;
|
||||
}
|
||||
|
||||
XClearWindow(display, window);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user