Bugfix: Store width_factor/height_factor per workspace, not per container

This is a relatively big change, however all cases should be handled by
now.

Because the function to do graphical resizing got rather large, I’ve created
a new file src/resize.c for it.

This fixes ticket #35.
This commit is contained in:
Michael Stapelberg
2009-05-09 17:48:35 +02:00
parent 18da0a3017
commit 5b4f10eaca
9 changed files with 325 additions and 235 deletions

View File

@ -8,11 +8,11 @@
* See file LICENSE for license information.
*
*/
#include <xcb/xcb.h>
#ifndef _COMMANDS_H
#define _COMMANDS_H
#include <xcb/xcb.h>
bool focus_window_in_container(xcb_connection_t *conn, Container *container, direction_t direction);
/** Switches to the given workspace */

View File

@ -174,6 +174,12 @@ struct Workspace {
/* This is a two-dimensional dynamic array of Container-pointers. Ive always wanted
* to be a three-star programmer :) */
Container ***table;
/* width_factor and height_factor contain the amount of space (percentage) a column/row
has of all the space which is available for resized windows. This ensures that
non-resized windows (newly opened, for example) have the same size as always */
float *width_factor;
float *height_factor;
};
/*
@ -312,11 +318,6 @@ struct Container {
/* Width/Height of the container. Changeable by the user */
int width;
int height;
/* width_factor and height_factor contain the amount of space (percentage) a window
has of all the space which is available for resized windows. This ensures that
non-resized windows (newly opened, for example) have the same size as always */
float width_factor;
float height_factor;
/* When in stacking mode, we draw the titlebars of each client onto a separate window */
struct Stack_Window stack_win;

View File

@ -15,11 +15,11 @@
/**
* Gets the unoccupied space (= space which is available for windows which were resized by the user)
* for the given row. This is necessary to render both, customly resized windows and never touched
* This is necessary to render both, customly resized windows and never touched
* windows correctly, meaning that the aspect ratio will be maintained when opening new windows.
*
*/
int get_unoccupied_x(Workspace *workspace, int row);
int get_unoccupied_x(Workspace *workspace);
/**
* (Re-)draws window decorations for a given Client onto the given drawable/graphic context.

27
include/resize.h Normal file
View File

@ -0,0 +1,27 @@
/*
* vim:ts=8:expandtab
*
* i3 - an improved dynamic tiling window manager
*
* (c) 2009 Michael Stapelberg and contributors
*
* See file LICENSE for license information.
*
*/
#ifndef _RESIZE_H
#define _RESIZE_H
#include <xcb/xcb.h>
typedef enum { O_HORIZONTAL, O_VERTICAL } resize_orientation_t;
/**
* Renders the resize window between the first/second container and resizes
* the table column/row.
*
*/
int resize_graphical_handler(xcb_connection_t *conn, Container *first, Container *second,
resize_orientation_t orientation, xcb_button_press_event_t *event);
#endif