From ac972f2c2a080305d0c1a3dacd7fd72666e3d4b0 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 12 Apr 2014 18:24:47 -0400 Subject: handle window resizing --- window-xlib.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'window-xlib.c') diff --git a/window-xlib.c b/window-xlib.c index 8023eb2..d89af2e 100644 --- a/window-xlib.c +++ b/window-xlib.c @@ -23,6 +23,8 @@ static void runes_window_backend_process_event(uv_work_t *req, int status); static void runes_window_backend_map_window(RunesTerm *t); static void runes_window_backend_init_wm_properties( RunesTerm *t, int argc, char *argv[]); +static void runes_window_backend_resize_window( + RunesTerm *t, int width, int height); void runes_window_backend_init(RunesTerm *t) { @@ -208,6 +210,11 @@ static void runes_window_backend_process_event(uv_work_t *req, int status) case Expose: runes_window_backend_flush(t); break; + case ConfigureNotify: + while (XCheckTypedWindowEvent(w->dpy, w->w, ConfigureNotify, e)); + runes_window_backend_resize_window( + t, e->xconfigure.width, e->xconfigure.height); + break; case ClientMessage: { Atom a = e->xclient.data.l[0]; if (a == w->atoms[RUNES_ATOM_WM_DELETE_WINDOW]) { @@ -287,3 +294,14 @@ static void runes_window_backend_init_wm_properties( runes_window_backend_set_icon_name(t, "runes", 5); runes_window_backend_set_window_title(t, "runes", 5); } + +static void runes_window_backend_resize_window( + RunesTerm *t, int width, int height) +{ + if (width != t->xpixel || height != t->ypixel) { + cairo_xlib_surface_set_size( + cairo_get_target(t->backend_cr), width, height); + runes_display_set_window_size(t, width, height); + runes_pty_backend_set_window_size(t); + } +} -- cgit v1.2.3-54-g00ecf