summaryrefslogtreecommitdiff
path: root/src/winwidget.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-11-15 12:14:41 +0100
committerDaniel Friesel <derf@finalrewind.org>2015-11-15 12:14:41 +0100
commitf23f146cf68a52dbb1744d1a9e6f06baff4b32ad (patch)
tree49a787447702c386ab4947615f7fc3207de20517 /src/winwidget.c
parent0d064e95e689698047fdb7e695d357e7e158a9fb (diff)
parentdfe3c40f80f77a800479c31a51b1f3b1f648b0ea (diff)
Merge branch 'gattschardo-scaledown'
Diffstat (limited to 'src/winwidget.c')
-rw-r--r--src/winwidget.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/src/winwidget.c b/src/winwidget.c
index 8bf1dbb..4d7a519 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "filelist.h"
#include "winwidget.h"
#include "options.h"
+#include "events.h"
static void winwidget_unregister(winwidget win);
static void winwidget_register(winwidget win);
@@ -297,6 +298,11 @@ void winwidget_create_window(winwidget ret, int w, int h)
XSetCommand(disp, ret->win, cmdargv, cmdargc);
winwidget_register(ret);
+ if (opt.scale_down) {
+ opt.geom_w = w;
+ opt.geom_h = h;
+ opt.geom_flags |= WidthValue | HeightValue;
+ }
return;
}
@@ -408,28 +414,6 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
winwidget_setup_pixmaps(winwid);
- if (!winwid->full_screen && opt.scale_down &&
- (winwid->type != WIN_TYPE_THUMBNAIL) &&
- (winwid->old_zoom == 1.0)) {
- int max_w = winwid->w, max_h = winwid->h;
- if (opt.geom_flags & WidthValue) {
- max_w = opt.geom_w;
- }
- if (opt.geom_flags & HeightValue) {
- max_h = opt.geom_h;
- }
- D(("max: %dx%d, size: %dx%d\n", max_w, max_h, winwid->im_w, winwid->im_h));
- if (max_w < winwid->im_w || max_h < winwid->im_h) {
- D(("scaling down image %dx%d\n", max_w, max_h));
-
- feh_calc_needed_zoom(&(winwid->zoom), winwid->im_w, winwid->im_h,
- max_w, max_h);
- if (resize)
- winwidget_resize(winwid, winwid->im_w * winwid->zoom, winwid->im_h * winwid->zoom);
- D(("after scaling down image %dx%d\n", winwid->w, winwid->h));
- }
- }
-
if (!winwid->full_screen && ((gib_imlib_image_has_alpha(winwid->im))
|| (opt.geom_flags & (WidthValue | HeightValue))
|| (winwid->im_x || winwid->im_y) || (winwid->zoom != 1.0)
@@ -444,7 +428,7 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
if (resize && (winwid->full_screen
- || (!opt.scale_down && (opt.geom_flags & (WidthValue | HeightValue))))) {
+ || (opt.geom_flags & (WidthValue | HeightValue)))) {
int smaller; /* Is the image smaller than screen? */
int max_w = 0, max_h = 0;
@@ -532,7 +516,7 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
winwid->im_y = (int) (max_h - (winwid->im_h * winwid->zoom)) >> 1;
}
}
- else if (need_center && !winwid->full_screen && opt.scale_down
+ else if (need_center && !winwid->full_screen
&& (winwid->type != WIN_TYPE_THUMBNAIL)) {
winwid->im_x = (int) (winwid->w - (winwid->im_w * winwid->zoom)) >> 1;
winwid->im_y = (int) (winwid->h - (winwid->im_h * winwid->zoom)) >> 1;
@@ -776,6 +760,15 @@ void winwidget_show(winwidget winwid)
/* wait for the window to map */
D(("Waiting for window to map\n"));
XMaskEvent(disp, StructureNotifyMask, &ev);
+ /* Unfortunately, StructureNotifyMask does not only mask
+ * the events of type MapNotify (which we want to mask here)
+ * but also such of type ConfigureNotify (and others, see
+ * https://tronche.com/gui/x/xlib/events/processing-overview.html),
+ * which should be handled, especially on tiling wm's. To
+ * remedy this, the handler is executed explicitly:
+ */
+ if (ev.type == ConfigureNotify)
+ feh_event_handle_ConfigureNotify(&ev);
D(("Window mapped\n"));
winwid->visible = 1;
}
@@ -838,7 +831,7 @@ void winwidget_resize(winwidget winwid, int w, int h)
D((" x %d y %d w %d h %d\n", attributes.x, attributes.y, winwid->w,
winwid->h));
- if (!opt.scale_down && opt.geom_flags & (WidthValue | HeightValue)) {
+ if (opt.geom_flags & (WidthValue | HeightValue)) {
winwid->had_resize = 1;
return;
}