-
-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to create borders externally #81
Comments
@incertia You seem to know way more about this than I do. Any chance you want to submit a patch? |
@erthalion Got for it! |
Well, I'm really confused by this statement. I couldn't find any mention of I couldn't also reproduce a situation when borders are outside of a window
So, at this point I see following options:
I think it also worth to mention that I see similar problems when I toggle |
Super late reply, but here's another attempt at explaining what I'm trying to get at: Other window managers/desktop sessions will draw window decorators around the client area. Specifically, in the case of My defaults xmb_input xmb_notif = defaultConfig
{ modMask = mod4Mask
, manageHook = myManageHook <+> manageDocks
, layoutHook = avoidStruts $ myLayoutHook
, startupHook = myStartupHook
, logHook = myLogHook xmb_input xmb_notif
, handleEventHook = docksEventHook
, terminal = "urxvtc"
, normalBorderColor = "#63c0f5"
, focusedBorderColor = "#00d000"
, borderWidth = 2 -- <-- the important line here
, workspaces = myWorkspaces } The window creation code is nothing fancy: xcb_create_window(app->xc,
XCB_COPY_FROM_PARENT,
app->xw,
screen->root,
(screen->width_in_pixels - w) / 2,
(screen->height_in_pixels - h) / 2,
w, h, // width, height
0, // border
XCB_WINDOW_CLASS_INPUT_OUTPUT,
screen->root_visual,
mask, values);
xcb_change_property(app->xc, XCB_PROP_MODE_REPLACE, app->xw,
app->ewmh->_NET_WM_WINDOW_TYPE, XCB_ATOM_ATOM,
32, 1, &app->ewmh->_NET_WM_WINDOW_TYPE_NORMAL);
memset(&size_hints, 0, sizeof(xcb_size_hints_t));
memset(&wm_hints, 0, sizeof(xcb_icccm_wm_hints_t));
xcb_icccm_size_hints_set_base_size(&size_hints, w, h);
xcb_icccm_size_hints_set_min_size(&size_hints, w, h);
xcb_icccm_size_hints_set_max_size(&size_hints, w, h);
xcb_icccm_size_hints_set_win_gravity(&size_hints, XCB_GRAVITY_CENTER);
xcb_icccm_set_wm_size_hints(app->xc, app->xw, XCB_ATOM_WM_NORMAL_HINTS,
&size_hints);
xcb_icccm_set_wm_transient_for(app->xc, app->xw, screen->root);
xcb_icccm_wm_hints_set_normal(&wm_hints);
xcb_icccm_set_wm_hints(app->xc, app->xw, &wm_hints); and we report geometry during the event loop as follows: case XCB_INPUT_RAW_KEY_RELEASE:
keysym = get_keysym(app, ev.kr->detail, mods);
if (keysym == XK_Escape) {
printf("escape released\n");
ggc = xcb_get_geometry(app->xc, app->xw);
ggr = xcb_get_geometry_reply(app->xc, ggc, NULL);
printf("window size: %u x %u\n", ggr->width, ggr->height);
printf("border size: %u\n", ggr->border_width);
xcb_destroy_window(app->xc, app->xw);
xcb_flush(app->xc);
}
break; tl;dr it seems to me that the default behavior of EDIT: this could be a problem inherent to EDIT (again): I have updated my program to use an additional call to EDIT (yet again): I took a look at |
I think "external" borders are usually what you get with reparenting window managers. Rather than drawing outside the window, a new window is created for the border and WM controls, and the client window is embedded inside that. |
Aha, I think I tracked down the issue. |
Here's a hack I put together to theoretically address this issue, I'm not sure if there are any other changes that need to be made. I am also able to make a PR with these changes @pjones @erthalion. diff --git a/src/XMonad/Operations.hs b/src/XMonad/Operations.hs
index 2845a6e..b25dd07 100644
--- a/src/XMonad/Operations.hs
+++ b/src/XMonad/Operations.hs
@@ -128,7 +128,7 @@ windows f = do
-- for each workspace, layout the currently visible workspaces
let allscreens = W.screens ws
summed_visible = scanl (++) [] $ map (W.integrate' . W.stack . W.workspace) allscreens
- rects <- fmap concat $ forM (zip allscreens summed_visible) $ \ (w, vis) -> do
+ rects <- fmap (foldl (\(a, b) (c, d) -> (a ++ c, b ++ d)) ([], [])) $ forM (zip allscreens summed_visible) $ \ (w, vis) -> do
let wsp = W.workspace w
this = W.view n ws
n = W.tag wsp
@@ -151,11 +151,11 @@ windows f = do
io $ restackWindows d (map fst vs)
-- return the visible windows for this workspace:
- return vs
+ return (flt, rs)
- let visible = map fst rects
+ let visible = let (floating, tiled) = rects in map fst floating ++ map fst tiled
- mapM_ (uncurry tileWindow) rects
+ mapM_ (uncurry tileWindow) (snd rects)
whenJust (W.peek ws) $ \w -> do
fbs <- asks (focusedBorderColor . config) |
Problem Description
Borders are created internally, so if borderWidth = 2, a call to xcb_create_window() with width=1280 and height=720 and borderwidth = 0 ends up creating a client area measuring 1276 x 716. For graphics applications that require a fixed window size, this can be particularly annoying if you have to wait for the window to become exposed to resize the window.
An .xinitrc file consisting of precisely
can create borders that go outward like so, confirmed via xcb_get_geometry having the correct client area.
Configuration File
Checklist
I've read CONTRIBUTING.md
I tested my configuration with xmonad-testing
The text was updated successfully, but these errors were encountered: