From bb25a741c24ad8141f51e60e18fd65aeab0b0b2d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 2 Oct 2008 23:44:51 +0000 Subject: [PATCH] honour wx{CLOSE,MINIMIZE,MAXIMIZE}_BOX even for borderless windows; also always allow moving the windows as we don't have a special style to enable/disable this (#10029) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56037 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/toplevel.cpp | 62 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 24f387e3d9..319887643f 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -296,7 +296,7 @@ gtk_frame_configure_callback( GtkWidget* widget, // "realize" from m_widget //----------------------------------------------------------------------------- -// we cannot MWM hints and icons before the widget has been realized, +// we cannot the WM hints and icons before the widget has been realized, // so we do this directly after realization extern "C" { @@ -304,15 +304,13 @@ static void gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxTopLevelWindowGTK *win ) { - // All this is for Motif Window Manager "hints" and is supposed to be - // recognized by other WM as well. Not tested. gdk_window_set_decorations(win->m_widget->window, (GdkWMDecoration)win->m_gdkDecor); gdk_window_set_functions(win->m_widget->window, (GdkWMFunction)win->m_gdkFunc); // GTK's shrinking/growing policy - if ((win->m_gdkFunc & GDK_FUNC_RESIZE) == 0) + if ( !(win->m_gdkFunc & GDK_FUNC_RESIZE) ) gtk_window_set_resizable(GTK_WINDOW(win->m_widget), FALSE); else gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1); @@ -436,7 +434,8 @@ void wxTopLevelWindowGTK::Init() m_isIconized = false; m_fsIsShowing = false; m_themeEnabled = true; - m_gdkDecor = m_gdkFunc = 0; + m_gdkDecor = + m_gdkFunc = 0; m_grabbed = false; m_deferShow = true; @@ -593,42 +592,43 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, g_signal_connect(m_widget, "property_notify_event", G_CALLBACK(property_notify_event), this); - // decorations - if ((style & wxSIMPLE_BORDER) || (style & wxNO_BORDER)) + // translate wx decorations styles into Motif WM hints (they are recognized + // by other WMs as well) + + // always enable moving the window as we have no separate flag for enabling + // it + m_gdkFunc = GDK_FUNC_MOVE; + + if ( style & wxCLOSE_BOX ) + m_gdkFunc |= GDK_FUNC_CLOSE; + + if ( style & wxMINIMIZE_BOX ) + m_gdkFunc |= GDK_FUNC_MINIMIZE; + + if ( style & wxMAXIMIZE_BOX ) + m_gdkFunc |= GDK_FUNC_MAXIMIZE; + + if ( (style & wxSIMPLE_BORDER) || (style & wxNO_BORDER) ) { m_gdkDecor = 0; - m_gdkFunc = 0; } - else + else // have border { m_gdkDecor = GDK_DECOR_BORDER; - m_gdkFunc = GDK_FUNC_MOVE; - // All this is for Motif Window Manager "hints" and is supposed to be - // recognized by other WMs as well. - if ((style & wxCAPTION) != 0) - { + if ( style & wxCAPTION ) m_gdkDecor |= GDK_DECOR_TITLE; - } - if ((style & wxCLOSE_BOX) != 0) - { - m_gdkFunc |= GDK_FUNC_CLOSE; - } - if ((style & wxSYSTEM_MENU) != 0) - { + + if ( style & wxSYSTEM_MENU ) m_gdkDecor |= GDK_DECOR_MENU; - } - if ((style & wxMINIMIZE_BOX) != 0) - { - m_gdkFunc |= GDK_FUNC_MINIMIZE; + + if ( style & wxMINIMIZE_BOX ) m_gdkDecor |= GDK_DECOR_MINIMIZE; - } - if ((style & wxMAXIMIZE_BOX) != 0) - { - m_gdkFunc |= GDK_FUNC_MAXIMIZE; + + if ( style & wxMAXIMIZE_BOX ) m_gdkDecor |= GDK_DECOR_MAXIMIZE; - } - if ((style & wxRESIZE_BORDER) != 0) + + if ( style & wxRESIZE_BORDER ) { m_gdkFunc |= GDK_FUNC_RESIZE; m_gdkDecor |= GDK_DECOR_RESIZEH; -- 2.45.2