activate = TRUE;
}
+ /* remove the client's border */
+ XSetWindowBorderWidth(ob_display, self->window, 0);
+
/* adjust the frame to the client's size before showing or placing
the window */
frame_adjust_area(self->frame, FALSE, TRUE, FALSE);
self->functions = OB_CLIENT_FUNC_MOVE | OB_CLIENT_FUNC_RESIZE;
self->decorations = 0; /* unmanaged windows have no decor */
+ /* give the client its border back */
+ XSetWindowBorderWidth(ob_display, self->window, self->border_width);
+
client_move_resize(self, a.x, a.y, a.width, a.height);
}
{
client_configure(self, self->area.x, self->area.y,
self->area.width, self->area.height,
- self->border_width, FALSE, TRUE);
+ FALSE, TRUE);
}
void client_update_wmhints(ObClient *self)
do this before applying the states so they have the correct
pre-max/pre-fullscreen values
*/
- client_configure(self, x, y, w, h, self->border_width, FALSE, TRUE);
+ client_configure(self, x, y, w, h, FALSE, TRUE);
ob_debug("placed window 0x%x at %d, %d with size %d x %d\n",
self->window, self->area.x, self->area.y,
self->area.width, self->area.height);
}
-void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gint b,
+void client_configure(ObClient *self, gint x, gint y, gint w, gint h,
gboolean user, gboolean final)
{
gint oldw, oldh;
/* figure out if we moved or resized or what */
moved = x != self->area.x || y != self->area.y;
- resized = w != self->area.width || h != self->area.height ||
- b != self->border_width;
+ resized = w != self->area.width || h != self->area.height;
oldw = self->area.width;
oldh = self->area.height;
RECT_SET(self->area, x, y, w, h);
- self->border_width = b;
/* for app-requested resizes, always resize if 'resized' is true.
for user-requested ones, only resize if final is true, or when
/* if the client is enlarging, then resize the client before the frame */
if (send_resize_client && (w > oldw || h > oldh)) {
- XWindowChanges changes;
- changes.x = self->frame->size.left - self->border_width;
- changes.y = self->frame->size.top -self->border_width;
- changes.width = MAX(w, oldw);
- changes.height = MAX(h, oldh);
- changes.border_width = self->border_width;
- XConfigureWindow(ob_display, self->window,
- CWX|CWY|CWWidth|CWHeight|CWBorderWidth,
- &changes);
-
+ XResizeWindow(ob_display, self->window, MAX(w, oldw), MAX(h, oldh));
frame_adjust_client_area(self->frame);
}
/* if the client is shrinking, then resize the frame before the client */
if (send_resize_client && (w <= oldw && h <= oldh)) {
- XWindowChanges changes;
-
frame_adjust_client_area(self->frame);
-
- changes.x = self->frame->size.left - self->border_width;
- changes.y = self->frame->size.top -self->border_width;
- changes.width = w;
- changes.height = h;
- changes.border_width = self->border_width;
- XConfigureWindow(ob_display, self->window,
- CWX|CWY|CWWidth|CWHeight|CWBorderWidth,
- &changes);
+ XResizeWindow(ob_display, self->window, w, h);
}
XFlush(ob_display);
gint w, gint h);
#define client_move(self, x, y) \
- client_configure(self, x, y, self->area.width, self->area.height, \
- self->border_width, TRUE, TRUE)
+ client_configure(self, x, y, self->area.width, self->area.height, TRUE, TRUE)
#define client_resize(self, w, h) \
- client_configure(self, self->area.x, self->area.y, w, h, \
- self->border_width, TRUE, TRUE)
+ client_configure(self, self->area.x, self->area.y, w, h, TRUE, TRUE)
#define client_move_resize(self, x, y, w, h) \
- client_configure(self, x, y, w, h, self->border_width, TRUE, TRUE)
+ client_configure(self, x, y, w, h, TRUE, TRUE)
/*! Figure out where a window will end up and what size it will be if you
told it to move/resize to these coordinates.
@param force_reply Send a ConfigureNotify to the client regardless of if
the position changed.
*/
-void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gint b,
+void client_configure(ObClient *self, gint x, gint y, gint w, gint h,
gboolean user, gboolean final);
void client_reconfigure(ObClient *self);
also you can't compress stacking events
*/
- gint x, y, w, h, b;
+ gint x, y, w, h;
gboolean move = FALSE;
gboolean resize = FALSE;
- gboolean border = FALSE;
/* get the current area */
RECT_TO_DIMS(client->area, x, y, w, h);
- b = client->border_width;
ob_debug("ConfigureRequest for \"%s\" desktop %d wmstate %d "
"visibile %d\n"
" x %d y %d w %d h %d b %d\n",
client->title,
screen_desktop, client->wmstate, client->frame->visible,
- x, y, w, h, b);
+ x, y, w, h, client->border_width);
if (e->xconfigurerequest.value_mask & CWBorderWidth)
if (client->border_width != e->xconfigurerequest.border_width) {
- b = e->xconfigurerequest.border_width;
- border = TRUE;
+ client->border_width = e->xconfigurerequest.border_width;
+
+ /* if the border width is changing then that is the same
+ as requesting a resize, but we don't actually change
+ the client's border, so it will change their root
+ coordiantes (since they include the border width) and
+ we need to a notify then */
+ move = TRUE;
}
notify is sent or not */
}
- if (move || resize || border) {
+ if (move || resize) {
gint lw,lh;
- if (move || resize) {
- client_try_configure(client, &x, &y, &w, &h, &lw, &lh, FALSE);
+ client_try_configure(client, &x, &y, &w, &h, &lw, &lh, FALSE);
- /* if x was not given, then use gravity to figure out the new
- x. the reference point should not be moved */
- if ((e->xconfigurerequest.value_mask & CWWidth &&
- !(e->xconfigurerequest.value_mask & CWX)))
- client_gravity_resize_w(client, &x, client->area.width, w);
- /* if y was not given, then use gravity to figure out the new
- y. the reference point should not be moved */
- if ((e->xconfigurerequest.value_mask & CWHeight &&
- !(e->xconfigurerequest.value_mask & CWY)))
- client_gravity_resize_h(client, &y, client->area.height,h);
+ /* if x was not given, then use gravity to figure out the new
+ x. the reference point should not be moved */
+ if ((e->xconfigurerequest.value_mask & CWWidth &&
+ !(e->xconfigurerequest.value_mask & CWX)))
+ client_gravity_resize_w(client, &x, client->area.width, w);
+ /* if y was not given, then use gravity to figure out the new
+ y. the reference point should not be moved */
+ if ((e->xconfigurerequest.value_mask & CWHeight &&
+ !(e->xconfigurerequest.value_mask & CWY)))
+ client_gravity_resize_h(client, &y, client->area.height,h);
+
+ client_find_onscreen(client, &x, &y, w, h, FALSE);
- client_find_onscreen(client, &x, &y, w, h, FALSE);
- }
/* if they requested something that moves the window, or if
the window is actually being changed then configure it and
send a configure notify to them */
- if (move || !RECT_EQUAL_DIMS(client->area, x, y, w, h) ||
- border)
- {
- ob_debug("Granting ConfigureRequest x %d y %d w %d h %d "
- "b %d\n",
- x, y, w, h, b);
- client_configure(client, x, y, w, h, b, FALSE, TRUE);
+ if (move || !RECT_EQUAL_DIMS(client->area, x, y, w, h)) {
+ ob_debug("Granting ConfigureRequest x %d y %d w %d h %d\n",
+ x, y, w, h);
+ client_configure(client, x, y, w, h, FALSE, TRUE);
}
/* ignore enter events caused by these like ob actions do */
client_find_onscreen(client, &x, &y, w, h, FALSE);
- client_configure(client, x, y, w, h, client->border_width,
- FALSE, TRUE);
+ client_configure(client, x, y, w, h, FALSE, TRUE);
client->gravity = ograv;
/* when the client has StaticGravity, it likes to move around. */
XMoveWindow(ob_display, self->client->window,
- self->size.left - self->client->border_width,
- self->size.top - self->client->border_width);
+ self->size.left, self->size.top);
}
}
client_configure(moveresize_client, x, y,
(cancel ? start_cw : cur_x),
(cancel ? start_ch : cur_y),
- moveresize_client->border_width, TRUE, TRUE);
+ TRUE, TRUE);
}
moveresize_in_progress = FALSE;
client_configure(moveresize_client, cur_x, cur_y,
moveresize_client->area.width,
moveresize_client->area.height,
- moveresize_client->border_width, TRUE, FALSE);
+ TRUE, FALSE);
if (config_resize_popup_show == 2) /* == "Always" */
popup_coords(moveresize_client, "%d x %d",
moveresize_client->frame->area.x,
#endif
get_resize_position(&x, &y, FALSE);
- client_configure(moveresize_client, x, y, cur_x, cur_y,
- moveresize_client->border_width, TRUE, FALSE);
+ client_configure(moveresize_client, x, y, cur_x, cur_y, TRUE, FALSE);
/* this would be better with a fixed width font ... XXX can do it better
if there are 2 text boxes */