From 85448518e32e703167ce4e1aecd97dbfd9b4c607 Mon Sep 17 00:00:00 2001 From: Michael Cardell Widerkrantz Date: Mon, 23 Aug 2010 23:50:48 +0200 Subject: If US_POSITION flag is set in WM_NORMAL_HINT, we obey the coordinates in the window geometry. --- mcwm.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/mcwm.c b/mcwm.c index ffc4c33..2b8137d 100644 --- a/mcwm.c +++ b/mcwm.c @@ -118,6 +118,7 @@ typedef enum { struct client { xcb_drawable_t id; /* ID of this window. */ + bool usercoord; /* X,Y was set by -geom. */ uint32_t x; /* X coordinate. Only updated when maxed. */ uint32_t y; /* Y coordinate. Ditto. */ uint16_t width; /* Width in pixels. Ditto. */ @@ -767,6 +768,17 @@ void newwin(xcb_window_t win) PDEBUG("Couldn't get geometry\n"); return; } + + /* + * If the client says the user specified the coordinates, we + * override the pointer position and place the window where the + * client specifies instead. + */ + if (client->usercoord) + { + pointx = x; + pointy = y; + } /* * If the window is larger than our screen, just place it in the @@ -858,6 +870,7 @@ struct client *setupwin(xcb_window_t win) /* Initialize client. */ client->id = win; + client->usercoord = false; client->x = 0; client->y = 0; client->width = 0; @@ -886,13 +899,22 @@ struct client *setupwin(xcb_window_t win) { PDEBUG("Couldn't get size hints."); } - + + /* + * The user specified the position coordinates. Remember that so + * we can use geometry later. + */ + if (hints.flags & XCB_SIZE_HINT_US_POSITION) + { + client->usercoord = true; + } + if (hints.flags & XCB_SIZE_HINT_P_MIN_SIZE) { client->min_width = hints.min_width; client->min_height = hints.min_height; } - + if (hints.flags & XCB_SIZE_HINT_P_MAX_SIZE) { -- cgit v1.2.3