10 #warning Do something clever with xinerama
11 ObEdge *edge[OB_NUM_EDGES];
12 #warning put in config.c and parse configs of course
13 gboolean config_edge_enabled[OB_NUM_EDGES] = {1, 1, 1, 1, 1, 1, 1, 1};
17 #define CORNER_SIZE 20
22 static void get_position(ObEdgeLocation edge, Rect screen, Rect *rect)
26 RECT_SET(*rect, CORNER_SIZE, 0,
27 screen.width - 2 * CORNER_SIZE, EDGE_WIDTH);
29 case OB_EDGE_TOPRIGHT:
30 RECT_SET(*rect, screen.width - CORNER_SIZE, 0,
31 CORNER_SIZE, CORNER_SIZE);
34 RECT_SET(*rect, screen.width - EDGE_WIDTH, CORNER_SIZE,
35 EDGE_WIDTH, screen.height - 2 * CORNER_SIZE);
37 case OB_EDGE_BOTTOMRIGHT:
38 RECT_SET(*rect, screen.width - CORNER_SIZE,
39 screen.height - CORNER_SIZE,
40 CORNER_SIZE, CORNER_SIZE);
43 RECT_SET(*rect, CORNER_SIZE, screen.height - EDGE_WIDTH,
44 screen.width - 2 * CORNER_SIZE, EDGE_WIDTH);
46 case OB_EDGE_BOTTOMLEFT:
47 RECT_SET(*rect, 0, screen.height - CORNER_SIZE,
48 CORNER_SIZE, CORNER_SIZE);
51 RECT_SET(*rect, 0, CORNER_SIZE,
52 EDGE_WIDTH, screen.height - 2 * CORNER_SIZE);
55 RECT_SET(*rect, 0, 0, CORNER_SIZE, CORNER_SIZE);
60 void edges_startup(gboolean reconfigure)
64 XSetWindowAttributes xswa;
65 const Rect *screen = screen_physical_area_all_monitors();
67 xswa.override_redirect = True;
69 for (i=0; i < OB_NUM_EDGES; i++) {
70 if (!config_edge_enabled[i])
73 edge[i] = g_new(ObEdge, 1);
74 edge[i]->obwin.type = OB_WINDOW_CLASS_EDGE;
75 edge[i]->location = i;
77 get_position(i, *screen, &r);
78 edge[i]->win = XCreateWindow(obt_display, obt_root(ob_screen),
79 r.x, r.y, r.width, r.height, 0, 0, InputOnly,
80 CopyFromParent, CWOverrideRedirect, &xswa);
81 XSelectInput(obt_display, edge[i]->win, ButtonPressMask | ButtonReleaseMask
82 | EnterWindowMask | LeaveWindowMask);
83 XMapWindow(obt_display, edge[i]->win);
85 stacking_add(EDGE_AS_WINDOW(edge[i]));
86 window_add(&edge[i]->win, EDGE_AS_WINDOW(edge[i]));
89 ob_debug("mapped edge window %i at %03i %03i %02i %02i", i, r.x, r.y, r.width, r.height);
96 void edges_shutdown(gboolean reconfigure)
100 for (i=0; i < OB_NUM_EDGES; i++) {
101 window_remove(edge[i]->win);
102 stacking_remove(EDGE_AS_WINDOW(edge[i]));
103 XDestroyWindow(obt_display, edge[i]->win);