return size without decorations from size_request GTK callback in wxTLW
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f030b28c93
commit
6e26499721
@ -114,6 +114,9 @@ public:
|
|||||||
int maxW = wxDefaultCoord, int maxH = wxDefaultCoord,
|
int maxW = wxDefaultCoord, int maxH = wxDefaultCoord,
|
||||||
int incW = wxDefaultCoord, int incH = wxDefaultCoord );
|
int incW = wxDefaultCoord, int incH = wxDefaultCoord );
|
||||||
|
|
||||||
|
// return the full size of the window without WM decorations
|
||||||
|
void GTKDoGetSize(int *width, int *height) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@ -248,6 +248,24 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// "size_request"
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
void wxgtk_tlw_size_request_callback(GtkWidget * WXUNUSED(widget),
|
||||||
|
GtkRequisition *requisition,
|
||||||
|
wxTopLevelWindowGTK *win)
|
||||||
|
{
|
||||||
|
// we must return the size of the window without WM decorations, otherwise
|
||||||
|
// GTK+ gets confused, so don't call just GetSize() here
|
||||||
|
int w, h;
|
||||||
|
win->GTKDoGetSize(&w, &h);
|
||||||
|
|
||||||
|
requisition->height = h;
|
||||||
|
requisition->width = w;
|
||||||
|
}
|
||||||
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "delete_event"
|
// "delete_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -586,6 +604,8 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||||||
g_signal_connect (m_widget, "size_allocate",
|
g_signal_connect (m_widget, "size_allocate",
|
||||||
G_CALLBACK (gtk_frame_size_callback), this);
|
G_CALLBACK (gtk_frame_size_callback), this);
|
||||||
|
|
||||||
|
g_signal_connect (m_widget, "size_request",
|
||||||
|
G_CALLBACK (wxgtk_tlw_size_request_callback), this);
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
if ((m_x != -1) || (m_y != -1))
|
if ((m_x != -1) || (m_y != -1))
|
||||||
@ -849,6 +869,11 @@ void wxTopLevelWindowGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXU
|
|||||||
// window geometry
|
// window geometry
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxTopLevelWindowGTK::GTKDoGetSize(int *width, int *height) const
|
||||||
|
{
|
||||||
|
return wxTopLevelWindowBase::DoGetSize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowGTK::GTKDoSetSize(int width, int height)
|
void wxTopLevelWindowGTK::GTKDoSetSize(int width, int height)
|
||||||
{
|
{
|
||||||
// avoid recursions
|
// avoid recursions
|
||||||
@ -938,7 +963,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
|
|||||||
|
|
||||||
int wUndec,
|
int wUndec,
|
||||||
hUndec;
|
hUndec;
|
||||||
wxTopLevelWindowBase::DoGetSize(&wUndec, &hUndec);
|
GTKDoGetSize(&wUndec, &hUndec);
|
||||||
|
|
||||||
if ( width != -1 )
|
if ( width != -1 )
|
||||||
width -= wTotal - wUndec;
|
width -= wTotal - wUndec;
|
||||||
@ -957,7 +982,7 @@ void wxTopLevelWindowGTK::DoGetSize(int *width, int *height) const
|
|||||||
{
|
{
|
||||||
// this can happen if we're called before the window is realized, so
|
// this can happen if we're called before the window is realized, so
|
||||||
// don't assert but just return the stored values
|
// don't assert but just return the stored values
|
||||||
wxTopLevelWindowBase::DoGetSize(width, height);
|
GTKDoGetSize(width, height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2556,7 +2556,7 @@ void wxWindowGTK::PostCreation()
|
|||||||
// FIXME: what should be done here ?
|
// FIXME: what should be done here ?
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else if ( !IsTopLevel() ) // top level windows use their own callback
|
||||||
{
|
{
|
||||||
// This is needed if we want to add our windows into native
|
// This is needed if we want to add our windows into native
|
||||||
// GTK controls, such as the toolbar. With this callback, the
|
// GTK controls, such as the toolbar. With this callback, the
|
||||||
|
Loading…
Reference in New Issue
Block a user