fenster icon indicating copy to clipboard operation
fenster copied to clipboard

window size on windows

Open ktye opened this issue 2 years ago • 2 comments

on windows the drawing area is smaller than requested. AdjustWindowRectEx can compensate.

on return wr.left and wr.top are negative for me. e.g. when 400x400 is requested, i get: wr.left:-10 wr.right:410 wr.top:-33 wr.botom:410

FENSTER_API int fenster_open(struct fenster *f) {
  HINSTANCE hInstance = GetModuleHandle(NULL);
  RECT wr = {0, 0, 0, 0};
  wr.right = f->width;
  wr.bottom = f->height;
  AdjustWindowRectEx(&wr, WS_OVERLAPPEDWINDOW, FALSE, WS_EX_CLIENTEDGE);
  printf("wr:%d %d %d %d\n", wr.right, wr.left, wr.bottom, wr.top);
  WNDCLASSEX wc = {0};
  wc.cbSize = sizeof(WNDCLASSEX);
  wc.style = CS_VREDRAW | CS_HREDRAW;
  wc.lpfnWndProc = fenster_wndproc;
  wc.hInstance = hInstance;
  wc.lpszClassName = f->title;
  RegisterClassEx(&wc);
  f->hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, f->title, f->title,
                           WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
                           wr.right-wr.left, wr.bottom-wr.top, NULL, NULL, hInstance, NULL);

PS: fenster_auf() fenster_zu() would be better names

ktye avatar Jan 23 '23 10:01 ktye

I can confirm the suggested change works. I will open a PR for it.

cinemast avatar Apr 10 '23 07:04 cinemast

Ah, this is already covered in #17. @zserge could you please merge that?

cinemast avatar Apr 10 '23 07:04 cinemast