summaryrefslogtreecommitdiff
path: root/src/events.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-03-01 05:01:29 +0000
committersabetts <sabetts>2001-03-01 05:01:29 +0000
commitdb8f252fca8d05f3f79ecbec76b85bb89df5581d (patch)
tree6a0d2095b805603c407f4bdda9c88bfb5d5af6b1 /src/events.c
parent811441c3d6f45b4d6eebbf919dac160619a3a389 (diff)
downloadratpoison-db8f252fca8d05f3f79ecbec76b85bb89df5581d.zip
* 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.
Diffstat (limited to 'src/events.c')
-rw-r--r--src/events.c85
1 files changed, 39 insertions, 46 deletions
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: