Fixes fixed size window creation

This commit is contained in:
Paul Breugnot 2025-05-17 11:34:29 +02:00
parent a888c234a3
commit a4b48b60bf
5 changed files with 27 additions and 16 deletions

View file

@ -17,8 +17,8 @@ int main(void) {
set_up_test_logger();
if(check_xephyr_available()) {
RUN_TEST(run_aswm);
/*RUN_TEST(create_single_resizeable_top_level_window);*/
/*RUN_TEST(create_multiple_resizeable_top_level_window);*/
RUN_TEST(create_single_resizeable_top_level_window);
RUN_TEST(create_multiple_resizeable_top_level_window);
RUN_TEST(create_single_fixed_size_top_level_window);
}
tear_down_test_logger();

View file

@ -9,8 +9,7 @@ void create_single_fixed_size_top_level_window(void) {
Window child = XCreateSimpleWindow(test_display, window,
0, 0, 25, 30,
0, CopyFromParent, red(1).pixel);
XMapWindow(test_display, child);
const int fixed_width = 250;
const int fixed_height = 75;
{
@ -24,7 +23,16 @@ void create_single_fixed_size_top_level_window(void) {
XSetWMNormalHints(test_display, window, normal_size);
XFree(normal_size);
}
XMapWindow(test_display, child);
XMapWindow(test_display, window);
// Even if we called XMapWindow before XSetWindowAttributes, there is NO
// guarante that the property.h event handler for WM_NORMAL_HINTS will be
// triggered AFTER the map. Indeed, the property event can be handled before
// the WM has actually set event handlers on the mapped window. This is not
// an issue as long as the map request handler handles the initial
// WM_NORMAL_HINTS value. Calling XSetWMNormalHints before XMapWindow should
// however ensure that the current test reproduce this situation.
int visibility = wait_visibility(test_display, window);
@ -52,5 +60,4 @@ void create_single_fixed_size_top_level_window(void) {
TEST_ASSERT_EQUAL_INT(30, child_attributes.height);
TEST_ASSERT_EQUAL_INT(0, child_attributes.border_width);
TEST_ASSERT_EQUAL_INT(IsViewable, child_attributes.map_state);
}

View file

@ -4,4 +4,4 @@ simple = "[%c %p] %d(%m-%d %T) %-5V %-8f:%-3L %m%n"
[rules]
aswm.NOTICE >stdout; simple
aswm.DEBUG >stdout; simple