Krolyxon
Commit 07300da

Branches

Refs →

nsxiv07300da

Do not keep track of fullscreen state

There is no more need for this after the removal of the special color handling
for fullscreen mode in commit 2886876.
Author
Bert Münnich
Date
2019-07-16 19:26 +0200
Parent
2886876
Commit
07300da7dfc1f783418e81eb7bea9b6c42952755

+3 −53

3 files changed

  1. M main.c +1 −1
  2. M sxiv.h +0 −3
  3. M window.c +2 −49
M main.c View
@@ -774,7 +774,7 @@ void run(void)
774774 } else {
775775 tns.dirty = true;
776776 }
777− if (!resized || win.fullscreen) {
777+ if (!resized) {
778778 redraw();
779779 set_timeout(clear_resize, TO_REDRAW_RESIZE, false);
780780 resized = true;
M sxiv.h View
@@ -385,7 +385,6 @@ enum {
385385 ATOM__NET_WM_ICON,
386386 ATOM__NET_WM_STATE,
387387 ATOM__NET_WM_STATE_FULLSCREEN,
388− ATOM__NET_SUPPORTED,
389388 ATOM_COUNT
390389 };
391390
@@ -417,8 +416,6 @@ struct win {
417416 unsigned int h; /* = win height - bar height */
418417 unsigned int bw;
419418
420− bool fullscreen;
421−
422419 struct {
423420 int w;
424421 int h;
M window.c View
@@ -53,9 +53,6 @@ static int barheight;
5353
5454 Atom atoms[ATOM_COUNT];
5555
56−static Bool fs_support;
57−static Bool fs_warned;
58−
5956 void win_init_font(const win_env_t *e, const char *fontstr)
6057 {
6158 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)
7471 }
7572 }
7673
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−
10774 const char* win_res(Display *dpy, const char *name, const char *def)
10875 {
10976 char *type;
@@ -170,9 +137,6 @@ void win_init(win_t *win)
170137 INIT_ATOM_(_NET_WM_ICON);
171138 INIT_ATOM_(_NET_WM_STATE);
172139 INIT_ATOM_(_NET_WM_STATE_FULLSCREEN);
173− INIT_ATOM_(_NET_SUPPORTED);
174−
175− win_check_wm_support(e->dpy, RootWindow(e->dpy, e->scr));
176140 }
177141
178142 void win_open(win_t *win)
@@ -188,7 +152,6 @@ void win_open(win_t *win)
188152 Pixmap none;
189153 int gmask;
190154 XSizeHints sizehints;
191− Bool fullscreen = options->fullscreen && fs_support;
192155
193156 e = &win->env;
194157 parent = options->embed != 0 ? options->embed : RootWindow(e->dpy, e->scr);
@@ -300,7 +263,7 @@ void win_open(win_t *win)
300263 XMapWindow(e->dpy, win->xwin);
301264 XFlush(e->dpy);
302265
303− if (fullscreen)
266+ if (options->fullscreen)
304267 win_toggle_fullscreen(win);
305268 }
306269
@@ -337,15 +300,6 @@ void win_toggle_fullscreen(win_t *win)
337300 XEvent ev;
338301 XClientMessageEvent *cm;
339302
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−
349303 memset(&ev, 0, sizeof(ev));
350304 ev.type = ClientMessage;
351305
@@ -353,9 +307,8 @@ void win_toggle_fullscreen(win_t *win)
353307 cm->window = win->xwin;
354308 cm->message_type = atoms[ATOM__NET_WM_STATE];
355309 cm->format = 32;
356− cm->data.l[0] = win->fullscreen;
310+ cm->data.l[0] = 2; // toggle
357311 cm->data.l[1] = atoms[ATOM__NET_WM_STATE_FULLSCREEN];
358− cm->data.l[2] = cm->data.l[3] = 0;
359312
360313 XSendEvent(win->env.dpy, DefaultRootWindow(win->env.dpy), False,
361314 SubstructureNotifyMask | SubstructureRedirectMask, &ev);