]> git.saurik.com Git - wxWidgets.git/blob - src/x11/toplevel.cpp
d1a58623b7305e0bd93258a6d04d92db14aa25d1
[wxWidgets.git] / src / x11 / toplevel.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: x11/toplevel.cpp
3 // Purpose: implements wxTopLevelWindow for X11
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 24.09.01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2002 Julian Smart
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "toplevel.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include "wx/app.h"
33 #include "wx/toplevel.h"
34 #include "wx/string.h"
35 #include "wx/log.h"
36 #include "wx/intl.h"
37 #include "wx/frame.h"
38 #include "wx/menu.h"
39 #include "wx/statusbr.h"
40 #endif //WX_PRECOMP
41
42 #include "wx/settings.h"
43 #include "wx/x11/private.h"
44 #include "X11/Xutil.h"
45
46 #include "wx/unix/utilsx11.h"
47
48 bool wxMWMIsRunning(Window w);
49
50 // ----------------------------------------------------------------------------
51 // wxTopLevelWindowX11 creation
52 // ----------------------------------------------------------------------------
53
54 void wxTopLevelWindowX11::Init()
55 {
56 m_iconized =
57 m_maximizeOnShow = FALSE;
58
59 // unlike (almost?) all other windows, frames are created hidden
60 m_isShown = FALSE;
61
62 // Data to save/restore when calling ShowFullScreen
63 m_fsStyle = 0;
64 m_fsIsMaximized = FALSE;
65 m_fsIsShowing = FALSE;
66
67 m_needResizeInIdle = FALSE;
68
69 m_x = -1;
70 m_y = -1;
71 m_width = 20;
72 m_height = 20;
73 }
74
75 bool wxTopLevelWindowX11::Create(wxWindow *parent,
76 wxWindowID id,
77 const wxString& title,
78 const wxPoint& pos,
79 const wxSize& size,
80 long style,
81 const wxString& name)
82 {
83 // init our fields
84 Init();
85
86 m_windowStyle = style;
87 m_parent = parent;
88
89 SetName(name);
90
91 m_windowId = id == -1 ? NewControlId() : id;
92
93 if (parent)
94 parent->AddChild(this);
95
96 wxTopLevelWindows.Append(this);
97
98 Display *xdisplay = wxGlobalDisplay();
99 int xscreen = DefaultScreen( xdisplay );
100 Visual *xvisual = DefaultVisual( xdisplay, xscreen );
101 Window xparent = RootWindow( xdisplay, xscreen );
102 Colormap cm = DefaultColormap( xdisplay, xscreen );
103
104 if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
105 m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
106 else
107 m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
108 m_backgroundColour.CalcPixel( (WXColormap) cm );
109 m_hasBgCol = TRUE;
110
111 m_x = pos.x;
112 if (m_x < -1)
113 m_x = 10;
114
115 m_y = pos.y;
116 if (m_y < 0)
117 m_y = 10;
118
119 m_width = size.x;
120 if (m_width < 0)
121 m_width = 500;
122
123 m_height = size.y;
124 if (m_height < 0)
125 m_height = 380;
126
127 #if !wxUSE_NANOX
128 XSetWindowAttributes xattributes;
129
130 long xattributes_mask =
131 CWBorderPixel | CWBackPixel;
132
133 xattributes.background_pixel = m_backgroundColour.GetPixel();
134 xattributes.border_pixel = BlackPixel( xdisplay, xscreen );
135
136 if (HasFlag( wxNO_BORDER ))
137 {
138 xattributes_mask |= CWOverrideRedirect;
139 xattributes.override_redirect = True;
140 }
141
142 if (HasFlag( wxNO_FULL_REPAINT_ON_RESIZE ))
143 {
144 xattributes_mask |= CWBitGravity;
145 xattributes.bit_gravity = NorthWestGravity;
146 }
147
148 xattributes_mask |= CWEventMask;
149 xattributes.event_mask =
150 ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
151 ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
152 KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
153 PropertyChangeMask;
154
155 Window xwindow = XCreateWindow( xdisplay, xparent, m_x, m_y, m_width, m_height,
156 0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
157 #else
158 long backColor, foreColor;
159 backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
160 foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
161
162 Window xwindow = XCreateWindowWithColor( xdisplay, xparent, m_x, m_y, m_width, m_height,
163 0, 0, InputOutput, xvisual, backColor, foreColor);
164 #endif
165
166 m_mainWindow = (WXWindow) xwindow;
167 m_clientWindow = (WXWindow) xwindow;
168 wxAddWindowToTable( xwindow, (wxWindow*) this );
169
170 #if wxUSE_NANOX
171 XSelectInput( xdisplay, xwindow,
172 GR_EVENT_MASK_CLOSE_REQ |
173 ExposureMask |
174 KeyPressMask |
175 KeyReleaseMask |
176 ButtonPressMask |
177 ButtonReleaseMask |
178 ButtonMotionMask |
179 EnterWindowMask |
180 LeaveWindowMask |
181 PointerMotionMask |
182 KeymapStateMask |
183 FocusChangeMask |
184 ColormapChangeMask |
185 StructureNotifyMask |
186 PropertyChangeMask
187 );
188 #endif
189
190 // Set background to None which will prevent X11 from clearing the
191 // background completely.
192 XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
193
194 #if !wxUSE_NANOX
195 if (HasFlag( wxSTAY_ON_TOP ))
196 {
197 Window xroot = RootWindow( xdisplay, xscreen );
198 XSetTransientForHint( xdisplay, xwindow, xroot );
199 }
200 else
201 {
202 if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
203 {
204 if (GetParent() && GetParent()->GetMainWindow())
205 {
206 Window xparentwindow = (Window) GetParent()->GetMainWindow();
207 XSetTransientForHint( xdisplay, xwindow, xparentwindow );
208 }
209 }
210 }
211
212 XSizeHints size_hints;
213 size_hints.flags = PSize | PPosition | PWinGravity;
214 size_hints.x = m_x;
215 size_hints.y = m_y;
216 size_hints.width = m_width;
217 size_hints.height = m_height;
218 size_hints.win_gravity = NorthWestGravity;
219 XSetWMNormalHints( xdisplay, xwindow, &size_hints);
220
221 XWMHints wm_hints;
222 wm_hints.flags = InputHint | StateHint;
223 if (GetParent())
224 {
225 wm_hints.flags |= WindowGroupHint;
226 wm_hints.window_group = (Window) GetParent()->GetMainWindow();
227 }
228 wm_hints.input = True;
229 wm_hints.initial_state = NormalState;
230 XSetWMHints( xdisplay, xwindow, &wm_hints);
231
232 Atom wm_protocols[2];
233 wm_protocols[0] = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False );
234 wm_protocols[1] = XInternAtom( xdisplay, "WM_TAKE_FOCUS", False );
235 XSetWMProtocols( xdisplay, xwindow, wm_protocols, 2);
236
237 #endif
238
239 wxSetWMDecorations( xwindow, style);
240
241 SetTitle(title);
242
243 return TRUE;
244 }
245
246 wxTopLevelWindowX11::~wxTopLevelWindowX11()
247 {
248 wxTopLevelWindows.DeleteObject(this);
249
250 // If this is the last top-level window, exit.
251 if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
252 {
253 wxTheApp->SetTopWindow(NULL);
254
255 if (wxTheApp->GetExitOnFrameDelete())
256 {
257 // Signal to the app that we're going to close
258 wxTheApp->ExitMainLoop();
259 }
260 }
261 }
262
263 void wxTopLevelWindowX11::OnInternalIdle()
264 {
265 wxWindow::OnInternalIdle();
266
267 if (m_needResizeInIdle)
268 {
269 wxSizeEvent event( GetClientSize(), GetId() );
270 event.SetEventObject( this );
271 GetEventHandler()->ProcessEvent( event );
272
273 m_needResizeInIdle = FALSE;
274 }
275 }
276
277 // ----------------------------------------------------------------------------
278 // wxTopLevelWindowX11 showing
279 // ----------------------------------------------------------------------------
280
281 bool wxTopLevelWindowX11::Show(bool show)
282 {
283 // Nano-X has to force a size event,
284 // else there's no initial size.
285 #if wxUSE_NANOX
286 if (show)
287 #else
288 if (show && m_needResizeInIdle)
289 #endif
290 {
291 wxSizeEvent event(GetSize(), GetId());
292 event.SetEventObject(this);
293 GetEventHandler()->ProcessEvent(event);
294
295 m_needResizeInIdle = FALSE;
296 }
297 if (show)
298 {
299 // This does the layout _before_ the
300 // window is shown, else the items are
301 // drawn first at the wrong positions,
302 // then at the correct positions.
303 if (GetAutoLayout())
304 {
305 Layout();
306 }
307 }
308
309 bool ret = wxWindowX11::Show(show);
310
311 return ret;
312 }
313
314 // ----------------------------------------------------------------------------
315 // wxTopLevelWindowX11 maximize/minimize
316 // ----------------------------------------------------------------------------
317
318 void wxTopLevelWindowX11::Maximize(bool maximize)
319 {
320 // TODO
321 }
322
323 bool wxTopLevelWindowX11::IsMaximized() const
324 {
325 // TODO
326 return TRUE;
327 }
328
329 void wxTopLevelWindowX11::Iconize(bool iconize)
330 {
331 if (!m_iconized && GetMainWindow())
332 {
333 if (XIconifyWindow(wxGlobalDisplay(),
334 (Window) GetMainWindow(), DefaultScreen(wxGlobalDisplay())) != 0)
335 m_iconized = TRUE;
336 }
337 }
338
339 bool wxTopLevelWindowX11::IsIconized() const
340 {
341 return m_iconized;
342 }
343
344 void wxTopLevelWindowX11::Restore()
345 {
346 // This is the way to deiconify the window, according to the X FAQ
347 if (m_iconized && GetMainWindow())
348 {
349 XMapWindow(wxGlobalDisplay(), (Window) GetMainWindow());
350 m_iconized = FALSE;
351 }
352 }
353
354 // ----------------------------------------------------------------------------
355 // wxTopLevelWindowX11 fullscreen
356 // ----------------------------------------------------------------------------
357
358 bool wxTopLevelWindowX11::ShowFullScreen(bool show, long style)
359 {
360 if (show)
361 {
362 if (IsFullScreen())
363 return FALSE;
364
365 m_fsIsShowing = TRUE;
366 m_fsStyle = style;
367
368 // TODO
369
370 return TRUE;
371 }
372 else
373 {
374 if (!IsFullScreen())
375 return FALSE;
376
377 m_fsIsShowing = FALSE;
378
379 // TODO
380 return TRUE;
381 }
382 }
383
384 // ----------------------------------------------------------------------------
385 // wxTopLevelWindowX11 misc
386 // ----------------------------------------------------------------------------
387
388 void wxTopLevelWindowX11::DoSetIcon(const wxIcon& icon)
389 {
390 if (icon.Ok() && GetMainWindow())
391 {
392 #if wxUSE_NANOX
393 #else
394 XWMHints *wmHints = XAllocWMHints();
395 wmHints->icon_pixmap = (Pixmap) icon.GetPixmap();
396
397 wmHints->flags = IconPixmapHint;
398
399 if (icon.GetMask())
400 {
401 wmHints->flags |= IconMaskHint;
402 wmHints->icon_mask = (Pixmap) icon.GetMask()->GetBitmap();
403 }
404
405 XSetWMHints(wxGlobalDisplay(), (Window) GetMainWindow(), wmHints);
406 XFree(wmHints);
407 #endif
408 }
409 }
410
411 void wxTopLevelWindowX11::SetIcons(const wxIconBundle& icons )
412 {
413 // this sets m_icon
414 wxTopLevelWindowBase::SetIcons( icons );
415
416 DoSetIcon( icons.GetIcon( -1 ) );
417 wxSetIconsX11( wxGlobalDisplay(), GetMainWindow(), icons );
418 }
419
420 void wxTopLevelWindowX11::SetTitle(const wxString& title)
421 {
422 m_title = title;
423
424 if (GetMainWindow())
425 {
426 XStoreName(wxGlobalDisplay(), (Window) GetMainWindow(),
427 (const char*) title);
428 XSetIconName(wxGlobalDisplay(), (Window) GetMainWindow(),
429 (const char*) title);
430 }
431 }
432
433 wxString wxTopLevelWindowX11::GetTitle() const
434 {
435 return m_title;
436 }
437
438 // For implementation purposes - sometimes decorations make the client area
439 // smaller
440 wxPoint wxTopLevelWindowX11::GetClientAreaOrigin() const
441 {
442 // wxFrame::GetClientAreaOrigin
443 // does the required calculation already.
444 return wxPoint(0, 0);
445 }
446
447 void wxTopLevelWindowX11::DoGetClientSize( int *width, int *height ) const
448 {
449 if (width)
450 *width = m_width;
451 if (height)
452 *height = m_height;
453 }
454
455 void wxTopLevelWindowX11::DoSetClientSize(int width, int height)
456 {
457 // wxLogDebug("DoSetClientSize: %s (%ld) %dx%d", GetClassInfo()->GetClassName(), GetId(), width, height);
458
459 m_width = width;
460 m_height = height;
461
462 #if !wxUSE_NANOX
463 XSizeHints size_hints;
464 size_hints.flags = PSize;
465 size_hints.width = width;
466 size_hints.height = height;
467 XSetWMNormalHints( wxGlobalDisplay(), (Window) GetMainWindow(), &size_hints );
468 #endif
469
470 wxWindowX11::DoSetClientSize(width, height);
471 }
472
473 void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
474 {
475 // wxLogDebug("DoSetSize: %s (%ld) %d, %d %dx%d", GetClassInfo()->GetClassName(), GetId(), x, y, width, height);
476
477 if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
478 m_x = x;
479
480 if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
481 m_y = y;
482
483 if (width != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
484 m_width = width;
485
486 if (height != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
487 m_height = height;
488
489 #if !wxUSE_NANOX
490 XSizeHints size_hints;
491 size_hints.flags = 0;
492 size_hints.flags |= PPosition;
493 size_hints.flags |= PSize;
494 size_hints.x = m_x;
495 size_hints.y = m_y;
496 size_hints.width = m_width;
497 size_hints.height = m_height;
498 XSetWMNormalHints( wxGlobalDisplay(), (Window) GetMainWindow(), &size_hints);
499 #endif
500
501 wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
502
503 #if 0
504 Display *display = wxGlobalDisplay();
505 Window root = RootWindowOfScreen(DefaultScreenOfDisplay(display));
506 Window parent_window = window,
507 next_parent = window;
508
509 // search for the parent that is child of ROOT, because the WM may
510 // reparent twice and notify only the next parent (like FVWM)
511 while (next_parent != root) {
512 Window *theChildren;
513 #if wxUSE_NANOX
514 GR_COUNT n;
515 #else
516 unsigned int n;
517 #endif
518 parent_window = next_parent;
519 XQueryTree(display, parent_window, &root,
520 &next_parent, &theChildren, &n);
521 XFree(theChildren); // not needed
522 }
523
524 XWindowChanges windowChanges;
525 windowChanges.x = x;
526 windowChanges.y = y;
527 windowChanges.width = width;
528 windowChanges.height = height;
529 windowChanges.stack_mode = 0;
530 int valueMask = CWX | CWY | CWWidth | CWHeight;
531
532 if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
533 {
534 valueMask |= CWX;
535 }
536 if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
537 {
538 valueMask |= CWY;
539 }
540 if (width != -1)
541 {
542 windowChanges.width = wxMax(1, width);
543 valueMask |= CWWidth;
544 }
545 if (height != -1)
546 {
547 windowChanges.height = wxMax(1, height);
548 valueMask |= CWHeight;
549 }
550
551 XConfigureWindow( display, parent_window, valueMask, &windowChanges );
552 #endif
553 }
554
555 void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
556 {
557 XSync(wxGlobalDisplay(), False);
558 Window window = (Window) m_mainWindow;
559 if (!window)
560 return ;
561
562 Display *display = wxGlobalDisplay();
563 Window root = RootWindowOfScreen(DefaultScreenOfDisplay(display));
564 Window parent_window = window,
565 next_parent = window;
566
567 // search for the parent that is child of ROOT, because the WM may
568 // reparent twice and notify only the next parent (like FVWM)
569 while (next_parent != root) {
570 Window *theChildren;
571 #if wxUSE_NANOX
572 GR_COUNT n;
573 #else
574 unsigned int n;
575 #endif
576 parent_window = next_parent;
577 XQueryTree(display, parent_window, &root,
578 &next_parent, &theChildren, &n);
579 XFree(theChildren); // not needed
580 }
581 #if 0
582 int xx, yy; unsigned int dummy;
583 XGetGeometry(display, parent_window, &root,
584 &xx, &yy, &dummy, &dummy, &dummy, &dummy);
585 if (x) *x = xx;
586 if (y) *y = yy;
587 #else
588 XWindowAttributes attr;
589 Status status = XGetWindowAttributes( wxGlobalDisplay(), parent_window, & attr);
590 if (status)
591 {
592 if (x) *x = attr.x;
593 if (y) *y = attr.y;
594 }
595 else
596 {
597 if (x) *x = 0;
598 if (y) *y = 0;
599 }
600 #endif
601 }
602
603
604 #ifndef MWM_DECOR_BORDER
605
606 #define MWM_HINTS_FUNCTIONS (1L << 0)
607 #define MWM_HINTS_DECORATIONS (1L << 1)
608 #define MWM_HINTS_INPUT_MODE (1L << 2)
609 #define MWM_HINTS_STATUS (1L << 3)
610
611 #define MWM_DECOR_ALL (1L << 0)
612 #define MWM_DECOR_BORDER (1L << 1)
613 #define MWM_DECOR_RESIZEH (1L << 2)
614 #define MWM_DECOR_TITLE (1L << 3)
615 #define MWM_DECOR_MENU (1L << 4)
616 #define MWM_DECOR_MINIMIZE (1L << 5)
617 #define MWM_DECOR_MAXIMIZE (1L << 6)
618
619 #define MWM_FUNC_ALL (1L << 0)
620 #define MWM_FUNC_RESIZE (1L << 1)
621 #define MWM_FUNC_MOVE (1L << 2)
622 #define MWM_FUNC_MINIMIZE (1L << 3)
623 #define MWM_FUNC_MAXIMIZE (1L << 4)
624 #define MWM_FUNC_CLOSE (1L << 5)
625
626 #define MWM_INPUT_MODELESS 0
627 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
628 #define MWM_INPUT_SYSTEM_MODAL 2
629 #define MWM_INPUT_FULL_APPLICATION_MODAL 3
630 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
631
632 #define MWM_TEAROFF_WINDOW (1L<<0)
633
634 #endif
635
636 struct MwmHints {
637 long flags;
638 long functions;
639 long decorations;
640 long input_mode;
641 };
642
643 #define PROP_MOTIF_WM_HINTS_ELEMENTS 5
644
645 // Set the window manager decorations according to the
646 // given wxWindows style
647 bool wxSetWMDecorations(Window w, long style)
648 {
649 #if wxUSE_NANOX
650 GR_WM_PROPERTIES wmProp;
651
652 wmProp.flags = 0;
653 wmProp.props = 0;
654
655 if (style & wxRESIZE_BORDER)
656 {
657 wmProp.props |= GR_WM_PROPS_APPFRAME ;
658 wmProp.flags |= GR_WM_FLAGS_PROPS ;
659 }
660
661 if (style & wxSYSTEM_MENU)
662 {
663 wmProp.props |= GR_WM_PROPS_CLOSEBOX ;
664 wmProp.flags |= GR_WM_FLAGS_PROPS ;
665 }
666
667 if ((style & wxCAPTION) ||
668 (style & wxTINY_CAPTION_HORIZ) ||
669 (style & wxTINY_CAPTION_VERT))
670 {
671 wmProp.props |= GR_WM_PROPS_CAPTION ;
672 wmProp.flags |= GR_WM_FLAGS_PROPS ;
673
674 // The default dialog style doesn't include any kind
675 // of border, which is a bit odd. Anyway, inclusion
676 // of a caption surely implies a border.
677 style |= wxTHICK_FRAME;
678 }
679
680 if (style & wxTHICK_FRAME)
681 {
682 wmProp.props |= GR_WM_PROPS_APPFRAME ;
683 wmProp.flags |= GR_WM_FLAGS_PROPS ;
684 }
685
686 if (style & wxSIMPLE_BORDER)
687 {
688 wmProp.props |= GR_WM_PROPS_BORDER ;
689 wmProp.flags |= GR_WM_FLAGS_PROPS ;
690 }
691
692 if (style & wxMINIMIZE_BOX)
693 {
694 }
695
696 if (style & wxMAXIMIZE_BOX)
697 {
698 wmProp.props |= GR_WM_PROPS_MAXIMIZE ;
699 wmProp.flags |= GR_WM_FLAGS_PROPS ;
700 }
701
702 if (((style & wxBORDER) != wxBORDER) && ((style & wxTHICK_FRAME) != wxTHICK_FRAME)
703 && ((style & wxRESIZE_BORDER) != wxRESIZE_BORDER))
704 {
705 wmProp.props |= GR_WM_PROPS_NODECORATE ;
706 wmProp.flags |= GR_WM_FLAGS_PROPS ;
707 }
708
709 GrSetWMProperties(w, & wmProp);
710
711 #else
712
713 Atom mwm_wm_hints = XInternAtom(wxGlobalDisplay(),"_MOTIF_WM_HINTS", False);
714 if (mwm_wm_hints == 0)
715 return FALSE;
716
717 MwmHints hints;
718 hints.flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS;
719 hints.decorations = 0;
720 hints.functions = 0;
721
722 if ((style & wxSIMPLE_BORDER) || (style & wxNO_BORDER))
723 {
724 // leave zeros
725 }
726 else
727 {
728 hints.decorations = MWM_DECOR_BORDER;
729 hints.functions = MWM_FUNC_MOVE;
730
731 if ((style & wxCAPTION) != 0)
732 hints.decorations |= MWM_DECOR_TITLE;
733
734 if ((style & wxSYSTEM_MENU) != 0)
735 {
736 hints.functions |= MWM_FUNC_CLOSE;
737 hints.decorations |= MWM_DECOR_MENU;
738 }
739
740 if ((style & wxMINIMIZE_BOX) != 0)
741 {
742 hints.functions |= MWM_FUNC_MINIMIZE;
743 hints.decorations |= MWM_DECOR_MINIMIZE;
744 }
745
746 if ((style & wxMAXIMIZE_BOX) != 0)
747 {
748 hints.functions |= MWM_FUNC_MAXIMIZE;
749 hints.decorations |= MWM_DECOR_MAXIMIZE;
750 }
751
752 if ((style & wxRESIZE_BORDER) != 0)
753 {
754 hints.functions |= MWM_FUNC_RESIZE;
755 hints.decorations |= MWM_DECOR_RESIZEH;
756 }
757 }
758
759 XChangeProperty(wxGlobalDisplay(),
760 w,
761 mwm_wm_hints, mwm_wm_hints,
762 32, PropModeReplace,
763 (unsigned char *) &hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
764
765 #endif
766 return TRUE;
767 }
768
769