diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 53 |
1 files changed, 25 insertions, 28 deletions
@@ -12,7 +12,9 @@ * * - XRender, not OpenGL * - * - There is no theming + * - No theming + * + * - No workspaces. They are crack. * * - There is very little configuation */ @@ -45,19 +47,19 @@ get_time (ocm_app_t *app) static ocm_window_t * app_find_xwindow (ocm_app_t *app, Window xwindow) { - ocm_window_t *window = app->windows; + ocm_window_t *w; - while (window) + for (w = app->windows; w != NULL; w = w->next) { - if (window->xwindow == xwindow) - return window; - - window = window->next; + if (w->xwindow == xwindow) + return w; } + + return NULL; } static void -app_unmanage_xwindow (ocm_app_t *app, Window xwindow) +app_unmanage_window (ocm_app_t *app, Window xwindow) { ocm_window_t *prev, *window; @@ -81,24 +83,6 @@ app_unmanage_xwindow (ocm_app_t *app, Window xwindow) } } -static void -app_manage_window (ocm_app_t *app, Window window) -{ - XWindowAttributes attrs; - - XGrabServer (app->display); - - if (XGetWindowAttributes (app->display, window, &attrs)) - { - ocm_window_t *owindow = ocm_window_new (app, window); - - owindow->next = app->windows; - app->windows = owindow; - } - - XUngrabServer (app->display); -} - static Window create_offscreen_window (ocm_app_t *app) { @@ -236,17 +220,30 @@ ocm_app_new (int argc, char **argv) CWEventMask | CWOverrideRedirect | CWBackPixmap | CWBorderPixel, &attr); + app->wm_owner = create_offscreen_window (app); - app->cm_owner = create_offscreen_window (app); acquire_manager_selection (app, "WM_S0", app->wm_owner, replace); + + app->cm_owner = create_offscreen_window (app); acquire_manager_selection (app, "WM_CM_S0", app->cm_owner, replace); + + XCompositeRedirectSubwindows ( + app->display, app->root, CompositeRedirectManual); /* Now manage all the windows */ if (!XQueryTree (app->display, app->root, &r, &p, &children, &n_children)) ocm_error ("XQueryTree() failed"); for (i = 0; i < n_children; ++i) - app_manage_window (app, children[i]); + { + ocm_window_t *owindow = ocm_window_new (app, children[i]); + + if (owindow) + { + owindow->next = app->windows; + app->windows = owindow; + } + } if (children) XFree (children); |