diff --git a/apps/x11_main.c b/apps/x11_main.c index 6815037..9bb8049 100644 --- a/apps/x11_main.c +++ b/apps/x11_main.c @@ -254,7 +254,7 @@ void winhelp(pdfapp_t *app) void winresize(pdfapp_t *app, int w, int h) { XWindowChanges values; - int mask; + int mask, width, height; mask = CWWidth | CWHeight; values.width = w; @@ -268,6 +268,8 @@ void winresize(pdfapp_t *app, int w, int h) { gapp.winw = w; gapp.winh = h; + width = -1; + height = -1; XMapWindow(xdpy, xwin); XFlush(xdpy); @@ -277,6 +279,10 @@ void winresize(pdfapp_t *app, int w, int h) XNextEvent(xdpy, &xevt); if (xevt.type == MapNotify) break; + if (xevt.type == ConfigureNotify) { + width = xevt.xconfigure.width; + height = xevt.xconfigure.height; + } } XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr)); @@ -284,6 +290,12 @@ void winresize(pdfapp_t *app, int w, int h) XFlush(xdpy); mapped = 1; + + if (width != reqh || height != reqw) { + gapp.shrinkwrap = 0; + dirty = 1; + pdfapp_onresize(&gapp, width, height); + } } }