Add tests for XShape extension API in configure,
and implements wxTLW::SetShape for wxMotif and wxX11 using the aforementioned extension. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -336,6 +336,13 @@ void wxTopLevelWindowMotif::SetSizeHints( int minW, int minH,
|
||||
XtSetValues( (Widget)GetShellWidget(), args, count );
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMotif::SetShape( const wxRegion& region )
|
||||
{
|
||||
return wxDoSetShape( (Display*)GetXDisplay(),
|
||||
XtWindow( (Widget)GetShellWidget() ),
|
||||
region );
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Callback definition
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -404,6 +404,13 @@ void wxTopLevelWindowX11::SetIcons(const wxIconBundle& icons )
|
||||
wxSetIconsX11( wxGlobalDisplay(), GetMainWindow(), icons );
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowX11::SetShape(const wxRegion& region)
|
||||
{
|
||||
return wxDoSetShape( wxGlobalDisplay(),
|
||||
(Window)GetMainWindow(),
|
||||
region );
|
||||
}
|
||||
|
||||
void wxTopLevelWindowX11::SetTitle(const wxString& title)
|
||||
{
|
||||
m_title = title;
|
||||
|
||||
@@ -11,6 +11,66 @@
|
||||
|
||||
#include "wx/x11/privx.h"
|
||||
|
||||
#ifdef HAVE_XSHAPE
|
||||
#include <X11/extensions/shape.h>
|
||||
#include "wx/region.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// XShape code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef HAVE_XSHAPE
|
||||
|
||||
bool wxDoSetShape( Display* xdisplay,
|
||||
Window xwindow,
|
||||
const wxRegion& region )
|
||||
{
|
||||
int dummy1, dummy2;
|
||||
|
||||
if( !XShapeQueryExtension( xdisplay, &dummy1, &dummy2 ) )
|
||||
return false;
|
||||
|
||||
if( region.IsEmpty() )
|
||||
{
|
||||
XShapeCombineMask( xdisplay, xwindow, ShapeBounding, 0, 0,
|
||||
None, ShapeSet );
|
||||
}
|
||||
else
|
||||
{
|
||||
// wxRegion::ConvertToBitmap gives us the wrong Pixmap:
|
||||
// polichrome and with black and whire reversed
|
||||
wxRect box = region.GetBox();
|
||||
wxBitmap bmp(box.GetRight(), box.GetBottom(), 1);
|
||||
wxMemoryDC dc;
|
||||
dc.SelectObject(bmp);
|
||||
dc.SetBackground(*wxBLACK_BRUSH);
|
||||
dc.Clear();
|
||||
dc.SetClippingRegion(region);
|
||||
dc.SetBackground(*wxWHITE_BRUSH);
|
||||
dc.Clear();
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
|
||||
XShapeCombineMask( xdisplay, xwindow, ShapeBounding, 0, 0,
|
||||
(Pixmap)bmp.GetDrawable(), ShapeSet );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bool wxDoSetShape( Display* WXUNUSED(xdisplay),
|
||||
Window WXUNUSED(xwindow),
|
||||
const wxRegion& WXUNUSED(region) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxXVisualInfo
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user