wxX11:
Reorganized SetSize() code so that composite controls work. Removed call to XSync() in the same code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -92,9 +92,9 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPopupWindow::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
|
void wxPopupWindow::DoMoveWindow(int x, int y, int width, int height )
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("DoMoveWindow called for wxPopupWindow") );
|
wxWindowX11::DoMoveWindow( x, y, width, height );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
||||||
|
@@ -645,7 +645,7 @@ void wxWindowX11::DoGetClientSize(int *x, int *y) const
|
|||||||
|
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
XSync(wxGlobalDisplay(), False);
|
XSync(wxGlobalDisplay(), False); // Is this really a good idea?
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
Status status = XGetWindowAttributes( wxGlobalDisplay(), window, &attr );
|
Status status = XGetWindowAttributes( wxGlobalDisplay(), window, &attr );
|
||||||
wxASSERT(status);
|
wxASSERT(status);
|
||||||
@@ -660,72 +660,70 @@ void wxWindowX11::DoGetClientSize(int *x, int *y) const
|
|||||||
|
|
||||||
void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
if (!GetMainWindow())
|
Window xwindow = (Window) GetMainWindow();
|
||||||
return;
|
|
||||||
|
|
||||||
XWindowChanges windowChanges;
|
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||||
windowChanges.x = 0;
|
|
||||||
windowChanges.y = 0;
|
XWindowAttributes attr;
|
||||||
windowChanges.width = 0;
|
Status status = XGetWindowAttributes( wxGlobalDisplay(), xwindow, &attr );
|
||||||
windowChanges.height = 0;
|
wxCHECK_RET( status, wxT("invalid window attributes") );
|
||||||
windowChanges.stack_mode = 0;
|
|
||||||
int valueMask = 0;
|
int new_x = attr.x;
|
||||||
|
int new_y = attr.y;
|
||||||
|
int new_w = attr.width;
|
||||||
|
int new_h = attr.height;
|
||||||
|
|
||||||
|
|
||||||
if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
{
|
{
|
||||||
int yy = 0;
|
int yy = 0;
|
||||||
AdjustForParentClientOrigin( x, yy, sizeFlags);
|
AdjustForParentClientOrigin( x, yy, sizeFlags);
|
||||||
windowChanges.x = x;
|
new_x = x;
|
||||||
valueMask |= CWX;
|
|
||||||
}
|
}
|
||||||
if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
{
|
{
|
||||||
int xx = 0;
|
int xx = 0;
|
||||||
AdjustForParentClientOrigin( xx, y, sizeFlags);
|
AdjustForParentClientOrigin( xx, y, sizeFlags);
|
||||||
windowChanges.y = y;
|
new_y = y;
|
||||||
valueMask |= CWY;
|
|
||||||
}
|
}
|
||||||
if (width != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (width != -1)
|
||||||
{
|
{
|
||||||
windowChanges.width = width /* - m_borderSize*2 */;
|
new_w = width;
|
||||||
if (windowChanges.width == 0)
|
if (new_w <= 0)
|
||||||
windowChanges.width = 1;
|
new_w = 20;
|
||||||
valueMask |= CWWidth;
|
|
||||||
}
|
}
|
||||||
if (height != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (height != -1)
|
||||||
{
|
{
|
||||||
windowChanges.height = height /* -m_borderSize*2*/;
|
new_h = height;
|
||||||
if (windowChanges.height == 0)
|
if (new_h <= 0)
|
||||||
windowChanges.height = 1;
|
new_h = 20;
|
||||||
valueMask |= CWHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XConfigureWindow(wxGlobalDisplay(), (Window) GetMainWindow(),
|
DoMoveWindow( new_x, new_y, new_w, new_h );
|
||||||
valueMask, & windowChanges);
|
|
||||||
XSync(wxGlobalDisplay(), False);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowX11::DoSetClientSize(int width, int height)
|
void wxWindowX11::DoSetClientSize(int width, int height)
|
||||||
{
|
{
|
||||||
if (!GetMainWindow())
|
Window xwindow = (Window) GetMainWindow();
|
||||||
return;
|
|
||||||
|
|
||||||
XWindowChanges windowChanges;
|
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||||
int valueMask = 0;
|
|
||||||
|
|
||||||
|
XWindowAttributes attr;
|
||||||
|
Status status = XGetWindowAttributes( wxGlobalDisplay(), xwindow, &attr );
|
||||||
|
wxCHECK_RET( status, wxT("invalid window attributes") );
|
||||||
|
|
||||||
|
int new_x = attr.x;
|
||||||
|
int new_y = attr.y;
|
||||||
|
int new_w = attr.width;
|
||||||
|
int new_h = attr.height;
|
||||||
|
|
||||||
if (width != -1)
|
if (width != -1)
|
||||||
{
|
new_w = width;
|
||||||
windowChanges.width = width ;
|
|
||||||
valueMask |= CWWidth;
|
|
||||||
}
|
|
||||||
if (height != -1)
|
if (height != -1)
|
||||||
{
|
new_h = height;
|
||||||
windowChanges.height = height ;
|
|
||||||
valueMask |= CWHeight;
|
DoMoveWindow( new_x, new_y, new_w, new_h );
|
||||||
}
|
|
||||||
XConfigureWindow(wxGlobalDisplay(), (Window) GetMainWindow(),
|
|
||||||
valueMask, & windowChanges);
|
|
||||||
XSync(wxGlobalDisplay(), False);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For implementation purposes - sometimes decorations make the client area
|
// For implementation purposes - sometimes decorations make the client area
|
||||||
@@ -780,7 +778,19 @@ void wxWindowX11::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW,
|
|||||||
|
|
||||||
void wxWindowX11::DoMoveWindow(int x, int y, int width, int height)
|
void wxWindowX11::DoMoveWindow(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
DoSetSize(x, y, width, height);
|
Window xwindow = (Window) GetMainWindow();
|
||||||
|
|
||||||
|
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||||
|
|
||||||
|
XWindowChanges windowChanges;
|
||||||
|
windowChanges.x = x;
|
||||||
|
windowChanges.y = y;
|
||||||
|
windowChanges.width = width;
|
||||||
|
windowChanges.height = height;
|
||||||
|
windowChanges.stack_mode = 0;
|
||||||
|
int valueMask = CWX | CWY | CWWidth | CWHeight;
|
||||||
|
|
||||||
|
XConfigureWindow( wxGlobalDisplay(), xwindow, valueMask, &windowChanges );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user