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:
Mattia Barbon
2003-04-09 16:58:33 +00:00
parent aae0472bf3
commit f7f78039d2
9 changed files with 729 additions and 513 deletions

1122
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -2359,6 +2359,13 @@ equivalent variable and GTK+ is version 1.2.3 or above.
)
fi
AC_CHECK_LIB([Xext], [XShapeQueryExtension],
[
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXext"
wxHAVE_XEXT_LIB=1
],
[], [$GUI_TK_LIBRARY -lX11])
if test "$wxUSE_UNICODE" = "yes"; then
PKG_CHECK_MODULES(PANGOX, pangox,
[
@@ -2591,6 +2598,32 @@ equivalent variable and GTK+ is version 1.2.3 or above.
TOOLKIT_VPATH="\${top_srcdir}/src/motif${PATH_IFS}\${top_srcdir}/src/motif/xmcombo${PATH_IFS}\${top_srcdir}/src/x11"
TOOLKIT=MOTIF
GUIDIST=MOTIF_DIST
wxHAVE_XEXT_LIB=1
fi
if test "$wxUSE_X11" = 1 -o "$wxUSE_MOTIF" = 1 &&
test "$wxHAVE_XEXT_LIB" = 1; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
AC_MSG_CHECKING([for X11/extensions/shape.h])
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/shape.h>
],
[
int dummy1, dummy2;
XShapeQueryExtension((Display*)NULL,
(int*)NULL, (int*)NULL);
],
[
AC_DEFINE(HAVE_XSHAPE)
AC_MSG_RESULT([found])
],
[
AC_MSG_RESULT([not found])
])
CFLAGS="$save_CFLAGS"
fi
if test "$wxUSE_MAC" = 1; then

View File

@@ -60,6 +60,8 @@ public:
int maxW = -1, int maxH = -1,
int incW = -1, int incH = -1 );
virtual bool SetShape( const wxRegion& region );
WXWidget GetShellWidget() const;
protected:
// common part of all constructors

View File

@@ -23,6 +23,7 @@
class wxMouseEvent;
class wxKeyEvent;
class wxWindow;
class wxRegion;
// ----------------------------------------------------------------------------
// key events related functions
@@ -135,6 +136,12 @@ bool wxWindowIsVisible(Window win);
#define XFontStructGetAscent(f) f->ascent
#endif
// ----------------------------------------------------------------------------
// Misc functions
// ----------------------------------------------------------------------------
bool wxDoSetShape( Display* xdisplay, Window xwindow, const wxRegion& region );
class WXDLLEXPORT wxXVisualInfo
{
public:

View File

@@ -79,6 +79,8 @@ protected:
// set the icon for the window
void DoSetIcon( const wxIcon& icon );
virtual bool SetShape(const wxRegion& region);
// For implementation purposes - sometimes decorations make the
// client area smaller
virtual wxPoint GetClientAreaOrigin() const;

View File

@@ -1141,6 +1141,8 @@
/* Define this if you are using gtk and gdk contains support for X11R6 XIM */
#undef HAVE_XIM
/* Define this is you have X11/extensions/shape.h */
#undef HAVE_XSHAPE
/* -------------------------------------------------------------------------
Win32 adjustments section

View File

@@ -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
// ---------------------------------------------------------------------------

View File

@@ -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;

View File

@@ -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
// ----------------------------------------------------------------------------