soc.2008.finch: c214b559: Fixed resizing of child frames in direct...
queueram at soc.pidgin.im
queueram at soc.pidgin.im
Wed Aug 20 02:50:36 EDT 2008
-----------------------------------------------------------------
Revision: c214b55916e7c82c562057e053902a0869faf43c
Ancestor: a5d0e8adf55a91083e49fb5c2438385ccea8b95d
Author: queueram at soc.pidgin.im
Date: 2008-08-20T06:45:06
Branch: im.pidgin.soc.2008.finch
URL: http://d.pidgin.im/viewmtn/revision/info/c214b55916e7c82c562057e053902a0869faf43c
Modified files:
finch/libgnt/wms/tiling.c
ChangeLog:
Fixed resizing of child frames in direction perpendicular to parent split type.
-------------- next part --------------
============================================================
--- finch/libgnt/wms/tiling.c 443b22fe39e84d40b3108378c9ccd75b16f0304f
+++ finch/libgnt/wms/tiling.c a1d5dc6788debc46042e0f418cf7cf217964a5eb
@@ -527,6 +527,19 @@ static TilingFrame *
}
static TilingFrame *
+find_child_of_type(TilingFrame *frame, int type)
+{
+ while (frame && frame->parent) {
+ if (frame->parent->type == type) {
+ return frame;
+ }
+ frame = frame->parent;
+ }
+
+ return NULL;
+}
+
+static TilingFrame *
find_rightmost_child(TilingFrame *frame)
{
TilingFrame *child = frame;
@@ -671,58 +684,72 @@ twm_resize(GntBindable *bindable, GList
{
GntWM *wm = GNT_WM(bindable);
TilingWM *twm = (TilingWM*)wm;
+ TilingFrame *frame;
int direction = GPOINTER_TO_INT(list->data);
if (wm->mode == GNT_KP_MODE_RESIZE) {
- /* can't resize root */
- if (twm->current->sibling) {
+ switch (direction) {
+ case RESIZE_LEFT:
+ case RESIZE_RIGHT:
+ frame = find_child_of_type(twm->current, FRAME_SPLIT_H);
+ break;
+ case RESIZE_UP:
+ case RESIZE_DOWN:
+ frame = find_child_of_type(twm->current, FRAME_SPLIT_V);
+ break;
+ }
+
+ if (frame) {
int xmin = 0, ymin = 0, xmax = getmaxx(stdscr), ymax = getmaxy(stdscr) - 1;
switch (direction) {
case RESIZE_LEFT:
- if (twm->current->width > xmin) {
- if (twm->current->x < twm->current->sibling->x) {
- twm_propagate_x_width_change(wm, twm->current, 0, -1);
- twm_propagate_x_width_change(wm, twm->current->sibling, -1, 1);
+ if (frame->width > xmin) {
+ if (frame->x < frame->sibling->x) {
+ twm_propagate_x_width_change(wm, frame, 0, -1);
+ twm_propagate_x_width_change(wm, frame->sibling, -1, 1);
} else {
- twm_propagate_x_width_change(wm, twm->current, 1, -1);
- twm_propagate_x_width_change(wm, twm->current->sibling, 0, 1);
+ twm_propagate_x_width_change(wm, frame, 1, -1);
+ twm_propagate_x_width_change(wm, frame->sibling, 0, 1);
}
}
break;
case RESIZE_RIGHT:
- if (twm->current->width < xmax) {
- if (twm->current->x < twm->current->sibling->x) {
- twm_propagate_x_width_change(wm, twm->current, 0, 1);
- twm_propagate_x_width_change(wm, twm->current->sibling, 1, -1);
+ if (frame->width < xmax) {
+ if (frame->x < frame->sibling->x) {
+ twm_propagate_x_width_change(wm, frame, 0, 1);
+ twm_propagate_x_width_change(wm, frame->sibling, 1, -1);
} else {
- twm_propagate_x_width_change(wm, twm->current, -1, 1);
- twm_propagate_x_width_change(wm, twm->current->sibling, 0, -1);
+ twm_propagate_x_width_change(wm, frame, -1, 1);
+ twm_propagate_x_width_change(wm, frame->sibling, 0, -1);
}
}
break;
case RESIZE_UP:
- if (twm->current->height > ymin) {
- if (twm->current->y < twm->current->sibling->y) {
- twm_propagate_y_height_change(wm, twm->current, 0, -1);
- twm_propagate_y_height_change(wm, twm->current->sibling, -1, 1);
+ if (frame->height > ymin) {
+ if (frame->y < frame->sibling->y) {
+ twm_propagate_y_height_change(wm, frame, 0, -1);
+ twm_propagate_y_height_change(wm, frame->sibling, -1, 1);
} else {
- twm_propagate_y_height_change(wm, twm->current, 1, -1);
- twm_propagate_y_height_change(wm, twm->current->sibling, 0, 1);
+ twm_propagate_y_height_change(wm, frame, 1, -1);
+ twm_propagate_y_height_change(wm, frame->sibling, 0, 1);
}
}
break;
case RESIZE_DOWN:
- if (twm->current->height < ymax) {
- if (twm->current->y < twm->current->sibling->y) {
- twm_propagate_y_height_change(wm, twm->current, 0, 1);
- twm_propagate_y_height_change(wm, twm->current->sibling, 1, -1);
+ if (frame->height < ymax) {
+ if (frame->y < frame->sibling->y) {
+ twm_propagate_y_height_change(wm, frame, 0, 1);
+ twm_propagate_y_height_change(wm, frame->sibling, 1, -1);
} else {
- twm_propagate_y_height_change(wm, twm->current, -1, 1);
- twm_propagate_y_height_change(wm, twm->current->sibling, 0, -1);
+ twm_propagate_y_height_change(wm, frame, -1, 1);
+ twm_propagate_y_height_change(wm, frame->sibling, 0, -1);
}
}
break;
}
+ if (twm->current->window) {
+ window_reverse(twm->current->window, TRUE, wm);
+ }
}
return TRUE;
}
More information about the Commits
mailing list