From: Karsten Ballüder Date: Wed, 5 May 1999 21:16:16 +0000 (+0000) Subject: Modified WM hints handling which should be much better now. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/aa64626e23b89ec4942aa0c6d313cda932a38d5e?ds=sidebyside Modified WM hints handling which should be much better now. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2347 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/defs.h b/include/wx/defs.h index 2b51d4fae6..4f6f3379c1 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -388,7 +388,7 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); #define wxMINIMIZE wxICONIZE #define wxMAXIMIZE 0x2000 #define wxTHICK_FRAME 0x1000 -#define wxSYSTEM_MENU 0x0800 +#define wxSYSTEM_MENU 0x0800 #define wxMINIMIZE_BOX 0x0400 #define wxMAXIMIZE_BOX 0x0200 #define wxTINY_CAPTION_HORIZ 0x0100 @@ -400,13 +400,21 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); /* Add for normal Windows frame behaviour */ #define wxFRAME_FLOAT_ON_PARENT 0x0020 -#define wxDEFAULT_FRAME_STYLE (wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN) #if WXWIN_COMPATIBILITY #define wxDEFAULT_FRAME wxDEFAULT_FRAME_STYLE #endif -#define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU|wxCAPTION|wxTHICK_FRAME) +#define wxDEFAULT_FRAME_STYLE (wxSYSTEM_MENU|wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN) + +#ifdef __WXMSW__ +# define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU|wxCAPTION|wxTHICK_FRAME) +#else +// Under Unix, the dialogs don't have a system menu. Specifying +// wxSYSTEM_MENU here, will make a close button appear. +# define wxDEFAULT_DIALOG_STYLE (wxCAPTION) +#endif + /* * Subwindow style flags diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index ff79b0c840..5b38a4085d 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -189,7 +189,6 @@ void MyFrame::ChooseFontGeneric(wxCommandEvent& WXUNUSED(event) ) void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) ) { -#if 0 wxMessageDialog dialog(NULL, "This is a message box\nA long, long string to test out the message box properly", "Message box text", wxYES_NO|wxCANCEL); @@ -197,10 +196,6 @@ void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) ) ::wxMessageBox("MsgBox with a really long long string", "this is the text", wxYES_NO|wxICON_EXCLAMATION); - -#endif - ::wxMessageBox("Short", - "This is the text", wxYES_NO|wxICON_EXCLAMATION); } void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event) ) diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index d2339efb44..fd729112db 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -87,7 +87,7 @@ IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog) wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, const wxString& message, const wxString& caption, long style, const wxPoint& pos) : - wxDialog( parent, -1, caption, pos, wxDefaultSize ) + wxDialog( parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE ) { m_dialogStyle = style; diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index fc6e7041ff..685411ea48 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -133,26 +133,31 @@ gtk_dialog_map_callback( GtkWidget *widget, wxDialog *win ) /* all this is for Motif Window Manager "hints" and is supposed to be recognized by other WM as well. not tested. */ - long decor = (long) GDK_DECOR_ALL; - long func = (long) GDK_FUNC_ALL; + long decor = (long) GDK_DECOR_BORDER ; + long func = (long) GDK_FUNC_MOVE ; - if ((win->m_windowStyle & wxCAPTION) == 0) + if ((win->m_windowStyle & wxCAPTION) != 0) decor |= GDK_DECOR_TITLE; - if ((win->m_windowStyle & wxSYSTEM_MENU) == 0) - decor |= GDK_DECOR_MENU; - if ((win->m_windowStyle & wxMINIMIZE_BOX) == 0) + if ((win->m_windowStyle & wxSYSTEM_MENU) != 0) + { + decor |= GDK_DECOR_MENU; + func |= GDK_FUNC_CLOSE; + } + if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0) { func |= GDK_FUNC_MINIMIZE; decor |= GDK_DECOR_MINIMIZE; } - if ((win->m_windowStyle & wxMAXIMIZE_BOX) == 0) + if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0) { decor |= GDK_DECOR_MAXIMIZE; func |= GDK_FUNC_MAXIMIZE; } - if ((win->m_windowStyle & wxRESIZE_BORDER) == 0) - func |= GDK_FUNC_RESIZE; - + if ((win->m_windowStyle & 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); diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index fdb231157e..044bce6f8c 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -191,26 +191,36 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) /* all this is for Motif Window Manager "hints" and is supposed to be recognized by other WM as well. not tested. */ - long decor = (long) GDK_DECOR_ALL; - long func = (long) GDK_FUNC_ALL; + long decor = (long) 0; + long func = (long) GDK_FUNC_MOVE|GDK_FUNC_CLOSE; - if ((win->m_windowStyle & wxCAPTION) == 0) + if ((win->m_windowStyle & wxCAPTION) != 0) decor |= GDK_DECOR_TITLE; - if ((win->m_windowStyle & wxSYSTEM_MENU) == 0) - decor |= GDK_DECOR_MENU; - if ((win->m_windowStyle & wxMINIMIZE_BOX) == 0) + if ((win->m_windowStyle & wxSYSTEM_MENU) != 0) + { + decor |= GDK_DECOR_MENU; + func |= GDK_FUNC_CLOSE; + } + if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0) { func |= GDK_FUNC_MINIMIZE; decor |= GDK_DECOR_MINIMIZE; + decor |= GDK_DECOR_BORDER; } - if ((win->m_windowStyle & wxMAXIMIZE_BOX) == 0) + if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0) { func |= GDK_FUNC_MAXIMIZE; decor |= GDK_DECOR_MAXIMIZE; + decor |= GDK_DECOR_BORDER; } - if ((win->m_windowStyle & wxRESIZE_BORDER) == 0) - func |= GDK_FUNC_RESIZE; - + if ((win->m_windowStyle & wxRESIZE_BORDER) != 0) + { + func |= GDK_FUNC_RESIZE; + decor |= GDK_DECOR_RESIZEH; + decor |= GDK_DECOR_BORDER; + } + + gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor); gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func); diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index fc6e7041ff..685411ea48 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -133,26 +133,31 @@ gtk_dialog_map_callback( GtkWidget *widget, wxDialog *win ) /* all this is for Motif Window Manager "hints" and is supposed to be recognized by other WM as well. not tested. */ - long decor = (long) GDK_DECOR_ALL; - long func = (long) GDK_FUNC_ALL; + long decor = (long) GDK_DECOR_BORDER ; + long func = (long) GDK_FUNC_MOVE ; - if ((win->m_windowStyle & wxCAPTION) == 0) + if ((win->m_windowStyle & wxCAPTION) != 0) decor |= GDK_DECOR_TITLE; - if ((win->m_windowStyle & wxSYSTEM_MENU) == 0) - decor |= GDK_DECOR_MENU; - if ((win->m_windowStyle & wxMINIMIZE_BOX) == 0) + if ((win->m_windowStyle & wxSYSTEM_MENU) != 0) + { + decor |= GDK_DECOR_MENU; + func |= GDK_FUNC_CLOSE; + } + if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0) { func |= GDK_FUNC_MINIMIZE; decor |= GDK_DECOR_MINIMIZE; } - if ((win->m_windowStyle & wxMAXIMIZE_BOX) == 0) + if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0) { decor |= GDK_DECOR_MAXIMIZE; func |= GDK_FUNC_MAXIMIZE; } - if ((win->m_windowStyle & wxRESIZE_BORDER) == 0) - func |= GDK_FUNC_RESIZE; - + if ((win->m_windowStyle & 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); diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index fdb231157e..044bce6f8c 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -191,26 +191,36 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) /* all this is for Motif Window Manager "hints" and is supposed to be recognized by other WM as well. not tested. */ - long decor = (long) GDK_DECOR_ALL; - long func = (long) GDK_FUNC_ALL; + long decor = (long) 0; + long func = (long) GDK_FUNC_MOVE|GDK_FUNC_CLOSE; - if ((win->m_windowStyle & wxCAPTION) == 0) + if ((win->m_windowStyle & wxCAPTION) != 0) decor |= GDK_DECOR_TITLE; - if ((win->m_windowStyle & wxSYSTEM_MENU) == 0) - decor |= GDK_DECOR_MENU; - if ((win->m_windowStyle & wxMINIMIZE_BOX) == 0) + if ((win->m_windowStyle & wxSYSTEM_MENU) != 0) + { + decor |= GDK_DECOR_MENU; + func |= GDK_FUNC_CLOSE; + } + if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0) { func |= GDK_FUNC_MINIMIZE; decor |= GDK_DECOR_MINIMIZE; + decor |= GDK_DECOR_BORDER; } - if ((win->m_windowStyle & wxMAXIMIZE_BOX) == 0) + if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0) { func |= GDK_FUNC_MAXIMIZE; decor |= GDK_DECOR_MAXIMIZE; + decor |= GDK_DECOR_BORDER; } - if ((win->m_windowStyle & wxRESIZE_BORDER) == 0) - func |= GDK_FUNC_RESIZE; - + if ((win->m_windowStyle & wxRESIZE_BORDER) != 0) + { + func |= GDK_FUNC_RESIZE; + decor |= GDK_DECOR_RESIZEH; + decor |= GDK_DECOR_BORDER; + } + + gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor); gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);