Fix regression caused by overlay window support code
Closing a window would not update the window layout, depending on the position of the window in the current layout.
This commit is contained in:
parent
6a51096304
commit
0bb8ec61e5
@ -448,16 +448,27 @@ PYWRAP1(mark_os_window_for_close) {
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
fix_window_idx(Tab *tab, id_type window_id, unsigned int *window_idx) {
|
||||
for (id_type fix = 0; fix < tab->num_windows; fix++) {
|
||||
if (tab->windows[fix].id == window_id) { *window_idx = fix; return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
PYWRAP1(set_window_render_data) {
|
||||
#define A(name) &(d.name)
|
||||
#define B(name) &(g.name)
|
||||
id_type os_window_id, tab_id;
|
||||
id_type os_window_id, tab_id, window_id;
|
||||
unsigned int window_idx;
|
||||
ScreenRenderData d = {0};
|
||||
WindowGeometry g = {0};
|
||||
PA("KKIffffOIIII", &os_window_id, &tab_id, &window_idx, A(xstart), A(ystart), A(dx), A(dy), A(screen), B(left), B(top), B(right), B(bottom));
|
||||
PA("KKKIffffOIIII", &os_window_id, &tab_id, &window_id, &window_idx, A(xstart), A(ystart), A(dx), A(dy), A(screen), B(left), B(top), B(right), B(bottom));
|
||||
|
||||
WITH_TAB(os_window_id, tab_id);
|
||||
if (tab->windows[window_idx].id != window_id) {
|
||||
if (!fix_window_idx(tab, window_id, &window_idx)) Py_RETURN_NONE;
|
||||
}
|
||||
Py_CLEAR(tab->windows[window_idx].render_data.screen);
|
||||
d.vao_idx = tab->windows[window_idx].render_data.vao_idx;
|
||||
d.gvao_idx = tab->windows[window_idx].render_data.gvao_idx;
|
||||
@ -471,11 +482,14 @@ PYWRAP1(set_window_render_data) {
|
||||
}
|
||||
|
||||
PYWRAP1(update_window_visibility) {
|
||||
id_type os_window_id;
|
||||
unsigned int window_idx, tab_id;
|
||||
id_type os_window_id, tab_id, window_id;
|
||||
unsigned int window_idx;
|
||||
int visible;
|
||||
PA("KIIp", &os_window_id, &tab_id, &window_idx, &visible);
|
||||
PA("KKKIp", &os_window_id, &tab_id, &window_id, &window_idx, &visible);
|
||||
WITH_TAB(os_window_id, tab_id);
|
||||
if (tab->windows[window_idx].id != window_id) {
|
||||
if (!fix_window_idx(tab, window_id, &window_idx)) Py_RETURN_NONE;
|
||||
}
|
||||
tab->windows[window_idx].visible = visible & 1;
|
||||
END_WITH_TAB;
|
||||
Py_RETURN_NONE;
|
||||
|
||||
@ -112,7 +112,8 @@ class Window:
|
||||
return self.override_title or self.child_title
|
||||
|
||||
def __repr__(self):
|
||||
return 'Window(title={}, id={})'.format(self.title, self.id)
|
||||
return 'Window(title={}, id={}, overlay_for={}, overlay_window_id={})'.format(
|
||||
self.title, self.id, self.overlay_for, self.overlay_window_id)
|
||||
|
||||
def as_dict(self):
|
||||
return dict(
|
||||
@ -142,7 +143,7 @@ class Window:
|
||||
val = bool(val)
|
||||
if val is not self.is_visible_in_layout:
|
||||
self.is_visible_in_layout = val
|
||||
update_window_visibility(self.os_window_id, self.tab_id, window_idx, val)
|
||||
update_window_visibility(self.os_window_id, self.tab_id, self.id, window_idx, val)
|
||||
if val:
|
||||
self.refresh()
|
||||
|
||||
@ -170,7 +171,7 @@ class Window:
|
||||
else:
|
||||
sg = self.update_position(new_geometry)
|
||||
self.geometry = g = new_geometry
|
||||
set_window_render_data(self.os_window_id, self.tab_id, window_idx, sg.xstart, sg.ystart, sg.dx, sg.dy, self.screen, *g[:4])
|
||||
set_window_render_data(self.os_window_id, self.tab_id, self.id, window_idx, sg.xstart, sg.ystart, sg.dx, sg.dy, self.screen, *g[:4])
|
||||
|
||||
def contains(self, x, y):
|
||||
g = self.geometry
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user