- }
-
- if (changed) {
- if (client->fullscreen)
- DLOG("Not resizing client, it is in fullscreen mode\n");
- else {
- resize_client(conn, client);
- xcb_flush(conn);
- }
- }
-
- /* If no aspect ratio was set or if it was invalid, we ignore the hints */
- if (!(size_hints.flags & XCB_SIZE_HINT_P_ASPECT) ||
- (size_hints.min_aspect_num <= 0) ||
- (size_hints.min_aspect_den <= 0)) {
- return 1;
- }
-
- double width = client->rect.width - base_width;
- double height = client->rect.height - base_height;
- /* Convert numerator/denominator to a double */
- double min_aspect = (double)size_hints.min_aspect_num / size_hints.min_aspect_den;
- double max_aspect = (double)size_hints.max_aspect_num / size_hints.min_aspect_den;
-
- DLOG("Aspect ratio set: minimum %f, maximum %f\n", min_aspect, max_aspect);
- DLOG("width = %f, height = %f\n", width, height);
-
- /* Sanity checks, this is user-input, in a way */
- if (max_aspect <= 0 || min_aspect <= 0 || height == 0 || (width / height) <= 0)
- return 1;
-
- /* Check if we need to set proportional_* variables using the correct ratio */
- if ((width / height) < min_aspect) {
- client->proportional_width = width;
- client->proportional_height = width / min_aspect;
- } else if ((width / height) > max_aspect) {
- client->proportional_width = width;
- client->proportional_height = width / max_aspect;
- } else return 1;
-
- client->force_reconfigure = true;
-
- if (client->container != NULL) {
- render_container(conn, client->container);
- xcb_flush(conn);
- }
-
- return 1;
+ }
+ if (size_hints.height_inc > 0 && size_hints.height_inc < 0xFFFF)
+ if (con->height_increment != size_hints.height_inc) {
+ con->height_increment = size_hints.height_inc;
+ changed = true;
+ }
+
+ if (changed)
+ DLOG("resize increments changed\n");
+ }
+
+ int base_width = 0, base_height = 0;
+
+ /* base_width/height are the desired size of the window.
+ We check if either the program-specified size or the program-specified
+ min-size is available */
+ if (size_hints.flags & XCB_SIZE_HINT_BASE_SIZE) {
+ base_width = size_hints.base_width;
+ base_height = size_hints.base_height;
+ } else if (size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE) {
+ /* TODO: is this right? icccm says not */
+ base_width = size_hints.min_width;
+ base_height = size_hints.min_height;
+ }
+
+ if (base_width != con->base_width ||
+ base_height != con->base_height) {
+ con->base_width = base_width;
+ con->base_height = base_height;
+ DLOG("client's base_height changed to %d\n", base_height);
+ DLOG("client's base_width changed to %d\n", base_width);
+ }
+
+ /* If no aspect ratio was set or if it was invalid, we ignore the hints */
+ if (!(size_hints.flags & XCB_SIZE_HINT_P_ASPECT) ||
+ (size_hints.min_aspect_num <= 0) ||
+ (size_hints.min_aspect_den <= 0)) {
+ goto render_and_return;
+ }
+
+ /* XXX: do we really use rect here, not window_rect? */
+ double width = con->rect.width - base_width;
+ double height = con->rect.height - base_height;
+ /* Convert numerator/denominator to a double */
+ double min_aspect = (double)size_hints.min_aspect_num / size_hints.min_aspect_den;
+ double max_aspect = (double)size_hints.max_aspect_num / size_hints.min_aspect_den;
+
+ DLOG("Aspect ratio set: minimum %f, maximum %f\n", min_aspect, max_aspect);
+ DLOG("width = %f, height = %f\n", width, height);
+
+ /* Sanity checks, this is user-input, in a way */
+ if (max_aspect <= 0 || min_aspect <= 0 || height == 0 || (width / height) <= 0)
+ goto render_and_return;
+
+ /* Check if we need to set proportional_* variables using the correct ratio */
+ if ((width / height) < min_aspect) {
+ con->proportional_width = width;
+ con->proportional_height = width / min_aspect;
+ } else if ((width / height) > max_aspect) {
+ con->proportional_width = width;
+ con->proportional_height = width / max_aspect;
+ } else goto render_and_return;
+
+render_and_return:
+ tree_render();
+ return 1;