From eac6dda17283fe9f312d0c8576f4370f82fc5c0a Mon Sep 17 00:00:00 2001 From: sabetts Date: Mon, 31 Mar 2003 07:06:22 +0000 Subject: * src/split.c (current_window): call screen_get_frame. (split_frame): call screen_get_frame to get appropriate structure. (split_frame): call find_window_number to get appropriate structure. (remove_all_splits): call screen_get_frame to get appropriate structure. (resize_frame): make sure all frames that will be resized are big enough for the resize. (resize_frame): return int (resize_shrink_to_window): call find_window_number to get the appropriate structure. (resize_frame_right): return int (resize_frame_left): likewise (resize_frame_top): likewise (resize_frame_bottom): likewise (resize_frame_horizontally): backup the frameset and restore it if the resize fails. Do not allow a frame to be resized too small or too big. (resize_frame_vertically): likewise (remove_frame): call find_window_number to get the appropriate structure. (set_active_frame): likewise (blank_frame): likewise (show_frame_message): call screen_get_frame to get the appropriate structure. * src/screen.c (screen_width): new function (and prototype) (screen_height): likewise (screen_left): likewise (screen_right): likewise (screen_top): likewise (screen_bottom): likewise (screen_copy_frameset): likewise (screen_restore_frameset): likewise (frameset_free): likewise (screen_get_frame): likewise * src/split.c (maximize_frame): call screen_width and screen_height to get the size for the frame. * src/ratpoison.h: include screen.h * src/manage.c (move_window): * src/frame.h (frame_copy): new prototype (frame_dump): likewise * src/frame.c (frame_copy): new function (frame_dump): likewise * src/events.c (unmap_notify): compare frame numbers, not pointers. (client_msg): call screen_get_frame when blanking the frame. * src/data.h (EMPTY): new define (struct rp_window_frame): replace the win field with win_number. Dependant code updated. (struct rp_window): replace frame with frame_number. Dependant code updated. (struct screen_info): replace rp_current_frame with current_frame and change type to int. Dependant code updated. * src/Makefile.am (ratpoison_SOURCES): added screen.h and screen.c --- src/manage.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/manage.c') diff --git a/src/manage.c b/src/manage.c index 7a19934..93fe869 100644 --- a/src/manage.c +++ b/src/manage.c @@ -397,26 +397,30 @@ get_state (rp_window *win) static void move_window (rp_window *win) { - if (win->frame == NULL) + rp_window_frame *frame; + + if (win->frame_number == EMPTY) return; + frame = win_get_frame (win); + /* X coord. */ switch (win->gravity) { case NorthWestGravity: case WestGravity: case SouthWestGravity: - win->x = win->frame->x; + win->x = frame->x; break; case NorthGravity: case CenterGravity: case SouthGravity: - win->x = win->frame->x + (win->frame->width - win->border * 2) / 2 - win->width / 2; + win->x = frame->x + (frame->width - win->border * 2) / 2 - win->width / 2; break; case NorthEastGravity: case EastGravity: case SouthEastGravity: - win->x = win->frame->x + win->frame->width - win->width - win->border; + win->x = frame->x + frame->width - win->width - win->border; break; } @@ -426,17 +430,17 @@ move_window (rp_window *win) case NorthEastGravity: case NorthGravity: case NorthWestGravity: - win->y = win->frame->y; + win->y = frame->y; break; case EastGravity: case CenterGravity: case WestGravity: - win->y = win->frame->y + (win->frame->height - win->border * 2) / 2 - win->height / 2; + win->y = frame->y + (frame->height - win->border * 2) / 2 - win->height / 2; break; case SouthEastGravity: case SouthGravity: case SouthWestGravity: - win->y = win->frame->y + win->frame->height - win->height - win->border; + win->y = frame->y + frame->height - win->height - win->border; break; } } @@ -449,15 +453,15 @@ maximize_transient (rp_window *win) rp_window_frame *frame; int maxx, maxy; + frame = win_get_frame (win); + /* We can't maximize a window if it has no frame. */ - if (win->frame == NULL) + if (frame == NULL) return; /* Set the window's border */ win->border = defaults.window_border_width; - frame = win->frame; - /* Always use the window's current width and height for transients. */ maxx = win->width; @@ -507,15 +511,15 @@ maximize_normal (rp_window *win) rp_window_frame *frame; int maxx, maxy; + frame = win_get_frame (win); + /* We can't maximize a window if it has no frame. */ - if (win->frame == NULL) + if (frame == NULL) return; /* Set the window's border */ win->border = defaults.window_border_width; - frame = win->frame; - /* Honour the window's maximum size */ if (win->hints->flags & PMaxSize) { @@ -670,7 +674,7 @@ hide_window (rp_window *win) if (win == NULL) return; /* An unmapped window is not inside a frame. */ - win->frame = NULL; + win->frame_number = EMPTY; /* Ignore the unmap_notify event. */ XSelectInput(dpy, win->w, WIN_EVENTS&~(StructureNotifyMask)); @@ -748,7 +752,7 @@ hide_others (rp_window *win) { if (find_windows_frame (cur) || cur->state != NormalState - || cur->frame != frame) + || cur->frame_number != frame->number) continue; hide_window (cur); -- cgit v1.2.3