mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
Only configure client geometries once per main loop iteration
This should "protect" the user from some stupidities that Lua code might be doing that e.g. makes a client jump to another position and then immediately back to where it was before. Only the last change in a single main loop iteration will actually have any effect. Original idea by Daniel here: https://github.com/awesomeWM/awesome/pull/174 Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
dd1d81a3ac
commit
baaff93a73
2 changed files with 49 additions and 30 deletions
|
@ -1135,9 +1135,55 @@ client_border_refresh(void)
|
|||
window_border_refresh((window_t *) *c);
|
||||
}
|
||||
|
||||
static void
|
||||
client_geometry_refresh(void)
|
||||
{
|
||||
client_ignore_enterleave_events();
|
||||
foreach(_c, globalconf.clients)
|
||||
{
|
||||
client_t *c = *_c;
|
||||
|
||||
/* Compute the client window's and frame window's geometry */
|
||||
area_t geometry = c->geometry;
|
||||
area_t real_geometry = c->geometry;
|
||||
if (!c->fullscreen)
|
||||
{
|
||||
real_geometry.x = c->titlebar[CLIENT_TITLEBAR_LEFT].size;
|
||||
real_geometry.y = c->titlebar[CLIENT_TITLEBAR_TOP].size;
|
||||
real_geometry.width -= c->titlebar[CLIENT_TITLEBAR_LEFT].size;
|
||||
real_geometry.width -= c->titlebar[CLIENT_TITLEBAR_RIGHT].size;
|
||||
real_geometry.height -= c->titlebar[CLIENT_TITLEBAR_TOP].size;
|
||||
real_geometry.height -= c->titlebar[CLIENT_TITLEBAR_BOTTOM].size;
|
||||
} else {
|
||||
real_geometry.x = 0;
|
||||
real_geometry.y = 0;
|
||||
}
|
||||
|
||||
/* Is there anything to do? */
|
||||
if (AREA_EQUAL(geometry, c->x11_frame_geometry)
|
||||
&& AREA_EQUAL(real_geometry, c->x11_client_geometry))
|
||||
continue;
|
||||
|
||||
xcb_configure_window(globalconf.connection, c->frame_window,
|
||||
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
|
||||
(uint32_t[]) { geometry.x, geometry.y, geometry.width, geometry.height });
|
||||
xcb_configure_window(globalconf.connection, c->window,
|
||||
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
|
||||
(uint32_t[]) { real_geometry.x, real_geometry.y, real_geometry.width, real_geometry.height });
|
||||
|
||||
c->x11_frame_geometry = geometry;
|
||||
c->x11_client_geometry = real_geometry;
|
||||
|
||||
/* ICCCM 4.2.3 says something else, but Java always needs this... */
|
||||
client_send_configure(c);
|
||||
}
|
||||
client_restore_enterleave_events();
|
||||
}
|
||||
|
||||
void
|
||||
client_refresh(void)
|
||||
{
|
||||
client_geometry_refresh();
|
||||
client_border_refresh();
|
||||
client_focus_refresh();
|
||||
}
|
||||
|
@ -1517,36 +1563,6 @@ client_resize_do(client_t *c, area_t geometry)
|
|||
area_t old_geometry = c->geometry;
|
||||
c->geometry = geometry;
|
||||
|
||||
/* Ignore all spurious enter/leave notify events */
|
||||
client_ignore_enterleave_events();
|
||||
|
||||
/* Configure the client for its new size */
|
||||
area_t real_geometry = geometry;
|
||||
if (!c->fullscreen)
|
||||
{
|
||||
real_geometry.x = c->titlebar[CLIENT_TITLEBAR_LEFT].size;
|
||||
real_geometry.y = c->titlebar[CLIENT_TITLEBAR_TOP].size;
|
||||
real_geometry.width -= c->titlebar[CLIENT_TITLEBAR_LEFT].size;
|
||||
real_geometry.width -= c->titlebar[CLIENT_TITLEBAR_RIGHT].size;
|
||||
real_geometry.height -= c->titlebar[CLIENT_TITLEBAR_TOP].size;
|
||||
real_geometry.height -= c->titlebar[CLIENT_TITLEBAR_BOTTOM].size;
|
||||
} else {
|
||||
real_geometry.x = 0;
|
||||
real_geometry.y = 0;
|
||||
}
|
||||
|
||||
xcb_configure_window(globalconf.connection, c->frame_window,
|
||||
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
|
||||
(uint32_t[]) { geometry.x, geometry.y, geometry.width, geometry.height });
|
||||
xcb_configure_window(globalconf.connection, c->window,
|
||||
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
|
||||
(uint32_t[]) { real_geometry.x, real_geometry.y, real_geometry.width, real_geometry.height });
|
||||
|
||||
/* ICCCM 4.2.3 says something else, but Java always needs this... */
|
||||
client_send_configure(c);
|
||||
|
||||
client_restore_enterleave_events();
|
||||
|
||||
luaA_object_push(L, c);
|
||||
if (!AREA_EQUAL(old_geometry, geometry))
|
||||
luaA_object_emit_signal(L, -1, "property::geometry", 0);
|
||||
|
|
|
@ -61,6 +61,9 @@ struct client_t
|
|||
char *class, *instance;
|
||||
/** Window geometry */
|
||||
area_t geometry;
|
||||
/** Old window geometry currently configured in X11 */
|
||||
area_t x11_client_geometry;
|
||||
area_t x11_frame_geometry;
|
||||
/** Startup ID */
|
||||
char *startup_id;
|
||||
/** True if the client is sticky */
|
||||
|
|
Loading…
Reference in a new issue