summaryrefslogtreecommitdiff
path: root/urgency_test.c
blob: cf403a9fdf22cd6d599f63c91695d0f6a558cc5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <assert.h>
#include <unistd.h>
#include <stdio.h>


//
// gcc -g -Wall -o urgency_test urgency_test.c -lX11
//
// test case for urgency hint
//

int main()
{
  // Open the display
  Display *dpy = XOpenDisplay(NULL);
  assert(dpy);

  // Get some colors
  int blackColor = BlackPixel(dpy, DefaultScreen(dpy));

  // Create the window
  Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 200, 100, 0, blackColor, blackColor);

  // Map the window
  XMapWindow(dpy, w);
  XFlush(dpy);

  sleep(2);

  printf("Setting the urgency hint\n");

  XWMHints *h;
  h = XAllocWMHints();
  h->initial_state = NormalState;
  // = XGetWMHints(dpy, w);
  h->flags |= XUrgencyHint;
  // h->flags &= ~XUrgencyHint;
  XSetWMHints(dpy, w, h);
  XFlush(dpy);

  while (1)
    {
	sleep(1);
    }

  return 0;
}