summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2002-02-16 10:51:25 +0000
committersabetts <sabetts>2002-02-16 10:51:25 +0000
commit0ffaa2d7743832871d966190f67145651829493f (patch)
tree48a09ebef46ef202fd4cdac1ce1cdf832708fb2d /src
parent77ed579271333781b9a97bbfc901795080c0ca16 (diff)
downloadratpoison-0ffaa2d7743832871d966190f67145651829493f.zip
* src/manage.c (maximize): remove calls to XSelectInput.
(force_maximize): likewise (unhide_window): likewise (unhide_window_below): likewise * src/events.c (configure_notify): remove function. (configure_request): grant the request, then immediately maximize the window. (delegate_event): ignore ConfigureNotify events. (configure_request): grant the request if ratpoison isn't managing the window.
Diffstat (limited to 'src')
-rw-r--r--src/events.c78
-rw-r--r--src/manage.c22
2 files changed, 21 insertions, 79 deletions
diff --git a/src/events.c b/src/events.c
index 35d415f..c07fb0b 100644
--- a/src/events.c
+++ b/src/events.c
@@ -216,47 +216,6 @@ destroy_window (XDestroyWindowEvent *ev)
}
static void
-configure_notify (XConfigureEvent *e)
-{
- rp_window *win;
-
- /* ignore SubstructureNotify ConfigureNotify events. */
- if(e->event != e->window && e->send_event != True)
- return;
-
- win = find_window (e->window);
-
- if (win && win->state == NormalState)
- {
- if (win->height != e->height
- || win->width != e->width
- || win->border != e->border_width
- || win->x != e->x
- || win->y != e->y)
- {
- /* The notify event was generated from a granted configure
- request which means we must re-maximize the window.
-
- If the window has resize increments then ratpoison has to
- know the real size of the window to increment properly. So,
- update the structure before calling maximize. */
-
- PRINT_DEBUG ("Notify geom: x=%d y=%d width=%d height=%d\n", e->x, e->y, e->width, e->height);
- PRINT_DEBUG ("Current geom: x=%d y=%d width=%d height=%d\n", win->x, win->y, win->width, win->height);
-
- win->x = e->x;
- win->y = e->y;
- win->width = e->width;
- win->height = e->height;
- win->border = e->border_width;
-
- maximize (win);
- }
- }
-}
-
-
-static void
configure_request (XConfigureRequestEvent *e)
{
XWindowChanges changes;
@@ -266,13 +225,6 @@ configure_request (XConfigureRequestEvent *e)
if (win)
{
- /* Initialize the XWindowChanges structure. */
- changes.x = win->x;
- changes.y = win->y;
- changes.width = win->width;
- changes.height = win->height;
- changes.border_width = win->border;
-
if (e->value_mask & CWStackMode)
{
if (e->detail == Above)
@@ -309,49 +261,61 @@ configure_request (XConfigureRequestEvent *e)
if (e->value_mask & CWBorderWidth)
{
changes.border_width = e->border_width;
+ win->border = e->border_width;
PRINT_DEBUG("request CWBorderWidth %d\n", e->border_width);
}
if (e->value_mask & CWWidth)
{
changes.width = e->width;
+ win->width = e->width;
PRINT_DEBUG("request CWWidth %d\n", e->width);
}
if (e->value_mask & CWHeight)
{
changes.height = e->height;
+ win->height = e->height;
PRINT_DEBUG("request CWHeight %d\n", e->height);
}
if (e->value_mask & CWX)
{
changes.x = e->x;
+ win->x = e->x;
PRINT_DEBUG("request CWX %d\n", e->x);
}
if (e->value_mask & CWY)
{
changes.y = e->y;
+ win->y = e->y;
PRINT_DEBUG("request CWY %d\n", e->y);
}
if (e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight))
{
- /* Ignore the configure notify event caused by the geometry
- change if the window is not mapped. */
- if (win->state != NormalState)
- XSelectInput (dpy, win->w, WIN_EVENTS&~(StructureNotifyMask));
+ /* Grant the request, then immediately maximize it. */
XConfigureWindow (dpy, win->w,
e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight),
&changes);
- if (win->state != NormalState)
- XSelectInput (dpy, win->w, WIN_EVENTS);
+
+ if (win->state == NormalState)
+ maximize (win);
}
}
else
{
- PRINT_DEBUG ("FIXME: Don't handle this\n");
+ /* Its an unmanaged window, so give it what it wants. But don't
+ change the stack mode.*/
+ if (e->value_mask & CWX) changes.x = e->x;
+ if (e->value_mask & CWY) changes.x = e->x;
+ if (e->value_mask & CWWidth) changes.x = e->x;
+ if (e->value_mask & CWHeight) changes.x = e->x;
+ if (e->value_mask & CWBorderWidth) changes.x = e->x;
+ XConfigureWindow (dpy, e->window,
+ e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight),
+ &changes);
}
}
@@ -777,10 +741,6 @@ delegate_event (XEvent *ev)
break;
case ConfigureNotify:
- PRINT_DEBUG ("--- Handling ConfigureNotify ---\n");
- configure_notify (&ev->xconfigure);
- break;
-
case MapNotify:
case Expose:
case MotionNotify:
diff --git a/src/manage.c b/src/manage.c
index 1d941b2..12699d7 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -588,12 +588,9 @@ maximize (rp_window *win)
win->x, win->y, win->width, win->height);
- /* Actually do the maximizing, and ignore the event created by the
- maximizing. */
- XSelectInput (dpy, win->w, WIN_EVENTS&~(StructureNotifyMask));
+ /* Actually do the maximizing. */
XMoveResizeWindow (dpy, win->w, win->x, win->y, win->width, win->height);
XSetWindowBorderWidth (dpy, win->w, win->border);
- XSelectInput (dpy, win->w, WIN_EVENTS);
XSync (dpy, False);
}
@@ -611,9 +608,6 @@ force_maximize (rp_window *win)
/* Reposition the window. */
move_window (win);
- /* Don't listen to the events caused by the maximize. */
- XSelectInput (dpy, win->w, WIN_EVENTS&~(StructureNotifyMask));
-
/* This little dance is to force a maximize event. If the window is
already "maximized" X11 will optimize away the event since to
geometry changes were made. This initial resize solves the
@@ -633,7 +627,6 @@ force_maximize (rp_window *win)
XMoveResizeWindow (dpy, win->w, win->x, win->y, win->width, win->height);
XSetWindowBorderWidth (dpy, win->w, win->border);
- XSelectInput (dpy, win->w, WIN_EVENTS);
XSync (dpy, False);
}
@@ -682,10 +675,7 @@ hide_window (rp_window *win)
/* An unmapped window is not inside a frame. */
win->frame = NULL;
- /* Ignore the unmap_notify event. */
- XSelectInput(dpy, win->w, WIN_EVENTS&~(StructureNotifyMask));
XUnmapWindow (dpy, win->w);
- XSelectInput (dpy, win->w, WIN_EVENTS);
set_state (win, IconicState);
}
@@ -694,17 +684,12 @@ unhide_window (rp_window *win)
{
if (win == NULL) return;
- /* Always raise the window. But ignore notify event. */
- XSelectInput(dpy, win->w, WIN_EVENTS&~(StructureNotifyMask));
+ /* Always raise the window. */
XRaiseWindow (dpy, win->w);
- XSelectInput (dpy, win->w, WIN_EVENTS);
if (win->state != IconicState) return;
- /* Ignore the notify event. */
- XSelectInput(dpy, win->w, WIN_EVENTS&~(StructureNotifyMask));
XMapWindow (dpy, win->w);
- XSelectInput (dpy, win->w, WIN_EVENTS);
set_state (win, NormalState);
}
@@ -721,10 +706,7 @@ unhide_window_below (rp_window *win)
if (win->state != IconicState) return;
- /* Ignore the event caused by the window mapping. */
- XSelectInput(dpy, win->w, WIN_EVENTS&~(StructureNotifyMask));
XMapWindow (dpy, win->w);
- XSelectInput (dpy, win->w, WIN_EVENTS);
set_state (win, NormalState);
}