summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-12-03 19:47:07 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-12-03 19:47:07 +0000
commit74115a7a0d6a04f3d2e8164c5b8fe212f34e5d4c (patch)
tree7aa6ceb33374b310eca7792f33724f0e75de3f4d
parentd18f49f0047221b431fc5ba3a89d1fd60e4198e5 (diff)
downloadnetsurf-74115a7a0d6a04f3d2e8164c5b8fe212f34e5d4c.tar.gz
netsurf-74115a7a0d6a04f3d2e8164c5b8fe212f34e5d4c.tar.bz2
Correctly support NORESIZE flag for frames (partially fix 1593228)
svn path=/trunk/netsurf/; revision=3100
-rw-r--r--desktop/frames.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/desktop/frames.c b/desktop/frames.c
index abb34dd99..1991a702c 100644
--- a/desktop/frames.c
+++ b/desktop/frames.c
@@ -563,13 +563,15 @@ bool browser_window_resolve_frame_dimension(struct browser_window *bw, struct br
bool browser_window_resize_frames(struct browser_window *bw, browser_mouse_state mouse, int x, int y,
gui_pointer_shape *pointer, const char **status, bool *action) {
+ struct browser_window *parent;
bool left, right, up, down;
int i, resize_margin;
if ((x < bw->x0) || (x > bw->x1) || (y < bw->y0) || (y > bw->y1))
return false;
- if ((!bw->no_resize) && (bw->parent)) {
+ parent = bw->parent;
+ if ((!bw->no_resize) && parent) {
resize_margin = FRAME_RESIZE;
if (resize_margin * 2 > (bw->x1 - bw->x0))
resize_margin = (bw->x1 - bw->x0) / 2;
@@ -591,21 +593,38 @@ bool browser_window_resize_frames(struct browser_window *bw, browser_mouse_state
break;
case BROWSER_WINDOW_FRAME:
case BROWSER_WINDOW_FRAMESET:
- assert(bw->parent);
break;
}
- for (i = 0; i < (bw->parent->cols * bw->parent->rows); i++) {
- if (&bw->parent->children[i] == bw) {
- col = i % bw->parent->cols;
- row = i / bw->parent->cols;
+ for (i = 0; i < (parent->cols * parent->rows); i++) {
+ if (&parent->children[i] == bw) {
+ col = i % parent->cols;
+ row = i / parent->cols;
+ break;
}
}
assert((row >= 0) && (col >= 0));
+ /* check the sibling frame is within bounds */
left &= (col > 0);
- right &= (col < bw->parent->cols - 1) & (!left);
+ right &= (col < parent->cols - 1);
up &= (row > 0);
- down &= (row < bw->parent->rows - 1) & (!up);
+ down &= (row < parent->rows - 1);
+
+ /* check the sibling frames can be resized */
+ if (left)
+ left &= !parent->children[row * parent->cols + (col - 1)].no_resize;
+ if (right)
+ right &= !parent->children[row * parent->cols + (col + 1)].no_resize;
+ if (up)
+ up &= !parent->children[(row - 1) * parent->cols + col].no_resize;
+ if (down)
+ down &= !parent->children[(row + 1) * parent->cols + col].no_resize;
+
+ /* can't have opposite directions simultaneously */
+ if (up)
+ down = false;
+ if (left)
+ right = false;
}
if (left || right || up || down) {