evaluate window style in Create, not later
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11670 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -89,6 +89,8 @@ public:
|
|||||||
long m_fsSaveFlag;
|
long m_fsSaveFlag;
|
||||||
wxRect m_fsSaveFrame;
|
wxRect m_fsSaveFrame;
|
||||||
|
|
||||||
|
long m_gdkFunc, m_gdkDecor; // m_windowStyle translated to GDK's terms
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -89,6 +89,8 @@ public:
|
|||||||
long m_fsSaveFlag;
|
long m_fsSaveFlag;
|
||||||
wxRect m_fsSaveFrame;
|
wxRect m_fsSaveFrame;
|
||||||
|
|
||||||
|
long m_gdkFunc, m_gdkDecor; // m_windowStyle translated to GDK's terms
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -133,7 +133,7 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
|
|||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (win->IsEnabled() &&
|
if (win->IsEnabled() &&
|
||||||
(g_openDialogs == 0 || (win->GetExtraStyle() & wxTLW_EX_DIALOG)))
|
(g_openDialogs == 0 || (win->GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)))
|
||||||
win->Close();
|
win->Close();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -188,48 +188,15 @@ gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxTopLevelWindowGTK *
|
|||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if ((win->m_miniEdge > 0) || (win->HasFlag(wxSIMPLE_BORDER)) || (win->HasFlag(wxNO_BORDER)))
|
|
||||||
{
|
|
||||||
/* This is a mini-frame or a borderless frame. */
|
|
||||||
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)0 );
|
|
||||||
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* All this is for Motif Window Manager "hints" and is supposed to be
|
/* All this is for Motif Window Manager "hints" and is supposed to be
|
||||||
recognized by other WM as well. Not tested. */
|
recognized by other WM as well. Not tested. */
|
||||||
long decor = (long) GDK_DECOR_BORDER;
|
gdk_window_set_decorations(win->m_widget->window,
|
||||||
long func = (long) GDK_FUNC_MOVE;
|
(GdkWMDecoration)win->m_gdkDecor);
|
||||||
|
gdk_window_set_functions(win->m_widget->window,
|
||||||
if ((win->GetWindowStyle() & wxCAPTION) != 0)
|
(GdkWMFunction)win->m_gdkFunc);
|
||||||
decor |= GDK_DECOR_TITLE;
|
|
||||||
if ((win->GetWindowStyle() & wxSYSTEM_MENU) != 0)
|
|
||||||
{
|
|
||||||
decor |= GDK_DECOR_MENU;
|
|
||||||
func |= GDK_FUNC_CLOSE;
|
|
||||||
}
|
|
||||||
if ((win->GetWindowStyle() & wxMINIMIZE_BOX) != 0)
|
|
||||||
{
|
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
|
||||||
}
|
|
||||||
if ((win->GetWindowStyle() & wxMAXIMIZE_BOX) != 0)
|
|
||||||
{
|
|
||||||
func |= GDK_FUNC_MAXIMIZE;
|
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
|
||||||
}
|
|
||||||
if ((win->GetWindowStyle() & wxRESIZE_BORDER) != 0)
|
|
||||||
{
|
|
||||||
func |= GDK_FUNC_RESIZE;
|
|
||||||
decor |= GDK_DECOR_RESIZEH;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
|
||||||
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
/* GTK's shrinking/growing policy */
|
||||||
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
|
if ((win->m_gdkFunc & GDK_FUNC_RESIZE) == 0)
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
||||||
else
|
else
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
@@ -368,6 +335,7 @@ void wxTopLevelWindowGTK::Init()
|
|||||||
m_isIconized = FALSE;
|
m_isIconized = FALSE;
|
||||||
m_fsIsShowing = FALSE;
|
m_fsIsShowing = FALSE;
|
||||||
m_themeEnabled = TRUE;
|
m_themeEnabled = TRUE;
|
||||||
|
m_gdkDecor = m_gdkFunc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
||||||
@@ -410,7 +378,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||||||
if (style & wxFRAME_TOOL_WINDOW)
|
if (style & wxFRAME_TOOL_WINDOW)
|
||||||
win_type = GTK_WINDOW_POPUP;
|
win_type = GTK_WINDOW_POPUP;
|
||||||
|
|
||||||
if (GetExtraStyle() & wxTLW_EX_DIALOG)
|
if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
|
||||||
win_type = GTK_WINDOW_DIALOG;
|
win_type = GTK_WINDOW_DIALOG;
|
||||||
|
|
||||||
m_widget = gtk_window_new( win_type );
|
m_widget = gtk_window_new( win_type );
|
||||||
@@ -495,6 +463,44 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "focus",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "focus",
|
||||||
GTK_SIGNAL_FUNC(gtk_frame_focus_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_frame_focus_callback), (gpointer)this );
|
||||||
|
|
||||||
|
|
||||||
|
/* decorations */
|
||||||
|
if ((m_miniEdge > 0) || (style & wxSIMPLE_BORDER) || (style & wxNO_BORDER))
|
||||||
|
{
|
||||||
|
m_gdkDecor = 0;
|
||||||
|
m_gdkFunc = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_gdkDecor = (long) GDK_DECOR_BORDER;
|
||||||
|
m_gdkFunc = (long) GDK_FUNC_MOVE;
|
||||||
|
|
||||||
|
// All this is for Motif Window Manager "hints" and is supposed to be
|
||||||
|
// recognized by other WM as well. Not tested.
|
||||||
|
if ((style & wxCAPTION) != 0)
|
||||||
|
m_gdkDecor |= GDK_DECOR_TITLE;
|
||||||
|
if ((style & wxSYSTEM_MENU) != 0)
|
||||||
|
{
|
||||||
|
m_gdkFunc |= GDK_FUNC_CLOSE;
|
||||||
|
m_gdkDecor |= GDK_DECOR_MENU;
|
||||||
|
}
|
||||||
|
if ((style & wxMINIMIZE_BOX) != 0)
|
||||||
|
{
|
||||||
|
m_gdkFunc |= GDK_FUNC_MINIMIZE;
|
||||||
|
m_gdkDecor |= GDK_DECOR_MINIMIZE;
|
||||||
|
}
|
||||||
|
if ((style & wxMAXIMIZE_BOX) != 0)
|
||||||
|
{
|
||||||
|
m_gdkFunc |= GDK_FUNC_MAXIMIZE;
|
||||||
|
m_gdkDecor |= GDK_DECOR_MAXIMIZE;
|
||||||
|
}
|
||||||
|
if ((style & wxRESIZE_BORDER) != 0)
|
||||||
|
{
|
||||||
|
m_gdkFunc |= GDK_FUNC_RESIZE;
|
||||||
|
m_gdkDecor |= GDK_DECOR_RESIZEH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -133,7 +133,7 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
|
|||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (win->IsEnabled() &&
|
if (win->IsEnabled() &&
|
||||||
(g_openDialogs == 0 || (win->GetExtraStyle() & wxTLW_EX_DIALOG)))
|
(g_openDialogs == 0 || (win->GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)))
|
||||||
win->Close();
|
win->Close();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -188,48 +188,15 @@ gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxTopLevelWindowGTK *
|
|||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if ((win->m_miniEdge > 0) || (win->HasFlag(wxSIMPLE_BORDER)) || (win->HasFlag(wxNO_BORDER)))
|
|
||||||
{
|
|
||||||
/* This is a mini-frame or a borderless frame. */
|
|
||||||
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)0 );
|
|
||||||
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* All this is for Motif Window Manager "hints" and is supposed to be
|
/* All this is for Motif Window Manager "hints" and is supposed to be
|
||||||
recognized by other WM as well. Not tested. */
|
recognized by other WM as well. Not tested. */
|
||||||
long decor = (long) GDK_DECOR_BORDER;
|
gdk_window_set_decorations(win->m_widget->window,
|
||||||
long func = (long) GDK_FUNC_MOVE;
|
(GdkWMDecoration)win->m_gdkDecor);
|
||||||
|
gdk_window_set_functions(win->m_widget->window,
|
||||||
if ((win->GetWindowStyle() & wxCAPTION) != 0)
|
(GdkWMFunction)win->m_gdkFunc);
|
||||||
decor |= GDK_DECOR_TITLE;
|
|
||||||
if ((win->GetWindowStyle() & wxSYSTEM_MENU) != 0)
|
|
||||||
{
|
|
||||||
decor |= GDK_DECOR_MENU;
|
|
||||||
func |= GDK_FUNC_CLOSE;
|
|
||||||
}
|
|
||||||
if ((win->GetWindowStyle() & wxMINIMIZE_BOX) != 0)
|
|
||||||
{
|
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
|
||||||
}
|
|
||||||
if ((win->GetWindowStyle() & wxMAXIMIZE_BOX) != 0)
|
|
||||||
{
|
|
||||||
func |= GDK_FUNC_MAXIMIZE;
|
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
|
||||||
}
|
|
||||||
if ((win->GetWindowStyle() & wxRESIZE_BORDER) != 0)
|
|
||||||
{
|
|
||||||
func |= GDK_FUNC_RESIZE;
|
|
||||||
decor |= GDK_DECOR_RESIZEH;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
|
||||||
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
/* GTK's shrinking/growing policy */
|
||||||
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
|
if ((win->m_gdkFunc & GDK_FUNC_RESIZE) == 0)
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
||||||
else
|
else
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
||||||
@@ -368,6 +335,7 @@ void wxTopLevelWindowGTK::Init()
|
|||||||
m_isIconized = FALSE;
|
m_isIconized = FALSE;
|
||||||
m_fsIsShowing = FALSE;
|
m_fsIsShowing = FALSE;
|
||||||
m_themeEnabled = TRUE;
|
m_themeEnabled = TRUE;
|
||||||
|
m_gdkDecor = m_gdkFunc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
||||||
@@ -410,7 +378,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||||||
if (style & wxFRAME_TOOL_WINDOW)
|
if (style & wxFRAME_TOOL_WINDOW)
|
||||||
win_type = GTK_WINDOW_POPUP;
|
win_type = GTK_WINDOW_POPUP;
|
||||||
|
|
||||||
if (GetExtraStyle() & wxTLW_EX_DIALOG)
|
if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
|
||||||
win_type = GTK_WINDOW_DIALOG;
|
win_type = GTK_WINDOW_DIALOG;
|
||||||
|
|
||||||
m_widget = gtk_window_new( win_type );
|
m_widget = gtk_window_new( win_type );
|
||||||
@@ -495,6 +463,44 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "focus",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "focus",
|
||||||
GTK_SIGNAL_FUNC(gtk_frame_focus_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_frame_focus_callback), (gpointer)this );
|
||||||
|
|
||||||
|
|
||||||
|
/* decorations */
|
||||||
|
if ((m_miniEdge > 0) || (style & wxSIMPLE_BORDER) || (style & wxNO_BORDER))
|
||||||
|
{
|
||||||
|
m_gdkDecor = 0;
|
||||||
|
m_gdkFunc = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_gdkDecor = (long) GDK_DECOR_BORDER;
|
||||||
|
m_gdkFunc = (long) GDK_FUNC_MOVE;
|
||||||
|
|
||||||
|
// All this is for Motif Window Manager "hints" and is supposed to be
|
||||||
|
// recognized by other WM as well. Not tested.
|
||||||
|
if ((style & wxCAPTION) != 0)
|
||||||
|
m_gdkDecor |= GDK_DECOR_TITLE;
|
||||||
|
if ((style & wxSYSTEM_MENU) != 0)
|
||||||
|
{
|
||||||
|
m_gdkFunc |= GDK_FUNC_CLOSE;
|
||||||
|
m_gdkDecor |= GDK_DECOR_MENU;
|
||||||
|
}
|
||||||
|
if ((style & wxMINIMIZE_BOX) != 0)
|
||||||
|
{
|
||||||
|
m_gdkFunc |= GDK_FUNC_MINIMIZE;
|
||||||
|
m_gdkDecor |= GDK_DECOR_MINIMIZE;
|
||||||
|
}
|
||||||
|
if ((style & wxMAXIMIZE_BOX) != 0)
|
||||||
|
{
|
||||||
|
m_gdkFunc |= GDK_FUNC_MAXIMIZE;
|
||||||
|
m_gdkDecor |= GDK_DECOR_MAXIMIZE;
|
||||||
|
}
|
||||||
|
if ((style & wxRESIZE_BORDER) != 0)
|
||||||
|
{
|
||||||
|
m_gdkFunc |= GDK_FUNC_RESIZE;
|
||||||
|
m_gdkDecor |= GDK_DECOR_RESIZEH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user