#include #include #include #include #include int main() { int screen_number_ret; xcb_connection_t *conn=xcb_connect(0, &screen_number_ret); const struct xcb_setup_t *setup=xcb_get_setup(conn); xcb_screen_iterator_t iter=xcb_setup_roots_iterator(setup); xcb_window_t root=iter.data->root; xcb_window_t app=xcb_generate_id(conn); xcb_size_hints_t hints; xcb_atom_t wm_normal_hints; char buffer[1024]; static const char wm_normal_hints_name[]="WM_NORMAL_HINTS"; xcb_create_window(conn, iter.data->root_depth, app, root, 100, 100, 300, 300, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, iter.data->root_visual, 0, 0); memset(&hints, 0, sizeof(hints)); xcb_icccm_size_hints_set_min_size(&hints, 300, 300); xcb_icccm_size_hints_set_base_size(&hints, 300, 300); xcb_icccm_size_hints_set_max_size(&hints, 300, 300); wm_normal_hints= xcb_intern_atom_reply(conn, xcb_intern_atom(conn, 0, sizeof(wm_normal_hints_name)-1, wm_normal_hints_name), 0)->atom; xcb_icccm_set_wm_size_hints(conn, app, wm_normal_hints, &hints); xcb_map_window(conn, app); /* ** This flush and sleep is required to reproduce the bug. ** With this in place, the app window is not resizable. ** ** Without the sleep, the app window will be resizable 99% of the ** the time! */ xcb_flush(conn); sleep(5); xcb_icccm_size_hints_set_min_size(&hints, 1, 300); xcb_icccm_size_hints_set_max_size(&hints, 1920, 300); xcb_icccm_set_wm_size_hints(conn, app, wm_normal_hints, &hints); xcb_flush(conn); printf("Ok, go ahead and try to resize the window horizontally\n"); fgets(buffer, sizeof(buffer), stdin); }