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
17391739 mp_dispatch_queue_process(w32->dispatch, 1000);
17401740 }
17411741
1742−static void gui_thread_reconfig(void *ptr)
1742+static void window_reconfig(struct vo_w32_state *w32, bool force)
17431743 {
1744− struct vo_w32_state *w32 = ptr;
17451744 struct vo *vo = w32->vo;
17461745
17471746 RECT r = get_working_area(w32);
@@ -1764,14 +1763,14 @@ static void gui_thread_reconfig(void *ptr) · 16 unmodified lines
17641763 vo_calc_window_geometry3(vo, &screen, &mon, w32->dpi_scale, &geo);
17651764 vo_apply_window_geometry(vo, &geo);
17661765
1767− bool reset_size = (w32->o_dwidth != vo->dwidth ||
1766+ bool reset_size = ((w32->o_dwidth != vo->dwidth ||
17681767 w32->o_dheight != vo->dheight) &&
1769− w32->opts->auto_window_resize;
1768+ w32->opts->auto_window_resize) || force;
17701769
17711770 w32->o_dwidth = vo->dwidth;
17721771 w32->o_dheight = vo->dheight;
17731772
1774− if (!w32->parent && !w32->window_bounds_initialized) {
1773+ if (!w32->parent && (!w32->window_bounds_initialized || force)) {
17751774 SetRect(&w32->windowrc, geo.win.x0, geo.win.y0,
17761775 geo.win.x0 + vo->dwidth, geo.win.y0 + vo->dheight);
17771776 w32->prev_windowrc = w32->windowrc;
@@ -1802,6 +1801,11 @@ finish: · 24 unmodified lines
18021801 reinit_window_state(w32);
18031802 }
18041803
1804+static void gui_thread_reconfig(void *ptr)
1805+{
1806+ window_reconfig(ptr, false);
1807+}
1808+
18051809 // Resize the window. On the first call, it's also made visible.
18061810 void vo_w32_config(struct vo *vo)
18071811 {
@@ -2077,6 +2081,10 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg) · 269 unmodified lines
20772081 update_maximized_state(w32);
20782082 } else if (changed_option == &vo_opts->window_corners) {
20792083 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);
20802088 }
20812089 }
20822090

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