summaryrefslogtreecommitdiff
path: root/src/manage.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-04-13 08:22:11 +0000
committersabetts <sabetts>2001-04-13 08:22:11 +0000
commitbb36a84d39dc9d189e67874fff38c38a9812387a (patch)
treed6b7d767c86eb8ead997731e526215cbc37f0faa /src/manage.c
parent10dddc8331d453533b604c950ef1474b026d5abd (diff)
downloadratpoison-bb36a84d39dc9d189e67874fff38c38a9812387a.zip
* src/split.h (blank_frame): new prototype
* src/split.c (split_frame): calls unhide_window after maximizing the new frame's window. (remove_all_splits): hide all windows but the current one (remove_all_splits): maximize the current window in its newly resized frame. (remove_frame): hide the frame's window after removing it from the list. (blank_frame): new function * src/manage.h (withdraw_window): new prototype (hide_window): likewise (unhide_window): likewise * src/manage.c (scanwins): glob ignored windows into 1 if statement. (scanwins): set the window's state to NormalState before calling map_window. (set_state): sets win->state (map_window): calls set_state (hide_window): new function (unhide_window): likewise (withdraw_window): new function * src/main.c (main): setup error handlers after --command, --restart, and --kill commands have been processed. (main): doesn't call set_active_window (init_screen): XSync's after selecting ewents on the root window. (clean_up): map iconized windows * src/list.h (give_window_focus): prototype updated * src/list.c (give_window_focus): takes a second argument, last_win. (give_window_focus): calls unhide_window (give_window_focus): uses last_win instead of current_window() (set_active_window): hides the last window and unhides the new window. (set_active_window): calls give_window_focus * src/events.c (cleanup_frame): maximizes the frame's new window (unmap_notify): do nothing if the window is in the iconic state. Withdraw the window if it is in the normal state. (map_request): calls unhide_window if the window is iconized. Do nothing if it is already mapped. (destroy_window): tightened up (client_msg): detects iconize requests from clients. * src/data.h (STATE_UNMAPPED): remove. Dependant code uses WithdawnState in its stead. (STATE_MAPPED): likewise. Dependant code uses NormalState in its stead * src/actions.c (initialize_default_keybindings): new keybinding - bound to "select -" (cmd_select): the string "-" selects a blank window
Diffstat (limited to 'src/manage.c')
-rw-r--r--src/manage.c85
1 files changed, 62 insertions, 23 deletions
diff --git a/src/manage.c b/src/manage.c
index 1e52fe3..e5bfa4d 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -233,21 +233,21 @@ scanwins(screen_info *s)
if (wins[i] == s->bar_window
|| wins[i] == s->key_window
|| wins[i] == s->input_window
- || wins[i] == s->frame_window) continue;
+ || wins[i] == s->frame_window
+ || attr.override_redirect == True
+ || unmanaged_window (wins[i])) continue;
- if (attr.override_redirect != True && !unmanaged_window (wins[i]))
+ win = add_to_window_list (s, wins[i]);
+
+ PRINT_DEBUG ("map_state: %d\n", attr.map_state);
+ if (attr.map_state == IsViewable)
{
- win = add_to_window_list (s, wins[i]);
-
- PRINT_DEBUG ("map_state: %d\n", attr.map_state);
- if (attr.map_state == IsViewable)
- {
- map_window (win);
- }
-
+ win->state = NormalState;
+ map_window (win);
}
}
- XFree((void *) wins); /* cast is to shut stoopid compiler up */
+
+ XFree(wins);
}
int
@@ -271,17 +271,15 @@ unmanaged_window (Window w)
return 0;
}
-/* Set the state of the window.
-
- FIXME: This is sort of broken. We should really record the state in
- win->state and mimic the X states NormalState, WithdrawnState,
- IconicState */
+/* Set the state of the window. */
void
set_state (rp_window *win, int state)
{
long data[2];
- data[0] = (long)state;
+ win->state = state;
+
+ data[0] = (long)win->state;
data[1] = (long)None;
XChangeProperty (dpy, win->w, wm_state, wm_state, 32,
@@ -480,19 +478,60 @@ map_window (rp_window *win)
{
PRINT_DEBUG ("Mapping the unmapped window %s\n", win->name);
+ /* Fill in the necessary data about the window */
update_window_information (win);
+ win->number = get_unique_window_number ();
grab_prefix_key (win->w);
- maximize (win);
+ /* Put win in the mapped window list */
+ remove_from_list (win);
+ insert_into_list (win, rp_mapped_window_sentinel);
+
+ /* It is now considered iconic and set_active_window can handle the rest. */
+ set_state (win, IconicState);
+
+ /* FIXME: We may not want a window to pop up out of nowhere */
+ set_active_window (win);
+}
+
+void
+hide_window (rp_window *win)
+{
+ if (win == NULL) return;
+
+ set_state (win, IconicState);
+ XUnmapWindow (dpy, win->w);
+}
+
+void
+unhide_window (rp_window *win)
+{
+ if (win == NULL) return;
+ if (win->state != IconicState) return;
XMapWindow (dpy, win->w);
set_state (win, NormalState);
- set_active_window (win);
+}
- win->state = STATE_MAPPED;
- win->number = get_unique_window_number ();
+void
+withdraw_window (rp_window *win)
+{
+ if (win == NULL) return;
+
+ PRINT_DEBUG ("withdawn_window on '%s'\n", win->name);
+
+ /* Give back the window number. the window will get another one,
+ if it is remapped. */
+ return_window_number (win->number);
+ win->number = -1;
- /* Put win in the mapped window list */
remove_from_list (win);
- insert_into_list (win, rp_mapped_window_sentinel);
+ append_to_list (win, rp_unmapped_window_sentinel);
+
+ XRemoveFromSaveSet (dpy, win->w);
+ set_state (win, WithdrawnState);
+
+ ignore_badwindow++;
+ XSync (dpy, False);
+ ignore_badwindow--;
}