/* minimum increment size specified for the window (in pixels) */
int width_increment;
int height_increment;
+
+ /* aspect ratio from WM_NORMAL_HINTS (MPlayer uses this for example) */
+ double aspect_ratio;
};
/**
double percent;
- /* aspect ratio from WM_NORMAL_HINTS (MPlayer uses this for example) */
- double aspect_ratio;
-
/* the x11 border pixel attribute */
int border_width;
int current_border_width;
const i3Window *window = focused_con->window;
if (window != NULL) {
if (strcmp(direction, "up") == 0 || strcmp(direction, "down") == 0 ||
- strcmp(direction, "height") == 0) {
+ strcmp(direction, "height") == 0) {
if (px < 0)
px = (-px < window->height_increment) ? -window->height_increment : px;
else
Con *new = scalloc(1, sizeof(Con));
new->on_remove_child = con_on_remove_child;
TAILQ_INSERT_TAIL(&all_cons, new, all_cons);
- new->aspect_ratio = 0.0;
new->type = CT_CON;
new->window = window;
new->border_style = config.default_border;
new->current_border_width = -1;
- if (window)
+ if (window) {
new->depth = window->depth;
- else
+ new->window->aspect_ratio = 0.0;
+ } else {
new->depth = XCB_COPY_FROM_PARENT;
+ }
DLOG("opening window\n");
TAILQ_INIT(&(new->floating_head));
} else
goto render_and_return;
- if (fabs(con->aspect_ratio - aspect_ratio) > DBL_EPSILON) {
- con->aspect_ratio = aspect_ratio;
+ if (fabs(con->window->aspect_ratio - aspect_ratio) > DBL_EPSILON) {
+ con->window->aspect_ratio = aspect_ratio;
changed = true;
}
* Ignoring aspect ratio during fullscreen was necessary to fix MPlayer
* subtitle rendering, see http://bugs.i3wm.org/594 */
if (!render_fullscreen &&
- con->aspect_ratio > 0.0) {
+ con->window->aspect_ratio > 0.0) {
DLOG("aspect_ratio = %f, current width/height are %d/%d\n",
- con->aspect_ratio, inset->width, inset->height);
+ con->window->aspect_ratio, inset->width, inset->height);
double new_height = inset->height + 1;
int new_width = inset->width;
while (new_height > inset->height) {
- new_height = (1.0 / con->aspect_ratio) * new_width;
+ new_height = (1.0 / con->window->aspect_ratio) * new_width;
if (new_height > inset->height)
new_width--;