1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "window.h"
27 #include "wx/dcclient.h"
31 #include "wx/layout.h"
32 #include "wx/dialog.h"
33 #include "wx/listbox.h"
34 #include "wx/button.h"
35 #include "wx/settings.h"
36 #include "wx/msgdlg.h"
38 #include "wx/scrolwin.h"
39 #include "wx/scrolbar.h"
40 #include "wx/module.h"
41 #include "wx/menuitem.h"
43 #include "wx/fontutil.h"
44 #include "wx/univ/renderer.h"
47 #if wxUSE_DRAG_AND_DROP
51 #include "wx/x11/private.h"
52 #include "X11/Xutil.h"
55 // For wxGetLocalTime, used by XButtonEventGetTime
61 // ----------------------------------------------------------------------------
62 // global variables for this module
63 // ----------------------------------------------------------------------------
65 static wxWindow
* g_captureWindow
= NULL
;
68 // ----------------------------------------------------------------------------
70 // ----------------------------------------------------------------------------
72 #define event_left_is_down(x) ((x)->xbutton.state & Button1Mask)
73 #define event_middle_is_down(x) ((x)->xbutton.state & Button2Mask)
74 #define event_right_is_down(x) ((x)->xbutton.state & Button3Mask)
76 // ----------------------------------------------------------------------------
78 // ----------------------------------------------------------------------------
80 IMPLEMENT_ABSTRACT_CLASS(wxWindowX11
, wxWindowBase
)
82 BEGIN_EVENT_TABLE(wxWindowX11
, wxWindowBase
)
83 EVT_SYS_COLOUR_CHANGED(wxWindowX11::OnSysColourChanged
)
86 // ============================================================================
88 // ============================================================================
90 // ----------------------------------------------------------------------------
92 // ----------------------------------------------------------------------------
94 // ----------------------------------------------------------------------------
96 // ----------------------------------------------------------------------------
98 void wxWindowX11::Init()
101 m_mainWindow
= (WXWindow
) 0;
102 m_clientWindow
= (WXWindow
) 0;
103 m_insertIntoMain
= FALSE
;
104 m_updateNcArea
= FALSE
;
106 m_winCaptured
= FALSE
;
107 m_needsInputFocus
= FALSE
;
113 // real construction (Init() must have been called before!)
114 bool wxWindowX11::Create(wxWindow
*parent
, wxWindowID id
,
118 const wxString
& name
)
120 wxCHECK_MSG( parent
, FALSE
, wxT("can't create wxWindow without parent") );
122 CreateBase(parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
);
124 parent
->AddChild(this);
126 Display
*xdisplay
= (Display
*) wxGlobalDisplay();
127 int xscreen
= DefaultScreen( xdisplay
);
128 Visual
*xvisual
= DefaultVisual( xdisplay
, xscreen
);
129 Colormap cm
= DefaultColormap( xdisplay
, xscreen
);
131 m_backgroundColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
132 m_backgroundColour
.CalcPixel( (WXColormap
) cm
);
134 m_foregroundColour
= *wxBLACK
;
135 m_foregroundColour
.CalcPixel( (WXColormap
) cm
);
137 Window xparent
= (Window
) parent
->GetClientAreaWindow();
139 // Add window's own scrollbars to main window, not to client window
140 if (parent
->GetInsertIntoMain())
142 // wxLogDebug( "Inserted into main: %s", GetName().c_str() );
143 xparent
= (Window
) parent
->GetMainWindow();
146 // Size (not including the border) must be nonzero (or a Value error results)!
147 // Note: The Xlib manual doesn't mention this restriction of XCreateWindow.
160 #if wxUSE_TWO_WINDOWS
161 bool need_two_windows
=
162 ((( wxSUNKEN_BORDER
| wxRAISED_BORDER
| wxSIMPLE_BORDER
| wxHSCROLL
| wxVSCROLL
) & m_windowStyle
) != 0);
164 bool need_two_windows
= FALSE
;
168 long xattributes
= 0;
170 XSetWindowAttributes xattributes
;
171 long xattributes_mask
= 0;
173 xattributes_mask
|= CWBackPixel
;
174 xattributes
.background_pixel
= m_backgroundColour
.GetPixel();
176 xattributes_mask
|= CWBorderPixel
;
177 xattributes
.border_pixel
= BlackPixel( xdisplay
, xscreen
);
179 xattributes_mask
|= CWEventMask
;
182 if (need_two_windows
)
185 long backColor
, foreColor
;
186 backColor
= GR_RGB(m_backgroundColour
.Red(), m_backgroundColour
.Green(), m_backgroundColour
.Blue());
187 foreColor
= GR_RGB(m_foregroundColour
.Red(), m_foregroundColour
.Green(), m_foregroundColour
.Blue());
189 Window xwindow
= XCreateWindowWithColor( xdisplay
, xparent
, pos2
.x
, pos2
.y
, size2
.x
, size2
.y
,
190 0, 0, InputOutput
, xvisual
, backColor
, foreColor
);
191 XSelectInput( xdisplay
, xwindow
,
192 GR_EVENT_MASK_CLOSE_REQ
| ExposureMask
| KeyPressMask
| KeyReleaseMask
| ButtonPressMask
| ButtonReleaseMask
|
193 ButtonMotionMask
| EnterWindowMask
| LeaveWindowMask
| PointerMotionMask
|
194 KeymapStateMask
| FocusChangeMask
| ColormapChangeMask
| StructureNotifyMask
|
195 PropertyChangeMask
);
199 xattributes
.event_mask
=
200 ExposureMask
| StructureNotifyMask
| ColormapChangeMask
;
202 Window xwindow
= XCreateWindow( xdisplay
, xparent
, pos2
.x
, pos2
.y
, size2
.x
, size2
.y
,
203 0, DefaultDepth(xdisplay
,xscreen
), InputOutput
, xvisual
, xattributes_mask
, &xattributes
);
207 XSetWindowBackgroundPixmap( xdisplay
, xwindow
, None
);
209 m_mainWindow
= (WXWindow
) xwindow
;
210 wxAddWindowToTable( xwindow
, (wxWindow
*) this );
212 XMapWindow( xdisplay
, xwindow
);
215 xattributes
.event_mask
=
216 ExposureMask
| KeyPressMask
| KeyReleaseMask
| ButtonPressMask
| ButtonReleaseMask
|
217 ButtonMotionMask
| EnterWindowMask
| LeaveWindowMask
| PointerMotionMask
|
218 KeymapStateMask
| FocusChangeMask
| ColormapChangeMask
| StructureNotifyMask
|
219 PropertyChangeMask
| VisibilityChangeMask
;
221 if (!HasFlag( wxFULL_REPAINT_ON_RESIZE
))
223 xattributes_mask
|= CWBitGravity
;
224 xattributes
.bit_gravity
= StaticGravity
;
228 if (HasFlag( wxSUNKEN_BORDER
) || HasFlag( wxRAISED_BORDER
))
235 else if (HasFlag( wxSIMPLE_BORDER
))
248 // Make again sure the size is nonzero.
255 backColor
= GR_RGB(m_backgroundColour
.Red(), m_backgroundColour
.Green(), m_backgroundColour
.Blue());
256 foreColor
= GR_RGB(m_foregroundColour
.Red(), m_foregroundColour
.Green(), m_foregroundColour
.Blue());
258 xwindow
= XCreateWindowWithColor( xdisplay
, xwindow
, pos2
.x
, pos2
.y
, size2
.x
, size2
.y
,
259 0, 0, InputOutput
, xvisual
, backColor
, foreColor
);
260 XSelectInput( xdisplay
, xwindow
,
261 GR_EVENT_MASK_CLOSE_REQ
| ExposureMask
| KeyPressMask
| KeyReleaseMask
| ButtonPressMask
| ButtonReleaseMask
|
262 ButtonMotionMask
| EnterWindowMask
| LeaveWindowMask
| PointerMotionMask
|
263 KeymapStateMask
| FocusChangeMask
| ColormapChangeMask
| StructureNotifyMask
|
264 PropertyChangeMask
);
267 xwindow
= XCreateWindow( xdisplay
, xwindow
, pos2
.x
, pos2
.y
, size2
.x
, size2
.y
,
268 0, DefaultDepth(xdisplay
,xscreen
), InputOutput
, xvisual
, xattributes_mask
, &xattributes
);
271 XSetWindowBackgroundPixmap( xdisplay
, xwindow
, None
);
273 m_clientWindow
= (WXWindow
) xwindow
;
274 wxAddClientWindowToTable( xwindow
, (wxWindow
*) this );
276 XMapWindow( xdisplay
, xwindow
);
280 // wxLogDebug( "No two windows needed %s", GetName().c_str() );
282 long backColor
, foreColor
;
283 backColor
= GR_RGB(m_backgroundColour
.Red(), m_backgroundColour
.Green(), m_backgroundColour
.Blue());
284 foreColor
= GR_RGB(m_foregroundColour
.Red(), m_foregroundColour
.Green(), m_foregroundColour
.Blue());
286 Window xwindow
= XCreateWindowWithColor( xdisplay
, xparent
, pos2
.x
, pos2
.y
, size2
.x
, size2
.y
,
287 0, 0, InputOutput
, xvisual
, backColor
, foreColor
);
288 XSelectInput( xdisplay
, xwindow
,
289 GR_EVENT_MASK_CLOSE_REQ
| ExposureMask
| KeyPressMask
| KeyReleaseMask
| ButtonPressMask
| ButtonReleaseMask
|
290 ButtonMotionMask
| EnterWindowMask
| LeaveWindowMask
| PointerMotionMask
|
291 KeymapStateMask
| FocusChangeMask
| ColormapChangeMask
| StructureNotifyMask
|
292 PropertyChangeMask
);
295 xattributes
.event_mask
=
296 ExposureMask
| KeyPressMask
| KeyReleaseMask
| ButtonPressMask
| ButtonReleaseMask
|
297 ButtonMotionMask
| EnterWindowMask
| LeaveWindowMask
| PointerMotionMask
|
298 KeymapStateMask
| FocusChangeMask
| ColormapChangeMask
| StructureNotifyMask
|
299 PropertyChangeMask
| VisibilityChangeMask
;
301 if (!HasFlag( wxFULL_REPAINT_ON_RESIZE
))
303 xattributes_mask
|= CWBitGravity
;
304 xattributes
.bit_gravity
= NorthWestGravity
;
307 Window xwindow
= XCreateWindow( xdisplay
, xparent
, pos2
.x
, pos2
.y
, size2
.x
, size2
.y
,
308 0, DefaultDepth(xdisplay
,xscreen
), InputOutput
, xvisual
, xattributes_mask
, &xattributes
);
311 XSetWindowBackgroundPixmap( xdisplay
, xwindow
, None
);
313 m_mainWindow
= (WXWindow
) xwindow
;
314 m_clientWindow
= m_mainWindow
;
315 wxAddWindowToTable( xwindow
, (wxWindow
*) this );
317 XMapWindow( xdisplay
, xwindow
);
320 // Is a subwindow, so map immediately
323 // Without this, the cursor may not be restored properly (e.g. in splitter
325 SetCursor(*wxSTANDARD_CURSOR
);
326 SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
));
328 // Don't call this, it can have nasty repercussions for composite controls,
330 // SetSize(pos.x, pos.y, size.x, size.y);
336 wxWindowX11::~wxWindowX11()
340 if (g_captureWindow
== this)
341 g_captureWindow
= NULL
;
343 m_isBeingDeleted
= TRUE
;
347 if (m_clientWindow
!= m_mainWindow
)
349 // Destroy the cleint window
350 Window xwindow
= (Window
) m_clientWindow
;
351 wxDeleteClientWindowFromTable( xwindow
);
352 XDestroyWindow( wxGlobalDisplay(), xwindow
);
353 m_clientWindow
= NULL
;
356 // Destroy the window
357 Window xwindow
= (Window
) m_mainWindow
;
358 wxDeleteWindowFromTable( xwindow
);
359 XDestroyWindow( wxGlobalDisplay(), xwindow
);
363 // ---------------------------------------------------------------------------
365 // ---------------------------------------------------------------------------
367 void wxWindowX11::SetFocus()
369 Window xwindow
= (Window
) m_clientWindow
;
371 wxCHECK_RET( xwindow
, wxT("invalid window") );
373 // Don't assert; we might be trying to set the focus for a panel
374 // with only static controls, so the panel returns false from AcceptsFocus.
375 // The app should be not be expected to deal with this.
380 if (GetName() == "scrollBar")
387 if (wxWindowIsVisible(xwindow
))
389 wxLogTrace( _T("focus"), _T("wxWindowX11::SetFocus: %s"), GetClassInfo()->GetClassName());
390 // XSetInputFocus( wxGlobalDisplay(), xwindow, RevertToParent, CurrentTime );
391 XSetInputFocus( wxGlobalDisplay(), xwindow
, RevertToNone
, CurrentTime
);
392 m_needsInputFocus
= FALSE
;
396 m_needsInputFocus
= TRUE
;
400 // Get the window with the focus
401 wxWindow
*wxWindowBase::DoFindFocus()
403 Window xfocus
= (Window
) 0;
406 XGetInputFocus( wxGlobalDisplay(), &xfocus
, &revert
);
409 wxWindow
*win
= wxGetWindowFromTable( xfocus
);
412 win
= wxGetClientWindowFromTable( xfocus
);
421 // Enabling/disabling handled by event loop, and not sending events
423 bool wxWindowX11::Enable(bool enable
)
425 if ( !wxWindowBase::Enable(enable
) )
431 bool wxWindowX11::Show(bool show
)
433 wxWindowBase::Show(show
);
435 Window xwindow
= (Window
) m_mainWindow
;
436 Display
*xdisp
= wxGlobalDisplay();
439 // wxLogDebug( "Mapping window of type %s", GetName().c_str() );
440 XMapWindow(xdisp
, xwindow
);
444 // wxLogDebug( "Unmapping window of type %s", GetName().c_str() );
445 XUnmapWindow(xdisp
, xwindow
);
451 // Raise the window to the top of the Z order
452 void wxWindowX11::Raise()
455 XRaiseWindow( wxGlobalDisplay(), (Window
) m_mainWindow
);
458 // Lower the window to the bottom of the Z order
459 void wxWindowX11::Lower()
462 XLowerWindow( wxGlobalDisplay(), (Window
) m_mainWindow
);
465 void wxWindowX11::DoCaptureMouse()
467 if ((g_captureWindow
!= NULL
) && (g_captureWindow
!= this))
469 wxASSERT_MSG(FALSE
, wxT("Trying to capture before mouse released."));
480 Window xwindow
= (Window
) m_clientWindow
;
482 wxCHECK_RET( xwindow
, wxT("invalid window") );
484 g_captureWindow
= (wxWindow
*) this;
488 int res
= XGrabPointer(wxGlobalDisplay(), xwindow
,
490 ButtonPressMask
| ButtonReleaseMask
| ButtonMotionMask
| EnterWindowMask
| LeaveWindowMask
| PointerMotionMask
,
494 None
, /* cursor */ // TODO: This may need to be set to the cursor of this window
497 if (res
!= GrabSuccess
)
500 msg
.Printf(wxT("Failed to grab pointer for window %s"), this->GetClassInfo()->GetClassName());
502 if (res
== GrabNotViewable
)
503 wxLogDebug( wxT("This is not a viewable window - perhaps not shown yet?") );
505 g_captureWindow
= NULL
;
509 m_winCaptured
= TRUE
;
513 void wxWindowX11::DoReleaseMouse()
515 g_captureWindow
= NULL
;
517 if ( !m_winCaptured
)
520 Window xwindow
= (Window
) m_clientWindow
;
524 XUngrabPointer( wxGlobalDisplay(), CurrentTime
);
527 // wxLogDebug( "Ungrabbed pointer in %s", GetName().c_str() );
529 m_winCaptured
= FALSE
;
532 bool wxWindowX11::SetFont(const wxFont
& font
)
534 if ( !wxWindowBase::SetFont(font
) )
543 bool wxWindowX11::SetCursor(const wxCursor
& cursor
)
545 if ( !wxWindowBase::SetCursor(cursor
) )
551 Window xwindow
= (Window
) m_clientWindow
;
553 wxCHECK_MSG( xwindow
, FALSE
, wxT("invalid window") );
555 wxCursor cursorToUse
;
557 cursorToUse
= m_cursor
;
559 cursorToUse
= *wxSTANDARD_CURSOR
;
561 Cursor xcursor
= (Cursor
) cursorToUse
.GetCursor();
563 XDefineCursor( wxGlobalDisplay(), xwindow
, xcursor
);
568 // Coordinates relative to the window
569 void wxWindowX11::WarpPointer (int x
, int y
)
571 Window xwindow
= (Window
) m_clientWindow
;
573 wxCHECK_RET( xwindow
, wxT("invalid window") );
575 XWarpPointer( wxGlobalDisplay(), None
, xwindow
, 0, 0, 0, 0, x
, y
);
578 // Does a physical scroll
579 void wxWindowX11::ScrollWindow(int dx
, int dy
, const wxRect
*rect
)
581 // No scrolling requested.
582 if ((dx
== 0) && (dy
== 0)) return;
584 if (!m_updateRegion
.IsEmpty())
586 m_updateRegion
.Offset( dx
, dy
);
590 GetSize( &cw
, &ch
); // GetClientSize() ??
591 m_updateRegion
.Intersect( 0, 0, cw
, ch
);
594 if (!m_clearRegion
.IsEmpty())
596 m_clearRegion
.Offset( dx
, dy
);
600 GetSize( &cw
, &ch
); // GetClientSize() ??
601 m_clearRegion
.Intersect( 0, 0, cw
, ch
);
604 Window xwindow
= (Window
) GetClientAreaWindow();
606 wxCHECK_RET( xwindow
, wxT("invalid window") );
608 Display
*xdisplay
= wxGlobalDisplay();
610 GC xgc
= XCreateGC( xdisplay
, xwindow
, 0, NULL
);
611 XSetGraphicsExposures( xdisplay
, xgc
, True
);
629 GetClientSize( &cw
, &ch
);
632 #if wxUSE_TWO_WINDOWS
633 wxPoint
offset( 0,0 );
635 wxPoint offset
= GetClientAreaOrigin();
640 int w
= cw
- abs(dx
);
641 int h
= ch
- abs(dy
);
643 if ((h
< 0) || (w
< 0))
650 if (dx
< 0) rect
.x
= cw
+dx
+ offset
.x
; else rect
.x
= s_x
;
651 if (dy
< 0) rect
.y
= ch
+dy
+ offset
.y
; else rect
.y
= s_y
;
652 if (dy
!= 0) rect
.width
= cw
; else rect
.width
= abs(dx
);
653 if (dx
!= 0) rect
.height
= ch
; else rect
.height
= abs(dy
);
658 if (dx
< 0) s_x
+= -dx
;
659 if (dy
< 0) s_y
+= -dy
;
660 if (dx
> 0) d_x
= dx
+ offset
.x
;
661 if (dy
> 0) d_y
= dy
+ offset
.y
;
663 XCopyArea( xdisplay
, xwindow
, xwindow
, xgc
, s_x
, s_y
, w
, h
, d_x
, d_y
);
665 // wxLogDebug( "Copy: s_x %d s_y %d w %d h %d d_x %d d_y %d", s_x, s_y, w, h, d_x, d_y );
667 // wxLogDebug( "Update: %d %d %d %d", rect.x, rect.y, rect.width, rect.height );
669 m_updateRegion
.Union( rect
);
670 m_clearRegion
.Union( rect
);
673 XFreeGC( xdisplay
, xgc
);
675 // Move Clients, but not the scrollbars
676 // FIXME: There may be a better method to move a lot of Windows within X11
677 wxScrollBar
*sbH
= ((wxWindow
*) this)->GetScrollbar( wxHORIZONTAL
);
678 wxScrollBar
*sbV
= ((wxWindow
*) this)->GetScrollbar( wxVERTICAL
);
679 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
682 // Only propagate to non-top-level windows
683 wxWindow
*win
= node
->GetData();
684 if ( win
->GetParent() && win
!= sbH
&& win
!= sbV
)
686 wxPoint pos
= win
->GetPosition();
687 // Add the delta to the old Position
690 win
->SetPosition(pos
);
692 node
= node
->GetNext();
696 // ---------------------------------------------------------------------------
698 // ---------------------------------------------------------------------------
700 #if wxUSE_DRAG_AND_DROP
702 void wxWindowX11::SetDropTarget(wxDropTarget
* WXUNUSED(pDropTarget
))
709 // Old style file-manager drag&drop
710 void wxWindowX11::DragAcceptFiles(bool WXUNUSED(accept
))
715 // ----------------------------------------------------------------------------
717 // ----------------------------------------------------------------------------
721 void wxWindowX11::DoSetToolTip(wxToolTip
* WXUNUSED(tooltip
))
726 #endif // wxUSE_TOOLTIPS
728 // ---------------------------------------------------------------------------
729 // moving and resizing
730 // ---------------------------------------------------------------------------
732 bool wxWindowX11::PreResize()
738 void wxWindowX11::DoGetSize(int *x
, int *y
) const
740 Window xwindow
= (Window
) m_mainWindow
;
742 wxCHECK_RET( xwindow
, wxT("invalid window") );
744 //XSync(wxGlobalDisplay(), False);
746 XWindowAttributes attr
;
747 Status status
= XGetWindowAttributes( wxGlobalDisplay(), xwindow
, &attr
);
752 *x
= attr
.width
/* + 2*m_borderSize */ ;
753 *y
= attr
.height
/* + 2*m_borderSize */ ;
757 void wxWindowX11::DoGetPosition(int *x
, int *y
) const
759 Window window
= (Window
) m_mainWindow
;
762 //XSync(wxGlobalDisplay(), False);
763 XWindowAttributes attr
;
764 Status status
= XGetWindowAttributes(wxGlobalDisplay(), window
, & attr
);
772 // We may be faking the client origin. So a window that's really at (0, 30)
773 // may appear (to wxWin apps) to be at (0, 0).
776 wxPoint
pt(GetParent()->GetClientAreaOrigin());
784 void wxWindowX11::DoScreenToClient(int *x
, int *y
) const
786 Display
*display
= wxGlobalDisplay();
787 Window rootWindow
= RootWindowOfScreen(DefaultScreenOfDisplay(display
));
788 Window thisWindow
= (Window
) m_clientWindow
;
793 XTranslateCoordinates(display
, rootWindow
, thisWindow
, xx
, yy
, x
, y
, &childWindow
);
796 void wxWindowX11::DoClientToScreen(int *x
, int *y
) const
798 Display
*display
= wxGlobalDisplay();
799 Window rootWindow
= RootWindowOfScreen(DefaultScreenOfDisplay(display
));
800 Window thisWindow
= (Window
) m_clientWindow
;
805 XTranslateCoordinates(display
, thisWindow
, rootWindow
, xx
, yy
, x
, y
, &childWindow
);
809 // Get size *available for subwindows* i.e. excluding menu bar etc.
810 void wxWindowX11::DoGetClientSize(int *x
, int *y
) const
812 Window window
= (Window
) m_mainWindow
;
816 XWindowAttributes attr
;
817 Status status
= XGetWindowAttributes( wxGlobalDisplay(), window
, &attr
);
828 void wxWindowX11::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
830 // wxLogDebug("DoSetSize: %s (%ld) %d, %d %dx%d", GetClassInfo()->GetClassName(), GetId(), x, y, width, height);
832 Window xwindow
= (Window
) m_mainWindow
;
834 wxCHECK_RET( xwindow
, wxT("invalid window") );
836 XWindowAttributes attr
;
837 Status status
= XGetWindowAttributes( wxGlobalDisplay(), xwindow
, &attr
);
838 wxCHECK_RET( status
, wxT("invalid window attributes") );
842 int new_w
= attr
.width
;
843 int new_h
= attr
.height
;
845 if (x
!= -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
848 AdjustForParentClientOrigin( x
, yy
, sizeFlags
);
851 if (y
!= -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
854 AdjustForParentClientOrigin( xx
, y
, sizeFlags
);
870 DoMoveWindow( new_x
, new_y
, new_w
, new_h
);
873 void wxWindowX11::DoSetClientSize(int width
, int height
)
875 // wxLogDebug("DoSetClientSize: %s (%ld) %dx%d", GetClassInfo()->GetClassName(), GetId(), width, height);
877 Window xwindow
= (Window
) m_mainWindow
;
879 wxCHECK_RET( xwindow
, wxT("invalid window") );
881 XResizeWindow( wxGlobalDisplay(), xwindow
, width
, height
);
883 if (m_mainWindow
!= m_clientWindow
)
885 xwindow
= (Window
) m_clientWindow
;
887 wxWindow
*window
= (wxWindow
*) this;
888 wxRenderer
*renderer
= window
->GetRenderer();
891 wxRect border
= renderer
->GetBorderDimensions( (wxBorder
)(m_windowStyle
& wxBORDER_MASK
) );
892 width
-= border
.x
+ border
.width
;
893 height
-= border
.y
+ border
.height
;
896 XResizeWindow( wxGlobalDisplay(), xwindow
, width
, height
);
900 void wxWindowX11::DoMoveWindow(int x
, int y
, int width
, int height
)
902 Window xwindow
= (Window
) m_mainWindow
;
904 wxCHECK_RET( xwindow
, wxT("invalid window") );
908 XMoveResizeWindow( wxGlobalDisplay(), xwindow
, x
, y
, width
, height
);
909 if (m_mainWindow
!= m_clientWindow
)
911 xwindow
= (Window
) m_clientWindow
;
913 wxWindow
*window
= (wxWindow
*) this;
914 wxRenderer
*renderer
= window
->GetRenderer();
917 wxRect border
= renderer
->GetBorderDimensions( (wxBorder
)(m_windowStyle
& wxBORDER_MASK
) );
920 width
-= border
.x
+ border
.width
;
921 height
-= border
.y
+ border
.height
;
929 wxScrollBar
*sb
= window
->GetScrollbar( wxHORIZONTAL
);
930 if (sb
&& sb
->IsShown())
932 wxSize size
= sb
->GetSize();
935 sb
= window
->GetScrollbar( wxVERTICAL
);
936 if (sb
&& sb
->IsShown())
938 wxSize size
= sb
->GetSize();
942 XMoveResizeWindow( wxGlobalDisplay(), xwindow
, x
, y
, wxMax(1, width
), wxMax(1, height
) );
947 XWindowChanges windowChanges
;
950 windowChanges
.width
= width
;
951 windowChanges
.height
= height
;
952 windowChanges
.stack_mode
= 0;
953 int valueMask
= CWX
| CWY
| CWWidth
| CWHeight
;
955 XConfigureWindow( wxGlobalDisplay(), xwindow
, valueMask
, &windowChanges
);
960 void wxWindowX11::DoSetSizeHints(int minW
, int minH
, int maxW
, int maxH
, int incW
, int incH
)
968 XSizeHints sizeHints
;
971 if (minW
> -1 && minH
> -1)
973 sizeHints
.flags
|= PMinSize
;
974 sizeHints
.min_width
= minW
;
975 sizeHints
.min_height
= minH
;
977 if (maxW
> -1 && maxH
> -1)
979 sizeHints
.flags
|= PMaxSize
;
980 sizeHints
.max_width
= maxW
;
981 sizeHints
.max_height
= maxH
;
983 if (incW
> -1 && incH
> -1)
985 sizeHints
.flags
|= PResizeInc
;
986 sizeHints
.width_inc
= incW
;
987 sizeHints
.height_inc
= incH
;
990 XSetWMNormalHints(wxGlobalDisplay(), (Window
) m_mainWindow
, &sizeHints
);
994 // ---------------------------------------------------------------------------
996 // ---------------------------------------------------------------------------
998 int wxWindowX11::GetCharHeight() const
1000 wxCHECK_MSG( m_font
.Ok(), 0, wxT("valid window font needed") );
1003 // There should be an easier way.
1004 PangoLayout
*layout
= pango_layout_new( wxTheApp
->GetPangoContext() );
1005 pango_layout_set_font_description( layout
, GetFont().GetNativeFontInfo()->description
);
1006 pango_layout_set_text(layout
, "H", 1 );
1008 pango_layout_get_pixel_size(layout
, &w
, &h
);
1009 g_object_unref( G_OBJECT( layout
) );
1013 WXFontStructPtr pFontStruct
= m_font
.GetFontStruct(1.0, wxGlobalDisplay());
1015 int direction
, ascent
, descent
;
1016 XCharStruct overall
;
1017 XTextExtents ((XFontStruct
*) pFontStruct
, "x", 1, &direction
, &ascent
,
1018 &descent
, &overall
);
1020 // return (overall.ascent + overall.descent);
1021 return (ascent
+ descent
);
1025 int wxWindowX11::GetCharWidth() const
1027 wxCHECK_MSG( m_font
.Ok(), 0, wxT("valid window font needed") );
1030 // There should be an easier way.
1031 PangoLayout
*layout
= pango_layout_new( wxTheApp
->GetPangoContext() );
1032 pango_layout_set_font_description( layout
, GetFont().GetNativeFontInfo()->description
);
1033 pango_layout_set_text(layout
, "H", 1 );
1035 pango_layout_get_pixel_size(layout
, &w
, &h
);
1036 g_object_unref( G_OBJECT( layout
) );
1040 WXFontStructPtr pFontStruct
= m_font
.GetFontStruct(1.0, wxGlobalDisplay());
1042 int direction
, ascent
, descent
;
1043 XCharStruct overall
;
1044 XTextExtents ((XFontStruct
*) pFontStruct
, "x", 1, &direction
, &ascent
,
1045 &descent
, &overall
);
1047 return overall
.width
;
1051 void wxWindowX11::GetTextExtent(const wxString
& string
,
1053 int *descent
, int *externalLeading
,
1054 const wxFont
*theFont
) const
1056 wxFont fontToUse
= m_font
;
1057 if (theFont
) fontToUse
= *theFont
;
1059 wxCHECK_RET( fontToUse
.Ok(), wxT("invalid font") );
1061 if (string
.IsEmpty())
1069 PangoLayout
*layout
= pango_layout_new( wxTheApp
->GetPangoContext() );
1071 PangoFontDescription
*desc
= fontToUse
.GetNativeFontInfo()->description
;
1072 pango_layout_set_font_description(layout
, desc
);
1074 const wxCharBuffer data
= wxConvUTF8
.cWC2MB( string
);
1075 pango_layout_set_text(layout
, (const char*) data
, strlen( (const char*) data
));
1077 PangoLayoutLine
*line
= (PangoLayoutLine
*)pango_layout_get_lines(layout
)->data
;
1080 PangoRectangle rect
;
1081 pango_layout_line_get_extents(line
, NULL
, &rect
);
1083 if (x
) (*x
) = (wxCoord
) (rect
.width
/ PANGO_SCALE
);
1084 if (y
) (*y
) = (wxCoord
) (rect
.height
/ PANGO_SCALE
);
1087 // Do something about metrics here
1090 if (externalLeading
) (*externalLeading
) = 0; // ??
1092 g_object_unref( G_OBJECT( layout
) );
1094 WXFontStructPtr pFontStruct
= fontToUse
.GetFontStruct(1.0, wxGlobalDisplay());
1096 int direction
, ascent
, descent2
;
1097 XCharStruct overall
;
1098 int slen
= string
.Len();
1100 XTextExtents((XFontStruct
*) pFontStruct
, (char*) string
.c_str(), slen
,
1101 &direction
, &ascent
, &descent2
, &overall
);
1104 *x
= (overall
.width
);
1106 *y
= (ascent
+ descent2
);
1108 *descent
= descent2
;
1109 if (externalLeading
)
1110 *externalLeading
= 0;
1114 // ----------------------------------------------------------------------------
1116 // ----------------------------------------------------------------------------
1118 void wxWindowX11::Refresh(bool eraseBack
, const wxRect
*rect
)
1124 // Schedule for later Updating in ::Update() or ::OnInternalIdle().
1125 m_clearRegion
.Union( rect
->x
, rect
->y
, rect
->width
, rect
->height
);
1130 GetSize( &width
, &height
);
1132 // Schedule for later Updating in ::Update() or ::OnInternalIdle().
1133 m_clearRegion
.Clear();
1134 m_clearRegion
.Union( 0, 0, width
, height
);
1140 // Schedule for later Updating in ::Update() or ::OnInternalIdle().
1141 m_updateRegion
.Union( rect
->x
, rect
->y
, rect
->width
, rect
->height
);
1146 GetSize( &width
, &height
);
1148 // Schedule for later Updating in ::Update() or ::OnInternalIdle().
1149 m_updateRegion
.Clear();
1150 m_updateRegion
.Union( 0, 0, width
, height
);
1154 void wxWindowX11::Update()
1158 // wxLogDebug("wxWindowX11::UpdateNC: %s", GetClassInfo()->GetClassName());
1159 // Send nc paint events.
1160 SendNcPaintEvents();
1163 if (!m_updateRegion
.IsEmpty())
1165 // wxLogDebug("wxWindowX11::Update: %s", GetClassInfo()->GetClassName());
1166 // Actually send erase events.
1169 // Actually send paint events.
1174 void wxWindowX11::SendEraseEvents()
1176 if (m_clearRegion
.IsEmpty()) return;
1178 wxClientDC
dc( (wxWindow
*)this );
1179 dc
.SetClippingRegion( m_clearRegion
);
1181 wxEraseEvent
erase_event( GetId(), &dc
);
1182 erase_event
.SetEventObject( this );
1184 if (!GetEventHandler()->ProcessEvent(erase_event
) )
1186 Display
*xdisplay
= wxGlobalDisplay();
1187 Window xwindow
= (Window
) GetClientAreaWindow();
1188 XSetForeground( xdisplay
, g_eraseGC
, m_backgroundColour
.GetPixel() );
1190 wxRegionIterator
upd( m_clearRegion
);
1193 XFillRectangle( xdisplay
, xwindow
, g_eraseGC
,
1194 upd
.GetX(), upd
.GetY(), upd
.GetWidth(), upd
.GetHeight() );
1199 m_clearRegion
.Clear();
1202 void wxWindowX11::SendPaintEvents()
1204 // wxLogDebug("SendPaintEvents: %s (%ld)", GetClassInfo()->GetClassName(), GetId());
1206 m_clipPaintRegion
= TRUE
;
1208 wxPaintEvent
paint_event( GetId() );
1209 paint_event
.SetEventObject( this );
1210 GetEventHandler()->ProcessEvent( paint_event
);
1212 m_updateRegion
.Clear();
1214 m_clipPaintRegion
= FALSE
;
1217 void wxWindowX11::SendNcPaintEvents()
1219 wxWindow
*window
= (wxWindow
*) this;
1221 // All this for drawing the small square between the scrollbars.
1226 wxScrollBar
*sb
= window
->GetScrollbar( wxHORIZONTAL
);
1227 if (sb
&& sb
->IsShown())
1229 height
= sb
->GetSize().y
;
1230 y
= sb
->GetPosition().y
;
1232 sb
= window
->GetScrollbar( wxVERTICAL
);
1233 if (sb
&& sb
->IsShown())
1235 width
= sb
->GetSize().x
;
1236 x
= sb
->GetPosition().x
;
1238 Display
*xdisplay
= wxGlobalDisplay();
1239 Window xwindow
= (Window
) GetMainWindow();
1240 Colormap cm
= (Colormap
) wxTheApp
->GetMainColormap( wxGetDisplay() );
1241 wxColour colour
= wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
);
1242 colour
.CalcPixel( (WXColormap
) cm
);
1244 XSetForeground( xdisplay
, g_eraseGC
, colour
.GetPixel() );
1246 XFillRectangle( xdisplay
, xwindow
, g_eraseGC
, x
, y
, width
, height
);
1250 wxNcPaintEvent
nc_paint_event( GetId() );
1251 nc_paint_event
.SetEventObject( this );
1252 GetEventHandler()->ProcessEvent( nc_paint_event
);
1254 m_updateNcArea
= FALSE
;
1257 // ----------------------------------------------------------------------------
1259 // ----------------------------------------------------------------------------
1261 // Responds to colour changes: passes event on to children.
1262 void wxWindowX11::OnSysColourChanged(wxSysColourChangedEvent
& event
)
1264 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
1267 // Only propagate to non-top-level windows
1268 wxWindow
*win
= node
->GetData();
1269 if ( win
->GetParent() )
1271 wxSysColourChangedEvent event2
;
1272 event
.SetEventObject(win
);
1273 win
->GetEventHandler()->ProcessEvent(event2
);
1276 node
= node
->GetNext();
1280 // See handler for InFocus case in app.cpp for details.
1281 wxWindow
* g_GettingFocus
= NULL
;
1283 void wxWindowX11::OnInternalIdle()
1285 // Update invalidated regions.
1288 // This calls the UI-update mechanism (querying windows for
1289 // menu/toolbar/control state information)
1290 if (wxUpdateUIEvent::CanUpdate((wxWindow
*) this))
1291 UpdateWindowUI(wxUPDATE_UI_FROMIDLE
);
1293 // Set the input focus if couldn't do it before
1294 if (m_needsInputFocus
)
1298 msg
.Printf("Setting focus for %s from OnInternalIdle\n", GetClassInfo()->GetClassName());
1299 printf(msg
.c_str());
1303 // If it couldn't set the focus now, there's
1304 // no point in trying again.
1305 m_needsInputFocus
= FALSE
;
1307 g_GettingFocus
= NULL
;
1310 // ----------------------------------------------------------------------------
1311 // function which maintain the global hash table mapping Widgets to wxWidgets
1312 // ----------------------------------------------------------------------------
1314 static bool DoAddWindowToTable(wxWindowHash
*hash
, Window w
, wxWindow
*win
)
1316 if ( !hash
->insert(wxWindowHash::value_type(w
, win
)).second
)
1318 wxLogDebug( wxT("Widget table clash: new widget is 0x%08x, %s"),
1319 (unsigned int)w
, win
->GetClassInfo()->GetClassName());
1323 wxLogTrace( wxT("widget"), wxT("XWindow 0x%08x <-> window %p (%s)"),
1324 (unsigned int) w
, win
, win
->GetClassInfo()->GetClassName());
1329 static inline wxWindow
*DoGetWindowFromTable(wxWindowHash
*hash
, Window w
)
1331 wxWindowHash::iterator i
= hash
->find(w
);
1332 return i
== hash
->end() ? NULL
: i
->second
;
1335 static inline void DoDeleteWindowFromTable(wxWindowHash
*hash
, Window w
)
1337 wxLogTrace( wxT("widget"), wxT("XWindow 0x%08x deleted"), (unsigned int) w
);
1342 // ----------------------------------------------------------------------------
1344 // ----------------------------------------------------------------------------
1346 bool wxAddWindowToTable(Window w
, wxWindow
*win
)
1348 return DoAddWindowToTable(wxWidgetHashTable
, w
, win
);
1351 wxWindow
*wxGetWindowFromTable(Window w
)
1353 return DoGetWindowFromTable(wxWidgetHashTable
, w
);
1356 void wxDeleteWindowFromTable(Window w
)
1358 DoDeleteWindowFromTable(wxWidgetHashTable
, w
);
1361 bool wxAddClientWindowToTable(Window w
, wxWindow
*win
)
1363 return DoAddWindowToTable(wxClientWidgetHashTable
, w
, win
);
1366 wxWindow
*wxGetClientWindowFromTable(Window w
)
1368 return DoGetWindowFromTable(wxClientWidgetHashTable
, w
);
1371 void wxDeleteClientWindowFromTable(Window w
)
1373 DoDeleteWindowFromTable(wxClientWidgetHashTable
, w
);
1376 // ----------------------------------------------------------------------------
1377 // X11-specific accessors
1378 // ----------------------------------------------------------------------------
1380 WXWindow
wxWindowX11::GetMainWindow() const
1382 return m_mainWindow
;
1385 WXWindow
wxWindowX11::GetClientAreaWindow() const
1387 return m_clientWindow
;
1390 // ----------------------------------------------------------------------------
1391 // TranslateXXXEvent() functions
1392 // ----------------------------------------------------------------------------
1394 bool wxTranslateMouseEvent(wxMouseEvent
& wxevent
, wxWindow
*win
, Window window
, XEvent
*xevent
)
1396 switch (XEventGetType(xevent
))
1404 wxEventType eventType
= wxEVT_NULL
;
1406 if (XEventGetType(xevent
) == EnterNotify
)
1408 //if (local_event.xcrossing.mode!=NotifyNormal)
1409 // return ; // Ignore grab events
1410 eventType
= wxEVT_ENTER_WINDOW
;
1411 // canvas->GetEventHandler()->OnSetFocus();
1413 else if (XEventGetType(xevent
) == LeaveNotify
)
1415 //if (local_event.xcrossingr.mode!=NotifyNormal)
1416 // return ; // Ignore grab events
1417 eventType
= wxEVT_LEAVE_WINDOW
;
1418 // canvas->GetEventHandler()->OnKillFocus();
1420 else if (XEventGetType(xevent
) == MotionNotify
)
1422 eventType
= wxEVT_MOTION
;
1424 else if (XEventGetType(xevent
) == ButtonPress
)
1426 wxevent
.SetTimestamp(XButtonEventGetTime(xevent
));
1428 if (XButtonEventLChanged(xevent
))
1430 eventType
= wxEVT_LEFT_DOWN
;
1433 else if (XButtonEventMChanged(xevent
))
1435 eventType
= wxEVT_MIDDLE_DOWN
;
1438 else if (XButtonEventRChanged(xevent
))
1440 eventType
= wxEVT_RIGHT_DOWN
;
1444 // check for a double click
1445 // TODO: where can we get this value from?
1446 //long dclickTime = XtGetMultiClickTime(wxGlobalDisplay());
1447 long dclickTime
= 200;
1448 long ts
= wxevent
.GetTimestamp();
1450 int buttonLast
= win
->GetLastClickedButton();
1451 long lastTS
= win
->GetLastClickTime();
1452 if ( buttonLast
&& buttonLast
== button
&& (ts
- lastTS
) < dclickTime
)
1455 win
->SetLastClick(0, ts
);
1456 if ( eventType
== wxEVT_LEFT_DOWN
)
1457 eventType
= wxEVT_LEFT_DCLICK
;
1458 else if ( eventType
== wxEVT_MIDDLE_DOWN
)
1459 eventType
= wxEVT_MIDDLE_DCLICK
;
1460 else if ( eventType
== wxEVT_RIGHT_DOWN
)
1461 eventType
= wxEVT_RIGHT_DCLICK
;
1465 // not fast enough or different button
1466 win
->SetLastClick(button
, ts
);
1469 else if (XEventGetType(xevent
) == ButtonRelease
)
1471 if (XButtonEventLChanged(xevent
))
1473 eventType
= wxEVT_LEFT_UP
;
1475 else if (XButtonEventMChanged(xevent
))
1477 eventType
= wxEVT_MIDDLE_UP
;
1479 else if (XButtonEventRChanged(xevent
))
1481 eventType
= wxEVT_RIGHT_UP
;
1490 wxevent
.SetEventType(eventType
);
1492 wxevent
.m_x
= XButtonEventGetX(xevent
);
1493 wxevent
.m_y
= XButtonEventGetY(xevent
);
1495 wxevent
.m_leftDown
= ((eventType
== wxEVT_LEFT_DOWN
)
1496 || (XButtonEventLIsDown(xevent
)
1497 && (eventType
!= wxEVT_LEFT_UP
)));
1498 wxevent
.m_middleDown
= ((eventType
== wxEVT_MIDDLE_DOWN
)
1499 || (XButtonEventMIsDown(xevent
)
1500 && (eventType
!= wxEVT_MIDDLE_UP
)));
1501 wxevent
.m_rightDown
= ((eventType
== wxEVT_RIGHT_DOWN
)
1502 || (XButtonEventRIsDown (xevent
)
1503 && (eventType
!= wxEVT_RIGHT_UP
)));
1505 wxevent
.m_shiftDown
= XButtonEventShiftIsDown(xevent
);
1506 wxevent
.m_controlDown
= XButtonEventCtrlIsDown(xevent
);
1507 wxevent
.m_altDown
= XButtonEventAltIsDown(xevent
);
1508 wxevent
.m_metaDown
= XButtonEventMetaIsDown(xevent
);
1510 wxevent
.SetId(win
->GetId());
1511 wxevent
.SetEventObject(win
);
1519 bool wxTranslateKeyEvent(wxKeyEvent
& wxevent
, wxWindow
*win
, Window
WXUNUSED(win
), XEvent
*xevent
, bool isAscii
)
1521 switch (XEventGetType(xevent
))
1529 (void) XLookupString ((XKeyEvent
*) xevent
, buf
, 20, &keySym
, NULL
);
1530 int id
= wxCharCodeXToWX (keySym
);
1531 // id may be WXK_xxx code - these are outside ASCII range, so we
1532 // can't just use toupper() on id.
1533 // Only change this if we want the raw key that was pressed,
1534 // and don't change it if we want an ASCII value.
1535 if (!isAscii
&& (id
>= 'a' && id
<= 'z'))
1537 id
= id
+ 'A' - 'a';
1540 wxevent
.m_shiftDown
= XKeyEventShiftIsDown(xevent
);
1541 wxevent
.m_controlDown
= XKeyEventCtrlIsDown(xevent
);
1542 wxevent
.m_altDown
= XKeyEventAltIsDown(xevent
);
1543 wxevent
.m_metaDown
= XKeyEventMetaIsDown(xevent
);
1544 wxevent
.SetEventObject(win
);
1545 wxevent
.m_keyCode
= id
;
1546 wxevent
.SetTimestamp(XKeyEventGetTime(xevent
));
1548 wxevent
.m_x
= XKeyEventGetX(xevent
);
1549 wxevent
.m_y
= XKeyEventGetY(xevent
);
1559 // ----------------------------------------------------------------------------
1561 // ----------------------------------------------------------------------------
1563 bool wxWindowX11::SetBackgroundColour(const wxColour
& col
)
1565 wxWindowBase::SetBackgroundColour(col
);
1567 Display
*xdisplay
= (Display
*) wxGlobalDisplay();
1568 int xscreen
= DefaultScreen( xdisplay
);
1569 Colormap cm
= DefaultColormap( xdisplay
, xscreen
);
1571 m_backgroundColour
.CalcPixel( (WXColormap
) cm
);
1573 // We don't set the background colour as we paint
1574 // the background ourselves.
1575 // XSetWindowBackground( xdisplay, (Window) m_clientWindow, m_backgroundColour.GetPixel() );
1580 bool wxWindowX11::SetForegroundColour(const wxColour
& col
)
1582 if ( !wxWindowBase::SetForegroundColour(col
) )
1588 // ----------------------------------------------------------------------------
1590 // ----------------------------------------------------------------------------
1592 wxWindow
*wxGetActiveWindow()
1595 wxFAIL_MSG(wxT("Not implemented"));
1600 wxWindow
*wxWindowBase::GetCapture()
1602 return (wxWindow
*)g_captureWindow
;
1606 // Find the wxWindow at the current mouse position, returning the mouse
1608 wxWindow
* wxFindWindowAtPointer(wxPoint
& pt
)
1610 return wxFindWindowAtPoint(wxGetMousePosition());
1613 // Get the current mouse position.
1614 wxPoint
wxGetMousePosition()
1618 return wxPoint(0, 0);
1620 Display
*display
= wxGlobalDisplay();
1621 Window rootWindow
= RootWindowOfScreen (DefaultScreenOfDisplay(display
));
1622 Window rootReturn
, childReturn
;
1623 int rootX
, rootY
, winX
, winY
;
1624 unsigned int maskReturn
;
1626 XQueryPointer (display
,
1630 &rootX
, &rootY
, &winX
, &winY
, &maskReturn
);
1631 return wxPoint(rootX
, rootY
);
1636 // ----------------------------------------------------------------------------
1637 // wxNoOptimize: switch off size optimization
1638 // ----------------------------------------------------------------------------
1640 int wxNoOptimize::ms_count
= 0;
1643 // ----------------------------------------------------------------------------
1645 // ----------------------------------------------------------------------------
1647 class wxWinModule
: public wxModule
1654 DECLARE_DYNAMIC_CLASS(wxWinModule
)
1657 IMPLEMENT_DYNAMIC_CLASS(wxWinModule
, wxModule
)
1659 bool wxWinModule::OnInit()
1661 Display
*xdisplay
= wxGlobalDisplay();
1662 int xscreen
= DefaultScreen( xdisplay
);
1663 Window xroot
= RootWindow( xdisplay
, xscreen
);
1664 g_eraseGC
= XCreateGC( xdisplay
, xroot
, 0, NULL
);
1665 XSetFillStyle( xdisplay
, g_eraseGC
, FillSolid
);
1670 void wxWinModule::OnExit()
1672 Display
*xdisplay
= wxGlobalDisplay();
1673 XFreeGC( xdisplay
, g_eraseGC
);