History

win32: support runtime geometry update

Similar to other platforms. Also make sure that the x/y positions are set on geometry update.

nanahi committed 2 years ago

Commit 4370dc01 parent f236e241 file · +13 −5Browse files

Unified · Split

video/out/w32_common.c+13−5
@@ -1739,9 +1739,8 @@ static void run_message_loop(struct vo_w32_state *w32) · 1738 unmodified lines
1739 mp_dispatch_queue_process(w32->dispatch, 1000);1739 mp_dispatch_queue_process(w32->dispatch, 1000);
1740}1740}
1741 1741
1742static void gui_thread_reconfig(void *ptr)1742static void window_reconfig(struct vo_w32_state *w32, bool force)
1743{1743{
1744 struct vo_w32_state *w32 = ptr;
1745 struct vo *vo = w32->vo;1744 struct vo *vo = w32->vo;
1746 1745
1747 RECT r = get_working_area(w32);1746 RECT r = get_working_area(w32);
@@ -1764,14 +1763,14 @@ static void gui_thread_reconfig(void *ptr) · 16 unmodified lines
1764 vo_calc_window_geometry3(vo, &screen, &mon, w32->dpi_scale, &geo);1763 vo_calc_window_geometry3(vo, &screen, &mon, w32->dpi_scale, &geo);
1765 vo_apply_window_geometry(vo, &geo);1764 vo_apply_window_geometry(vo, &geo);
1766 1765
1767 bool reset_size = (w32->o_dwidth != vo->dwidth ||1766 bool reset_size = ((w32->o_dwidth != vo->dwidth ||
1768 w32->o_dheight != vo->dheight) &&1767 w32->o_dheight != vo->dheight) &&
1769 w32->opts->auto_window_resize;1768 w32->opts->auto_window_resize) || force;
1770 1769
1771 w32->o_dwidth = vo->dwidth;1770 w32->o_dwidth = vo->dwidth;
1772 w32->o_dheight = vo->dheight;1771 w32->o_dheight = vo->dheight;
1773 1772
1774 if (!w32->parent && !w32->window_bounds_initialized) {1773 if (!w32->parent && (!w32->window_bounds_initialized || force)) {
1775 SetRect(&w32->windowrc, geo.win.x0, geo.win.y0,1774 SetRect(&w32->windowrc, geo.win.x0, geo.win.y0,
1776 geo.win.x0 + vo->dwidth, geo.win.y0 + vo->dheight);1775 geo.win.x0 + vo->dwidth, geo.win.y0 + vo->dheight);
1777 w32->prev_windowrc = w32->windowrc;1776 w32->prev_windowrc = w32->windowrc;
@@ -1802,6 +1801,11 @@ finish: · 24 unmodified lines
1802 reinit_window_state(w32);1801 reinit_window_state(w32);
1803}1802}
1804 1803
1804static void gui_thread_reconfig(void *ptr)
1805{
1806 window_reconfig(ptr, false);
1807}
1808
1805// Resize the window. On the first call, it's also made visible.1809// Resize the window. On the first call, it's also made visible.
1806void vo_w32_config(struct vo *vo)1810void vo_w32_config(struct vo *vo)
1807{1811{
@@ -2077,6 +2081,10 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg) · 269 unmodified lines
2077 update_maximized_state(w32);2081 update_maximized_state(w32);
2078 } else if (changed_option == &vo_opts->window_corners) {2082 } else if (changed_option == &vo_opts->window_corners) {
2079 update_corners_pref(w32);2083 update_corners_pref(w32);
2084 } else if (changed_option == &vo_opts->geometry || changed_option == &vo_opts->autofit ||
2085 changed_option == &vo_opts->autofit_smaller || changed_option == &vo_opts->autofit_larger)
2086 {
2087 window_reconfig(w32, true);
2080 }2088 }
2081 }2089 }
2082 2090

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t