summaryrefslogtreecommitdiff
path: root/src/events.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/events.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/events.c')
-rw-r--r--src/events.c97
1 files changed, 51 insertions, 46 deletions
diff --git a/src/events.c b/src/events.c
index 6476f55..8d48fdb 100644
--- a/src/events.c
+++ b/src/events.c
@@ -59,6 +59,11 @@ static void
cleanup_frame (rp_window_frame *frame)
{
frame->win = find_window_other ();
+ if (frame->win)
+ {
+ maximize (frame->win);
+ unhide_window (frame->win);
+ }
}
void
@@ -75,37 +80,27 @@ unmap_notify (XEvent *ev)
if (s && win)
{
rp_window_frame *frame;
- long data[2] = { WithdrawnState, None };
-
- /* Give back the window number. the window will get another one,
- if it in remapped. */
- return_window_number (win->number);
- win->number = -1;
- win->state = STATE_UNMAPPED;
-
- ignore_badwindow++;
+ /* If the window was inside a frame, fill the frame with another
+ window. */
frame = find_windows_frame (win);
if (frame) cleanup_frame (frame);
- remove_from_list (win);
- append_to_list (win, rp_unmapped_window_sentinel);
-
- /* Update the state of the actual window */
-
- XRemoveFromSaveSet (dpy, win->w);
- XChangeProperty(dpy, win->w, wm_state, wm_state, 32,
- PropModeReplace, (unsigned char *)data, 2);
-
- XSync(dpy, False);
-
- if (frame == rp_current_frame)
+ switch (win->state)
{
- set_active_frame (frame);
+ case IconicState:
+ /* This shouldn't actually happen, since the window is
+ already unmapped, so do nothing */
+ PRINT_DEBUG ("Iconizing iconized window '%s'\n", win->name);
+ break;
+ case NormalState:
+ PRINT_DEBUG ("Withdrawing window '%s'\n", win->name);
+ withdraw_window (win);
+/* hide_window (win); */
+ if (frame == rp_current_frame) set_active_frame (frame);
+ break;
}
- ignore_badwindow--;
-
update_window_names (s);
}
}
@@ -125,7 +120,7 @@ map_request (XEvent *ev)
switch (win->state)
{
- case STATE_UNMAPPED:
+ case WithdrawnState:
PRINT_DEBUG ("Unmapped window\n");
if (unmanaged_window (win->w))
{
@@ -136,17 +131,21 @@ map_request (XEvent *ev)
else
{
PRINT_DEBUG ("managed Window\n");
-
map_window (win);
break;
}
- case STATE_MAPPED:
+ case NormalState:
PRINT_DEBUG ("Mapped Window\n");
+ /* Its already mapped, so we don't have to do anything */
- maximize (win);
- XMapRaised (dpy, win->w);
- set_state (win, NormalState);
- set_active_window (win);
+/* maximize (win); */
+/* XMapRaised (dpy, win->w); */
+/* set_state (win, NormalState); */
+/* set_active_window (win); */
+ break;
+ case IconicState:
+ PRINT_DEBUG ("Mapped iconic window\n");
+ unhide_window (win);
break;
}
}
@@ -174,7 +173,6 @@ void
destroy_window (XDestroyWindowEvent *ev)
{
rp_window *win;
-
ignore_badwindow++;
win = find_window (ev->window);
@@ -185,20 +183,9 @@ destroy_window (XDestroyWindowEvent *ev)
frame = find_windows_frame (win);
if (frame) cleanup_frame (frame);
+ if (frame == rp_current_frame) set_active_frame (frame);
- if (frame == rp_current_frame)
- {
- PRINT_DEBUG ("Destroying the current window.\n");
-
- set_active_frame (frame);
- unmanage (win);
- }
- else
- {
- PRINT_DEBUG ("Destroying some other window.\n");
-
- unmanage (win);
- }
+ unmanage (win);
}
ignore_badwindow--;
@@ -242,7 +229,7 @@ configure_request (XConfigureRequestEvent *e)
PRINT_DEBUG("request CWY %d\n", e->y);
}
- if (e->value_mask & CWStackMode && win->state == STATE_MAPPED)
+ if (e->value_mask & CWStackMode && win->state == NormalState)
{
if (e->detail == Above)
{
@@ -310,6 +297,24 @@ client_msg (XClientMessageEvent *ev)
clean_up ();
exit (EXIT_SUCCESS);
}
+ else if (ev->message_type == wm_change_state)
+ {
+ rp_window *win;
+
+ win = find_window (ev->window);
+ if (win == NULL) return;
+ if (ev->format == 32 && ev->data.l[0] == IconicState)
+ {
+ if (win->state == NormalState)
+ {
+ /* TODO: Handle iconify events */
+ }
+ }
+ else
+ {
+ PRINT_ERROR ("Non-standard WM_CHANGE_STATE format\n");
+ }
+ }
}
static void