diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2017-03-31 03:31:44 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2017-04-04 17:48:58 -0700 |
commit | f26f79f361eebb9af08ce64bc1c2f35b705e2927 (patch) | |
tree | 91ba988a3075dfea64bd4a37be7f89f503911925 /src | |
parent | 7a13afda4a51c28025eaae7789d8afb7e076d591 (diff) |
window: drop configuring member from vwm_window_t
Rather than setting this configuring flag for the sake of
vwm_screen_is_empty() to ignore, simply supply the xwin to ignore if
desired.
Diffstat (limited to 'src')
-rw-r--r-- | src/screen.c | 6 | ||||
-rw-r--r-- | src/screen.h | 3 | ||||
-rw-r--r-- | src/window.c | 6 | ||||
-rw-r--r-- | src/window.h | 1 |
4 files changed, 6 insertions, 10 deletions
diff --git a/src/screen.c b/src/screen.c index 1d082ad..3ee9540 100644 --- a/src/screen.c +++ b/src/screen.c @@ -137,16 +137,16 @@ _out: /* check if a screen contains any windows (assuming the current desktop) */ -int vwm_screen_is_empty(vwm_t *vwm, const vwm_screen_t *scr) +int vwm_screen_is_empty(vwm_t *vwm, const vwm_screen_t *scr, vwm_xwindow_t *ignore_xwin) { vwm_xwindow_t *xwin; int is_empty = 1; list_for_each_entry(xwin, &vwm->xwindows, xwindows) { - if (!xwin->client_mapped) + if (xwin == ignore_xwin || !xwin->client_mapped) continue; - if (!xwin->managed || (xwin->managed->desktop == vwm->focused_desktop && !xwin->managed->shelved && !xwin->managed->configuring)) { + if (!xwin->managed || (xwin->managed->desktop == vwm->focused_desktop && !xwin->managed->shelved)) { /* XXX: it may make more sense to see what %age of the screen is overlapped by windows, and consider it empty if < some % */ /* This is just seeing if any window is predominantly within the specified screen, the rationale being if you had a focusable * window on the screen you would have used the keyboard to make windows go there; this function is only used in determining diff --git a/src/screen.h b/src/screen.h index c8b7531..51b4f05 100644 --- a/src/screen.h +++ b/src/screen.h @@ -4,6 +4,7 @@ #include <X11/extensions/Xinerama.h> /* XINERAMA extension, facilitates easy multihead awareness */ typedef struct _vwm_t vwm_t; +typedef struct _vwm_xwindow_t vwm_xwindow_t; typedef XineramaScreenInfo vwm_screen_t; /* conveniently reuse the xinerama type for describing screens */ @@ -14,6 +15,6 @@ typedef enum _vwm_screen_rel_t { } vwm_screen_rel_t; const vwm_screen_t * vwm_screen_find(vwm_t *vwm, vwm_screen_rel_t rel, ...); -int vwm_screen_is_empty(vwm_t *vwm, const vwm_screen_t *scr); +int vwm_screen_is_empty(vwm_t *vwm, const vwm_screen_t *scr, vwm_xwindow_t *ignore_xwin); #endif diff --git a/src/window.c b/src/window.c index 30622b8..144587e 100644 --- a/src/window.c +++ b/src/window.c @@ -410,18 +410,14 @@ static void vwm_win_assimilate(vwm_t *vwm, vwm_window_t *vwin) if (!vwin->shelved) { /* we place the window on the screen containing the the pointer only if that screen is empty, * otherwise we place windows on the screen containing the currently focused window */ - /* since we query the geometry of windows in determining where to place them, a configuring - * flag is used to exclude the window being configured from those queries */ scr = vwm_screen_find(vwm, VWM_SCREEN_REL_POINTER); - vwin->configuring = 1; - if (vwm_screen_is_empty(vwm, scr)) { + if (vwm_screen_is_empty(vwm, scr, vwin->xwindow)) { /* focus the new window if it isn't already focused when it's going to an empty screen */ VWM_TRACE("window \"%s\" is alone on screen \"%i\", focusing", vwin->xwindow->name, scr->screen_number); vwm_win_focus(vwm, vwin); } else { scr = vwm_screen_find(vwm, VWM_SCREEN_REL_XWIN, vwm->focused_desktop->focused_window->xwindow); } - vwin->configuring = 0; changes.x = scr->x_org; changes.y = scr->y_org; diff --git a/src/window.h b/src/window.h index 3b3c745..7db1d13 100644 --- a/src/window.h +++ b/src/window.h @@ -34,7 +34,6 @@ typedef struct _vwm_window_t { unsigned int autoconfigured:3; /* autoconfigured window states (none/quarter/half/full/all) */ unsigned int mapping:1; /* is the window being mapped? (by vwm) */ unsigned int unmapping:1; /* is the window being unmapped? (by vwm) */ - unsigned int configuring:1; /* is the window being configured/placed? (by vwm) */ unsigned int shelved:1; /* is the window shelved? */ } vwm_window_t; |