| @@ -53,9 +53,6 @@ static int barheight; |
| 53 | 53 | | |
| 54 | 54 | | Atom atoms[ATOM_COUNT]; |
| 55 | 55 | | |
| 56 | | − | static Bool fs_support; |
| 57 | | − | static Bool fs_warned; |
| 58 | | − | |
| 59 | 56 | | void win_init_font(const win_env_t *e, const char *fontstr) |
| 60 | 57 | | { |
| 61 | 58 | | if ((font = XftFontOpenName(e->dpy, e->scr, fontstr)) == NULL) |
| @@ -74,36 +71,6 @@ void win_alloc_color(const win_env_t *e, const char *name, XftColor *col) |
| 74 | 71 | | } |
| 75 | 72 | | } |
| 76 | 73 | | |
| 77 | | − | void win_check_wm_support(Display *dpy, Window root) |
| 78 | | − | { |
| 79 | | − | int format; |
| 80 | | − | long offset = 0, length = 16; |
| 81 | | − | Atom *data, type; |
| 82 | | − | unsigned long i, nitems, bytes_left; |
| 83 | | − | Bool found = False; |
| 84 | | − | |
| 85 | | − | while (!found && length > 0) { |
| 86 | | − | if (XGetWindowProperty(dpy, root, atoms[ATOM__NET_SUPPORTED], |
| 87 | | − | offset, length, False, XA_ATOM, &type, &format, |
| 88 | | − | &nitems, &bytes_left, (unsigned char**) &data)) |
| 89 | | − | { |
| 90 | | − | break; |
| 91 | | − | } |
| 92 | | − | if (type == XA_ATOM && format == 32) { |
| 93 | | − | for (i = 0; i < nitems; i++) { |
| 94 | | − | if (data[i] == atoms[ATOM__NET_WM_STATE_FULLSCREEN]) { |
| 95 | | − | found = True; |
| 96 | | − | fs_support = True; |
| 97 | | − | break; |
| 98 | | − | } |
| 99 | | − | } |
| 100 | | − | } |
| 101 | | − | XFree(data); |
| 102 | | − | offset += nitems; |
| 103 | | − | length = MIN(length, bytes_left / 4); |
| 104 | | − | } |
| 105 | | − | } |
| 106 | | − | |
| 107 | 74 | | const char* win_res(Display *dpy, const char *name, const char *def) |
| 108 | 75 | | { |
| 109 | 76 | | char *type; |
| @@ -170,9 +137,6 @@ void win_init(win_t *win) |
| 170 | 137 | | INIT_ATOM_(_NET_WM_ICON); |
| 171 | 138 | | INIT_ATOM_(_NET_WM_STATE); |
| 172 | 139 | | INIT_ATOM_(_NET_WM_STATE_FULLSCREEN); |
| 173 | | − | INIT_ATOM_(_NET_SUPPORTED); |
| 174 | | − | |
| 175 | | − | win_check_wm_support(e->dpy, RootWindow(e->dpy, e->scr)); |
| 176 | 140 | | } |
| 177 | 141 | | |
| 178 | 142 | | void win_open(win_t *win) |
| @@ -188,7 +152,6 @@ void win_open(win_t *win) |
| 188 | 152 | | Pixmap none; |
| 189 | 153 | | int gmask; |
| 190 | 154 | | XSizeHints sizehints; |
| 191 | | − | Bool fullscreen = options->fullscreen && fs_support; |
| 192 | 155 | | |
| 193 | 156 | | e = &win->env; |
| 194 | 157 | | parent = options->embed != 0 ? options->embed : RootWindow(e->dpy, e->scr); |
| @@ -300,7 +263,7 @@ void win_open(win_t *win) |
| 300 | 263 | | XMapWindow(e->dpy, win->xwin); |
| 301 | 264 | | XFlush(e->dpy); |
| 302 | 265 | | |
| 303 | | − | if (fullscreen) |
| 266 | + | if (options->fullscreen) |
| 304 | 267 | | win_toggle_fullscreen(win); |
| 305 | 268 | | } |
| 306 | 269 | | |
| @@ -337,15 +300,6 @@ void win_toggle_fullscreen(win_t *win) |
| 337 | 300 | | XEvent ev; |
| 338 | 301 | | XClientMessageEvent *cm; |
| 339 | 302 | | |
| 340 | | − | if (!fs_support) { |
| 341 | | − | if (!fs_warned) { |
| 342 | | − | error(0, 0, "No fullscreen support"); |
| 343 | | − | fs_warned = True; |
| 344 | | − | } |
| 345 | | − | return; |
| 346 | | − | } |
| 347 | | − | win->fullscreen = !win->fullscreen; |
| 348 | | − | |
| 349 | 303 | | memset(&ev, 0, sizeof(ev)); |
| 350 | 304 | | ev.type = ClientMessage; |
| 351 | 305 | | |
| @@ -353,9 +307,8 @@ void win_toggle_fullscreen(win_t *win) |
| 353 | 307 | | cm->window = win->xwin; |
| 354 | 308 | | cm->message_type = atoms[ATOM__NET_WM_STATE]; |
| 355 | 309 | | cm->format = 32; |
| 356 | | − | cm->data.l[0] = win->fullscreen; |
| 310 | + | cm->data.l[0] = 2; // toggle |
| 357 | 311 | | cm->data.l[1] = atoms[ATOM__NET_WM_STATE_FULLSCREEN]; |
| 358 | | − | cm->data.l[2] = cm->data.l[3] = 0; |
| 359 | 312 | | |
| 360 | 313 | | XSendEvent(win->env.dpy, DefaultRootWindow(win->env.dpy), False, |
| 361 | 314 | | SubstructureNotifyMask | SubstructureRedirectMask, &ev); |