summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2017-04-06 18:25:18 -0700
committerVito Caputo <vcaputo@pengaru.com>2017-04-07 13:29:24 -0700
commitcd7aade2689e7546b97c061616afb36237fe1787 (patch)
tree14c84fa7f08dd19685a0449562532742169b869a
parentf26f79f361eebb9af08ce64bc1c2f35b705e2927 (diff)
window: move console identification to helper
-rw-r--r--src/window.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/window.c b/src/window.c
index 144587e..aee4210 100644
--- a/src/window.c
+++ b/src/window.c
@@ -377,23 +377,17 @@ vwm_xwindow_t * vwm_win_unmanage(vwm_t *vwm, vwm_window_t *vwin)
}
-/* helper for doing the classification/placement of a window becoming managed */
-static void vwm_win_assimilate(vwm_t *vwm, vwm_window_t *vwin)
+/* helper for determining if a window is the console window */
+static int win_is_console(vwm_t *vwm, Window win)
{
- vwm_xwindow_t *xwin = vwin->xwindow;
- XWindowAttributes attrs;
- XWindowChanges changes = {};
- unsigned changes_mask = (CWX | CWY);
- XClassHint *classhint;
- const vwm_screen_t *scr = NULL;
+ XClassHint *classhint;
+ int ret = 0;
/* figure out if the window is the console */
if ((classhint = XAllocClassHint())) {
- if (XGetClassHint(VWM_XDISPLAY(vwm), xwin->id, classhint) && !strcmp(classhint->res_class, CONSOLE_WM_CLASS)) {
- vwm->console = vwin;
- vwm_win_shelve(vwm, vwin);
- vwm_win_autoconf(vwm, vwin, VWM_SCREEN_REL_XWIN, VWM_WIN_AUTOCONF_FULL);
- }
+ if (XGetClassHint(VWM_XDISPLAY(vwm), win, classhint) &&
+ !strcmp(classhint->res_class, CONSOLE_WM_CLASS))
+ ret = 1;
if (classhint->res_class)
XFree(classhint->res_class);
@@ -404,6 +398,25 @@ static void vwm_win_assimilate(vwm_t *vwm, vwm_window_t *vwin)
XFree(classhint);
}
+ return ret;
+}
+
+
+/* helper for doing the classification/placement of a window becoming managed */
+static void vwm_win_assimilate(vwm_t *vwm, vwm_window_t *vwin)
+{
+ vwm_xwindow_t *xwin = vwin->xwindow;
+ XWindowAttributes attrs;
+ XWindowChanges changes = {};
+ unsigned changes_mask = (CWX | CWY);
+ const vwm_screen_t *scr = NULL;
+
+ if (win_is_console(vwm, xwin->id)) {
+ vwm->console = vwin;
+ vwm_win_shelve(vwm, vwin);
+ vwm_win_autoconf(vwm, vwin, VWM_SCREEN_REL_XWIN, VWM_WIN_AUTOCONF_FULL);
+ }
+
/* TODO: this is a good place to hook in a window placement algo */
/* on client-requested mapping we place the window */
© All Rights Reserved