OK this is the situation now:
- the splash screen is centred properly and menus don't clip anymore.
- Windows with an owner are also centred above their parent windows.
- painting works properly
What doesn't work:
- The window menus don't stay open when you click the menu bar, they close as soon as you release the mouse button (I mean without dragging).
- setFullScreen(true) will set the physical window bounds to the scaled screen bounds. (Ideally the window should be maximised as on windows)
This is some code to maximise windows that seems to work (source http://stackoverflow.com/questions/4530786/xlib-create-window-in-mimized-or-maximized-state)
Atom wm_state = XInternAtom(display, "_NET_WM_STATE", False);
Atom max_horz = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
Atom max_vert = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
memset(&xev, 0, sizeof(xev));
xev.type = ClientMessage;
xev.xclient.window = window;
xev.xclient.message_type = wm_state;
xev.xclient.format = 32;
xev.xclient.data.l = _NET_WM_STATE_ADD;
xev.xclient.data.l = max_horz;
xev.xclient.data.l = max_vert;
XSendEvent(display, DefaultRootWindow(display), False, SubstructureNotifyMask, &xev);