diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 13 | ||||
-rw-r--r-- | src/actions.c | 18 | ||||
-rw-r--r-- | src/actions.h | 1 | ||||
-rw-r--r-- | src/data.h | 4 | ||||
-rw-r--r-- | src/events.c | 81 | ||||
-rw-r--r-- | src/manage.c | 30 | ||||
-rw-r--r-- | src/manage.h | 1 |
7 files changed, 119 insertions, 29 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4e6284b..371f70a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,18 @@ 2000-12-09 shawn <sabetts@diggin.lamenet.tmp> + * data.h (struct rp_window): added x, y, width, height, border; + + * events.c (configure_request): Now honours request, but then + maximizes it afterwards. + (configure_request): updates the rp_window's geometry fields + + * manage.c (manage): commented out XMoveResizeWindow call + (send_configure): added + + * actions.h (maximize): added prototype + + * actions.c (maximize): added + * input.c (cook_keycode): properly handle LockMask (cook_keycode): updated comments diff --git a/src/actions.c b/src/actions.c index 095604b..5bb0964 100644 --- a/src/actions.c +++ b/src/actions.c @@ -31,6 +31,7 @@ rp_action key_actions[] = { {KEY_PREFIX, 0, 0, generate_prefix}, {XK_7, -1, 0, goto_window_7}, {XK_8, -1, 0, goto_window_8}, {XK_9, -1, 0, goto_window_9}, + {XK_m, -1, 0, maximize}, { 0, 0, 0, 0 } }; void @@ -327,3 +328,20 @@ generate_prefix (void *data) XSendEvent (dpy, rp_current_window->w, False, KeyPressMask, &ev); XSync (dpy, False); } + +/* Maximize the current window if data = 0, otherwise assume it is a + pointer to a window that should be maximized */ +void +maximize (void *data) +{ + rp_window *win = (rp_window *)data; + + if (!win) win = rp_current_window; + if (!win) return; + + XMoveResizeWindow (dpy, win->w, + PADDING_LEFT, + PADDING_TOP, + win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT, + win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM); +} diff --git a/src/actions.h b/src/actions.h index 54317c3..b1690a5 100644 --- a/src/actions.h +++ b/src/actions.h @@ -25,5 +25,6 @@ void last_window (void *data); void next_window (void *data); void prev_window (void *data); void toggle_bar (void *data); +void maximize (void *data); extern rp_action key_actions[]; @@ -42,6 +42,10 @@ struct rp_window int state; int last_access; int named; + + /* Dimensions */ + int x, y, width, height, border; + rp_window *next, *prev; }; diff --git a/src/events.c b/src/events.c index d859965..0bcffbe 100644 --- a/src/events.c +++ b/src/events.c @@ -164,34 +164,49 @@ destroy_window (XDestroyWindowEvent *ev) } void +configure_notify (XConfigureEvent *e) +{ + rp_window *win; + + win = find_window (e->window); + if (win) + { + PRINT_DEBUG ("'%s' window notify: %d %d %d %d %d\n", win->name, + e->x, e->y, e->width, e->height, e->border_width); + + /* Once we get the notify that everything went through, try + maximizing. Netscape doesn't seem to like it here. */ +/* maximize (win); */ + } +} + +void configure_request (XConfigureRequestEvent *e) { - XWindowChanges wc; - XConfigureEvent ce; +/* 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 ("window req: %d %d %d %d %d\n", e->x, e->y, e->width, e->height, e->border_width); - - 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; - - ce.type = ConfigureNotify; - ce.event = e->window; - ce.window = e->window; - ce.x = PADDING_LEFT; - ce.y = PADDING_TOP; - ce.width = win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT; - ce.height = win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM; - ce.border_width = 0; - ce.above = None; - ce.override_redirect = 0; + 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 & CWStackMode && win->state == STATE_MAPPED) { @@ -206,10 +221,27 @@ configure_request (XConfigureRequestEvent *e) } } - XSendEvent(dpy, win->w, False, StructureNotifyMask, (XEvent*)&ce); - XConfigureWindow (dpy, win->w, - CWX | CWY | CWWidth | CWHeight | CWBorderWidth, - &wc); + if ((e->value_mask & CWX) || (e->value_mask & CWY)) + { + XMoveWindow (dpy, win->w, e->x, e->y); + need_move = 1; + } + if ((e->value_mask & CWWidth) || (e->value_mask & CWHeight)) + { + XResizeWindow (dpy, win->w, e->width, e->height); + need_resize = 1; + } + + if (need_move && !need_resize) + { + send_configure (win); + } + + maximize (win); + +/* XConfigureWindow (dpy, win->w, */ +/* CWX | CWY | CWWidth | CWHeight | CWBorderWidth, */ +/* &wc); */ } else { @@ -418,6 +450,7 @@ delegate_event (XEvent *ev) break; case ConfigureNotify: PRINT_DEBUG ("ConfigureNotify\n"); + configure_notify (&ev->xconfigure); break; case MapNotify: PRINT_DEBUG ("MapNotify\n"); diff --git a/src/manage.c b/src/manage.c index 7f6017a..aaff55a 100644 --- a/src/manage.c +++ b/src/manage.c @@ -113,6 +113,25 @@ update_window_name (rp_window *win) return 1; } +/* Send an artificial configure event to the window. */ +void +send_configure (rp_window *win) +{ + XConfigureEvent ce; + + ce.type = ConfigureNotify; + ce.event = win->w; + ce.window = win->w; + ce.x = PADDING_LEFT; + ce.y = PADDING_TOP; + ce.width = win->scr->root_attr.width - PADDING_LEFT - PADDING_RIGHT; + ce.height = win->scr->root_attr.height - PADDING_TOP - PADDING_BOTTOM; + ce.border_width = 0; + ce.above = None; + ce.override_redirect = 0; + + XSendEvent (dpy, win->w, False, StructureNotifyMask, (XEvent*)&ce); +} void manage (rp_window *win, screen_info *s) @@ -121,14 +140,15 @@ manage (rp_window *win, screen_info *s) /* We successfully got the name, which means we can start managing! */ XMapWindow (dpy, win->w); - XMoveResizeWindow (dpy, win->w, - PADDING_LEFT, - PADDING_TOP, - s->root_attr.width - PADDING_LEFT - PADDING_RIGHT, - s->root_attr.height - PADDING_TOP - PADDING_BOTTOM); XSelectInput (dpy, win->w, PropertyChangeMask); XAddToSaveSet(dpy, win->w); grab_prefix_key (win->w); +/* XMoveResizeWindow (dpy, win->w, */ +/* PADDING_LEFT, */ +/* PADDING_TOP, */ +/* s->root_attr.width - PADDING_LEFT - PADDING_RIGHT, */ +/* s->root_attr.height - PADDING_TOP - PADDING_BOTTOM); */ +/* send_configure (win); */ win->state = STATE_MAPPED; win->number = get_unique_window_number (); diff --git a/src/manage.h b/src/manage.h index 75801a4..81abae6 100644 --- a/src/manage.h +++ b/src/manage.h @@ -28,4 +28,5 @@ void manage (rp_window *w, screen_info *s); void unmanage (rp_window *w); int update_window_name (rp_window *win); void rename_current_window (); +void send_configure (rp_window *win); #endif /* _MANAGE_H */ |