diff options
-rw-r--r-- | src/ChangeLog | 23 | ||||
-rw-r--r-- | src/events.c | 85 | ||||
-rw-r--r-- | src/list.c | 5 | ||||
-rw-r--r-- | src/manage.c | 56 | ||||
-rw-r--r-- | src/manage.h | 4 |
5 files changed, 98 insertions, 75 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e52ac13..34c494b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,26 @@ +2001-02-28 shawn <sabetts@badbox.secure.basis.org> + + * manage.c (map_window): calls update_window_information. + + * manage.h (map_window): new prototype. + + * events.c (new_window): calls update_window_information on new windows. + (map_request): calls map_window on managed unmapped windows. + (configure_request): removed commented out old crusty + code. Updates window's structure based on what bits are set in the + event's value_mask. Doesn't honour resize request. Windows are + always maximized. + (property_notify): doesn't call maximize when WM_NORMAL_HINTS are + updated. + + * manage.c (manage): no longer maps the window, this code is in + map_window. + (map_window): new function + (maximize): no longer sends a synthetic configure event. + (scanwins): calls map_window on viewable windows. + (update_window_information): renamed from manage. dependant code + updated. + 2001-02-27 shawn <sabetts@diggin.lamenet.tmp> * actions.c (cmd_escape): updates the "other" command keybinding diff --git a/src/events.c b/src/events.c index ee468cb..9bc29e6 100644 --- a/src/events.c +++ b/src/events.c @@ -51,7 +51,7 @@ new_window (XCreateWindowEvent *e) && e->window != s->input_window) { win = add_to_window_list (s, e->window); - win->state = STATE_UNMAPPED; + update_window_information (win); } } @@ -119,20 +119,24 @@ map_request (XEvent *ev) if (unmanaged_window (win->w)) { PRINT_DEBUG ("Unmanaged Window\n"); - XMapRaised (dpy, win->w); + XMapWindow (dpy, win->w); break; } else { PRINT_DEBUG ("managed Window\n"); - manage (win, s); /* fall through */ + + map_window (win); + break; } case STATE_MAPPED: PRINT_DEBUG ("Mapped Window\n"); - XMapWindow (dpy, win->w); + + maximize (win); XMapRaised (dpy, win->w); set_state (win, NormalState); set_active_window (win); + break; } } else @@ -210,64 +214,54 @@ configure_notify (XConfigureEvent *e) void configure_request (XConfigureRequestEvent *e) { -/* XWindowChanges wc; */ rp_window *win; - int need_move = 0; - int need_resize = 0; win = find_window (e->window); -/* wc.x = PADDING_LEFT; */ -/* wc.y = PADDING_TOP; */ -/* wc.width = win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT; */ -/* wc.height = win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM; */ -/* wc.border_width = 0; */ - if (win) { - PRINT_DEBUG ("'%s' window req: %d %d %d %d %d\n", win->name, - e->x, e->y, e->width, e->height, e->border_width); - /* Updated our window struct */ - win->x = e->x; - win->y = e->y; - win->width = e->width; - win->height = e->height; - win->border = e->border_width; + if (e->value_mask & CWX) + { + win->x = e->x + win->border; + PRINT_DEBUG("request CWX %d\n", e->x); + } + if (e->value_mask & CWY) + { + win->y = e->y + win->border; + PRINT_DEBUG("request CWY %d\n", e->y); + } + + + PRINT_DEBUG ("'%s' new window size: %d %d %d %d %d\n", win->name, + win->x, win->y, win->width, win->height, win->border); - if (e->value_mask & CWStackMode && win->state == STATE_MAPPED) + if (e->value_mask & (CWWidth|CWHeight|CWBorderWidth)) { - if (e->detail == Above) + if (e->value_mask & CWBorderWidth) { - set_active_window (win); + win->border = e->border_width; + PRINT_DEBUG("request CWBorderWidth %d\n", e->border_width); } - else if (e->detail == Below && win == rp_current_window) + if (e->value_mask & CWWidth) { - cmd_other (NULL); + win->width = e->width; + PRINT_DEBUG("request CWWidth %d\n", e->width); + } + if (e->value_mask & CWHeight) + { + win->height = e->height; + PRINT_DEBUG("request CWHeight %d\n", e->height); } - } - if ((e->value_mask & CWX) || (e->value_mask & CWY)) - { - XMoveWindow (dpy, win->w, e->x, e->y); - need_move = 1; + maximize (win); + send_configure (win); } - if ((e->value_mask & CWWidth) || (e->value_mask & CWHeight)) + else { - XResizeWindow (dpy, win->w, e->width, e->height); - need_resize = 1; - } - -/* if (need_move && !need_resize) */ -/* { */ + maximize (win); send_configure (win); -/* } */ - - maximize (win); - -/* XConfigureWindow (dpy, win->w, */ -/* CWX | CWY | CWWidth | CWHeight | CWBorderWidth, */ -/* &wc); */ + } } else { @@ -397,7 +391,6 @@ property_notify (XEvent *ev) case XA_WM_NORMAL_HINTS: PRINT_DEBUG ("updating window normal hints\n"); update_normal_hints (win); - maximize (win); break; case XA_WM_TRANSIENT_FOR: @@ -63,11 +63,12 @@ add_to_window_list (screen_info *s, Window w) new_window->hints = XAllocSizeHints (); new_window->colormap = DefaultColormap (dpy, s->screen_num); new_window->transient = XGetTransientForHint (dpy, new_window->w, &new_window->transient_for); + PRINT_DEBUG ("transient %d\n", new_window->transient); get_mouse_root_position (new_window, &new_window->mouse_x, &new_window->mouse_y); - PRINT_DEBUG ("transient %d\n", new_window->transient); - + XSelectInput (dpy, new_window->w, PropertyChangeMask | ColormapChangeMask); + if ((new_window->name = malloc (strlen ("Unnamed") + 1)) == NULL) { PRINT_ERROR ("Out of memory!\n"); diff --git a/src/manage.c b/src/manage.c index be2613e..0eb0e28 100644 --- a/src/manage.c +++ b/src/manage.c @@ -174,7 +174,7 @@ send_configure (rp_window *win) } void -manage (rp_window *win, screen_info *s) +update_window_information (rp_window *win) { XWindowAttributes attr; @@ -192,26 +192,6 @@ manage (rp_window *win, screen_info *s) win->y = attr.y; win->width = attr.width; win->height = attr.height; - - /* We successfully got the name, which means we can start managing! */ - XSelectInput (dpy, win->w, PropertyChangeMask | ColormapChangeMask); - XAddToSaveSet(dpy, win->w); - grab_prefix_key (win->w); - - maximize (win); - - XMapWindow (dpy, win->w); - - win->state = STATE_MAPPED; - win->number = get_unique_window_number (); - - /* Put win in the mapped window list */ - remove_from_list (win); - insert_into_list (win, rp_mapped_window_sentinel); - -/* sort_window_list_by_number(); */ - - PRINT_DEBUG ("window '%s' managed.\n", win->name); } void @@ -259,10 +239,14 @@ scanwins(screen_info *s) 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) manage (win, s); + if (attr.map_state == IsViewable) + { + map_window (win); + } + } } XFree((void *) wins); /* cast is to shut stoopid compiler up */ @@ -422,9 +406,6 @@ maximize (rp_window *win) /* Actually do the maximizing */ XMoveResizeWindow (dpy, win->w, win->x, win->y, win->width, win->height); - /* I don't think this should be here, but it doesn't seem to hurt. */ - send_configure (win); - XSync (dpy, False); } @@ -444,3 +425,26 @@ force_maximize (rp_window *win) XSync (dpy, False); } + +/* map the unmapped window win */ +void +map_window (rp_window *win) +{ + PRINT_DEBUG ("Mapping the unmapped window %s\n", win->name); + + update_window_information (win); + grab_prefix_key (win->w); + + maximize (win); + + XMapWindow (dpy, win->w); + set_state (win, NormalState); + set_active_window (win); + + win->state = STATE_MAPPED; + win->number = get_unique_window_number (); + + /* Put win in the mapped window list */ + remove_from_list (win); + insert_into_list (win, rp_mapped_window_sentinel); +} diff --git a/src/manage.h b/src/manage.h index 35189f6..22a6127 100644 --- a/src/manage.h +++ b/src/manage.h @@ -27,7 +27,6 @@ int unmanaged_window (Window w); screen_info* current_screen (); void scanwins(screen_info *s); -void manage (rp_window *w, screen_info *s); void unmanage (rp_window *w); int update_window_name (rp_window *win); void update_normal_hints (rp_window *win); @@ -35,6 +34,9 @@ void rename_current_window (); void send_configure (rp_window *win); void set_state (rp_window *win, int state); +void update_window_information (rp_window *win); +void map_window (rp_window *win); + void maximize (rp_window *win); void force_maximize (rp_window *win); |