summaryrefslogtreecommitdiff
path: root/src/manage.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-04-06 07:43:17 +0000
committersabetts <sabetts>2001-04-06 07:43:17 +0000
commit4ef01dc374bd76295e7a46140591e516187e33df (patch)
tree0534514c60d47f7ed7640091840516bef51273a0 /src/manage.c
parentb5272706dbd9346033add6edee2aaa519f11b182 (diff)
downloadratpoison-4ef01dc374bd76295e7a46140591e516187e33df.zip
* src/split.h (h_split_frame): renamed frome h_split_window
(v_split_frame): renamed frome v_split_window (split_frame): renamed frome split_window (remove_all_splits): renamed frome remove_all_frames (find_windows_frame): new prototype (find_frame_next): likewise (find_frame_prev): likewise (current_window): likewise (init_frame_list): likewise (set_active_frame): likewise * src/split.c (create_initial_frame): new function (init_frame_list): likewise (find_windows_frame): likewise (find_frame_next): likewise (find_frame_prev): likewise (current_window): likewise (update_frame_indicator): likewise (set_active_frame): likewise (split_frame): rename from split_window (v_split_frame): rename from v_split_window (h_split_frame): rename from h_split_window (remove_all_splits): renamed frome remove_all_frames (total_frame_area): traverses rp_window_frame list (num_frames): likewise (frame_overlaps): likewise (remove_frame): likewise (remove_frame): calls delete_frame_from_list * src/manage.c (scanwins): skips the frame_window (maximize_transient): finds the window's frame (maximize_normal): likewise * src/main.c (main): calls init_frame_list (init_screen): create and map the frame_window * src/list.c (give_window_focus): new function (goto_window): likewise (set_active_window): calls give_window_focus * src/list.h (give_window_focus): new prototype (goto_window): likewise * src/events.c (new_window): the screen's frame_window is not managed (cleanup_frame): new function (unmap_notify): calls cleanup_frame if window exists in a frame (destroy_window): likewise * src/data.h (struct screen_info): remove frame field (struct rp_window_frame): new fields win, prev, next (rp_window_frame_sentinel): new global * src/actions.c (cmd_prev): jumps to last accessed window if current frame is empty. (cmd_next): likewise (cmd_remove): nothing is done if only 1 frame exists * src/data.h (struct screen_info): new field frame_window (rp_current_frame): new global (rp_current_window): removed. All dependant code updated.
Diffstat (limited to 'src/manage.c')
-rw-r--r--src/manage.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/manage.c b/src/manage.c
index afa4730..1e52fe3 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -65,8 +65,8 @@ ungrab_prefix_key (Window w)
screen_info*
current_screen ()
{
- if (rp_current_window)
- return rp_current_window->scr;
+ if (current_window())
+ return current_window()->scr;
else
return &screens[0];
}
@@ -230,7 +230,10 @@ scanwins(screen_info *s)
for (i = 0; i < nwins; i++)
{
XGetWindowAttributes(dpy, wins[i], &attr);
- if (wins[i] == s->bar_window || wins[i] == s->key_window || wins[i] == s->input_window) continue;
+ if (wins[i] == s->bar_window
+ || wins[i] == s->key_window
+ || wins[i] == s->input_window
+ || wins[i] == s->frame_window) continue;
if (attr.override_redirect != True && !unmanaged_window (wins[i]))
{
@@ -290,11 +293,14 @@ set_state (rp_window *win, int state)
static void
maximize_transient (rp_window *win)
{
+ rp_window_frame *frame;
int maxx, maxy;
/* Set the window's border */
win->border = WINDOW_BORDER_WIDTH;
+ frame = find_windows_frame (win);
+
/* Honour the window's maximum size */
if (win->hints->flags & PMaxSize)
{
@@ -330,12 +336,12 @@ maximize_transient (rp_window *win)
PRINT_DEBUG ("maxsize: %d %d\n", maxx, maxy);
/* Fit the window inside its frame (if it has one) */
- if (win->frame)
+ if (frame)
{
- win->x = win->frame->x - win->width / 2
- + (win->frame->width - win->border * 2) / 2;
- win->y = win->frame->y - win->height / 2
- + (win->frame->height - win->border * 2) / 2;
+ win->x = frame->x - win->width / 2
+ + (frame->width - win->border * 2) / 2;
+ win->y = frame->y - win->height / 2
+ + (frame->height - win->border * 2) / 2;
}
else
{
@@ -354,6 +360,7 @@ maximize_transient (rp_window *win)
static void
maximize_normal (rp_window *win)
{
+ rp_window_frame *frame;
int maxx, maxy;
int off_x = 0;
@@ -362,6 +369,8 @@ maximize_normal (rp_window *win)
/* Set the window's border */
win->border = WINDOW_BORDER_WIDTH;
+ frame = find_windows_frame (win);
+
/* Honour the window's maximum size */
if (win->hints->flags & PMaxSize)
{
@@ -377,15 +386,13 @@ maximize_normal (rp_window *win)
}
/* Fit the window inside its frame (if it has one) */
- if (win->frame)
+ if (frame)
{
PRINT_DEBUG ("frame width=%d height=%d\n",
- win->frame->width, win->frame->height);
+ frame->width, frame->height);
- if (maxx > win->frame->width) maxx = win->frame->width
- - win->border * 2;
- if (maxy > win->frame->height) maxy = win->frame->height
- - win->border * 2;
+ if (maxx > frame->width) maxx = frame->width - win->border * 2;
+ if (maxy > frame->height) maxy = frame->height - win->border * 2;
}
/* Make sure we maximize to the nearest Resize Increment specified
@@ -411,10 +418,10 @@ maximize_normal (rp_window *win)
PRINT_DEBUG ("maxsize: %d %d\n", maxx, maxy);
/* Fit the window inside its frame (if it has one) */
- if (win->frame)
+ if (frame)
{
- win->x = win->frame->x;
- win->y = win->frame->y;
+ win->x = frame->x;
+ win->y = frame->y;
}
else
{
@@ -431,7 +438,7 @@ maximize_normal (rp_window *win)
void
maximize (rp_window *win)
{
- if (!win) win = rp_current_window;
+ if (!win) win = current_window();
if (!win) return;
/* Handle maximizing transient windows differently */
@@ -455,7 +462,7 @@ maximize (rp_window *win)
void
force_maximize (rp_window *win)
{
- if (!win) win = rp_current_window;
+ if (!win) win = current_window();
if (!win) return;
maximize_normal(win);