gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gorm : Xib loading doesn't respect size


From: forumer
Subject: Re: Gorm : Xib loading doesn't respect size
Date: Mon, 24 Jun 2013 16:59:12 +0200
User-agent: Roundcube Webmail/0.6

I would need to setup a dev. environment to debug gnustep on windows
but in the mean time I am having a look at source code but I don't know which parts
of code is used.
Could you tell me if Win32Server.m is used when using the cairo backend ?
In this case I don't really understand the GSScreenRectToMS function :


static inline
RECT GSScreenRectToMS(NSRect r)
{
  RECT r1;
  int screen_height = GetSystemMetrics(SM_CYSCREEN);

  r1.left = r.origin.x;
  r1.bottom = screen_height - r.origin.y;
  r1.right = r.origin.x + r.size.width;
  r1.top = screen_height - r.origin.y - r.size.height;

  return r1;
}



For instance when the window is created you do :

- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style
              : (int) screen
{
  HWND hwnd;
  RECT r;
  DWORD wstyle;
  DWORD estyle;

  wstyle = [self windowStyleForGSStyle: style];
  estyle = [self exwindowStyleForGSStyle: style];

  r = GSScreenRectToMS(frame);


...
}

So you use the result of GSScreenRectToMS to call the win32 CreateWindowEx function but to me you should use some method like AdjustWindowRectEx to transform a client size into a window size because win32 api only works with window size.

Same remark about resizing you should have some method like :

void SetClientSize( HWND hwnd, int clientWidth, int clientHeight ) {
  if ( IsWindow( hwnd ) ) {
    DWORD dwStyle = GetWindowLongPtr( hwnd, GWL_STYLE ) ;
    DWORD dwExStyle = GetWindowLongPtr( hwnd, GWL_EXSTYLE ) ;
    HMENU menu = GetMenu( hwnd ) ;
    RECT rc = { 0, 0, clientWidth, clientHeight } ;
    AdjustWindowRectEx( &rc, dwStyle, menu ? TRUE : FALSE, dwExStyle );
SetWindowPos( hwnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
                  SWP_NOZORDER | SWP_NOMOVE ) ;
  }
}


http://stackoverflow.com/questions/431470/window-border-width-and-height-in-win32-how-do-i-get-it
for more information about how to get a window size from a client size.
In my opinion the best method is given by AdjustWindowRectEx.

Of course if Win32Server.m is not used you can ignore this email :-)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]