Skip to content

window size on windows #7

@ktye

Description

@ktye

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions