summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2006-03-16 01:41:13 +0000
committersabetts <sabetts>2006-03-16 01:41:13 +0000
commit4e1d3ffcec845b5618f6ac8a2b2c8ad40dadbceb (patch)
tree3bfca1227c7e1017504c1b4ac6f13832c1600764 /src/screen.c
parent2af887d39f6cba4cbbcaac8b51ffa773be809f23 (diff)
downloadratpoison-4e1d3ffcec845b5618f6ac8a2b2c8ad40dadbceb.zip
2006-03-15 Bernhard R. Link <brlink@debian.org>
* src/screen.c (screen_update): new function (init_screen): listen for screen resizes * src/screen.h: new prototype * src/events.c (configure_notify): new function (delegate_event): call configure_notify for ConfigureNotify events * src/frame.c (frame_dump): remember the size of the screen the frame coordinates are relative to. (frame_restore): adopt coordinates to possible screen resizes. * src/frame.h (frame_fump): take a screen argument (frame_read): likewise * src/actions.c (cmd_tmpwm): listen for screen resizes again (fdump, frestore, cmd_fdump): supply screen to frame_dump, frameread
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/screen.c b/src/screen.c
index c24d477..e4cc8d3 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -266,7 +266,8 @@ init_screen (rp_screen *s, int screen_num)
it, terminating ratpoison. */
XSelectInput(dpy, RootWindow (dpy, screen_num),
PropertyChangeMask | ColormapChangeMask
- | SubstructureRedirectMask | SubstructureNotifyMask );
+ | SubstructureRedirectMask | SubstructureNotifyMask
+ | StructureNotifyMask);
XSync (dpy, False);
/* Add netwm support. FIXME: I think this is busted. */
@@ -395,3 +396,33 @@ screen_dump (rp_screen *screen)
free (s);
return tmp;
}
+
+void
+screen_update (rp_screen *s, int width, int height)
+{
+ rp_frame *f;
+ int oldwidth,oldheight;
+
+ PRINT_DEBUG (("screen_update(%d,%d)\n", width, height));
+ if (rp_have_xinerama)
+ {
+ /* TODO: how to do this with xinerama? */
+ return;
+ }
+
+ if (s->width == width && s->height == height)
+ /* nothing to do */
+ return;
+
+ oldwidth = s->width; oldheight = s->height;
+ s->width = width; s->height = height;
+
+ list_for_each_entry (f, &s->frames, node)
+ {
+ f->x = (f->x*width)/oldwidth;
+ f->width = (f->width*width)/oldwidth;
+ f->y = (f->y*height)/oldheight;
+ f->height = (f->height*height)/oldheight;
+ maximize_all_windows_in_frame (f);
+ }
+}