There were a few pitfalls with the way this was previously implemented because --geometry implicitly depended on --auto-window-resize being enabled to operate in a few cases. Instead, let's change the logic a bit so that instead we choose whether or not to reuse the old rc (i.e. don't resize) and use the wh_valid and xy_valid fields within the m_geometry struct instead of using x11->geometry_change. This fixes several edge cases involving setting the position with --geometry when using --auto-window-resize=no.
Unified · Split
| @@ -1810,22 +1810,19 @@ void vo_x11_config_vo_window(struct vo *vo) · 1809 unmodified lines | |||
| 1810 | !x11->pseudo_mapped, &geo); | 1810 | !x11->pseudo_mapped, &geo); |
| 1811 | vo_apply_window_geometry(vo, &geo); | 1811 | vo_apply_window_geometry(vo, &geo); |
| 1812 | 1812 | ||
| 1813 | struct mp_rect rc = geo.win; | 1813 | struct mp_rect rc = !x11->pseudo_mapped || opts->auto_window_resize || opts->geometry.wh_valid || |
| 1814 | opts->geometry.xy_valid ? geo.win : x11->nofsrc; | ||
| 1814 | 1815 | ||
| 1815 | if (x11->parent) { | 1816 | if (x11->parent) { |
| 1816 | vo_x11_update_geometry(vo); | 1817 | vo_x11_update_geometry(vo); |
| 1817 | rc = (struct mp_rect){0, 0, RC_W(x11->winrc), RC_H(x11->winrc)}; | 1818 | rc = (struct mp_rect){0, 0, RC_W(x11->winrc), RC_H(x11->winrc)}; |
| 1818 | } | 1819 | } |
| 1819 | 1820 | ||
| 1820 | bool reset_size = ((x11->old_dw != RC_W(rc) || x11->old_dh != RC_H(rc)) | 1821 | bool reset_size = ((x11->old_dw != RC_W(rc) || x11->old_dh != RC_H(rc))) || |
| 1821 | && opts->auto_window_resize) || x11->geometry_change; | 1822 | opts->geometry.wh_valid || opts->geometry.xy_valid; |
| 1822 | reset_size |= (x11->old_x != rc.x0 || x11->old_y != rc.y0) && | ||
| 1823 | (x11->geometry_change); | ||
| 1824 | 1823 | ||
| 1825 | x11->old_dw = RC_W(rc); | 1824 | x11->old_dw = RC_W(rc); |
| 1826 | x11->old_dh = RC_H(rc); | 1825 | x11->old_dh = RC_H(rc); |
| 1827 | x11->old_x = rc.x0; | ||
| 1828 | x11->old_y = rc.y0; | ||
| 1829 | 1826 | ||
| 1830 | if (x11->window_hidden) { | 1827 | if (x11->window_hidden) { |
| 1831 | x11->nofsrc = rc; | 1828 | x11->nofsrc = rc; |
| @@ -1834,8 +1831,6 @@ void vo_x11_config_vo_window(struct vo *vo) · 2 unmodified lines | |||
| 1834 | vo_x11_highlevel_resize(vo, rc, geo.flags & VO_WIN_FORCE_POS); | 1831 | vo_x11_highlevel_resize(vo, rc, geo.flags & VO_WIN_FORCE_POS); |
| 1835 | } | 1832 | } |
| 1836 | 1833 | ||
| 1837 | x11->geometry_change = false; | ||
| 1838 | |||
| 1839 | if (opts->ontop) | 1834 | if (opts->ontop) |
| 1840 | vo_x11_setlayer(vo, opts->ontop); | 1835 | vo_x11_setlayer(vo, opts->ontop); |
| 1841 | if (!opts->show_in_taskbar) | 1836 | if (!opts->show_in_taskbar) |
| @@ -2069,7 +2064,6 @@ static void vo_x11_set_geometry(struct vo *vo) · 227 unmodified lines | |||
| 2069 | if (!x11->window) | 2064 | if (!x11->window) |
| 2070 | return; | 2065 | return; |
| 2071 | 2066 | ||
| 2072 | x11->geometry_change = true; | ||
| 2073 | vo_x11_config_vo_window(vo); | 2067 | vo_x11_config_vo_window(vo); |
| 2074 | } | 2068 | } |
| 2075 | 2069 | ||
| @@ -115,16 +115,12 @@ struct vo_x11_state { · 114 unmodified lines | |||
| 115 | * stays the same (even if that size is different from the current | 115 | * stays the same (even if that size is different from the current |
| 116 | * window size after the user modified the latter). */ | 116 | * window size after the user modified the latter). */ |
| 117 | int old_dw, old_dh; | 117 | int old_dw, old_dh; |
| 118 | int old_x, old_y; | ||
| 119 | /* Video size changed during fullscreen when we couldn't tell the new | 118 | /* Video size changed during fullscreen when we couldn't tell the new |
| 120 | * size to the window manager. Must set window size when turning | 119 | * size to the window manager. Must set window size when turning |
| 121 | * fullscreen off. */ | 120 | * fullscreen off. */ |
| 122 | bool size_changed_during_fs; | 121 | bool size_changed_during_fs; |
| 123 | bool pos_changed_during_fs; | 122 | bool pos_changed_during_fs; |
| 124 | 123 | ||
| 125 | /* One of the autofit/geometry options changed at runtime. */ | ||
| 126 | bool geometry_change; | ||
| 127 | |||
| 128 | XComposeStatus compose_status; | 124 | XComposeStatus compose_status; |
| 129 | 125 | ||
| 130 | /* XShm stuff */ | 126 | /* XShm stuff */ |